//*********************************************************************
//***************	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
//*********************************************************************

//*********************************************************************
// *** showLayer
//
function showLayer(oDiv, bShow, width, height, hCenter, vCenter, left, top){
	if(bShow){
		var l, t;
		l = (hCenter == true ? (screen.width - width) / 2 : left);
		t = (vCenter == true ? (screen.height - height) / 2 : top);
		
		if(width!=null)	oDiv.style.width = width;
		if(height!=null) oDiv.style.height = height;
		if(l!=null) oDiv.style.left = l 
		if(t!=null) oDiv.style.top = t;
		
		oDiv.style.visibility = 'visible';
	}else{
		oDiv.style.visibility = 'hidden';
	}
}// end showLayer
//*********************************************************************

//*********************************************************************
//***	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
//*********************************************************************

//*********************************************************************
//*** isEmpty
// true - valore vuoto o di soli spazi
// false 
function isEmpty(value){
	var s = value.replace(/\s*/,'');
	return (s=='');
}	// end function isEmpty
//*********************************************************************

//*********************************************************************
//*** isInteger
// true - la stringa è un intero
// false 
function isInteger(value){
	return !(isNaN(parseInt(value, 10)));
}	// end function isInteger
//*********************************************************************

//*********************************************************************
//*** isFloat
// true - valore è un numero decimale
// false 
function isFloat(value){
	return !(isNaN(parseFloat(value, 10)));
}	// end function isFloat
//*********************************************************************

//*********************************************************************
//*** getInteger
// true - valore è un numero decimale
// false 
function getInteger(value){
	var i = parseInt(value, 10);
	if(isNaN(i))return 0;
	else return i;
}	// end function getInteger
//*********************************************************************

//*********************************************************************
//*** getFloat
// true - valore è un numero decimale
// false 
function getFloat(value){
	var f = parseFloat(value);
	if(isNaN(f))return 0.0;
	else return f;
}	// end function isFloat
//*********************************************************************

//*********************************************************************
//*** 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
//*********************************************************************






