 
//************** RICHIAMO PIU' FUNZIONI SULL'ONLOAD *****************

function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
	  window.onload = func; 
	} else { 
	  window.onload = function() { 
	    oldonload(); 
	    func(); 
	  } 
	  } 
} 


//************** SWITCH LANG IT/EN *****************

function switchLang(langFrom, langTo){
	if(document.location){href = ''+document.location;
		if(langFrom=='it')document.write("<a href='javascript:toEng()'><img src='/media/img/icon/ico_lang_"+langTo+"_on.gif' alt='English'></a>");if(langFrom=='en')document.write("<a href='javascript:toIta()'><img src='/media/img/icon/ico_lang_"+langTo+"_on.gif' alt='Italiano'></a>");return;}
	if(langFrom=='it')document.write("<img src='/media/img/icon/ico_lang_"+langTo+"_off.gif' alt='English not available'>");if(langFrom=='en')document.write("<img src='/media/img/icon/ico_lang_"+langTo+"_off.gif' alt='Italiano non disponibile'>");
}

function toEng(){
	href = ''+document.location;
	if(href.indexOf('lang=en') >= 0) return;
	x = href.indexOf('lang=it');
	if(x>0){href = href.substring(0, x)+'lang=en'+href.substring(x+7)
	}else{if(href.indexOf('?')>=0){href = href+'&lang=en';}else{href = href+'?lang=en';}}
	document.location = href;
}

function toIta(){
	href = ''+document.location;
	if(href.indexOf('lang=it') >= 0) return;
	x = href.indexOf('lang=en');
	if(x>0){href = href.substring(0, x)+'lang=it'+href.substring(x+7)}
	document.location = href;
}


//************** WINDOW OPEN *****************

function openWindow(URL,TITLE){
	window.open(URL,TITLE,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizeable=no,copyhistory=no,width=350,height=450,marginwidth=0,marginheight=0');
}



