var popUp; 

// INIZIO Disabilita il click del pulsante destro
var message="";
function clickIE() {	if (document.all) {(message);return false;}}
function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// FINE Disabilita il click del pulsante destro

//funzione per avvertire che modificando il cliente selezionato si perde tutto l'ordine
function CambiaCliente(path,Cliente){
	if (Cliente==0) {
		OpenPopup(path) 
	} else {
		if (confirm("Selezionando un altro cliente l'ordine corrente non viene salvato.\nContinuare ?")) {
			OpenPopup(path)
		}
	}
}

function OpenPopup(path,width,height)	
{
	var w=700;
	var h=460;
	if (width) {
		if (width>0) {w=width}
	}
	if (height) {
		if (height>0) {h=height}
	}
	popUp = window.open(path, '_blank', 'width='+w+',height='+h+',left=50,top=50,resizable=yes,scrollbars=yes,status=yes');
}

function SetSelValue(formName, id, newValue, postBack)
{
	eval('var theform = document.' + formName + ';');
	if (popUp) {popUp.close();}
	if (theform.elements[id])
	{
		theform.elements[id].value = newValue;
		if (postBack) __doPostBack(id,'');
	}
}	

function SetSelValueCliente(formName, id, newValue, isNewCliente, postBack)
{
	eval('var theform = document.' + formName + ';');
	if (popUp) {popUp.close();}
	if (theform.elements[id])
	{
		theform.elements[id].value = isNewCliente+newValue;
		if (postBack) __doPostBack(id,'');
	}
}	


function OpenCalc(root,idname, postBack)
{
	popUp = window.open(root+'Calcolo.aspx?Popup=S'+
		'&formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + 
		'&postBack=' + postBack,
		'popupcalc', 
		'width=300,height=200,left=600,top=400');		
}	


function clickHandler() {
  var targetId, srcElement, targetElement;
  srcElement = window.event.srcElement;
  
   if (srcElement.id == "rbtTipoBudgetMesile") {
     targetId = "divservizi" ;
     targetElement = document.all(targetId);
     if (targetElement.style.display == "none") {
        targetElement.style.display = "";
     } else {
        targetElement.style.display = "none";
     }
  }
  }