function createRequest(){try{request=new XMLHttpRequest()}catch(trymicrosoft){var a=['Msxml2.XMLHTTP.7.0','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP'];
for(var i=0;
i<a.length;
i++){try{request=new ActiveXObject(a[i])}catch(failed){request=null}}}if(request==null){alert('Error creating request object!')}else{return request}}function list(b,a,c,d){if(arguments.length>4){var e=arguments[4]}else{var e=b.available}var f=createRequest();
var g="http://www.rls2000.com"+"/"+"art/search/search_townlist.asp";
if(f!=null){f.open('post',g,true);
f.onreadystatechange=function(){if(f.readyState==4){if(f.status==200){var a=json_parse(f.responseText);
switch(c){case"townall":displayTown(a,e);
break;
default:displayState(a,b.state)}}}} 
f.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
var l="";
l+="agentid="+escape(a);
l+="&listof="+escape(c);
l+="&filter="+escape(d);
l+="&state="+escape(b.strstate[b.strstate.selectedIndex].value);
if(b.searchtype.value.length>0){l+="&searchtype="+escape(b.searchtype.value)}f.send(l)}}function focusField(f,d){if(f.value==d){f.value="";
f.style.color="#000"}}function blurField(f,d){if(f.value.length<1){f.style.color="#666";
f.style.textAlign="right";
f.value=d}}function saveMeBox(){var a=document.boxSearch;
if(a.available.value==""&&a.txtnumber.value==""){alert("You must choose a town");
return(false)}else{a.txtTown.value=a.available.value;
switch(a.proptype.value){case'SF':a.SF.value=a.proptype.value;
break;
case'CC':a.CC.value=a.proptype.value;
break;
case'MF':a.MF.value=a.proptype.value;
break;
case'LD':a.LD.value=a.proptype.value;
break;
case'CI':a.CI.value=a.proptype.value;
break;
case'MM':a.MM.value=a.proptype.value;
break;
case'RN':a.RN.value=a.proptype.value;
break;
case'BU':a.BU.value=a.proptype.value;
break;
default:}return(true)}}function selectTown(a,b){addValue(b,a,false)}function changeInState(b,a){list(b,a,'townall',b.strstate[b.strstate.selectedIndex].value)}function displayState(a,b){var s;
for(var i=0;
i<a.list[0].statelist.length;
i++){popValue(a.list[0].statelist[i].abbr,a.list[0].statelist[i].state,a.list[0].statelist[i].selected,b);
if(a.list[0].statelist[i].selected.length>0){s=a.list[0].statelist[i].abbr}}}function displayTown(l,b){for(var q=b.options.length;
q>=0;
q--){b.options[q]=null}popValue('','Choose a city','',b);
if(navigator.appName!='Microsoft Internet Explorer'){var c='--'}else{var c='   '}for(var i=0;
i<l.list[0].town.length;
i++){popValue(l.list[0].town[i].value,l.list[0].town[i].name,'',b);
if(l.list[0].town[i].sub.length>0){for(var a=0;
a<l.list[0].town[i].sub.length;
a++){popValue(l.list[0].town[i].sub[a].value,c+l.list[0].town[i].sub[a].area,'',b)}}}}function removeMe(a){var b=a.length;
arrSelected=new Array();
var c=0;
for(i=0;
i<b;
i++){if(a.options[i].selected){arrSelected[c]=a.options[i].value}c++}var x;
for(i=0;
i<b;
i++){for(x=0;
x<arrSelected.length;
x++){if(a.options[i].value==arrSelected[x]){a.options[i]=null}}b=a.length}}function moveOver(a){var b=a.available;
var c=b.selectedIndex;
if(c>0){var d=trim(b.options[c].text);
var e=b.options[c].value;
addValue(a.txttown,e,false);
b.selectedIndex=-1}}function selectAllOptions(a,b){if(!hasOptions(a)){if(b.txtnumber.value.length>0){return true}else{alert("Please choose at least one town or neighborhood");
return false}}else{for(var i=0;
i<a.options.length;
i++){a.options[i].selected=true}return true}}function SingleSelect(a,b){re=new RegExp(a);
for(i=0;
i<document.forms[0].elements.length;
i++){elm=document.forms[0].elements[i];
if(elm.type=='checkbox'){if(re.test(elm.name)){elm.checked=false}}}b.checked=true}function hasOptions(a){return(a.length>0)?true:false}function IsVisable(a){if(document.layers){if(document.layers[a].display=='none'){return false}else{return true}}else if(document.all){if(document.all[a].style.display=='none'){return false}else{return true}}else if(document.getElementById){if(document.getElementById(a).style.display=='none'){return false}else{return true}}}function toggle(a){if(document.layers){var b=(document.layers[a].display=='none')?'block':'none';
document.layers[a].display=b}else if(document.all){var b=(document.all[a].style.display=='none')?'block':'none';
document.all[a].style.display=b}else if(document.getElementById){var b=(document.getElementById(a).style.display=='none')?'block':'none';
document.getElementById(a).style.display=b}}function addValue(a,b,c){var d;
var e;
var f=true;
var g=a.length;
for(var i=0;
i<g;
i++){d=a.options[i].text;
if(d==b){f=false;
i=g}}if(f){var e=new Option(b,b,false,false);
a.options[g]=e}else{if(f&&c){alert('You are limited to 5 Towns.\nPlease contact your realtor to add more towns.')}}}function trim(a){if(typeof a!="string"){return a}var b=a;
var c=b.substring(0,1);
while(c==" "){b=b.substring(1,b.length);
c=b.substring(0,1)}c=b.substring(b.length-1,b.length);
while(c==" "){b=b.substring(0,b.length-1);
c=b.substring(b.length-1,b.length)}while(b.indexOf("  ")!=-1){b=b.substring(0,b.indexOf("  "))+b.substring(b.indexOf("  ")+1,b.length)}return b}function BuildCell(a,b){var c;
c=document.createElement("TD");
c.className="tableText";
c.innerHTML=a;
if(b>1){c.colSpan=b}return c}function popValue(v,t,s,l){var e=document.createElement('option');
var a=new Array("Brighton's","Charlestown's","Dorchester's","East Boston's","Hyde Park's","Jamaica Plain's","Roxbury's","South Boston's","West Roxbury's");
if(navigator.appName!='Microsoft Internet Explorer'){var b='--'}else{var b='   '}for(var i=0;
i<a.length;
i++){if(t.indexOf(a[i])!=-1){t=t.replace(a[i],b)}}e.value=v;
e.text=t;
(navigator.appName!='Microsoft Internet Explorer')?l.add(e,null):l.add(e);
if(s.length>0){e.setAttribute('selected','selected')}}json_parse=(function(){var f,ch,escapee={'"':'"','\\':'\\','/':'/',b:'\b',f:'\f',n:'\n',r:'\r',t:'\t'},text,error=function(m){throw{name:'SyntaxError',message:m,at:f,text:text}},next=function(c){if(c&&c!==ch){error("Expected '"+c+"' instead of '"+ch+"'")}ch=text.charAt(f);
f+=1;
return ch},number=function(){var a,string='';
if(ch==='-'){string='-';
next('-')}while(ch>='0'&&ch<='9'){string+=ch;
next()}if(ch==='.'){string+='.';
while(next()&&ch>='0'&&ch<='9'){string+=ch}}if(ch==='e'||ch==='E'){string+=ch;
next();
if(ch==='-'||ch==='+'){string+=ch;
next()}while(ch>='0'&&ch<='9'){string+=ch;
next()}}a=+string;
if(isNaN(a)){error("Bad number")}else{return a}},string=function(){var a,i,string='',uffff;
if(ch==='"'){while(next()){if(ch==='"'){next();
return string}else if(ch==='\\'){next();
if(ch==='u'){uffff=0;
for(i=0;
i<4;
i+=1){a=parseInt(next(),16);
if(!isFinite(a)){break}uffff=uffff*16+a}string+=String.fromCharCode(uffff)}else if(typeof escapee[ch]==='string'){string+=escapee[ch]}else{break}}else{string+=ch}}}error("Bad string")},white=function(){while(ch&&ch<=' '){next()}},word=function(){switch(ch){case't':next('t');
next('r');
next('u');
next('e');
return true;
case'f':next('f');
next('a');
next('l');
next('s');
next('e');
return false;
case'n':next('n');
next('u');
next('l');
next('l');
return null}error("Unexpected '"+ch+"'")},value,array=function(){var a=[];
if(ch==='['){next('[');
white();
if(ch===']'){next(']');
return a}while(ch){a.push(value());
white();
if(ch===']'){next(']');
return a}next(',');
white()}}error("Bad array")},object=function(){var a,object={};
if(ch==='{'){next('{');
white();
if(ch==='}'){next('}');
return object}while(ch){a=string();
white();
next(':');
if(Object.hasOwnProperty.call(object,a)){error('Duplicate key "'+a+'"')}object[a]=value();
white();
if(ch==='}'){next('}');
return object}next(',');
white()}}error("Bad object")};
value=function(){white();
switch(ch){case'{':return object();
case'[':return array();
case'"':return string();
case'-':return number();
default:return ch>='0'&&ch<='9'?number():word()}};
return function(c,d){var e;
text=c;
f=0;
ch=' ';
e=value();
white();
if(ch){error("Syntax error")}return typeof d==='function'?(function walk(a,b){var k,v,value=a[b];
if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);
if(v!==undefined){value[k]=v}else{delete value[k]}}}}return d.call(a,b,value)}({'':e},'')):e}}());

