
function jumpMenu(targ,selObj,restore){ //v3.0 
	if(targ!='null'){
		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	}
	if (restore) selObj.selectedIndex=0; 
} 

function clearIframe(iframeID) { 
	if(document.getElementById("cache")!= null ){
		parent.document.getElementById(iframeID).src="";
	}
}

function resizeIframe(iframeID) {
	var myDetect=navigator.userAgent.indexOf("Firefox")
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
	var FFextraHeight=getFFVersion>=0.1? 16 : 0

	if(self==parent) return false;
	if(myDetect==-1){
		//alert("Explorer")
		FramePageHeight = framePage.scrollHeight;
		parent.     document.getElementById(iframeID).style.height=FramePageHeight;
		
	}else{
		//alert("Mozilla/Firefox")
		FramePageHeight = parent.     document.getElementById(iframeID).contentDocument.body.offsetHeight + FFextraHeight;
		parent.     document.getElementById(iframeID).height=FramePageHeight;
	}
} 


function openPage(page,name,w,h){
	if(h==null || w==null){
		h=575;
		w=580;
	}
	props='scrollbars=1,toolbar=0,status=1,resizable=0,width='+ w +',height='+ h +', left =20, top =20'
	window.open(page,name,props)
}


function fitPic(hoffset, title) {
    document.title = title;
	iWidth = (NS)?window.innerWidth:     document.body.clientWidth;
	iHeight = (NS)?window.innerHeight:     document.body.clientHeight;
	iWidth =      document.images[0].width - iWidth;
	iHeight =      document.images[0].height - iHeight+hoffset;
	window.resizeBy(iWidth+45, iHeight-1);
	self.focus();
};


function hideShowLayer(idList){
	//window.alert(hideArray);
	var hideArray=idList.split(",");
	if(hideArray[0]!=""){	
		for(i=0;i< hideArray.length ;i++) {
			if(     document.getElementById(hideArray[i]).className=="hidden"){
					 document.getElementById(hideArray[i]).className="visible";
			}else{
					 document.getElementById(hideArray[i]).className="hidden";
			}
		}
	}
}

function showLayer(idList){
	var hideArray=idList.split(",");
	if(hideArray[0]!=""){	
		for(i=0;i< hideArray.length ;i++) {
			 document.getElementById(hideArray[i]).className="visible";
		}
	}
}

function hideLayer(idList){
	var hideArray=idList.split(",");
	if(hideArray[0]!=""){	
		for(i=0;i< hideArray.length ;i++) {
			 document.getElementById(hideArray[i]).className="hidden";
		}
	}
}

function confirmSubmit(frmName,operName,Msg)
		{
		if(Msg!=''){
			var agree=confirm(Msg);
			if (agree){
				document.forms[frmName].elements['oper'].value=operName; document.forms[frmName].submit();
				return true ;
			}else{
				return false ;
			}
		}else{
			    if(checkMail(frmName)){
					document.forms[frmName].elements['oper'].value=operName; document.forms[frmName].submit();
				}
		}
}

function checkMail(formObj){
	
    for (var i = 0; i<document[formObj].elements.length; i++) {
        if (document[formObj].elements[i].name.substring(0,2)=="#_") {
            alertMsg=document[formObj].elements[i].value;
            compField=document[formObj].elements[i].name.substring(2,document[formObj].elements[i].name.length)
			document[formObj][compField].focus()
            switch (document[formObj][compField].type) {
            case "select-one":
                if (document[formObj][compField].selectedIndex == 0) {
                    window.alert(alertMsg);
                    return false;
                }
                break;
            case "text":
                if (document[formObj][compField].value == "") {
                    window.alert(alertMsg);
                    return false;
                }
                break;
            case "textarea":
                if (document[formObj][compField].value == "") {
                    window.alert(alertMsg);
                    return false;
                }
                break;
            }            
        }        
    } 
	 return true;
}

function checkPageTarget(refId, hiddenField, pageMax){	
	var currValue=document.getElementById(refId).value;	
	if (currValue <= 0 || currValue > pageMax) {
		window.alert("La pagina indicata è fuori dal range consentito.")
		document.getElementById(refId).value="";
		return false;
	} else{
		document.getElementById(hiddenField).value=currValue-1;
		return true;
	}
}

function hilightMe(hilightList,rollOnClass,clearListHolder,rollOutClass){	
	
	var clearList=document.getElementById(clearListHolder).value;
	var clearArray=clearList.split(",");
	//window.alert(clearArray[0]);
	if(clearArray[0]!=""){	
		for(i=0;i< clearArray.length ;i++) {
			document.getElementById(clearArray[i]).className=rollOutClass;
		}
	}
	
	var hilightArray=hilightList.split(",");
	if(hilightArray[0]!=""){	
		for(i=0;i< hilightArray.length ;i++) {
			document.getElementById(hilightArray[i]).className=rollOnClass;
		}
	}	
}