//*********************************************************************
//***************	FUNZIONI DI UTILITA

//*********************************************************************
//***************	FUNZIONI DI UTILITA

//*********************************************************************
//***	openPopup
// apertura popup
openPopup.newWindow=null;
function openPopup(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
	if((openPopup.newWindow!=null)&&(!openPopup.newWindow.closed)){
		//alert('closing...'+openPopup.newWindow.closed);
		//openPopup.newWindow.close();
		openPopup.newWindow.focus();
		openPopup.newWindow.location=theURL;
	}else{
	 	if(window.screen)if(isCenter)if(isCenter=="true"){
	    var myLeft = (screen.width-myWidth)/2;
	    var myTop = (screen.height-myHeight)/2;
	    features+=(features!='')?',':'';
	    features+=',left='+myLeft+',top='+myTop;
	   }
	 	openPopup.newWindow=window.open(theURL,'',features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
		openPopup.newWindow.opener=window;
		//alert(features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight)
	}
}	//	end function openPoUp
//*********************************************************************


//*********************************************************************
//***	checkRegular
// utilizzata per verificare il match con una regular expression
function checkRegular(regS,value){
	var re=new RegExp(regS);
	return re.test(value)
}	// end function checkRegular
//*********************************************************************


//*********************************************************************
//*** isEmail
// true - email formalmente valida
// false - email non valida
function isEmail(value){
	return checkRegular('^(.+)@(.+)\.([a-z]{2,4})$',value);
}	// end function isEmail
//*********************************************************************


//*********************************************************************
//*** chkSelectedSelect (IN: oggetto select, riferimento per non selezionata)
// true - select selezionata
// false - select non selezionata
function chkSelectedSelect(oSlc,sRef){
	if(oSlc!=null){
		var cSel = oSlc.options[oSlc.selectedIndex].value;
		return cSel!=sRef;
	}else{
		return false;
	}
}	// end function isEmail
//*********************************************************************



// per cambiare link da flash di infotraffic
function infoGoDetail(keyAutostrada,codiceEvento){
	//alert(keyAutostrada);
	var ch = '';
	if (keyAutostrada == 'A32'){
		ch = '40.1.2.1';
	}
	else{
		ch = '40.2.2.1';
	}
	location.href = 'home.aspx?ch=' + ch + '&ce=' + codiceEvento
}
