
if(typeof deconcept=="undefined")var deconcept={};if(typeof deconcept.util=="undefined")deconcept.util={};if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil={};deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return;}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];if(swf){this.setAttribute('swf',swf);}
if(id){this.setAttribute('id',id);}
if(w){this.setAttribute('width',w);}
if(h){this.setAttribute('height',h);}
if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);}
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}
if(c){this.addParam('bgcolor',c);}
var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute('redirectUrl',redirectUrl);}}
deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"expressinstall.swf":path;this.setAttribute('useExpressInstall',true);},setAttribute:function(name,value){this.attributes[name]=value;},getAttribute:function(name){return this.attributes[name]||"";},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariable:function(name){return this.variables[name]||"";},getVariables:function(){return this.variables;},getVariablePairs:function(){var variablePairs=[];var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=key+"="+variables[key];}
return variablePairs;},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<embed type="application/x-shockwave-flash" pluginspage=\"http://www.adobe.com/go/getflashplayer\" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+(this.getAttribute('style')||"")+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="'+params[key]+'" ';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"';}
swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+(this.getAttribute('style')||"")+'">';swfNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />';}
swfNode+="</object>";}
return swfNode;},write:function(elementId){if(this.getAttribute('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'));}}
return false;}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(PlayerVersion.major==6){return PlayerVersion;}}
try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}
if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return PlayerVersion;}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true;}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q;}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){};}}}}
if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;var EmUtil=new function(){this.siteRoot;this.contextRoot;this.staticUrl;this.initiate=function(siteRoot,contextRoot,staticUrl,loggedIn){this.siteRoot=siteRoot;this.contextRoot=contextRoot;this.staticUrl=staticUrl;EmLogin.loggedIn=loggedIn;while(this.siteRoot.charAt(this.siteRoot.length-1)=='/')
this.siteRoot=this.siteRoot.substring(0,this.siteRoot.length-1);while(this.contextRoot.charAt(this.contextRoot.length-1)=='/')
this.contextRoot=this.contextRoot.substring(0,this.contextRoot.length-1);while(this.staticUrl.charAt(this.staticUrl.length-1)=='/')
this.staticUrl=this.staticUrl.substring(0,this.staticUrl.length-1);}
this.preloadImages=function(){if(document.images){for(i=0;i<arguments.length;i++)
if(typeof(arguments[i])=='string'){var img=new Image();img.src=arguments[i];}}}
this.clickParentLink=function(img){var node=img;while(node&&!EmUtil.equalsIgnoreCase(node.nodeName,'A')){node=node.parentNode;}
if(node&&node.click)
return node.click();return true;}
this.switchPane=function(p){EmUtil.removeClass('infoLink','active');EmUtil.removeClass('mapLink','active');EmUtil.removeClass('photosLink','active');EmUtil.removeClass('videosLink','active');EmUtil.removeClass('similarLink','active');EmUtil.removeClass('agentLink','active');EmUtil.removeClass('fvideosLink','active');EmUtil.removeClass('agentsLink','active');EmUtil.removeClass('newsLink','active');EmUtil.removeClass('infoPane','active');EmUtil.removeClass('mapPane','active');EmUtil.removeClass('photosPane','active');EmUtil.removeClass('videosPane','active');EmUtil.removeClass('similarPane','active');EmUtil.removeClass('agentPane','active');EmUtil.removeClass('fvideosPane','active');EmUtil.removeClass('agentsPane','active');EmUtil.removeClass('newsPane','active');EmUtil.addClass(p+'Link','active');EmUtil.addClass(p+'Pane','active');EmUtil.getElementById(p+'Link').blur();return false;}
this.getScrollX=function(){if(typeof(window.pageYOffset)=='number'){return window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){return document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return document.documentElement.scrollLeft;}else{return 0;}}
this.getScrollY=function(){if(typeof(window.pageYOffset)=='number'){return window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){return document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return document.documentElement.scrollTop;}else{return 0;}}
this.switchMyBarPane=function(p){if(p){EmUtil.removeClass('myBar_rsearches','active');EmUtil.removeClass('myBar_rproperties','active');EmUtil.removeClass('myBar_ssearches','active');EmUtil.removeClass('myBar_sproperties','active');EmUtil.addClass('myBar_'+p,'active');EmUtil.setCookie('mybar',p);}}
this.activateMyBarPane=function(){this.switchMyBarPane(EmUtil.getCookie('mybar'));}
this.getContextRelativePath=function(){var path=window.location.pathname;if(EmUtil.equalsIgnoreCase(path.substring(0,EmUtil.contextRoot.length),EmUtil.contextRoot))
path=path.substring(EmUtil.contextRoot.length);if(path.charAt(0)!='/')
path='/'+path;return path;}
this.getSiteRelativePath=function(){var path=window.location.pathname;if(EmUtil.equalsIgnoreCase(path.substring(0,EmUtil.siteRoot.length),EmUtil.siteRoot))
path=path.substring(EmUtil.siteRoot.length);if(path.charAt(0)!='/')
path='/'+path;return path;}
this.resolveUrl=function(url,includeMask,includeSearch){var result;if(url.charAt(0)=='/'||(url.charAt(0)=='~'&&url.charAt(1)=='/'&&includeMask==false)){if(url.charAt(0)=='~')
url=url.substring(1);result=this.siteRoot+url;}
else if(url.charAt(0)=='~'&&url.charAt(1)=='/')
result=this.contextRoot+url.substring(1);else{var path=window.location.pathname;if(path.indexOf('/')>-1){path=path.substring(0,path.lastIndexOf('/'))+'/';}
result=path+url;}
if(this.isStaticPath(url)){result=this.staticUrl+result;}
if(includeSearch)
result=result+'?'+window.location.search;return result;}
this.isStaticPath=function(url){if(url.indexOf('?')>-1)
url=url.substring(0,url.indexOf('?'));if(url.indexOf('.')>-1){var ext=url.substring(url.lastIndexOf('.')+1);if(ext=='jpg'||ext=='jpeg'||ext=='gif'||ext=='html'||ext=='htm'||ext=='txt'||ext=='xml'||ext=='js'||ext=='ico'||ext=='png'){return true;}}
return false;}
this.textBoxDefault=function(field,defaultValue,clear){if(clear){if(field.value==defaultValue)
field.value='';}
else{if(field.value=='')
field.value=defaultValue;}}
this.formatNumber=function(num){num=String(num);var cpy='';for(var i=0;i<num.length;i++){if((num.length-i)%3==0&&i>0)
cpy+=',';cpy+=num.charAt(i);}
return cpy;}
this.trim=function(str){if(typeof(str)!='string')return str;return str.replace(/(^\s+)|(\s+$)/g,'');}
this.hasClass=function(e,cls){e=EmUtil.getElementById(e);if(!e||typeof(e.className)!='string')return false;var regex=new RegExp("(^|\\s)"+cls+"(\\s|$)");return regex.test(e.className);}
this.addClass=function(e,cls){e=EmUtil.getElementById(e);if(!e)return;if(!this.hasClass(e,cls)){e.className=e.className.replace(/\s*$/,' ');e.className+=' '+cls;}}
this.removeClass=function(e,cls){e=EmUtil.getElementById(e);if(!e)return;if(this.hasClass(e,cls)){e.className=e.className.replace(new RegExp('(^|\\s)'+cls+'(\\s|$)'),'');e.className=e.className.replace(/\s(\s+)/,' ');}}
this.equalsIgnoreCase=function(str1,str2){return typeof(str1)=='string'&&typeof(str2)=='string'&&str1.toLowerCase()==str2.toLowerCase();}
this.attachEvent=function(elmt,evt,fun){var wrapper=function(e){if(!e)e=window.event;fun(e);}
if(elmt.addEventListener)
elmt.addEventListener(evt,wrapper,false);else if(elmt.attachEvent)
elmt.attachEvent('on'+evt,wrapper);}
this.loadScript=function(url){if(document.createElement&&document.getElementsByTagName){var script=document.createElement('script');var head=document.getElementsByTagName('head');if(script&&head.length){script.src=url;head[0].appendChild(script);}}}
this.getCookie=function(name){var value=null,search=name+"=";if(document.cookie.length>0){var offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;var end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;value=unescape(document.cookie.substring(offset,end));}}
return value;}
this.setCookie=function(name,value,expire,path){document.cookie=name+"="+escape(value)+
((!expire)?"":("; expires="+expire.toGMTString()))+"; path="+((!path)?"/":path);}
this.deleteCookie=function(name,path){if(EmUtil.getCookie(name)){document.cookie=name+"="+"; path="+((!path)?"/":path)+"; expires="+new Date(0).toGMTString();}}
this.getElementById=function(e){if(typeof(e)=='string'){if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;}
return e;}
this.getControlById=function(id){return this.getElementById('_emCtrl_'+id);}
this.getElementLeft=function(e){e=EmUtil.getElementById(e);if(!e)return 0;var leftPos=e.offsetLeft;var parent=e.offsetParent;while(parent!=null){leftPos+=parent.offsetLeft;parent=parent.offsetParent;}
return leftPos;}
this.getElementTop=function(e){e=EmUtil.getElementById(e);if(!e)return 0;var topPos=e.offsetTop;var parent=e.offsetParent;while(parent!=null){topPos+=parent.offsetTop;parent=parent.offsetParent;}
return topPos;}
this.getElementRight=function(e){return EmUtil.getElementLeft(e)+EmUtil.getElementWidth(e);}
this.getElementBottom=function(e){return EmUtil.getElementTop(e)+EmUtil.getElementHeight(e);}
this.getElementWidth=function(e){e=EmUtil.getElementById(e);if(!e)return 0;if(e.offsetWidth)return e.offsetWidth;if(e.style.pixleWidth)return e.style.pixleWidth;return 0;}
this.getElementHeight=function(e){e=EmUtil.getElementById(e);if(!e)return 0;if(e.offsetHeight)return e.offsetHeight;if(e.style.pixleHeight)return e.style.pixleHeight;return 0;}
this.getDocumentWidth=function(){var width=EmUtil.getElementWidth(document.body);if(window.innerWidth>width)
width=window.innerWidth;if(document.documentElement.clientWidth>width)
width=document.documentElement.clientWidth;return width;}
this.getDocumentHeight=function(){var height=EmUtil.getElementHeight(document.body);if(document.body.scrollHeight>height)
height=document.body.scrollHeight;if(document.documentElement.clientHeight>height)
height=document.documentElement.clientHeight;if(window.innerHeight>height)
height=window.innerHeight;return height;}
this.base36Decode=function(str)
{if(str.length%6>0)
return"";var block;var ch;var buf='';for(i=0;i<str.length;i+=6)
{block=str.substring(i,i+6);ch=parseInt(block,36);buf+=String.fromCharCode((ch&0xFF));if((ch&0xFF00)>0)
buf+=String.fromCharCode((ch&0xFF00)>>>8);if((ch&0xFF0000)>0)
buf+=String.fromCharCode((ch&0xFF0000)>>>16);if((ch&0xFF000000)>0)
buf+=String.fromCharCode((ch&0xFF000000)>>>24);}
return buf;}
this.base36Encode=function(chrs)
{var buf='';var ch=0,tmp;var buffered=0;for(i=0;i<chrs.length;i++)
{tmp=(chrs.charCodeAt(i)&0xFF)<<(buffered*8);ch+=tmp;buffered++;if(buffered==4||i==chrs.length-1)
{buf+=EmUtil.padLeft(new Number(ch).toString(36),"0",6);ch=0;buffered=0;}}
return buf;}
this.padLeft=function(str,ch,len)
{while(str.length<len)
str=ch+str;return str;}
this.getFieldValue=function(fld,d){if(typeof(fld)=='string'){var tmp=EmUtil.getControlById(fld);if(tmp==null)
tmp=EmUtil.getElementById(fld);fld=tmp;}
if(fld){if(EmUtil.equalsIgnoreCase(fld.tagName,'SELECT')){return fld.options[fld.selectedIndex].value;}
else if(EmUtil.equalsIgnoreCase(fld.tagName,'INPUT')&&EmUtil.equalsIgnoreCase(fld.type,'RADIO')){return fld.checked;}
else if(EmUtil.equalsIgnoreCase(fld.tagName,'INPUT')&&EmUtil.equalsIgnoreCase(fld.type,'CHECKBOX')){return fld.checked;}
else{return(fld.value?fld.value:d);}}
return d;}
this.setFieldValue=function(fld,v){if(typeof(fld)=='string'){var tmp=EmUtil.getControlById(fld);if(tmp==null)
tmp=EmUtil.getElementById(fld);fld=tmp;}
if(fld){if(EmUtil.equalsIgnoreCase(fld.tagName,'SELECT')){fld.selectedIndex=0;for(i=0;i<fld.options.length;i++){if(fld.options[i].value==v){fld.selectedIndex=i;break;}}}
else{fld.value=v;}}}
this.createClosure=function(obj,fun){if(!window.__cxClosures){window.__cxClosures={id:0,objects:[],functions:[],aguments:[]}}
var id;var args;if(arguments.length>0){args=[];for(var i=2;i<arguments.length;i++)
args[i-2]=arguments[i];}
id=(window.__cxClosures.id++);window.__cxClosures.objects[id]=obj;window.__cxClosures.functions[id]=fun;window.__cxClosures.aguments[id]=args;obj=null;fun=null;return function(){var args;if(window.__cxClosures.aguments[id]){args=window.__cxClosures.aguments[id];}
else{args=arguments;}
return window.__cxClosures.functions[id].apply(window.__cxClosures.objects[id],window.__cxClosures.aguments[id]);}}
this.error=function(msg){}
this.oldImg;this.reloadCaptcha=function(){var img=document.getElementById('captchaImg');img.src='';img.src=EmUtil.resolveUrl('~/data/frmimg?t='+(new Date().getTime()));}}
EmAjax=new function()
{this.loadElement=function(uri,e,c,d,noloading){var sourceUri=uri;uri=this.buildRequest(uri);uri.uri.query.setValue('__e',e);var htmle,callback;if(typeof(c)=='function')
{callback=c;}
else{htmle=c;callback=d;}
if(!htmle)htmle=EmUtil.getElementById('_emElement_'+e);var loading=null;if(htmle&&htmle.nodeName!='DIV'){noloading=true;}
if(!noloading&&htmle){var height=EmUtil.getElementHeight(htmle);var width=EmUtil.getElementWidth(htmle);var loading=document.createElement('div');loading.style.height=(Math.floor(height/2-12)>24?Math.floor(height/2-12):24)+'px';loading.style.width=width+'px';loading.style.paddingTop=(Math.floor(height/2-12)>24?Math.floor(height/2-12):24)+'px';loading.style.textAlign='center';loading.innerHTML='<img src="'+EmUtil.resolveUrl('/_resources/images/loader.gif')+'" alt="Loading..." />';htmle.innerHTML='';htmle.appendChild(loading);}
return this.loadContent(uri,htmle,function(res){for(i=0;i<pageTrackers.length;i++)
pageTrackers[i]._trackPageview(sourceUri);if(callback)callback(res);});}
this.createXmlHttpRequest=function(){var reqObj=null;try{reqObj=new XMLHttpRequest();}
catch(e){try{reqObj=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){if(window.createRequest){try{reqObj=window.createRequest();}
catch(e){}}}}
return reqObj;}
this.downloadFile=function(url){if(!url)
return null;var req=this.createXmlHttpRequest();req.open('GET',url.toString(),false);req.send(null);return req.responseText;}
this.sendRequest=function(uri,callback){if(typeof(callback)!='function'||!uri)return false;if(uri.EmAjaxUri!=true&&uri.EmAjaxRequest!=true){uri=new EmAjax.Uri(uri);}
if(uri.EmAjaxRequest!=true){uri=new EmAjax.Request(uri);}
uri.uri.query.setValue('ts',new Date().getTime());var req=this.createXmlHttpRequest();req.open(uri.getMethod(),uri.uri.toString(),true);for(var header in uri.headers){if(header.toLowerCase()=='content-type'){if(req.overrideMimeType){req.overrideMimeType(uri.headers[header]);}}
req.setRequestHeader(header,uri.headers[header]);}
req.onreadystatechange=function(){if(req.readyState==4){var res=new EmAjax.Response();res.xmlhttpreq=req;res.status=req.status;res.statusText=req.statusText;res.responseText=req.responseText;if(req.responseXML)
res.responseXML=req.responseXML;callback(res);}}
req.send((uri.getMethod()=='POST'?uri.body:null));return false;}
this.loadContent=function(uri,e,callback){e=EmUtil.getElementById(e);if(!e)return false;return this.sendRequest(uri,function(response){if(response.status==200){EmAjax.setInnerHTML(e,response.responseText);if(callback)callback(response);}
else
{uri.uri.query.removeKey('__e');window.location=uri.uri.toString();}});}
this.buildRequest=function(e){var stre=e;e=EmUtil.getElementById(e);if(e&&e.tagName){if(e.tagName=='A'){return new EmAjax.Request(this.resolveUrl(e.href));}
else if(e.tagName=='FORM'){var req=new EmAjax.Request(this.resolveUrl(e.action));req.method=e.method.toUpperCase();if(!req.method||req.method==''){req.method='GET';}
if(req.method=='GET'){req.uri.query=this.buildQSFromForm(e);}
else if(req.method=='POST'){req.setHeader('Content-Type','application/x-www-form-urlencoded');req.body=this.buildQSFromForm(e).toString();}
return req;}}
else if(!e){e=stre;return new EmAjax.Request(e);}}
this.buildQSFromForm=function(form){form=EmUtil.getElementById(form);if(!form.tagName||form.tagName!='FORM')
return null;var qs=new EmAjax.QueryString();this.addElementsToQS(form.childNodes,qs);return qs;}
this.addElementsToQS=function(elements,qs){for(var i=0;i<elements.length;i++){var e=elements[i];if(e.tagName=='INPUT'||e.tagName=='TEXTAREA'){if(EmUtil.equalsIgnoreCase(e.type,'checkbox')||EmUtil.equalsIgnoreCase(e.type,'radio')){if(!e.checked)continue;}
if(e.name&&e.name!=''){qs.addValue(e.name,(e.value?e.value:''));}}
else if(e.tagName=='SELECT'){for(var i=0;i<e.options.length;i++){if(i==e.selectedIndex){qs.addValue(e.name,e.options[i].value);}}}
else if(e.childNodes){this.addElementsToQS(e.childNodes,qs);}}}
this.Request=function(uri){this.EmAjaxRequest=true;this.headers=[];this.uri;this.method;this.body;this.timeout;this.setHeader=function(key,value){var found=key;for(var k in this.headers){if(k.toLowerCase()==key.toLowerCase()){found=k;break;}}
this.headers[found]=value;}
this.getMethod=function(){if(!this.method)
return'GET';else
return this.method.toUpperCase();}
this.headers['Content-Type']='text/plain';this.headers['Cache-Control']='no-cache';if(uri)this.uri=(uri.EmAjaxUri==true?uri:new EmAjax.Uri(uri));}
this.Response=function(){this.EmAjaxResponse=true;this.status;this.statusText;this.responseText;this.responseXML;this.getHeader=function(key){return(this.xmlhttpreq?this.xmlhttpreq.getResponseHeader(key):'');}}
this.Uri=function(uri){this.EmAjaxUri=true;this.protocol;this.host;this.port;this.path;this.query;this.toString=function(){if(this.all)
return this.all;var str='';if(this.protocol&&this.host){str+=this.protocol+'://'+this.host;if(this.port){str+=':'+this.port;}}
var path='/';if(this.path&&this.path.length>0&&this.path.charAt(0)!='/')
path='/'+this.path;else
path=this.path;str+=path;if(this.query&&this.query.pairs.length>0)
str+='?'+this.query;return str;}
var uriRegex=/^((([^:\/]+):\/\/)([^:\/]+)(:([0-9]{1,5})){0,1}){0,1}(\/[^$\?]*){0,1}(\?(.*)){0,1}$/;var match=uriRegex.exec(uri);if(match){this.protocol=match[3];this.host=match[4];if(match[6])this.port=Number(match[6]);this.path=match[7];this.query=new EmAjax.QueryString(match[9]);}
else{this.all=uri;}}
this.QueryString=function(qs){this.EmAjaxQueryString=true;this.pairs=[];this.getValue=function(key){var pair=this.getPair(key);return(pair?pair.value:null);}
this.getPair=function(key){for(var i in this.pairs){if(this.pairs[i].key==key){return this.pairs[i];}}
return null;}
this.setValue=function(key,value){if(value==null)
this.removeKey(key);else{var pair=this.getPair(key);if(pair)
pair.value=value;else
this.addValue(key,value);}}
this.addValue=function(key,value){this.pairs[this.pairs.length]={key:key,value:value};}
this.removeKey=function(key){var newPairs=[];for(var i in this.pairs){var p=this.pairs[i];if(key!=p.key){newPairs[newPairs.length]=p;}}
this.pairs=newPairs;}
if(typeof(qs)=='string'){var qsPairs=qs.split('&');for(var i=0;i<qsPairs.length;i++){var key;var value;var eqIndex=qsPairs[i].indexOf('=');if(eqIndex>0){key=unescape(qsPairs[i].substring(0,eqIndex).replace(/\+/g,' '));value=unescape(qsPairs[i].substring(eqIndex+1).replace(/\+/g,' '));}
else{key=unescape(qsPairs[i]);value='';}
this.addValue(key,value);}}
this.toString=function(){var str='';for(var i in this.pairs){if(str.length>0)
str+='&';var pair=this.pairs[i];str+=escape(pair.key)+'='+escape(pair.value);}
return str;}}
this.resolveUrl=function(path){if(typeof(path)!='string'||EmUtil.trim(path).length==0)
return window.location;var winPath=window.location.toString();winPath=winPath.replace(/[A-Za-z]+:\/\/[^\/]+/g,'');var newPath=path.replace(/[A-Za-z]+:\/\/[^\/]+/g,'');if(newPath.charAt(0)!='/'){newPath=winPath.substring(0,winPath.lastIndexOf('/')+1)+newPath;return newPath;}
return path;}
this.initiate=function(){this.HistorySupport.initiate();this.innerHTMLSupportsJS=false;var e=document.createElement("div");document.body.appendChild(e);e.innerHTML='<script type="text/javascript">this.innerHTMLSupportsJS = true;<\/script>';document.body.removeChild(e);}
this.setInnerHTML=function(e,html){var e=EmUtil.getElementById(e);e.innerHTML='<span style="display:none;">&nbsp;</span>'+html;if(!EmAjax.innerHTMLSupportsJS){var d=e.getElementsByTagName('script');var t=d.length;for(var x=0;x<t;x++){var newScript=document.createElement('script');newScript.type="text/javascript";newScript.text=d[x].text;e.appendChild(newScript);}
for(var y=0;y<t;y++){d[y].parentNode.removeChild(d[y]);}}}
this.HistorySupport=new function(){this.useIFrame=false;this.iFrame=null;this.onhash=null;this.lastHash=null;this.browser=null;this.isSupported=function(){return this.browser&&this.browser!='opera';}
this.go=function(section,hash){if(!this.isSupported())
return true;if(this.useIFrame){this.iFrame.src=EmUtil.resolveUrl('/_resources/hash.jsp?hash='+section+'/'+hash);}
else{window.location.hash=section+'/'+hash;}
return false;}
this.checkHash=function(){if(this.lastHash!=window.location.hash){this.doHash();this.lastHash=window.location.hash;}
setTimeout(document.__EmAjaxCheckHash,200);}
this.doHash=function(){var hash=window.location.hash;var section='';var argument='';if(hash.indexOf('#')==0)
hash=hash.substring(1);if(hash.indexOf('/')>-1)
{section=hash.substring(0,hash.lastIndexOf('/'));argument=hash.substring(hash.lastIndexOf('/')+1);}
else{section=hash;}
if(this.onhash){this.onhash(section,argument);}}
this.initiate=function(){var userAgent='';if(navigator.userAgent)
userAgent=navigator.userAgent.toUpperCase();if(userAgent.indexOf("MSIE 7")>-1)
this.browser="ie7";else if(userAgent.indexOf("MSIE 6")>-1)
this.browser="ie6";else if(userAgent.indexOf("FIREFOX")>-1)
this.browser="firefox";else if(userAgent.indexOf("SAFARI")>-1)
this.browser="safari";else if(window.opera)
this.browser="opera";if(!this.isSupported())
return;if(this.browser=="ie6"||this.browser=="ie7")
this.useIFrame=true;if(this.useIFrame){this.iFrameInit=false;this.iFrame=document.createElement('iframe');this.iFrame.style.display='none';this.iFrame.src=EmUtil.resolveUrl('/_resources/hash.jsp');window.EmAjax=EmAjax;document.body.appendChild(this.iFrame);this.doHash();}
else{document.__EmAjaxCheckHash=EmUtil.createClosure(this,this.checkHash);setTimeout(document.__EmAjaxCheckHash,200);}}}}
var EmSearch=new function(){this.searchType;this.propertyType;this.currentPath;this.onsearchEvents=[];this.map;this.ajaxSearch=true;this.lastSearch;this.advancedDef=new Object();this.setSearch=function(search){var defaultSearch='00000000000000000000X';var defaultStatus='';for(i=0;i<this.advancedDef.status.length;i++){defaultStatus+=EmUtil.padLeft(new Number(EmSearch.advancedDef.status[i]).toString(36),"0",2);}
defaultSearch+=defaultStatus+'X';if(!search){search=defaultSearch;}
if(!this.lastSearch)
this.lastSearch=defaultSearch.substring(4);if(search){var re=new RegExp("^([0-9a-z]{20})(X(([0-9a-z]{2})+)X)?(A(([0-9a-z]{2})+)A)?(S(([0-9a-z]{2})+)S)?(([0-9a-z]{6})*)$");var groups=re.exec(search);var element='propertyList_search';var path=this.getCurrentPath();if(EmSearch.lastSearch!=search.substring(4)||!EmUtil.getElementById('_emElement_propertyList_search')){element='pageContent';if(EmMap)
EmMap.removeMap();}
EmAjax.loadElement(EmUtil.resolveUrl(path+'?q='+search),element,function(){if(!EmUtil.pp){window.scrollTo(0,0);}
if(EmSearch.lastSearch!=search.substring(4))
{EmSearch.lastSearch=search.substring(4);if(groups){EmUtil.getControlById('txtSearch').value=EmUtil.base36Decode(groups[11]);EmUtil.getControlById('txtSearch').onblur();if(EmSearch.getSearchType()=='sale'){EmUtil.setFieldValue('lstPriceFrom',parseInt(groups[1].substring(4,7),36)*1000);EmUtil.setFieldValue('lstPriceTo',parseInt(groups[1].substring(7,10),36)*1000);}
else{EmUtil.setFieldValue('lstPriceFrom',parseInt(groups[1].substring(4,7),36));EmUtil.setFieldValue('lstPriceTo',parseInt(groups[1].substring(7,10),36));}
EmUtil.setFieldValue('lstUnit1',parseInt(groups[1].substring(10,12),36));EmUtil.setFieldValue('lstUnit2',parseInt(groups[1].substring(12,14),36));EmUtil.setFieldValue('lstUnit3',parseInt(groups[1].substring(14,16),36));EmUtil.setFieldValue('lstRadius',parseInt(groups[1].substring(16,18),36));}
var frmAdvanced=EmUtil.getControlById('frmSearchAdvanced');var checkboxes=frmAdvanced.getElementsByTagName('input');for(var i=0;i<checkboxes.length;i++){checkboxes[i].checked=false;}
if(groups[6]){for(var i=0;i<groups[6].length;i+=2){var attribute=parseInt(groups[6].substring(i,i+2),36);var e=EmUtil.getControlById('attribute'+attribute);if(e)e.checked=true;}}
if(groups[9]){for(var i=0;i<groups[9].length;i+=2){var style=parseInt(groups[9].substring(i,i+2),36);var e=EmUtil.getControlById('style'+style);if(e)e.checked=true;}}
if(!groups[3])
groups[3]=defaultStatus;if(groups[3]){for(var i=0;i<groups[3].length;i+=2){var status=parseInt(groups[3].substring(i,i+2),36);var e=EmUtil.getControlById('status'+status);if(e)e.checked=true;}}
EmSearch.refreshSaveStatus();EmSearch.toggleAdvancedPane(true);}});}}
this.runHash=function(propertyType,searchType,hash)
{if(!EmAjax.HistorySupport.isSupported()){window.location=EmUtil.resolveUrl('~/property/'+(propertyType?propertyType+'/':'')+searchType+'?q='+hash);}
else{if(propertyType!=EmSearch.getPropertyType()||searchType!=EmSearch.getSearchType()){window.location=EmUtil.resolveUrl('~/property/'+(propertyType?propertyType+'/':'')+searchType+'#search/'+hash);}
else{EmAjax.HistorySupport.go('search',hash);}}
return false;}
this.reorder=function(order,hash){hash=hash.substring(0,3)+order+hash.substring(4);return EmAjax.HistorySupport.go('search',hash);}
this.attachEvent=function(e,f){var eventArr=eval('this.on'+e+'Events');if(eventArr){eventArr[eventArr.length]=f;}}
this.onSearch=function(){if(this.onsearchEvents){for(var i=0;i<this.onsearchEvents.length;i++){var fun=this.onsearchEvents[i];if(typeof(fun)=='function'&&fun())
return true;}}}
this.initiate=function(){this.toggleAdvancedPane(true);var txtSearch=EmUtil.getControlById('txtSearch');}
this.searchOnReturn=function(event){if(event.keyCode==13){return EmSearch.run();}}
this.run=function(notAjax){this.toggleAdvancedPane(true);var frmSearch=EmUtil.getControlById('frmSearch');var txtSearch=EmUtil.getControlById('txtSearch');if(!frmSearch){EmUtil.error('Could not find frmSearch');return true;}
if(!txtSearch){EmUtil.error('Could not find txtSearch');return true;}
if(txtSearch.value==txtSearch._def)
txtSearch.value='';var searchPath=this.getSearchPath().substring(1);if(txtSearch.value.length>0&&txtSearch.value!=txtSearch._def)
searchPath='/property'+(this.getPropertyType()?'/'+this.getPropertyType():'')+'/'+this.getSearchType();frmSearch.action=EmUtil.resolveUrl('~'+searchPath);if(!this.ajaxSearch)
notAjax=true;var notPath=false;if(!notAjax){var path=EmUtil.getContextRelativePath();if(!EmUtil.equalsIgnoreCase(path,searchPath)||window.location.search)
notPath=true;}
if(notPath){window.location=EmUtil.resolveUrl('~'+searchPath+'#search/'+EmSearch.buildHash());return false;}
else if(!this.onSearch()){if(!notAjax&&EmAjax.HistorySupport){if(!EmAjax.HistorySupport.isSupported()){window.location=EmUtil.resolveUrl('~'+searchPath+'?q='+EmSearch.buildHash());}
else{EmAjax.HistorySupport.go('search',EmSearch.buildHash());}}
else{window.location=EmUtil.resolveUrl('~'+searchPath+'?q='+EmSearch.buildHash());}
return false;}
else{return true;}}
this.loadSearch=function(hash){return EmAjax.HistorySupport.go('search',hash);}
this.search=function(search){var txtSearch=EmUtil.getControlById('txtSearch');EmSearch.clearSearch();txtSearch.value=search;return EmSearch.run();}
this.setHelperMsg=function(msg,error){var divSearchHelper=EmUtil.getControlById('divSearchHelper');if(divSearchHelper){if(error){msg='<span style="color: Red; font-weight: bold;">'+msg+'</span>';}
divSearchHelper.innerHTML=msg;}
else{if(error){alert(msg);}}}
this.advancedButtonClick=function(btn){this.toggleAdvancedPane(false,btn);}
this.toggleAdvancedPane=function(closeOnly,btn){var pane=EmUtil.getControlById('frmSearchAdvanced');var search=EmUtil.getControlById('frmSearch');if(!btn&&search){if(!this.btnAdvanced){var innerLinks=search.getElementsByTagName('a');for(id in innerLinks){var e=innerLinks[id];if(EmUtil.hasClass(e,'btnAdvanced')){this.btnAdvanced=e;break;}}}
btn=this.btnAdvanced;}
if(pane){if(pane._init||EmSearch.countAdvanced()>0){if((pane.style.display=='block'||closeOnly)){pane.style.display='none';if(btn)EmUtil.removeClass(btn,'active');return false;}
else
{pane.style.display='block';if(btn)EmUtil.addClass(btn,'active');return false;}}
else{pane._init=true;}}}
this.clearSearch=function(){this.clearAdvanced();var txtSearch=EmUtil.getControlById('txtSearch');var lstPriceFrom=EmUtil.getControlById('lstPriceFrom');var lstPriceTo=EmUtil.getControlById('lstPriceTo');var lstUnit1=EmUtil.getControlById('lstUnit1');var lstUnit2=EmUtil.getControlById('lstUnit2');var lstUnit3=EmUtil.getControlById('lstUnit3');var lstRadius=EmUtil.getControlById('lstRadius');txtSearch.value='';if(lstPriceFrom)
lstPriceFrom.selectedIndex=0;if(lstPriceTo)
lstPriceTo.selectedIndex=0;if(lstUnit1)
lstUnit1.selectedIndex=0;if(lstUnit2)
lstUnit2.selectedIndex=0;if(lstUnit3)
lstUnit3.selectedIndex=0;if(lstRadius)
lstRadius.selectedIndex=0;}
this.clearAdvanced=function(){var frmSearchAdvanced=EmUtil.getControlById('frmSearchAdvanced');if(frmSearchAdvanced){var inputs=frmSearchAdvanced.getElementsByTagName('INPUT');for(i=0;i<inputs.length;i++){inputs[i].checked=false;}
for(i=0;i<this.advancedDef.status.length;i++)
{var cbx=EmUtil.getControlById('status'+this.advancedDef.status[i]);}}
for(i=0;i<this.advancedDef.status.length;i++){var cbx=EmUtil.getControlById('status'+this.advancedDef.status[i]);if(cbx)cbx.checked=true;}
EmSearch.toggleAdvancedPane();}
this.countAdvanced=function(){var frmSearchAdvanced=EmUtil.getControlById('frmSearchAdvanced');if(frmSearchAdvanced&&this.advancedDef.status){var inputs=frmSearchAdvanced.getElementsByTagName('INPUT');var advancedOptions=0;var hasStatus=false;for(i=0;i<inputs.length&&!hasStatus;i++){if(inputs[i].id.indexOf('_emCtrl_status')==0&&inputs[i].checked)
hasStatus=true;}
if(!hasStatus){for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('_emCtrl_status')==0)
inputs[i].checked=true;}}
for(i=0;i<inputs.length;i++){if(inputs[i].checked){var count=true;for(j=0;j<this.advancedDef.status.length;j++){if(inputs[i].id=='_emCtrl_status'+this.advancedDef.status[j])
count=false;}
if(count)advancedOptions++;}}
return advancedOptions;}
return 0;}
this.getSearchType=function(){return this.searchType;}
this.setCurrentPath=function(path){this.currentPath=path;}
this.getSearchPath=function(){var path=this.currentPath;var st=new RegExp('/'+path.substring(path.length-4)+'$');path=path.replace(st,'/'+this.getSearchType());return path;}
this.getCurrentPath=function(){return this.currentPath;}
this.getPropertyType=function(){return this.propertyType;}
this.setSearchType=function(type){if(!EmUtil.equalsIgnoreCase(type,this.searchType)){this.repopulateDropDowns(type);}
this.searchType=type.toLowerCase();var frmSearchAdvanced=EmUtil.getControlById('frmSearchAdvanced');EmAjax.loadElement(EmUtil.resolveUrl(this.getSearchPath()),'advanced');var frmSearch=EmUtil.getControlById('frmSearch');if(frmSearch){EmUtil.removeClass(frmSearch,'sale');EmUtil.removeClass(frmSearch,'rent');EmUtil.addClass(frmSearch,type);}
if(frmSearchAdvanced){EmUtil.removeClass(frmSearchAdvanced,'sale');EmUtil.removeClass(frmSearchAdvanced,'rent');EmUtil.addClass(frmSearchAdvanced,type);}
var frmSearchSimple=EmUtil.getControlById('frmSearchSimple');if(frmSearchSimple){EmUtil.removeClass(frmSearchSimple,'sale');EmUtil.removeClass(frmSearchSimple,'rent');EmUtil.addClass(frmSearchSimple,type);}
var fldSearchTypeSale=EmUtil.getControlById('fldSearchTypeSale');var fldSearchTypeRent=EmUtil.getControlById('fldSearchTypeRent');if(fldSearchTypeSale)
fldSearchTypeSale.checked=EmUtil.equalsIgnoreCase(type,'sale');if(fldSearchTypeRent)
fldSearchTypeRent.checked=EmUtil.equalsIgnoreCase(type,'rent');return false;}
this.setPropertyType=function(type){this.propertyType=type;return false;}
this.repopulateDropDowns=function(type){var lstPriceFrom=EmUtil.getControlById('lstPriceFrom');var lstPriceTo=EmUtil.getControlById('lstPriceTo');if(lstPriceFrom){var nodes=[];for(var i=0;i<lstPriceFrom.childNodes.length;i++){nodes[i]=lstPriceFrom.childNodes[i];}
for(var i=0;i<nodes.length;i++){lstPriceFrom.removeChild(nodes[i]);}}
if(lstPriceTo)
{var nodes=[];for(var i=0;i<lstPriceTo.childNodes.length;i++){nodes[i]=lstPriceTo.childNodes[i];}
for(var i=0;i<nodes.length;i++){lstPriceTo.removeChild(nodes[i]);}}
if(lstPriceFrom){var opts=(EmUtil.equalsIgnoreCase(type,'sale')?lstPriceFrom._saleOpts:lstPriceFrom._rentOpts);var noMin1=document.createElement('option');noMin1.value='0';noMin1.innerHTML='No Min';lstPriceFrom.appendChild(noMin1);for(var i=0;i<opts.length;i++){o=document.createElement('option');o.value=opts[i];o.innerHTML='&pound;'+EmUtil.formatNumber(opts[i])+(type=='rent'?' / week':'');lstPriceFrom.appendChild(o);}
var noMax1=document.createElement('option');noMax1.value='0';noMax1.innerHTML='No Min';lstPriceFrom.appendChild(noMax1);}
if(lstPriceTo){opts=(EmUtil.equalsIgnoreCase(type,'sale')?lstPriceTo._saleOpts:lstPriceTo._rentOpts);var noMin2=document.createElement('option');noMin2.value='0';noMin2.innerHTML='No Max';lstPriceTo.appendChild(noMin2);for(var i=0;i<opts.length;i++){o=document.createElement('option');o.value=opts[i];o.innerHTML='&pound;'+EmUtil.formatNumber(opts[i])+(type=='rent'?' / week':'');lstPriceTo.appendChild(o);}
var noMax2=document.createElement('option');noMax2.value='0';noMax2.innerHTML='No Max';lstPriceTo.appendChild(noMax2);}}
this.buildHash=function(page){if(typeof(page)!='number')
page=0;var search=EmUtil.getFieldValue('txtSearch','');var lowerPrice=EmUtil.getFieldValue('lstPriceFrom',0);var upperPrice=EmUtil.getFieldValue('lstPriceTo',0);var unit1=EmUtil.getFieldValue('lstUnit1',0);var unit2=EmUtil.getFieldValue('lstUnit2',0);var unit3=EmUtil.getFieldValue('lstUnit3',0);var radius=EmUtil.getFieldValue('lstRadius',0);var age=EmUtil.getFieldValue('fldAge',0);if(search==EmUtil.getControlById('txtSearch')._def)
search='';var hash='';hash+=EmUtil.padLeft(Number(page).toString(36),"0",3);hash+=EmUtil.padLeft(Number(0).toString(36),"0",1);if(this.getSearchType()=='sale'){hash+=EmUtil.padLeft(Number((lowerPrice/1000)).toString(36),"0",3);hash+=EmUtil.padLeft(Number((upperPrice/1000)).toString(36),"0",3);}
else{hash+=EmUtil.padLeft(Number(lowerPrice).toString(36),"0",3);hash+=EmUtil.padLeft(Number(upperPrice).toString(36),"0",3);}
hash+=EmUtil.padLeft(Number(unit1).toString(36),"0",2);hash+=EmUtil.padLeft(Number(unit2).toString(36),"0",2);hash+=EmUtil.padLeft(Number(unit3).toString(36),"0",2);hash+=EmUtil.padLeft(Number(radius).toString(36),"0",2);hash+=EmUtil.padLeft(Number(age).toString(36),"0",2);var x='';var a='';var s='';var advanced=EmUtil.getControlById('frmSearchAdvanced');var totalStyles=0;var checkedStyles=0;if(advanced){var inputs=advanced.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(EmUtil.equalsIgnoreCase(inputs[i].name,'status')){if(inputs[i].checked&&!inputs[i].disabled)
x+=EmUtil.padLeft(Number(inputs[i].value).toString(36),"0",2);}
else if(EmUtil.equalsIgnoreCase(inputs[i].name,'attribute')){if(inputs[i].checked&&!inputs[i].disabled)
a+=EmUtil.padLeft(Number(inputs[i].value).toString(36),"0",2);}
else if(EmUtil.equalsIgnoreCase(inputs[i].name,'style')){totalStyles++;if(inputs[i].checked&&!inputs[i].disabled){checkedStyles++;s+=EmUtil.padLeft(Number(inputs[i].value).toString(36),"0",2);}}}}
if(totalStyles==checkedStyles)
s='';if(x.length>0)
hash+='X'+x+'X';if(a.length>0)
hash+='A'+a+'A';if(s.length>0)
hash+='S'+s+'S';hash+=EmUtil.base36Encode(search);return hash;}
this.handleSaveSearchForm=function(form){return EmAjax.loadElement(form,'saveSearchForm',function(response){if(response.getHeader('x-estatemate-closepopup')=='true'){EmPopup.close();EmSearch.refreshSaveStatus();EmAjax.loadElement(EmUtil.resolveUrl('~/property/'+(EmSearch.getPropertyType()?EmSearch.getPropertyType()+'/':'')+EmSearch.getSearchType()),'myBar_savedSearches');}});}
this.saveSearch=function(pt,st,hash){if(!EmLogin.loggedIn){var evt=EmUtil.createClosure(this,function(pt,st,hash){EmLogin.removeEvent('login',evt);this.saveSearch(pt,st,hash);},pt,st,hash);EmLogin.attachEvent('login',evt);EmLogin.showLogin();}
else{return EmAjax.sendRequest(EmUtil.resolveUrl('~/property/'+(pt?pt+'/':'')+st+'?q='+hash+'&act=save&__e=saveSearch'),function(){EmSearch.refreshSaveStatus();});}}
this.deleteSearch=function(pt,st,hash){if(!confirm("Are you sure you want to delete this search?"))
return false;return EmAjax.sendRequest(EmUtil.resolveUrl('~/property/'+(pt?pt+'/':'')+st+'?q='+hash+'&act=delete&__e=saveSearch'),function(){EmSearch.refreshSaveStatus();});}
this.refreshSaveStatus=function(){if(EmUtil.getElementById('_emElement_saveSearch'))
EmAjax.loadElement(EmUtil.resolveUrl('~/property/'+(EmSearch.getPropertyType()?EmSearch.getPropertyType()+'/':'')+EmSearch.getSearchType()+'?q='+EmSearch.buildHash()),'saveSearch',null,null,true);if(EmUtil.getElementById('_emElement_savedSearches'))
EmAjax.loadElement(window.location.pathname,'savedSearches',null,null,true);}}
var EmPopup=new function(){this.layer;this.inner;this.initiate=function(){this.layer=document.createElement('div');this.inner=document.createElement('div');document.body.appendChild(this.layer);document.body.appendChild(this.inner);var closeDiv=document.createElement('div');closeDiv.className='close';var close=document.createElement('a');close.innerHTML='X';close.href='';close.onclick=EmPopup.close;closeDiv.appendChild(close);this.inner.appendChild(closeDiv);var b=document.createElement('div');b.className='border';this.inner.appendChild(b);this.content=document.createElement('div');this.content.className='content';this.content.style.display='none';b.appendChild(this.content);this.loading=document.createElement('div');this.loading.innerHTML='<img src="'+EmUtil.resolveUrl('/_resources/images/loader.gif')+'" />';this.loading.style.padding='50px';this.loading.style.display='block';b.appendChild(this.loading);this.layer.className='xEmPopupLayer';this.layer.style.position='absolute';this.layer.style.zIndex='9991';this.layer.style.display='none';this.inner.className='xEmPopupInner';this.inner.style.position='absolute';this.inner.style.zIndex='9992';this.inner.style.display='none';this.reposition();this.inner.style.display='none';this.inner.style.top='200px';EmUtil.attachEvent(window,'resize',EmUtil.createClosure(this,this.reposition));}
this.reposition=function(){var height=0,d=document,w=window;if((!d.compatMode||d.compatMode=='CSS1Compat')&&!w.opera&&d.documentElement&&d.documentElement.clientHeight)
{height=d.documentElement.clientHeight;}
else if(d.body&&d.body.clientHeight)
{height=d.body.clientHeight;}
else if(xDef(w.innerWidth,w.innerHeight,d.width)){height=w.innerHeight;if(d.width>w.innerWidth)height-=16;}
this.layer.style.top='0px';this.layer.style.left='0px';this.layer.style.width=EmUtil.getDocumentWidth()+'px';this.layer.style.height=EmUtil.getDocumentHeight()+'px';this.inner.style.left=((EmUtil.getDocumentWidth()/2)-(EmUtil.getElementWidth(this.inner)/2))+'px';this.inner.style.top=((height/2)-(EmUtil.getElementHeight(this.inner)/2))+'px';window.scrollTo(0,0);}
this.open=function(url,element,width){this.inner.style.display='block';this.layer.style.display='block';this.loading.style.display='block';this.content.style.display='none';if(width)
this.inner.style.width=Math.floor(width)+'px';else
this.inner.style.width='';var selects=document.body.getElementsByTagName('SELECT');for(var i=0;i<selects.length;i++){selects[i].style.visibility='hidden';}
return EmAjax.loadElement(url,element,this.content,function(){EmPopup.loading.style.display='none';EmPopup.content.style.display='block';EmPopup.reposition();});}
this.close=function(){var selects=document.body.getElementsByTagName('SELECT');for(var i=0;i<selects.length;i++){selects[i].style.visibility='';}
EmPopup.inner.style.display='none';EmPopup.layer.style.display='none';EmPopup.content.innerHTML='';EmPopup.loading.style.display='block';EmPopup.content.style.display='none';return false;}}
var EmProperty=new function(){this.save=function(lpr){if(!EmLogin.loggedIn){var evt=function(){EmAjax.loadElement(EmUtil.resolveUrl('~/'+lpr+'?act=save'),'propertySaveButton',function(response){EmAjax.loadElement(EmUtil.resolveUrl('~/'+lpr),'savedProperties');});EmLogin.removeEvent('login',evt);}
EmLogin.attachEvent('login',evt);EmLogin.showLogin();}
else{EmAjax.loadElement(EmUtil.resolveUrl('~/'+lpr+'?act=save'),'propertySaveButton',function(response){EmAjax.loadElement(EmUtil.resolveUrl('~/'+lpr),'savedProperties');});}}
this.remove=function(lpr){if(!confirm("Are you sure you want to delete this property from your favourites?"))
return false;return EmAjax.sendRequest(EmUtil.resolveUrl('~/'+lpr+'?act=delete&__e=none'),function(){EmAjax.loadElement(window.location.pathname,'savedProperties');EmAjax.loadElement(EmUtil.resolveUrl('~/'+lpr),'propertySaveButton');});}
this.open=function(lpr,tab){return true;}
this.showVideo=function(){var e=EmUtil.getControlById('propertyVideo');window.scrollTo(0,EmUtil.getElementTop(e)-10);}}
var EmLogin=new function(){this.onloginEvents=[];this.onlogoutEvents=[];this.showLogin=function(){EmLogin.loggedIn=false;return EmPopup.open(EmUtil.resolveUrl('~/login'),'loginOuter');}
this.showSignup=function(){EmLogin.loggedIn=false;return EmPopup.open(EmUtil.resolveUrl('~/join'),'loginOuter');}
this.logout=function(){EmLogin.loggedIn=false;return EmAjax.loadElement(EmUtil.resolveUrl("~/login"),'loginBar',function(){EmLogin.onLogout();});}
this.handleForm=function(form){return EmAjax.loadElement(form,'login',function(response){if(response.getHeader('x-estatemate-closepopup')=='true'){EmAjax.loadElement(window.location.pathname,'loginBar');EmPopup.close();EmLogin.loggedIn=true;EmLogin.onLogin();}});}
this.attachEvent=function(e,f){var eventArr=eval('this.on'+e+'Events');if(eventArr){eventArr[eventArr.length]=f;}}
this.removeEvent=function(e,f){var eventArr=eval('this.on'+e+'Events');if(eventArr){for(i=0;i<eventArr.length;i++){if(eventArr[i]==f){eventArr[i]=null;}}}}
this.onLogin=function(){if(this.onloginEvents){for(var i=0;i<this.onloginEvents.length;i++){var fun=this.onloginEvents[i];if(fun&&typeof(fun)=='function'&&fun())
return true;}}}
this.onLogout=function(){if(this.onlogoutEvents){for(var i=0;i<this.onlogoutEvents.length;i++){var fun=this.onlogoutEvents[i];if(fun&&typeof(fun)=='function'&&fun())
return true;}}}}
var firstHash=true;EmAjax.HistorySupport.onhash=function(section,argument){if(section=='search'||(!section&&!firstHash)){EmSearch.setSearch(argument);}
else if(section=='property'){EmMap.removeMap();EmAjax.loadElement(EmUtil.resolveUrl('~/'+argument),'pageContent');}
else if(section=='video'){EmMap.removeMap();EmAjax.loadElement(EmUtil.resolveUrl('~/'+argument),'pageContent',function(){EmUtil.switchPane('videos');});}
firstHash=false;};