
﻿
function SetCookie(name,value,expires,domain,path){var expdate=new Date();if(expires!=null&&expires>=0)expdate.setTime(expdate.getTime()+expires);document.cookie=name+"="+escape(value)+((expires==null||expires<0)?((expires==-1)?"; expires=-1":""):("; expires="+expdate.toGMTString()))
+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain));}
function FillContent(filePath,id){var j="";new Ajax.Request(filePath+'utc='+((new Date().getTime()).toString()),{method:'get',asynchronous:true,onSuccess:function(transport){j=transport.responseText;$(id).innerHTML=j;},onFailure:function(){}});}
function Trim(str){return str.replace(/(^\s*)|(\s*$)/g,"");}
function Ltrim(str){return str.replace(/(^\s*)/g,"");}
function Rtrim(str){return str.replace(/(\s*$)/g,"");}
function getPosition(el){for(var lx=0,ly=0;el!=null;lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);return{x:lx,y:ly}}
function showmenu(p,m,s,pos,top,left){var obj=$(p);var obj0=$(m);var objt=$(m+"t");var objc=$(m+"c");obj.className="menu"
if(s=="show"){if(pos=="top"){obj.style.display="block";obj.style.top=(getPosition(obj0).y+top)+"px";obj.style.left=(getPosition(obj0).x+left)+"px";}else if(pos=="botom"){obj.style.display="block";obj.style.top=(getPosition(obj0).y+obj0.offsetHeight+top)+"px";obj.style.left=(getPosition(obj0).x+left)+"px";}else if(pos=="left"){obj.style.display="block";obj.style.top=(getPosition(obj0).y+top)+"px";obj.style.left=(getPosition(obj0).x-obj.offsetWidth+left)+"px";}else if(pos=="right"){obj.style.display="block";obj.style.top=(getPosition(obj0).y+top)+"px";obj.style.left=(getPosition(obj0).x+obj0.offsetWidth+left)+"px";}}else{obj.style.display="none";}}
FillContent("/Inc/city/ChangeCity.ashx?","changecitycontent");function GetProvince(obj){var str0="";var objs=$(obj);var strpost="{}";var filePath="/WebService/JSON/WsPosition.asmx/GetProvince";objs.innerHTML="<img src='/App_Themes/Default/cximg/loading.gif' /> 正在载入中...";new Ajax.Request(filePath+'?utc='+((new Date().getTime()).toString()),{method:'post',contentType:'application/json',asynchronous:true,onSuccess:function(transport){j=transport.responseJSON;GetLocationSuccessCallBack(objs,j,str0);},onFailure:function(){objs.innerHTML="<img src='/App_Themes/Default/cximg/loading.gif' /> 载入失败";}});}
function GetCities(obj,pid,pName){var str0=pName;var objs=$(obj);var strpost='{provinceId:'+pid+'}';var filePath="/WebService/JSON/WsPosition.asmx/GetCities";objs.innerHTML="<img src='/App_Themes/Default/cximg/loading.gif' /> 正在载入中...";new Ajax.Request(filePath,{method:'post',contentType:'application/json',asynchronous:true,postBody:strpost,onSuccess:function(transport){j=transport.responseJSON;GetLocationSuccessCallBack(objs,j,str0);},onFailure:function(){objs.innerHTML="<img src='/App_Themes/Default/cximg/loading.gif' /> 载入失败";}});}
function GetLocationSuccessCallBack(obj,rexm,str0){var data=rexm;var str="";if(str0!=""){str+="<div class='ptitle'>"+str0+">></div>";}
str+="<ul>";for(var i=0;i<data.length;i++){str+="<li>";if(data[i].CityId>0){if(data[i].CityId==1||data[i].CityId==2||data[i].CityId==3||data[i].CityId==6||data[i].CityId==4){str+="<a href=\"javascript:;\" onclick=\" SetCityCookie('province','"+data[i].ProvinceId+"');SetCityCookie('city','"+data[i].CityId+"');return FreshCityPage();\" class='scity'>"+data[i].Name+"</a>";}else{str+="<a href=\"javascript:;\" onclick=\" SetCityCookie('province','"+data[i].ProvinceId+"');SetCityCookie('city','"+data[i].CityId+"');return FreshCityPage();\">"+data[i].Name+"</a>";}}else{str+="<a href=\"javascript:;\" onclick=\"GetCities('"+obj.id+"', '"+data[i].ProvinceId+"', '"+data[i].Name+"');return false;\">"+data[i].Name+"</a>";}
str+="</li>";}
str+="</ul>";str+="<iframe src=\"javascript:false\" style=\"position:absolute; visibility:inherit; top:0px; left:0px; width:331px; height:200px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';opacity: 0.0;-moz-opacity: 0.0;\"></iframe>";obj.innerHTML=str;}
function FreshCityPage(){var i,m;var url=location.href.toLowerCase();i=url.indexOf('usedhouse');if(i>0){window.location.href='http://www.foloda.com/house/UsedHouse.aspx?ht=0';return false;}
i=url.indexOf('renthouse');if(i>0){window.location.href='http://www.foloda.com/house/RentHouse.aspx?ht=1';return false;}
i=url.indexOf('html/house');if(i>0){window.location.href='http://www.foloda.com/house/UsedHouse.aspx?ht=0';return false;}
i=url.indexOf('broker/search.aspx');if(i>0){window.location.href='http://www.foloda.com/Broker/Search.aspx';return false;}
if(window.location.toString().lastIndexOf("#")==window.location.toString().length-1){window.location.href=window.location.href.toString().substring(0,window.location.href.toString().length-1);return false;}else{window.location.href=window.location.href;return false;}}
function SetCityCookie(name,value){SetCookie(name,value,365*24*60*60*1000,".foloda.com","/");}
function ShowCityDiv(){var Element=$('changeCityDiv');Element.style.display="block";Element.focus();}
function HideCityDiv(){var Element=$('changeCityDiv');if(Element==null)return;Element.style.display="none";}
FillContent("/Inc/login/login.ashx?","logincontent");function _out(){var filePath="/Inc/login/Out.aspx";var j={};new Ajax.Request(filePath+'?utc='+((new Date().getTime()).toString()),{method:'get',asynchronous:true,onSuccess:function(transport){j=transport.responseText.evalJSON();eval(j.LoginUrl);},onFailure:function(){}});}
