function iFrameHeight() {		var h = 0;		if ( !document.all ) {			h = document.getElementById('blockrandom').contentDocument.height;			document.getElementById('blockrandom').style.height = h + 60 + 'px';		} else if( document.all ) {			h = document.frames('blockrandom').document.body.scrollHeight;			document.all.blockrandom.style.height = h + 20 + 'px';		}	}function checkformins_off(lang){		var checkValidation = 0		if( document.forms['form_offerta'].elements['titolo'].value ==""){							checkValidation = 1;						}else if( document.forms['form_offerta'].elements['prezzo'].value ==""){							checkValidation = 1;						}else if( document.forms['form_offerta'].elements['descrizione_offerta'].value == 0 ){							checkValidation = 1;						}else if( document.forms['form_offerta'].elements['datain'].value == 0 ){							checkValidation = 1;						}else if( document.forms['form_offerta'].elements['dataand'].value == 0 ){							checkValidation = 1;						}								if(checkValidation == 0){				document.forms['form_offerta'].submit();	}else {				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")				}else{						alert("FR complila tutti i campi obbligatori (*)")				}		}}function checkformrec_pw(lang){		var checkValidation = 0		if( document.forms['recupero_pw'].elements['mail'].value ==""){							checkValidation = 1;						}								if(checkValidation == 0){				document.forms['recupero_pw'].submit();	}else {				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")			}else{					alert("FR complila tutti i campi obbligatori (*)")			}		}}function checkformins_str(lang){		var checkValidation = 0		if( !checkEmail(document.forms["ins_str"]["mail"],lang))	{		checkValidation = 2;			}else 	if( document.forms['ins_str'].elements['mail'].value ==""){							checkValidation = 1;						}else if( document.forms['ins_str'].elements['tel'].value ==""){							checkValidation = 1;						}else if( document.forms['ins_str'].elements['id_comune'].value == 0 ){							checkValidation = 1;						}								if(checkValidation == 0){				document.forms['ins_str'].submit();	}else if(checkValidation == 2){		if(lang == 1){						alert("La tua mail non e' corretta!");				}else if(lang == 3){						alert("La tua mail non e' corretta!");				}else{						alert("La tua mail non e' corretta!");				}	}else {				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")				}else{						alert("FR complila tutti i campi obbligatori (*)")				}		}}function checkmod_prof(lang){		var checkValidation = 0			if( document.forms['form_modprof'].elements['name'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['lastname'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['cf'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['citta'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['prov'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['address'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['cap'].value ==""){							checkValidation = 1;						}else if( document.forms['form_modprof'].elements['tel'].value ==""){							checkValidation = 1;						}								if(checkValidation == 0){				document.forms['form_modprof'].submit();	}else if(checkValidation == 2){		if(lang == 1){						alert("La tua mail non e' corretta!");				}else if(lang == 3){						alert("La tua mail non e' corretta!");				}else{						alert("La tua mail non e' corretta!");				}	}else if(checkValidation == 3){		if(lang == 1){						alert("Le password non coincidono!");				}else if(lang == 3){						alert("Le password non coincidono!");				}else{						alert("Le password non coincidono!");				}	}else{				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")			}else{					alert("FR complila tutti i campi obbligatori (*)")			}		}}function checkmod_pw(lang){		var checkValidation = 0			if(document.forms['form_modpw'].elements['pw_m'].value =="")	{		checkValidation = 1;			}else if( document.forms['form_modpw'].elements['pw_m'].value != document.forms['form_modpw'].elements['pw_v'].value){					checkValidation = 3;					}								if(checkValidation == 0){				document.forms['form_modpw'].submit();	}else if(checkValidation == 2){		if(lang == 1){						alert("La tua mail non e' corretta!");				}else if(lang == 3){						alert("La tua mail non e' corretta!");				}else{						alert("La tua mail non e' corretta!");				}	}else if(checkValidation == 3){		if(lang == 1){						alert("Le password non coincidono!");				}else if(lang == 3){						alert("Le password non coincidono!");				}else{						alert("Le password non coincidono!");				}	}else{				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")			}else{					alert("FR complila tutti i campi obbligatori (*)")			}		}}function checkformregistrati(lang){		var checkValidation = 0			if( !checkEmail(document.forms["form_registrati"]["mail"],lang))	{		checkValidation = 2;			}else if( document.forms['form_registrati'].elements['pw'].value != document.forms['form_registrati'].elements['pw_v'].value){					checkValidation = 3;					}else if( document.forms['form_registrati'].elements['name'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['lastname'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['cf'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['citta'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['prov'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['address'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['cap'].value ==""){							checkValidation = 1;						}else if( document.forms['form_registrati'].elements['tel'].value ==""){							checkValidation = 1;						} else if( !document.forms['form_registrati'].elements['sr'].checked ){						checkValidation = 1;						} else if( !document.forms['form_registrati'].elements['privacy'].checked ){								checkValidation = 1;								}								if(checkValidation == 0){				document.forms['form_registrati'].submit();	}else if(checkValidation == 2){		if(lang == 1){						alert("La tua mail non e' corretta!");				}else if(lang == 3){						alert("La tua mail non e' corretta!");				}else{						alert("La tua mail non e' corretta!");				}	}else if(checkValidation == 3){		if(lang == 1){						alert("Le password non coincidono!");				}else if(lang == 3){						alert("Le password non coincidono!");				}else{						alert("Le password non coincidono!");				}	}else{				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")			}else{					alert("FR complila tutti i campi obbligatori (*)")			}		}}function checkformrichiedi(lang){		var checkValidation = 0			if( document.forms['formrichiedidiponibilita'].elements['name'].value ==""){					checkValidation = 1;			}else{				if( document.forms['formrichiedidiponibilita'].elements['lastname'].value ==""){					checkValidation = 1;				}else{						if( document.forms['formrichiedidiponibilita'].elements['tel'].value ==""){						checkValidation = 1;						}else{								if( document.forms['formrichiedidiponibilita'].elements['richiesta'].value ==""){							checkValidation = 1;							}else{										if( !document.forms['formrichiedidiponibilita'].elements['privacy'].checked ){								checkValidation = 1;								}else{												if(!checkEmail(document.forms["formrichiedidiponibilita"]["mail"],lang))						{							checkValidation = 2;													}											}									}							}					}			}			if(checkValidation == 0){				document.forms['formrichiedidiponibilita'].submit();	}else if(checkValidation == 2){		if(lang == 1){						alert("La tua mail non e' corretta!");				}else if(lang == 3){						alert("La tua mail non e' corretta!");				}else{						alert("La tua mail non e' corretta!");				}	}else{				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")			}else{					alert("FR complila tutti i campi obbligatori (*)")			}		}}function checkformcontatti(lang){		var checkValidation = 0		if( document.forms['form_contatti'].elements['name'].value ==""){					checkValidation = 1;			}else{				if( document.forms['form_contatti'].elements['lastname'].value ==""){					checkValidation = 1;				}else{						if( document.forms['form_contatti'].elements['domanda'].value ==""){						checkValidation = 1;						}else{								if( !checkEmail(document.forms["form_contatti"]["mail"],lang))				{					checkValidation = 2;								 	}							}					}			}			if(checkValidation == 0){				document.forms['form_contatti'].submit();	}else if(checkValidation == 2){		if(lang == 1){						alert("La tua mail non e' corretta!");				}else if(lang == 3){						alert("La tua mail non e' corretta!");				}else{						alert("La tua mail non e' corretta!");				}	}else{				if(lang == 1){					alert("complila tutti i campi obbligatori (*)")			}else if(lang == 3){					alert("ENG complila tutti i campi obbligatori (*)")			}else{					alert("FR complila tutti i campi obbligatori (*)")			}		}}function checkEmail(email,lang) {			var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;		if (!filter.test(email.value)) 	{												email.focus				return false;		}		return true;}function visualizzaContatti(){			if(idStruttura!=""){		//alert(idStruttura)				$.post("includes/updateInteressati.php", {id_struttura: idStruttura},function(data){ 	check_info = 1});			idStruttura= "";		}				$("#visualizzaContatti").fadeIn("normal");		$("#visualizza").hide();		$("#nascondi").show();		}function nascondiContatti(){			$("#visualizzaContatti").hide();			$("#visualizza").show();		$("#nascondi").hide();}function caricaProvince(dest){	var linkUri ="";			var lungezza = location.href.length				var pos_ini = location.href.lastIndexOf("&id_reg=")		if(pos_ini != -1){			var subString = location.href.substr(pos_ini,lungezza);		linkUri = location.href.replace(subString,"")+"&id_reg="+dest;		}else{		linkUri = location.href+"&id_reg="+dest;		}		document.location = linkUri;}function ORGcaricaComuni(dest){	var linkUri ="";			var lungezza = location.href.length		var subString = '#anc'	var tmp = location.href.replace(subString,"");		var pos_ini = tmp.lastIndexOf("&id_p=")		if(pos_ini != -1){			subString = tmp.substr(pos_ini,lungezza);		linkUri = tmp.replace(subString,"")+"&id_p="+dest;		}else{		linkUri = tmp+"&id_p="+dest;		}		document.location = linkUri;}function caricaComuni_MSIE(dest,primo,secondo){	location.href =  "/"+primo+"/"+secondo+"/"+dest+"/";}function caricaComuni(dest,primo,secondo){		var linkUri =window.location.hostname;		var lungezza = location.href.length		var vdest = "";	if(dest != "---"){			vdest = "/"+dest+"/";		}else{		vdest = "/";		}			document.location = primo+"/"+secondo+vdest;}function caricaStrutture(dest,primo,secondo,terzo){		var linkUri =window.location.hostname;		var lungezza = location.href.length		var vdest = "";	if(dest != "---"){			vdest = "/"+dest+"/";		}else{		vdest = "/";		}			document.location = primo+"/"+secondo+"/"+terzo+vdest;}function ORGcaricaStrutture(dest){	var linkUri ="";			var lungezza = location.href.length		var subString = '#anc'	var tmp = location.href.replace(subString,"");		var pos_ini = tmp.lastIndexOf("&id_c=")		if(pos_ini != -1){			var subString = tmp.substr(pos_ini,lungezza);		linkUri = tmp.replace(subString,"")+"&id_c="+dest;		}else{		linkUri = tmp+"&id_c="+dest;		}		document.location = linkUri;}function caricaStrutture_MSIE(dest,primo,secondo,terzo){	location.href =  "/"+primo+"/"+secondo+"/"+terzo+"/"+dest+"/";		}function caricaStruttureStelle(dest,primo,secondo,terzo,quarto){		var linkUri =window.location.hostname;		var lungezza = location.href.length		var vdest = "";	if(dest != "---"){			vdest = "/"+dest+"/";		}else{		vdest = "/";		}			document.location = primo+"/"+secondo+"/"+terzo+"/"+quarto+vdest;}function ORGcaricaStruttureStelle(dest){	var linkUri ="";			var lungezza = location.href.length			var subString = '#anc'	var tmp = location.href.replace(subString,"");			var pos_ini = tmp.lastIndexOf("&id_s=")		if(pos_ini != -1){			var subString = tmp.substr(pos_ini,lungezza);		linkUri = tmp.replace(subString,"")+"&id_s="+dest;		}else{		linkUri = tmp+"&id_s="+dest;		}		document.location = linkUri;}function caricaStruttureStelle_MSIE(dest,primo,secondo,terzo,quarto){	///document.location = primo+"/"+secondo+"/"+terzo+"/"+quarto+vdest;		var tmp = location.href;	var lunghezza = location.href.length	var quanti_slash = conta_ricorrenze(tmp, "/");	if(quanti_slash == 8) {		var link_def = tmp.substr(0,lunghezza-2);	} else {		var link_def = tmp;	}		if( dest > 0) {			linkUri = link_def+dest+"/";		} else {		    linkUri = link_def;	}		document.location = linkUri;}function invia_search(){		 var requiredFieldsErrorMessage = "";			var var_search = "";	var_search = document.forms['search'].elements['w'].value;		if (var_search)  // there are no problems with the form	{		document.forms['search'].submit();	}}function search_focus(){	var_search = document.forms['search'].elements['w'].value ="";	}function conta_ricorrenze(string, subString) {    var stringa = string;     while (stringa.indexOf(subString) != -1) {        stringa = stringa.replace(subString, "");    }    var risultato = (string.length - stringa.length) / subString.length;    return risultato;}