﻿

var imgRoot;

//StartKeyBoardMonitor(); //  Monitor every key pressed from keyboard, to avoid Enter, F5 or Back

	function validate(){
		return Page_ClientValidate();

		//  20090804 DRIBEIRO Retirado para devolver o value correcto
		//  return true;
	}

	function ProtectBox(e) 
	{
		return false;
	}

	function changeRicalcola(recalculationClientId, forwardClientId) {
	    if (recalculationClientId != undefined && recalculationClientId != '' && forwardClientId != undefined && forwardClientId != '') {

	        var btn = document.getElementById(recalculationClientId);
	        var btn2 = document.getElementById(forwardClientId);

	        if (btn != null && btn2 != null) {

	            btn.src = imgRoot + "/common/Simulator/buttons/b_ricalcolaBlu.gif";
	            btn.disabled = false;
	            btn2.src = imgRoot + "/common/Simulator/buttons/b_avantiOff.gif";
	            btn2.disabled = true;
	        }
	    }
	}

	function ValidateOnlyLetter()
	{
		if(document.getElementById('ctl00_ContentPlaceHolderMainArea_SimulatorContentPlaceHolderMainArea1_ucQuoteSave_txtBirthPlace').value != "")
		{    
			var alphaExp = /^[a-zA-Z ]+$/;
			var str=document.getElementById('ctl00_ContentPlaceHolderMainArea_SimulatorContentPlaceHolderMainArea1_ucQuoteSave_txtBirthPlace').value;
			if(str.match(alphaExp))
			{
				return true;
				document.getElementById('ctl00_ContentPlaceHolderMainArea_SimulatorContentPlaceHolderMainArea1_ucQuoteSave_txtBirthPlace').focus();
			}
			else
			{
				alert("Caratteri speciali non consentiti.");
				document.getElementById('ctl00_ContentPlaceHolderMainArea_SimulatorContentPlaceHolderMainArea1_ucQuoteSave_txtBirthPlace').value = '';
				document.getElementById('ctl00_ContentPlaceHolderMainArea_SimulatorContentPlaceHolderMainArea1_ucQuoteSave_txtBirthPlace').focus();
				return false;
			}
		}
	}
	
	function DisableNavegation(idCtrl)
	{
		var ddl = document.getElementById(idCtrl);
		if(ddl != null)
		{
			ddl.disabled=true;
		}
	}

	function EnableNavegation(idCtrl)
	{
		var ddl = document.getElementById(idCtrl);
		if(ddl != null)
		{
			ddl.disabled = false;
		}
	}

	function Hide(idCtrl)
	{
		var ddl = document.getElementById(idCtrl);
		if(ddl != null)
		{
			ddl.style.display = "none";
		}
	}

	function Unhide(idCtrl)
	{
		var ddl = document.getElementById(idCtrl);
		if(ddl != null)
		{
			ddl.style.display = "";
		}
	}

		
	function sayHi(message)
	{
		message = replaceAll(message, "<br/>", "\n\t");
		alert(message);
	}

	function replaceAll( str, getOut, getIn ) 
	{
		var idx = str.indexOf( getOut );

		while ( idx > -1 ) 
		{
			str = str.replace( getOut, getIn );
			idx = str.indexOf( getOut );
		}
		return str;
	}

	function ChangeImageCob(chkId, lbDescId, ddlValueId, ddlCoinsuranceId, lbPriceId, imgId) {


	    var chk;
	    var lbDesc;
	    var ddlValue;
	    var ddlCoinsurance;
	    var lbPrice;
	    var img;

        if (chkId != undefined && chkId != '')
            chk = document.getElementById(chkId);

        if (lbDescId != undefined && lbDescId != '')
            lbDesc = document.getElementById(lbDescId);

        if (ddlValueId != undefined && ddlValueId != '')
            ddlValue = (ddlValueId != undefined && ddlValueId != '') ? document.getElementById(ddlValueId) : null;

        if (ddlCoinsuranceId != undefined && ddlCoinsuranceId != '')
            ddlCoinsurance = (ddlCoinsuranceId != undefined && ddlCoinsuranceId != '') ? document.getElementById(ddlCoinsuranceId) : null;

        if (lbPriceId != undefined && lbPriceId != '')
            lbPrice = document.getElementById(lbPriceId);

        if (imgId != undefined && imgId != '')
	        img = document.getElementById(imgId);

	    if (chk != undefined) {

	        if (chk.checked) {

	            if (lbDesc != undefined)
	                lbDesc.style.fontWeight = 'bold';

	            if (ddlValue != undefined)
	                ddlValue.disabled = false;

	            if (ddlCoinsurance != undefined)
	                ddlCoinsurance.disabled = false;

	            if (lbPrice != undefined)
	                lbPrice.style.fontWeight = 'bold';

	            if (img != undefined)
	                img.src = imgRoot + '/common/oki.gif';

	        } else {

	            if (lbDesc != undefined)
	                lbDesc.style.fontWeight = 'normal';

	            if (ddlValue != undefined)
	                ddlValue.disabled = true;

	            if (ddlCoinsurance != undefined)
	                ddlCoinsurance.disabled = true;

	            if (lbPrice != undefined)
	                lbPrice.style.fontWeight = 'normal';

	            if (img != undefined)
	                img.src = imgRoot + '/common/false.gif';

	        }
	    }
	}

	  function printPage()
	  {
								
		 if( document.getElementById("a_contraiEspandiTutto") != null)
		 {
			espandiTutto(false);
		 }								
		
		 var siOption="toolbar=no,location=no,directories=no,menubar=no,"; 
		 siOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 
		 var siWinHTML = document.getElementById('main').innerHTML; 
		 var winprint=window.open("","",siOption); 

		 winprint.document.open(); 
		 winprint.document.write("<html><title>Quixa | questa pagina e' stata stampata da www.quixa.it</title><LINK href=css/axa.css rel=Stylesheet /><LINK href=css/newQuixa.css rel=Stylesheet /><body style='text-align:left'><table width=100% border=0 cellpadding=0 cellspacing=15 bgcolor=#FFFFFF><tr><td><img src=images/common/header-nexyou_Print.jpg>"); 
		 winprint.document.write('<div>'+siWinHTML+'</div>'); 
		 winprint.document.write('<div style=clear:both;><hr /></div>'); 
		 winprint.document.write('&copy;2009 Quixa'); 
		 winprint.document.write('</td></tr></body></html>'); 
		 winprint.document.close(); 
		 winprint.print();
		 winprint.focus(); 
		 winprint.close();
		 
		 
		 if( document.getElementById("a_contraiEspandiTutto") != null)
		 {
			 return false;
		 }
		 else
		 {
			 return true;
		 }
		
	  }
 
			
	/* function printPage()
	{
		
		var siOption="toolbar=no,location=no,directories=no,menubar=no"; 
		siOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 
		var siWinHTML = document.getElementById('main').innerHTML; 
		var winprint=window.open("","",siOption); 

		winprint.document.open(); 
		winprint.document.write("<html><title>Quixa | questa pagina e' stata stampata da www.quixa.it</title><LINK href=/css/axa.css rel=Stylesheet><body><table width=100% border=0 cellpadding=0 cellspacing=15 bgcolor=#FFFFFF><tr><td><img src=images/common/header-nexyou_Print.jpg>"); 
		winprint.document.write('<div style="font: 8px Arial, "Trebuchet MS", Trebuchet, Verdana, Helvetica, Arial, sans-serif;">'+siWinHTML+'</div>'); 
		winprint.document.write('<div style=clear:both;><hr /></div>'); 
		winprint.document.write('&copy;2008 Quixa'); 
		winprint.document.write('</td></tr></body></html>'); 
		winprint.document.close(); 
		winprint.print();
		winprint.focus(); 
		winprint.close();
	}*/


