
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,sb){
	if(h==null || w==null){
		h=575;
		w=580;
	}
	props='scrollbars='+sb+',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 hideShowRow(idList1,idList2,RsName,Rid){
	
	hideShowLayer(idList2+","+RsName+"hid_cmd"+Rid);
	hideShowLayer(idList1+","+RsName+"cmd"+Rid);
	
}



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 selRec(frmName,id)
		{
			document.forms[frmName].elements['recordId'].value=id;
			document.forms[frmName].submit();
}



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;
		}
	}	
}

function delMat(img,idmat,idr){

			var agree=confirm("Sei sicuro di cancellare il file selezionato?");
			if (agree){
				document.forms['delMat'].elements['Img'].value=img; 
				document.forms['delMat'].elements['recordId'].value=idmat; 
				document.forms['delMat'].elements['idRec'].value=idr; 
				
				document.forms['delMat'].submit();
			}

}

function chiudi(){
	window.close();
}

function stampa() {
window.print();  
}

