/************************************

			INIT

*************************************/


window.onload = function() {
	
	// Preload immagini menu
	
	var menuOn = new Array();
	
	menuOn[0] = new Image();
	menuOn[0].src = "/images/btn_chisiamo_on.gif"
	
	menuOn[1] = new Image();
	menuOn[1].src = "/images/btn_prodotti_on.gif"
	
	menuOn[2] = new Image();
	menuOn[2].src = "/images/btn_filiali_on.gif"
	
	menuOn[3] = new Image();
	menuOn[3].src = "/images/btn_finanziamento_on.gif"
	
	menuOn[4] = new Image();
	menuOn[4].src = "/images/btn_domanderisp_on.gif"
	
	var menuOff = new Array();
	
	menuOff[0] = new Image();
	menuOff[0].src = "/images/btn_chisiamo_off.gif"
	
	menuOff[1] = new Image();
	menuOff[1].src = "/images/btn_prodotti_off.gif"
	
	menuOff[2] = new Image();
	menuOff[2].src = "/images/btn_filiali_off.gif"
	
	menuOff[3] = new Image();
	menuOff[3].src = "/images/btn_finanziamento_off.gif"
	
	menuOff[4] = new Image();
	menuOff[4].src = "/images/btn_domanderisp_off.gif"
}


/************************************


*************************************/

function flashMessage (args) {

	switch (args) {

		case  "AD_HOME":
			window.open("home.html","_self","");
			break;
		
		case  "AD_DONNE_LEGGENDARIE":
			window.open("donneleggendarie.html","_self","");
			break;
		
		case  "AD_VISTE_DA_VICINO":
			window.open("vistedavicino.html","_self","");
			break;

		case  "AD_PERCORSI_AL_FEMMINILE":
			window.open("percorsi.html","_self","");
			break;
					
		case  "AD_TU_COSA_NE_PENSI":
			window.open("sondaggio.html","_self","");
			break;
		
		case  "AD_SCELTI_PER_TE_SOMMARIO":
			window.open("sceltiperte_home.html","_self","");
			break;
		
		case  "AD_SCELTI_PER_TE_APPROFONDIMENTI":
			window.open("sceltiperte_interna.html","_self","");
			break;
	
	}
}

/************************************

			Calcola bisogni

*************************************/

	   function calcola(){
	       stringError = "";
	       if ((document.aspnetForm.cliente[0].checked == false) && (document.aspnetForm.cliente[1].checked == false))
	           stringError += "Devi selezionare se sei gia' cliente<br/>";
	       if ((document.aspnetForm.azionista[0].checked == false) && (document.aspnetForm.azionista[1].checked == false))
	           stringError += "Devi selezionare se sei gia' azionista";
	       
	       if (stringError != ''){
                document.getElementById('errori').style.display = "block";
                document.getElementById('errori').innerHTML = stringError;
	            //alert(stringError)
	       } else {
	            document.getElementById('errori').style.display = "none";
	            document.getElementById('errori').innerHTML = "";
	            
	            var _formObj =  document.aspnetForm;
	            var _importo = parseInt(_formObj.importo.options[_formObj.importo.selectedIndex].value);
	            var _cliente = _formObj.cliente[0].checked == true ? true : false;
	            var _azionista = _formObj.azionista[0].checked == true ? true : false; 
	            var _categoria = _formObj.categoria.value;
	            hideAll();
	            
	            switch (_categoria){
	               case "1" :
	               case "2" :
	               case "10" :
	                  showProdotto("boxMysura");         
	                  break;
	               case "3" :
	               case "4" :
	               case "5" :
	               case "11" :
	                  showProdotto("boxValea");         
	                  break;
	               case "8" :
	                case "9" :
	                case "12" :
	                  showProdotto("boxDispenser");         
	                  break;
	               case "6" :
	               case "7" :
	               case "13" :
	                  if (_importo <= 3000) 
	                       showProdotto("boxValea");
	                  else
	                       showProdotto("boxMysura");
	                  break;
	            }
	            
	       }
	       if (_cliente || _azionista)
	           showProdotto("boxCliente");
	       else
	           hideProdotto("boxCliente");     
	       
	   }
	   
	   function hideAll(){
	       hideProdotto("boxMysura");
	       hideProdotto("boxValea");
	       hideProdotto("boxDispenser");
	   }
	   
	   function setcategoria(idCategoria){
	       document.aspnetForm.categoria.value = idCategoria;
	   }
	   
	   function showProdotto(idProdotto){
	       document.getElementById(idProdotto).style.display = "block";
	   }
	   
	    function hideProdotto(idProdotto){
	       document.getElementById(idProdotto).style.display = "none";
	   }
	   
	   
	   /************************************

			cerca filiali

*************************************/



function cercafiliali()
   {
   	window.open('http://www.gruppocarige.it/ws/gruppo/jsp/mappe_creditis_it.jsp','filiali','width=1024,height=730,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=yes');
   }
