var agt = navigator.userAgent.toLowerCase(); var is_major = parseInt(navigator.appVersion); var is_nav = ((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera') == -1) && (agt.indexOf('webtv') == -1)); var is_nav4up = (is_nav && (is_major >= 4)); var is_ie = (agt.indexOf("msie") != -1); var is_ie3 = (is_ie && (is_major < 4)); var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5") == -1) && (agt.indexOf("msie 6") == -1) && (agt.indexOf("msie 7") == -1)); var is_ie4up = (is_ie && (is_major >= 4)); var is_ie5up = (is_ie && !is_ie3 && !is_ie4); var is_mac = (agt.indexOf("mac") != -1); var is_gecko = (agt.indexOf("gecko") != -1); function getObject(id) { if (is_ie4) var el = eval(id); if (is_ie5up || is_gecko) var el = document.getElementById(id); return el; } function getWindow(t, s) { if(t == "top") { if(s > screen.availHeight) return 0; return (screen.availHeight-s)/2 } else { if(s > screen.availWidth) return 0; return (screen.availWidth-s)/2 } } function popWindow(loc, title, w, h, r) { t = getWindow("top", h); l = getWindow("left", w); if(w == 'full' || w > screen.availWidth) w = screen.availWidth; if(h == 'full' || h > screen.availHeight) h = screen.availHeight; win = window.open(loc, title, 'top='+t+',left='+l+',width='+w+',height='+h+',status=no,resizable='+r+',scrollbars='+(h > screen.availHeight || w > screen.availWidth ? "yes" : r)+',toolbar=no,location=no,directories=no,menubar=no'); win.focus(); } function round(num) { num = num.toString(); if(num.indexOf(".") == -1) return num; var split = num.split("."); var dec = split[1].substr(0,3); var dec1 = dec.match(/\d{2,2}/); var dec2 = dec.match(/(\d$)/); var rounded = (dec1 + "." + dec2[0]); return split[0] + "." + Math.round(rounded); } function URLEncode(plaintext) { // The Javascript escape and unescape functions do not correspond // with what browsers actually do... var SAFECHARS = "0123456789" + // Numeric "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic "abcdefghijklmnopqrstuvwxyz" + "-_.!~*'()"; // RFC2396 Mark characters var HEX = "0123456789ABCDEF"; var encoded = ""; for (var i = 0; i < plaintext.length; i++ ) { var ch = plaintext.charAt(i); if (ch == " ") { encoded += "+"; // x-www-urlencoded, rather than %20 } else if (SAFECHARS.indexOf(ch) != -1) { encoded += ch; } else { var charCode = ch.charCodeAt(0); if (charCode > 255) { alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" + "(URL encoding only supports 8-bit characters.)\n" + "A space (+) will be substituted." ); encoded += "+"; } else { encoded += "%"; encoded += HEX.charAt((charCode >> 4) & 0xF); encoded += HEX.charAt(charCode & 0xF); } } } // for return encoded; } function URLDecode(encoded) { // Replace + with ' ' // Replace %xx with equivalent character // Put [ERROR] in output if %xx is invalid. var HEXCHARS = "0123456789ABCDEFabcdef"; var plaintext = ""; var i = 0; while (i < encoded.length) { var ch = encoded.charAt(i); if (ch == "+") { plaintext += " "; i++; } else if (ch == "%") { if (i < (encoded.length-2) && HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 && HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) { plaintext += unescape( encoded.substr(i,3) ); i += 3; } else { alert( 'Bad escape combination near ...' + encoded.substr(i) ); plaintext += "%[ERROR]"; i++; } } else { plaintext += ch; i++; } } // while return plaintext; } function getRequestURI(path) { url = path.split("/"); url = url[url.length-1]; return url; } function changeDisplay(obj, display) { getObject(obj).style.display = display; } function delay(gap) { /* gap is in millisecs */ var then,now; then=new Date().getTime(); now=then; while((now-then)= t-1) p = 0; else p++; url = SITE_IMAGE_URL+'/image.php?file=images/listing_photos/'+id+'-'+p+'.jpg&ms=300&no_cache=1'; document.propertyPhoto.src = url; } function preloadSlideShow(id, n) { var array = new Array; for(i=0; i 0) { packages_array = packages.split("|"); for(i=0; i-1; i--) tt_list.options[i] = null; tt_list.options[0] = new Option(" Loading... ", ""); tt_list.disabled = 'disabled'; if(document.all) { objXmlTT = new ActiveXObject("Microsoft.XMLHTTP"); objXmlTT.open("GET", datafile, true); objXmlTT.onreadystatechange=function() { if (objXmlTT.readyState==4) { tt = objXmlTT.responseText; populateTransactionTypeAction(tt, tt_list); } } objXmlTT.send(null); } else { if(document.getElementById) { objXmlTT = new XMLHttpRequest(); objXmlTT.open("GET", datafile, false); objXmlTT.send(null); tt = objXmlTT.responseText; populateTransactionTypeAction(tt, tt_list); } } } function populateTransactionTypeAction(tt, tt_list) { tt_list.disabled = false; // repopulate if(tt == 'sale') tt_list.options[0] = new Option("For Sale","sale"); else if(tt == 'rent') tt_list.options[0] = new Option("For Rent","rent"); else { tt_list.options[0] = new Option("--Select Transaction Type--",""); tt_list.options[1] = new Option("For Sale","sale"); tt_list.options[2] = new Option("For Rent","rent"); } } function populatePropertyType(p, property_type) { var p = p.value; var property_type_list = getObject(property_type); var datafile = "/populate/package_item.php?package="+p+"&item=zoning"; //Clear the county box out for(i=property_type_list.options.length-1; i>-1; i--) property_type_list.options[i] = null; property_type_list.options[0] = new Option(" Loading... ", ""); property_type_list.disabled = 'disabled'; if(document.all) { objXmlPT = new ActiveXObject("Microsoft.XMLHTTP"); objXmlPT.open("GET", datafile, true); objXmlPT.onreadystatechange=function() { if (objXmlPT.readyState==4) { property_type = objXmlPT.responseText; populatePropertyTypeAction(property_type, property_type_list); } } objXmlPT.send(null); } else { if(document.getElementById) { objXmlPT = new XMLHttpRequest(); objXmlPT.open("GET", datafile, false); objXmlPT.send(null); property_type = objXml.responseText; populatePropertyTypeAction(property_type, property_type_list); } } } function populatePropertyTypeAction(property_type, property_type_list) { property_type_list.disabled = false; // repopulate if(property_type == 'res') property_type_list.options[0] = new Option("Residental","res"); else if(property_type == 'rent') property_type_list.options[0] = new Option("Commercial","com"); else { property_type_list.options[0] = new Option("--Select Property Type--",""); property_type_list.options[1] = new Option("Residential","res"); property_type_list.options[2] = new Option("Commercial","com"); } } function populatePropertyCategory() { var t = getObject('transaction_type'); var p = getObject('property_type'); var t_type = t.value; var p_type = p.value; var mls_category = getObject('mls_category'); if(mls_category) { // clear out the mls_category select box for(j=mls_category.options.length-1; j>-1; j--) mls_category.options[j] = null; if((t_type == 'sale' || t_type == 'rent') && (p_type == 'res' || p_type == 'com')) { mls_category.options[0] = new Option("Please Choose", ""); j=1; for(var formid in form_types) { if((form_types[formid]['type'] == 'both' || form_types[formid]['type'] == t_type) && (form_types[formid]['zoning'] == 'both' || form_types[formid]['zoning'] == p_type)) { mls_category.options[j] = new Option(form_types[formid]['name'], formid); j++; } } } else if(t_type == 'sale' || t_type == 'rent') mls_category.options[0] = new Option("Choose Property Type First", ""); else mls_category.options[0] = new Option("Choose Transaction Type First", ""); } } function populatePropertyTypeList() { var type_sale = getObject("type_sale"); var type_rent = getObject("type_rent"); var type_both = getObject("type_both"); var zoning_res = getObject("zoning_res"); var zoning_com = getObject("zoning_com"); var zoning_both = getObject("zoning_both"); var property_types = getObject("property_types"); var type_checked; var zoning_checked; // populate the type that's checked if(type_sale.checked) type_checked = "sale"; else if(type_rent.checked) type_checked = "rent"; else if(type_both.checked) type_checked = "both"; // populate the zoning that's checked if(zoning_com.checked) zoning_checked = "com"; else if(zoning_res.checked) zoning_checked = "res"; else if(zoning_both.checked) zoning_checked = "both"; // clear out the current option list for(j=property_types.options.length-1; j>-1; j--) property_types.options[j] = null; j=0; // filter out the list based on the type and zoning checked // if one is not checked, don't filter on that value // if both is checked or form is 'both', include it for(i in property_form_types) { if((!type_checked || type_checked == 'both' || property_form_types[i]['type'] == 'both' || property_form_types[i]['type'] == type_checked) && (!zoning_checked || zoning_checked == 'both' || property_form_types[i]['zoning'] == 'both' || property_form_types[i]['zoning'] == zoning_checked)) { // add the new option to the list property_types.options[j] = new Option(property_form_types[i]['name'], i); // update the 'selected' property with the value from the stored variable property_types.options[j].selected = property_form_types[i]['selected']; j++; } } } function addPropertyType(formid) { var form = getObject('property_types_'+formid); var list = getObject('available_property_types'); var error = ""; for(var k=0; k-1; i--) box.options[i] = null; box.options[0] = new Option(" Loading... ", ""); box.disabled = 'disabled'; if(document.all) { objXml = new ActiveXObject("Microsoft.XMLHTTP"); objXml.open("GET", datafile, true); objXml.onreadystatechange=function() { if (objXml.readyState==4) { states = objXml.responseText; populateSelectAction(box, state, states, forceCounty, showCounties); } } objXml.send(null); } else { if (document.getElementById) { objXml = new XMLHttpRequest(); objXml.open("GET",datafile,false); objXml.send(null); states = objXml.responseText; populateSelectAction(box, state, states, forceCounty, showCounties); } } } function populateSelectAction(box, state, states, forceCounty, showCounties) { box.disabled = false; // repopulate if(forceCounty == "yes" || state == '') o = "--Select County--"; else o = "--Entire State--"; box.options[0] = new Option(o,""); if(states != "none") { state_array = states.split("|"); if(showCounties == "yes") for(i=0; i-1; i--) cBox.options[i] = null; // repopulate if(state == '') { o = "--Select County--"; cBox.style.display = 'none'; cityBox.style.display = 'none'; } else { o = "--Entire State--"; cBox.style.display = 'block'; cityBox.style.display = 'none'; cBox.options[0] = new Option(o,""); var i = 1; for(var a in ls[state]) { cBox.options[i] = new Option(a+" County",a); i++; } if(i < 3) cBox.style.display = 'none'; } } function populateSearchCity() { var sBox = document.getElementById('state'); var state = sBox.options[sBox.selectedIndex].value; var cBox = document.getElementById('county'); var county = cBox.options[cBox.selectedIndex].value; var cityBox = document.getElementById('city'); //Clear the city box out for(i=cBox.options.length-1; i>-1; i--) cityBox.options[i] = null; // repopulate o = "--Entire "+(st[state] == 'nocounty' ? "State" : "County" )+"--"; cityBox.style.display = 'block'; cityBox.options[0] = new Option(o,""); var i = 1; var variable = st[state] == 'nocounty' ? lc[state] : ls[state][county]; for(var a in variable) { cityBox.options[i] = new Option(a,a); i++; } if(i < 3) cityBox.style.display = 'none'; }