//Added for live chat-By Yogi
try{
	var lpMTagConfig = {'lpServer' : "server.iad.liveperson.net",'lpNumber' : "58857452",'lpProtocol' : (document.location.toString().indexOf('https:')==0) ? 'https' : 'http'}; 
	function lpAddMonitorTag(src){
		if(typeof(src)=='undefined'||typeof(src)=='object'){
			src=lpMTagConfig.lpMTagSrc?lpMTagConfig.lpMTagSrc:'/hcp/html/mTag.js';
		}
		if(src.indexOf('http')!=0){
			src=lpMTagConfig.lpProtocol+"://"+lpMTagConfig.lpServer+src+'?site='+lpMTagConfig.lpNumber;
		}else{
			if(src.indexOf('site=')<0){
				if(src.indexOf('?')<0)
					src=src+'?';
				else 
					src=src+'&';
				src=src+'site='+lpMTagConfig.lpNumber;
			}
		};
		var s=document.createElement('script');
		s.setAttribute('type','text/javascript');
		s.setAttribute('charset','iso-8859-1');
		s.setAttribute('src',src);
		document.getElementsByTagName('head').item(0).appendChild(s);
	}
	if (window.attachEvent) 
		window.attachEvent('onload',lpAddMonitorTag); 
	else 
		window.addEventListener("load",lpAddMonitorTag,false);
}catch(e){}

