function go_filtro_quartiere(selObj)
{var option_value = new String(selObj.options[selObj.selectedIndex].value);url='' + option_value + '';location.replace(url);}	
function scrollDown(i)
{var ie=(navigator.appName.indexOf("Internet Explorer")!=-1)?1:0;var j='point'+i.toString();var thepoint=document.getElementById(j).offsetTop;if(ie)
document.getElementById('box_sottocat').scrollTop=thepoint;else document.getElementById('box_sottocat').scrollTop=thepoint-110;}
function scrollDown_new(i)
{var ie=(navigator.appName.indexOf("Internet Explorer")!=-1)?1:0;var j='point'+i.toString();var thepoint=document.getElementById(j).offsetTop;if(ie){document.getElementById('box_sottocat').scrollTop=thepoint;}
else{document.getElementById('box_sottocat').scrollTop=thepoint-260;}}
function gosurl(selObj){url='/index_cerca_singola.php?s='+selObj.options[selObj.selectedIndex].value+'';location.replace(url);if(restore)selObj.selectedIndex=0;}
function gosurl2(selObj){url='/index_cerca_all.php?s='+selObj.options[selObj.selectedIndex].value+'';location.replace(url);}
function mis_all(){for(i=0;i<10;i++){var el='tb_'+i;if(document.getElementById(el)){document.getElementById(el).width="100%";}}}
function error_img(obj){obj.width=parseInt(0,10);obj.height=parseInt(0,10);}
function mis(obj){w=obj.width;h=obj.height;if(w>500){h=500*h/w;w=500;};if(h>500){w=500*w/h;h=500;}
obj.width=parseInt(w,10);obj.height=parseInt(h,10);}
function zoom(url){ZooM=window.open(url,'zoom','scrollbars=yes,resizable=yes,width=400,height=400,status=no,location=no,toolbar=no');}
function show_zoom(id){var url_img='/big/'+id.substr(0,2)+'/'+id;theStr='<DIV id="foto_big" style="margin:2px;background-color: #FFFFFF;border: medium solid #000000;position:absolute; left:'+x+'px; top:'+y+'px; z-index:1; visibility:show;"><img hspace="2" vspace=2 src="'+url_img+'"></div>';document.getElementById('foto_big').innerHTML=theStr;}
function popup_segnala(u){u=mycode(u);window.open(u,'','width=500,height=370, resizable=0, scrollbars=0');}
function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if(restore)selObj.selectedIndex=0;}
function MM_jumpMenu_price(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if(restore)selObj.selectedIndex=0;}
function go(u){u=mycode(u);document.location.href=u;}
function exit(u){u=mycode(u);window.open(u);}
function map(u){window.open(u,"","width=620,height=420,toolbar=no,status=no");}
function mycode(stringa){str_out="";num_out=stringa;for(i=0;i<num_out.length;i+=2){num_in=parseInt(num_out.substr(i,[2]))+23;num_in=unescape('%'+num_in.toString(16));str_out+=num_in;}
stringa=unescape(str_out);while(stringa.indexOf('+')!=-1){stringa=stringa.replace('+',' ');}
return stringa;}
function getById(id){return document.getElementById?document.getElementById(id):(document.all?document.all(id):null);}
function hideDiv(id){getById(id).style.visibility="hidden";getById(id).style.display="none";}
function showDiv(id){getById(id).style.visibility="";getById(id).style.display="";}
function getScroll(){if(document.all){var ieBox=document.compatMode!="CSS1Compat";var cont=ieBox?document.body:document.documentElement;return{x:cont.scrollLeft,y:cont.scrollTop};}else{return{x:window.pageXOffset,y:window.pageYOffset};}}
function getBrowserWidth(){if(typeof(window.innerWidth)=='number'){return window.innerWidth;}else if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth;}else if(document.body&&document.body.clientWidth){return document.body.clientWidth;}}
function getBrowserHeight(){if(typeof(window.innerHeight)=='number'){return window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight;}else if(document.body&&document.body.clientHeight){return document.body.clientHeight;}}
function getXmlHttpRequestObject(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}else{alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");}}
var searchReq=getXmlHttpRequestObject();function searchSuggest(){if(searchReq.readyState==4||searchReq.readyState==0){var str=escape(document.getElementById('txtSearch').value);searchReq.open("GET",'searchSuggest.php?search='+str,true);searchReq.onreadystatechange=handleSearchSuggest;searchReq.send(null);}}
function searchSuggest2(){if(searchReq.readyState==4||searchReq.readyState==0){var str=escape(document.getElementById('txtSearch2').value);searchReq.open("GET",'searchSuggest.php?search='+str,true);searchReq.onreadystatechange=handleSearchSuggest2;searchReq.send(null);}}
function searchSuggest_adm(){if(searchReq.readyState==4||searchReq.readyState==0){var str=escape(document.getElementById('txtSearch').value);searchReq.open("GET",'/searchSuggest_adm.php?search='+str,true);searchReq.onreadystatechange=handleSearchSuggest;searchReq.send(null);}}
function handleSearchSuggest2(){if(searchReq.readyState==4){var ss=document.getElementById('search_suggest2')
ss.innerHTML='';var str=searchReq.responseText.split("\n");for(i=0;i<str.length-1;i++){var suggest='<div onmouseover="javascript:suggestOver2(this);" ';suggest+='onmouseout="javascript:suggestOut2(this);" ';suggest+='onclick="javascript:setSearch2(this.innerHTML);" ';suggest+='class="suggest_link2">'+str[i]+'</div>';ss.innerHTML+=suggest;}}}
function handleSearchSuggest(){if(searchReq.readyState==4){var ss=document.getElementById('search_suggest')
ss.innerHTML='';var str=searchReq.responseText.split("\n");for(i=0;i<str.length-1;i++){var suggest='<div onmouseover="javascript:suggestOver(this);" ';suggest+='onmouseout="javascript:suggestOut(this);" ';suggest+='onclick="javascript:setSearch(this.innerHTML);" ';suggest+='class="suggest_link">'+str[i]+'</div>';ss.innerHTML+=suggest;}}}
function suggestOver(div_value){div_value.className='suggest_link_over';}
function suggestOut(div_value){div_value.className='suggest_link';}
function setSearch(value){document.getElementById('txtSearch').value=value;document.getElementById('search_suggest').innerHTML='';}
function suggestOver2(div_value){div_value.className='suggest_link_over2';}
function suggestOut2(div_value){div_value.className='suggest_link2';}
function setSearch2(value){document.getElementById('txtSearch2').value=value;document.getElementById('search_suggest2').innerHTML='';}
function hideOL() 
{
	/* this function hide the overlay 
	div labeled 'ol' and 'olBox' */
	document.getElementById("ol").style.display    = "none";
	document.getElementById("olBox").style.display = "none";
}
 
function showOL() 
{
	/* this function show the overlay 
	div labeled 'ol' and 'olBox' */
	document.getElementById("ol").style.display    = "block";
	document.getElementById("olBox").style.display = "block";
}






///////////




 function go_search(selObj){ 
 				var option_value = new String(selObj.options[selObj.selectedIndex].value);
				var goarray = option_value.split("#");
			   url='?pg=' + goarray[0] + '&a=' + goarray[1] + '&b='+ goarray[2] + '&c='+ goarray[3] + '';
			   location.replace(url);
			 }
			 
 function go_search_geo(selObj){ 
 				var option_value = new String(selObj.options[selObj.selectedIndex].value);
			   url='' + option_value + '';
			   location.replace(url);
			 }			 
			 
			 
 function go_search2(url){ 
				var goarray = url.split("#");
			   url='?pg=' + goarray[0] + '';
			   location.replace(url);
			 }	


function popup_segnala(u){
u=  mycode(u);
window.open(u, '', 'width=500,height=370, resizable=0, scrollbars=0');
}

function start_login_form(){
ajaxpage('/_ajax_login.php', 'form_login');	   
}
                    
      
function start_dx_info(){
ajaxpage('/_ajax_dx_info.php', 'dx_info');	
}


/***********************************************
* Dynamic Ajax Content
***********************************************/

var bustcachevar=0 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){


var page_request = false
if (window.XMLHttpRequest) 
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ 
if (file.indexOf(".js")!=-1){ 
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ 
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " 
}
}
}



function mycode(stringa) {
str_out = ""; num_out = stringa;
for(i = 0; i < num_out.length; i += 2) { num_in = parseInt(num_out.substr(i,[2])) + 23; num_in = unescape('%' + num_in.toString(16)); str_out += num_in; }
stringa = unescape(str_out);
while (stringa.indexOf('+') != -1) { stringa = stringa.replace('+', ' '); }     
return stringa;
}
