function getE(id) {
	return document.getElementById(id);
}

mw=null;
function openWindowDimBars(FileName,w,h,barre) {
	myWindow=window.open(FileName,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+barre+',resizable=0,top=10,left=10,width='+w+',height='+h);
	return myWindow;
}

function confirmLink(theLink, confirmMsg) {
	if (typeof(window.opera) != 'undefined') {
		return true;
	}

	var is_confirmed = confirm(confirmMsg);

	return is_confirmed;
}

function checkemail(email_addr) {
	var testresults = false;
	var filter=/^[\'+\\./0-9A-Z^_\`a-z{|}~\-]+@[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+){1,3}$/i;
// '
	if (filter.test(email_addr)) {
		testresults = true;
	}

	return testresults;
}

function isFunction(a) {
	return typeof a == 'function';
}
function isObject(a) {
	return (a && typeof a == 'object') || isFunction(a);
}
function isArray(a) {
	return isObject(a) && a.constructor == Array;
}

function is_valid_username(str, min_chars, max_chars) {
	var filter=/^[a-zA-Z0-9]{1,}[\.|\_|-]?[a-zA-Z0-9]{1,}$/i
	if (filter.test(str) && str.length>=min_chars) {
		if (max_chars>=min_chars) {
			if (str.length<=max_chars) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return true;
		}
	}
	else {
		return false;
	}
}

/* inserisce un elemento flash */
function printVFlash(divid, divclass, pureHtml, nomefile, width, height, version, fallback, commonmarkup) {
	var xclose = (pureHtml)? '' : ' /';
	var isMSIE = /*@cc_on!@*/false;
	var divtag;
	var str;
	var commonstr;

	if (!version) {
		version = '8,0,0,0';
	}
	if (!fallback) {
		fallback = 'Please install Flash Player plugin.';
	}

	divtag = '<div';
	if (divid.length > 0) { divtag += ' id="' + divid + '"'; }
	if (divclass.length > 0) { divtag += ' class="' + divclass + '"'; }
	divtag += '>';

	commonstr = ('<param name="quality" value="high"' + xclose + '>');
	if (commonmarkup) {
		commonstr += commonmarkup;
	}

	if (isMSIE) {
		str = ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version);
		str += ('" width="' + width + '" height="' + height + '">');
		str += ('<param name="movie" value="' + nomefile + '"' + xclose + '>');
		str += (commonstr + '<\/object>');
	} else {
		str = ('<object data="' + nomefile + '" width="' + width + '" height="' + height);
		str += ('" type="application/x-shockwave-flash">' + commonstr);
		str += ('<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"' + xclose + '>');
		str += (fallback + '<\/object>');
	}

	document.write(divtag + str + '<\/div>');
}

// caricamento di Google Maps
function google_map_load() {
	if (GBrowserIsCompatible()) {
		var infobox_content =	'<font face="Verdana" size="-1" color="#000000">'+
									'<p><b>Scuola d\'Arte Drammatica</b><br />'+
									'Auditorium Comunale, Piazza G.M. Dettori 8,<br />09124 Cagliari</p>'+
									'<p><b>C. FISC.</b> 02050280920</p>'+
								'</font>';
		
		var map = new GMap2(document.getElementById("goog_maps"));
		map.setMapType(G_HYBRID_MAP);
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		
		map.setCenter(new GLatLng(39.215837, 9.114490), 17);		// centramento della mappa un po' piu' un alto rispetto al marker, per evitare sovraposizione dei tasti sull'InfoWindow
		
		
		var marker = new GMarker(new GLatLng(39.215537, 9.114490));
		GEvent.addListener(marker, "click",	function() {
														this.openInfoWindowHtml(infobox_content);
													}
		);
		map.addOverlay(marker);
		marker.openInfoWindowHtml(infobox_content);
		marker = null;
	}
}