//Adding for redirection to gohoming.com -- Vikash
this.location.href="http://www.gohoming.com";
var baseSubDomain="www";var baseURL="https://www.auction.gohoming.com/GoHomingWeb/";
var freeTextEntered="";var loadComplete=false;var compareCount=0;var autoRefresh=false;var saveSearchQuery="";var pageAutoPopup = false;var searchType = "Map";
try {var settings = {};} catch(e) { }
var baseDomain = "goinvestreo.com";var autoCompleteDefaultText = "Search by City or Zip";
var userDisplayStyle="text=font-family:arial;font-size:12px;font-weight:bold;color:%23333333;&login=font-family:arial;color:%23666666;font-weight:bold;font-size:12px;text-decoration:none;&logout=font-family:arial;color:%23666666;font-weight:bold;font-size:12px;text-decoration:none;&register=font-family:arial;color:%23167C5C;font-weight:bold;font-size:12px;text-decoration:none;&hover=color:%23020D48;";
function pageReadyLoad() {
  try { templatePageLoad(); } catch (e) { }
  setUserDisplay();
  try { if ($("#zipCityStateInput").val() == "") {$("#zipCityStateInput").val(autoCompleteDefaultText); initFreeTextSearch(); } } catch (e) { }
  try { if ($("#sortBy").length > 0) { setSearchResultsFields(); } } catch (e) { }
  try { if ($("#compareListings").length > 0) { loadCompareFromCookie(); } } catch (e) { }
  try { if ($("#mortageCalInPage").length > 0) { mortageCalInPage(); } } catch (e) { }
  try { if ($(".refinementBox").length > 0) { refinementsAddMoreLink(); } } catch (e) { }
  try { if ($("#thumbs").length > 0) {showFirstPhoto(); } } catch (e) { }
  try { if ($("#searchResultsPageMap").length > 0) {searchResultsMap(); } } catch (e) { }
  try { if ($("#loginPage").length > 0) { loginPage(); } } catch (e) { }
  try { if ($("#registerPage").length > 0) { registerPage(); } } catch (e) { }
  try { if ($("#embedPage").length > 0) { embedPage(); } } catch (e) { }
  try { if ($("#resultTotal").length > 0) { $("#resultTotal").html(resultsTotal+" Results Found, "+perPage+" per page"); } } catch (e) { }
  try { if ($("#detailsPageMap").length > 0) { propertyDetailsMapV2(); } } catch (e) { }
	try { if ($("#statePageMap").length > 0) {stateBrowsePathMap(); } } catch (e) { }
  try { if ($("#iframeMySeller").length > 0) { mySeller();iframeEmbedResize('MySeller');$(window).resize(function () {iframeEmbedResize('MySeller');}); } } catch (e) { }
  try { if ($("#iframeMyShopper").length > 0) { myAccount();iframeEmbedResize('MyShopper');$(window).resize(function () {iframeEmbedResize('MyShopper');}); } } catch (e) { }
  try { if ($("#iframeLogin").length > 0) { loginPage();iframeEmbedResize('Login');$(window).resize(function () {iframeEmbedResize('Login');}); } } catch (e) { }
  try { if ($("#iframeRegister").length > 0) { registerPage();iframeEmbedResize('Register');$(window).resize(function () {iframeEmbedResize('Register');}); } } catch (e) { }
  try { autoPopup(); } catch (e) { }
	loadComplete=true;
}
function featuredHomeScroll(direction) {
  if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 6)) {
  var topScroll = $("#scrollListingsHome").scrollLeft();
  if (direction == "LEFT") { $("#scrollListingsHome").animate({ scrollTop: topScroll - 110 }, 1000); }
  if (direction == "RIGHT") { $("#scrollListingsHome").animate({ scrollTop: topScroll + 110 }, 1000); }
  } else {
  var leftScroll = $("#scrollListingsHome").scrollLeft();
  if (direction == "LEFT") { $("#scrollListingsHome").animate({ scrollLeft: leftScroll - 333 }, 1000); }
  if (direction == "RIGHT") { $("#scrollListingsHome").animate({ scrollLeft: leftScroll + 333 }, 1000); }
  }
}
function customerCare() {showPageFrame();$("#iframePage").attr("src",baseURL+"ccHomePage.action?domain="+baseDomain+"&refUrl=http://"+baseSubDomain+"."+baseDomain);}
function requestNewsletter(sType) {trackEvent("Email Sign Up");showPageFrame();$("#iframePage").attr("src",baseURL+"registerUser.action?domain="+baseDomain+"&type="+sType);}
function findLocation() {$.get("/getgeolocation.htm",{x:""},geoLocation,"text");}
function contactSupport() {this.location.href='/contact-us.htm';}
function mySeller() {$("#iframeMySeller").attr("src", baseURL + "getSellerHome.action?domain="+baseDomain+"&refUrl="+escape(document.location.href));}
function myAccount() {$("#iframeMyShopper").attr("src",baseURL+"getShopperHome.action?domain="+baseDomain+"&refUrl="+escape(document.location.href));trackEvent("My GoHoming");}
function loginPage() {$("#iframeLogin").attr("src",baseURL+"getLoginForm.action?domain="+baseDomain+"&refUrl="+escape(document.location.href));}
function registerPage() {$("#iframeRegister").attr("src",baseURL+"registerUser.action?domain="+baseDomain+"&refUrl="+escape(document.location.href));}
function embedPage() {var sURL = document.location.href;sURL = sURL.substring(sURL.indexOf("?")+5);showPageFrame();$("#iframePage").attr("src", sURL);}
function setUserDisplay() {$("#loginFrame").attr("src", baseURL + "userFrame.action?domain="+baseDomain+"&registerTarget=http://"+baseSubDomain+"."+baseDomain+"/auctionRegister.htm&loginTarget=http://"+baseSubDomain+"."+baseDomain+"/auctionLogin.htm&"+userDisplayStyle);}
function basicSearch() {
  var sURL = ""; var propertyCount = "0"; var userInput = $("#zipCityStateInput").val().toUpperCase();
  if (userInput == autoCompleteDefaultText.toUpperCase()) {
    /* do nothing */
  } else if ($(".ac_results>li").length > 0) {
    var selectListItem = $(".ac_results>li").html().toUpperCase();
    selectListItem = selectListItem.replace("<SPAN CLASS=\"AC_MATCH\">","").replace("<SPAN CLASS=AC_MATCH>","").replace("</SPAN>","");
    if (selectListItem.indexOf(userInput) >= 0) {freeTextEntered = selectListItem.toUpperCase();}
  } else {
    if (!isNaN(userInput) || userInput.indexOf(",") > 0) {freeTextEntered = userInput.toUpperCase();}
  }
  if (freeTextEntered.indexOf(",") > 0) {
			if (freeTextEntered.indexOf(" (") > 0) {var tmpC = freeTextEntered.split(" (");freeTextEntered = tmpC[0];propertyCount=tmpC[1].replace(")","");}
      var baseURL = "";
      var tmp = freeTextEntered.split(",");
      if (tmp[0].toUpperCase().indexOf(" IN ") > 0) {
          var tmpCity = tmp[0].toUpperCase().split(" IN ");
          baseURL = "/" + tmp[1].trim() + "/" + tmpCity[1].trim().toProperCase() + "/" + tmp[0].substring(0,5);
      } else {
          baseURL = "/" + tmp[1].trim() + "/" + tmp[0].trim().toProperCase();
      }
      var minPrice = ($("#minPrice").length > 0)? $("#minPrice").val() : '';
      var maxPrice = ($("#maxPrice").length > 0)? $("#maxPrice").val() : '';
      sURL += baseURL + "/search-results.htm?statecode=" + tmp[1].trim();
      if (minPrice != "") { sURL += "&minPrice=" + minPrice; }
      if (maxPrice != "") { sURL += "&maxPrice=" + maxPrice; }
  } else {
      alert("Please enter a valid 'city, state' or 'zip'.\nYou can also make a selection from the suggestion dropdown.");
  }
	searchType = (sURL.indexOf("minPrice") > 0 || sURL.indexOf("maxPrice") > 0) ? "Price Search" : "Basic Search";
  if (sURL != "") {if (propertyCount == "0") {verifySearch(sURL);} else {document.location.href=sURL;}}
}
function setSearch(freeTextValue) {freeTextEntered=freeTextValue;}
function verifySearch(sURL) {trackEvent(searchType);if (sURL!="") {try {var SR=AJAX("get",sURL.replace("search-results.htm","verifysearch.htm"),"","text/html");if (SR=="0") {alert("There are no properties matching your search");} else {document.location.href=sURL;}} catch(e) {alert("Invalid Search, Try Again.");}} else {alert("Invalid Search");}}
function freeTextVal() {var txtVal="";var sURL=document.location.href.replace("http://","");if (sURL.indexOf("?")>0) {sURL=sURL.split("?");sURL=sURL[0].split("/");} else {sURL=sURL.split("/");}txtVal = sURL[1];if (sURL[2].indexOf(".htm") == -1) {txtVal=sURL[2]+", "+$.query.get("statecode");}txtVal=txtVal.toUpperCase();return txtVal;}
function mortageCalInPage() {$("#mortageCalInPage").attr("src",baseURL+"mortgageCalculator.action?domain="+baseDomain);}
function contactUsForm() {$("#contactusframe").attr("src",baseURL+"contactCustomerCare.action?domain="+baseDomain);}
function trackEvent(action, optional_label, optional_value) {
	if (pageAutoPopup == false) {
		var category = "Homepage";
		try {
			switch(window.location.href.replace("-", "_").match(/\w+\.htm|html/).toString()) {
				case "property.htm": category = "Property"; break;
				case "photo_results.htm": category = "Search Results"; break;
				case "search_results.htm": category = "Search Results"; break;
				case "map_results.htm": category = "Search Results"; break;
				case "home.htm": category = "Homepage"; break;
			}
		} catch(e) { }
		var label = (optional_label == null)? "null" : "'" + optional_label + "'";
		var value = (optional_value == null)? "null" : "'" + optional_value + "'";
		try {console.log("Calling pageTracker._trackEvent('" + category + "', '" + action + "', " + label + ", " + value +")");} catch(e) {}
		//pageTracker._trackEvent(category, action, optional_label, optional_value);
	}
}
function iframeEmbedResize(sFrame) {
  var maxHeight; var maxWidth;
  if (window.innerHeight == null) {
    maxHeight = document.documentElement.clientHeight; maxWidth = document.documentElement.clientWidth;
  } else {
    maxHeight = window.innerHeight; maxWidth = window.innerWidth;
  }
  maxWidth = maxWidth - 60; maxHeight = maxHeight - 330;
  $("#iframe"+sFrame).css("width", maxWidth + "px").css("height", maxHeight + "px");
  $(".details").css("width", maxWidth + "px").css("position", "relative").css("border", "1px solid #333").css("background", "").css("background-color", "white").css("padding-top", "6px");
}
function iframePageResize() {
  var maxHeight;var maxWidth;
  if (window.innerHeight == null) {
    maxHeight = document.documentElement.clientHeight; maxWidth = document.documentElement.clientWidth;
  } else {
    maxHeight = window.innerHeight; maxWidth = window.innerWidth;
  }
  pxLeft = 0; pxTop = -11;
  maxWidth = maxWidth - 50; maxHeight = maxHeight - 245;
  $("#iframePage").css("top", pxTop + "px").css("left", pxLeft + "px").css("width", maxWidth + "px").css("height", maxHeight + "px").css("display", "block");
  $(".details").css("width", maxWidth + "px").css("position", "relative").css("border", "1px solid #333").css("background", "").css("background-color", "white").css("padding-top", "6px");
}
function showPageFrame() { $("#mainContent").css("display", "none");iframePageResize();$(window).resize(function () {iframePageResize();}); }
function advancedSearch() {alert("Feature Not Available");}
/* $("#photoPreviewImg").attr("src", $("#thumbs>a>img:first").attr("src")); } */
function showFirstPhoto() {var hrefCall = $("#thumbs>a:first").attr("href");hrefCall=hrefCall.substring(22);hrefCall=hrefCall.substring(0,hrefCall.length-3);$("#photoPreviewImg").attr("src",hrefCall);}
function showPhoto(photoURL) {$("#photoPreviewImg").attr("src",photoURL);}
function slidePhoto(direction) {var leftScroll=$("#thumbs").scrollLeft();if (direction=="LEFT") {$("#thumbs").animate({scrollLeft:leftScroll-81},1000);trackEvent("Photos", "Slide Left");}if (direction=="RIGHT") {$("#thumbs").animate({scrollLeft:leftScroll+81},1000);trackEvent("Photos", "Slide Right");}}
function setCookie(c_name,value,expiredays) {var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":";expires="+exdate.toGMTString());}
function getCookie(c_name) {if (document.cookie.length>0) {c_start=document.cookie.indexOf(c_name+"=");if (c_start != -1) {c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if (c_end==-1) {c_end=document.cookie.length;}return unescape(document.cookie.substring(c_start,c_end));}}return "null";}
function siteLoad() {
  /*
  START: jQuery.query

  jQuery.query - Query String Modification and Creation for jQuery Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
  Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
  Date: 2009/8/13
  @author Blair Mitchelmore
  @version 2.1.6
  */
  try {
    var $separator = settings.separator || '&';
    var $spaces = settings.spaces === false ? false : true;
    var $suffix = settings.suffix === false ? '' : '[]';
    var $prefix = settings.prefix === false ? false : true;
    var $hash = $prefix ? settings.hash === true ? "#" : "?" : "";
    var $numbers = settings.numbers === false ? false : true;
    jQuery.query = new function() {
      var is = function(o, t) {return o != undefined && o !== null && (!!t ? o.constructor == t : true);};
      var parse = function(path) {var m, rx = /\[([^[]*)\]/g, match = /^([^[]+?)(\[.*\])?$/.exec(path), base = match[1], tokens = [];while (m = rx.exec(match[2])) tokens.push(m[1]);return [base, tokens];};
      var set = function(target, tokens, value) {
        var o, token = tokens.shift();
        if (typeof target != 'object') target = null;
        if (token === "") {
          if (!target) target = [];
          if (is(target, Array)) {
            target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value));
          } else if (is(target, Object)) {
            var i = 0;
            while (target[i++] != null);
            target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value);
          } else {
            target = [];
            target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value));
          }
        } else if (token && token.match(/^\s*[0-9]+\s*$/)) {
          var index = parseInt(token, 10);
          if (!target) target = [];
          target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value);
        } else if (token) {
          var index = token.replace(/^\s*|\s*$/g, "");
          if (!target) target = {};
          if (is(target, Array)) {
            var temp = {};
            for (var i = 0; i < target.length; ++i) {
              temp[i] = target[i];
            }
            target = temp;
          }
          target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value);
        } else {
          return value;
        }
        return target;
      };
      
      var queryObject = function(a) {
        var self = this;
        self.keys = {};
        
        if (a.queryObject) {
          jQuery.each(a.get(), function(key, val) {
            self.SET(key, val);
          });
        } else {
          jQuery.each(arguments, function() {
            var q = "" + this;
            q = q.replace(/^[?#]/,''); /* remove any leading ? || # */
            q = q.replace(/[;&]$/,''); /* remove any trailing & || ; */
            if ($spaces) q = q.replace(/[+]/g,' '); /* replace +'s with spaces */
            
            jQuery.each(q.split(/[&;]/), function(){
              var key = decodeURIComponent(this.split('=')[0] || "");
              var val = decodeURIComponent(this.split('=')[1] || "");
              
              if (!key) return;
              
              if ($numbers) {
                if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) /* simple float regex */
                  val = parseFloat(val);
                else if (/^[+-]?[0-9]+$/.test(val)) /* simple int regex */
                  val = parseInt(val, 10);
              }
              
              val = (!val && val !== 0) ? true : val;
              
              if (val !== false && val !== true && typeof val != 'number')
                val = val;
              
              self.SET(key, val);
            });
          });
        }
        return self;
      };
      queryObject.prototype = {
        queryObject: true,
        has: function(key, type) {var value = this.get(key);return is(value, type);},
        GET: function(key) {if (!is(key)) return this.keys;var parsed = parse(key), base = parsed[0], tokens = parsed[1];var target = this.keys[base];while (target != null && tokens.length != 0) {target = target[tokens.shift()];}return typeof target == 'number' ? target : target || "";},
        get: function(key) {var target = this.GET(key);if (is(target, Object))return jQuery.extend(true, {}, target);else if (is(target, Array))return target.slice(0);return target;},
        SET: function(key, val) {var value = !is(val) ? null : val;var parsed = parse(key), base = parsed[0], tokens = parsed[1];var target = this.keys[base];this.keys[base] = set(target, tokens.slice(0), value);return this;},
        set: function(key, val) {return this.copy().SET(key, val);},
        REMOVE: function(key) {return this.SET(key, null).COMPACT();},
        remove: function(key) {return this.copy().REMOVE(key);},
        EMPTY: function() {var self = this;jQuery.each(self.keys, function(key, value) {delete self.keys[key];});return self;},
        load: function(url) {var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1");var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1");return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash);},
        empty: function() {return this.copy().EMPTY();},
        copy: function() {return new queryObject(this);},
        COMPACT: function() {
          function build(orig) {
            var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig;
            if (typeof orig == 'object') {
              function add(o, key, value) {
                if (is(o, Array))
                  o.push(value);
                else
                  o[key] = value;
              }
              jQuery.each(orig, function(key, value) {
                if (!is(value)) return true;
                add(obj, key, build(value));
              });
            }
            return obj;
          }
          this.keys = build(this.keys);
          return this;
        },
        compact: function() {return this.copy().COMPACT();},
        toString: function() {
          var i = 0, queryString = [], chunks = [], self = this;
          var encode = function(str) {
            str = str + "";
            if ($spaces) str = str.replace(/ /g, "+");
            return encodeURIComponent(str);
          };
          var addFields = function(arr, key, value) {if (!is(value) || value === false) return;var o = [encode(key)];if (value !== true) {o.push("=");o.push(encode(value));}arr.push(o.join(""));};
          var build = function(obj, base) {var newKey = function(key) {return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join("");};jQuery.each(obj, function(key, value) {if (typeof value == 'object') {build(value, newKey(key));}else{addFields(chunks, newKey(key), value);}});};
          build(this.keys);
          if (chunks.length > 0) queryString.push($hash);
          queryString.push(chunks.join($separator));
          return queryString.join("");
        }
      };
      
      return new queryObject(location.search, location.hash);
    };
  } catch(e) {}
  /* END: jQuery.query */
  
  /* START: Third Party bgIframe script. (http://brandonaaron.net) Version 2.1.1 */
  try {
    (function($){
    $.fn.bgIframe = $.fn.bgiframe = function(s) {
      if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) {
        s = $.extend({top : 'auto', left : 'auto', width : 'auto', height : 'auto', opacity : true, src : 'javascript:false;'}, s || {});
        var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
            html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
                     'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
                     'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
                     'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
                     'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
              '"/>';
        return this.each(function() {if ( $('> iframe.bgiframe', this).length == 0 ) {this.insertBefore( document.createElement(html), this.firstChild );} });
      }
      return this;
    };
    })(jQuery);
  } catch(e) {}
  /* END: bgIframe script */

  /* environment changes */
  var sTestURL = document.location.href.toUpperCase().replace("HTTP://", "").replace("HTTPS://", "");
  if (sTestURL.substring(0, 3) != "WWW") {
	  if (sTestURL.substring(0, 7) == "PREVIEW") { baseURL = "http://preview.auction.gohoming.com/GoHomingWeb/"; baseSubDomain = "preview"; }
    if (sTestURL.substring(0, 3) == "UAT") { baseURL = "http://uat.auction.gohoming.com:8080/GoHomingWeb/"; baseSubDomain = "uat"; }
    if (sTestURL.substring(0, 2) == "QA") { baseURL = "http://qa.auction.gohoming.com:8080/GoHomingWeb/"; baseSubDomain = "qa"; }
    if (sTestURL.substring(0, 3) == "DEV") { baseURL = "http://dev.auction.gohoming.com/GoHomingWeb/"; baseSubDomain = "dev"; }
  }
  pageReadyLoad();
}

