function CInt(StringToConvertInInteger) {return parseInt(StringToConvertInInteger);}
function Mid(str, start, len){if (start < 0 || len < 0) return "";var iEnd, iLen = String(str).length;if (start + len > iLen) iEnd = iLen;	else  iEnd = start + len;		return String(str).substring(start,iEnd);}
function ricerca(rif) {var s="http://www.vacanzeinaffitto.com/ricerca.asp?";
	if(document.getElementById('cklast').checked==true) rif =0;s=s+"tipoappartamento=" + document.getElementById('cbtipoappatamento').value;
	s=s+ String.fromCharCode(38) + "tipobudget=" + document.getElementById('cbtipobudget').value;
	s=s+ String.fromCharCode(38) + "budget=" + document.getElementById('cbbudget').value;			
	s=s+ String.fromCharCode(38) + "regione=" + document.getElementById('cbregioni').value;
	s=s+ String.fromCharCode(38) + "citta=" + document.getElementById('txcitta').value;
	for (i=0;i<document.getElementById('cbregioni').length;i++) 		{
			if(document.getElementById('cbregioni').options[i].value==rif) 
			{document.getElementById('cbregioni').options[i].selected=true;i=document.getElementById('cbregioni').length;}}
	if (rif==0) s="http://www.vacanzeinaffitto.com/ricerca.asp?" + s + "&lastminute=-1"; location.href=s;}

function ricercacompleta(rif) {var s="http://www.vacanzeinaffitto.com/ricerca.asp?";
	if(document.getElementById('cklast').checked==true) rif =0;
	s=s+"tipoappartamento=" + document.getElementById('cbtipoappatamento').value;
	s=s+ String.fromCharCode(38) + "ubicazione=" + document.getElementById('cbubicazione').value;
	s=s+ String.fromCharCode(38) + "postiletto=" + document.getElementById('cbpostiletto').value;	
	s=s+ String.fromCharCode(38) + "stanze=" + document.getElementById('cbstanze').value;
	s=s+ String.fromCharCode(38) + "tipobudget=" + document.getElementById('cbtipobudget').value;
	s=s+ String.fromCharCode(38) + "budget=" + document.getElementById('cbbudget').value;
	s=s+ String.fromCharCode(38) + "regione=" + document.getElementById('cbregioni').value;
	s=s+ String.fromCharCode(38) + "citta=" + document.getElementById('txcitta').value;
	if(document.getElementById('ckdisabili').checked==true) 	s=s+ String.fromCharCode(38) + "disabili=1";	
	if(document.getElementById('cktv').checked==true) 	s=s+ String.fromCharCode(38) + "tv=1";	
	if(document.getElementById('cktelefono').checked==true) 	s=s+ String.fromCharCode(38) + "telefono=1";	
	if(document.getElementById('ckanimali').checked==true) 	s=s+ String.fromCharCode(38) + "animali=1";	
	if(document.getElementById('ckascensore').checked==true) 	s=s+ String.fromCharCode(38) + "ascensore=1";	
	if(document.getElementById('ckariacondizionata').checked==true) 	s=s+ String.fromCharCode(38) + "aria=1";	
	if(document.getElementById('ckinternet').checked==true) 	s=s+ String.fromCharCode(38) + "internet=1";	
	if(document.getElementById('cklavatrice').checked==true) 	s=s+ String.fromCharCode(38) + "lavatrice=1";	
	if(document.getElementById('cklavastoviglie').checked==true) 	s=s+ String.fromCharCode(38) + "stoviglie=1";	
	if(document.getElementById('ckfrigo').checked==true) 	s=s+ String.fromCharCode(38) + "frigo=1";	
	if(document.getElementById('ckforno').checked==true) 	s=s+ String.fromCharCode(38) + "forno=1";	
	if(document.getElementById('ckpostoauto').checked==true) 	s=s+ String.fromCharCode(38) + "postoauto=1";	
	if(document.getElementById('ckpiscina').checked==true) 	s=s+ String.fromCharCode(38) + "piscina=1";	
	if(document.getElementById('ckgiardino').checked==true) 	s=s+ String.fromCharCode(38) + "giardino=1";	
	for (i=0;i<document.getElementById('cbregioni').length;i++) 		{if(document.getElementById('cbregioni').options[i].value==rif) {document.getElementById('cbregioni').options[i].selected=true;i=document.getElementById('cbregioni').length;}}
	if(document.getElementById('cklast').checked==true) rif =0;	
	if (rif==0) s="http://www.vacanzeinaffitto.com/ricerca.asp?" + s + "&lastminute=-1"; location.href=s;}


document.write("<script type='text/javascript' src='http://www.vacanzeinaffitto.com/tff/tff.js'></script>");	

function ricercam(rif) {
	var s="http://www.vacanzeinaffitto.com/ricerca.asp?regione=" + rif;
	for (i=0;i<document.getElementById('cbregioni').length;i++) 		{
		if(document.getElementById('cbregioni').options[i].value==rif) {
			document.getElementById('cbregioni').options[i].selected=true;
			i=document.getElementById('cbregioni').length;
		}
	}

	if (rif==0) location.href="http://www.vacanzeinaffitto.com/ricerca.asp?" + s + "&lastminute=-1";
	location.href="http://www.vacanzeinaffitto.com/ricerca.asp?regione=" + rif;	
}


function regione(rif) {
	rif=rif.toString();
	if(rif.length==1) {rif='0'+rif}
	for (i=0;i<document.getElementById('cbregioni').length;i++) 		{
		if(document.getElementById('cbregioni').options[i].value==rif) {
			document.getElementById('cbregioni').options[i].selected=true;
			i=document.getElementById('cbregioni').length;
		}
	}
	frregione.location.href= 'http://www.vacanzeinaffitto.com/' + rif + '.html';

}


function lingua(l) {
	if (window.XMLHttpRequest) 		  
		{xmlhttp=new XMLHttpRequest()}
	else if (window.ActiveXObject) 
		{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}
	xmlhttp.open("post","http://www.vacanzeinaffitto.com/l.asp",false)
	xmlhttp.setRequestHeader("content-type","application/x-www-form-urlencoded");l='l='+l;
	xmlhttp.send(l);
	t=setTimeout('posizInt();',1500);


}
     function bearing( from, to ) {
       var lat1 = from.latRadians();var lon1 = from.lngRadians();
       var lat2 = to.latRadians();var lon2 = to.lngRadians();
       var angle = - Math.atan2( Math.sin( lon1 - lon2 ) * Math.cos( lat2 ), Math.cos( lat1 ) * Math.sin( lat2 ) - Math.sin( lat1 ) * Math.cos( lat2 ) * Math.cos( lon1 - lon2 ) );
       if ( angle < 0.0 )
		angle  += Math.PI * 2.0;
	       angle = angle * degreesPerRadian;
    	   angle = angle.toFixed(1);
       return angle;
     }
     
function posizInt() {
	document.getElementById("int2").style.width='450px';
	if((ind = navigator.appVersion.indexOf("MSIE")) > -1 && navigator.userAgent.indexOf("Opera") == -1) { 
		document.getElementById("int2").style.top='40px'}
	else 
		{document.getElementById("int1").style.top='-30px';document.getElementById("int2").style.top='25px'}
}
	
