// Source: CodeFoot.com
function blockError(){return true;}

//questa riga impedisce la visualizzazione di errori javascript
//commentare per eseguire il debug
window.onerror = blockError;

//	questo codice è necessario per il detect del 
//	javascript ed è "coordinato" con il codice 
//	asp della pagina "altresezionism/10057/default.asp"
//	template: "default.smt"
document.cookie = "javascript=enabled";
document.cookie = "screenWidth=" + screen.width;

function getCookie()
{
	var c_name = 'load';
	if (document.cookie.length>0)
	{
		// se il cookie load non è stato ancora scritto
		// vuol dire che è il primo caricamento per cui
		// la pagina necessata di un reload
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start==-1)
	  { 
	  	// scrivo il cookie load così la reload
		// viene eseguita solo la prima volta
		document.cookie = "load=true";
		document.location.reload();
	  } 
	}
	
}
getCookie();


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function  cambiaRicerca(){
	if (document.getElementById('tipoRicerca1').checked){
		document.getElementById('ParoleContenuteDocumento').value = document.getElementById('parola').value;
		document.getElementById('ricercaWeb').style.display = 'block';
		document.getElementById('ricercaIndiceAZ').style.display = 'none';
	}else{
		document.getElementById('parola').value = document.getElementById('ParoleContenuteDocumento').value;
		document.getElementById('ricercaWeb').style.display = 'none';
		document.getElementById('ricercaIndiceAZ').style.display = 'block';
	}
}



function apriOrdineDelGiorno(giorno, meseanno){
	document.forms["formOrdineGiorno"].hGiornoSel.value = giorno;
	document.forms["formOrdineGiorno"].hMeseSel.value = meseanno;
	document.forms["formOrdineGiorno"].submit();
}

onload = function()
{
	/*gestione dell'hover nei li all'interno di contenuto_testo */
	LIs = $$("#contenuto_testo ul.link li");
	for (var i=0; i < LIs.length; i++)
	{
		LIs[i].onmouseover = function(){this.className = 'hover';}
		LIs[i].onmouseout  = function(){this.className = null;}		
	}
	
	/*gestione dell'hover nei li all'interno di menu_sx */
	LIs = $$("#menusx li");
	for (var i=0; i < LIs.length; i++)
	{
		LIs[i].onmouseover = function(){this.oldclass = this.className.replace('undefined', ''); this.className += 'hover';}
		LIs[i].onmouseout  = function(){this.className = this.oldclass.replace('undefined', '');}		
	}	
}

	// gestisce l'apertura/chiusura del banner flash in homepage
	function openVideo(){
		document.getElementById('videobanner').innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="camera" align="middle">' +
			'<param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /><param name="movie" value="/flash/camera3.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />' +
			'<embed src="/flash/camera3.swf" quality="high" bgcolor="#ffffff" width="100%" height="100%" name="camera" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"/></object>';
		document.getElementById('videobanner').style.display = 'block';
	}
	
	function closeVideo(){
		document.getElementById('videobanner').innerHTML = '';
		document.getElementById('videobanner').style.display = 'none';
	}
	
	function drawVideoBanner(){
		document.getElementById('flash').innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="camera" align="middle">' +
			'<param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /><param name="movie" value="/flash/camera.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />' +
			'<embed src="/flash/camera.swf" quality="high" bgcolor="#ffffff" width="100%" height="100%" name="camera" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"/></object>';	
	}
