	var s_1='/sale-by-owner-home-services/',s_2='/sale-by-owner-user-area/',s_3='/for-sale-by-owner-company/';
	var mits = [{'add':'m1','its': [[s_1+'flat-fee-mls.htm','Flat Fee MLS'],[s_1+'buy-yard-sign.htm','Buy Yard Signs'],['/info/real-estate-forms.htm','Real Estate Forms'],['http://www.electronicappraiser.com/partner/235240','Home Appraiser'],[s_1+'service-providers-search.htm','Services Search &raquo;',{'its': [[s_1+'find-moving-services.htm','Moving Services'],[s_1+'find-home-appraiser.htm','Home Appraisers'],[s_1+'find-home-inspector.htm','Home Inspectors'],[s_1+'title-and-escrow.htm','Title and Escrow'],[s_1+'homeowner-insurance.htm','Homeowner Insurance'],[s_1+'home-warranty.htm','Home Warranty']]}],[s_1+'mortgages.htm','Mortgages &raquo;',{'its': [[s_1+'mortgages.htm','Get Mortgage'],[s_1+'mortgage-calculators.htm','Mortgage Calculators']]}],['http://drivescore.byowner.com/','DriveScore'],['http://climate.byowner.com/','Climate'],['http://streetview.byowner.com/','StreetView'],['http://homestaging.byowner.com/','Home Staging'],['http://realtor.byowner.com/','Broker/Agent Database'],['http://titlesearch.byowner.com/','Title Search'],['http://tax.byowner.com','Property Tax Estimator']]},{'add':'m2','its': [['/info/fsbo-help-center.htm','FSBO Help Center  &raquo;',{'its': [[s_3+'fsbo-faq.html','FAQ'],['/info/download-guide.htm','FSBO Guide'],['http://fsbo.byowner.com/','FSBO Blog'],[s_1+'glossary.html','Glossary'],[s_1+'ad-writing-tips.htm','Ad Writing Tips'],['/info/easy-blog.htm','Home Blog Guide']]}],['/info/neighborhood-info.htm','Neighborhood Info  &raquo;',{'its': [[s_1+'city-profiles.html','City Profiles'],[s_1+'fsbo-city-comparisons.html','City Comparisons'],[s_1+'school-profiles.html','School Profiles'],[s_1+'fsbo-crime-comparisons.html','Crime Comparisons'],['http://www.salaryexpert.com/seco/index.cfm?Action=DisplayNAInput&CobrandID=347','Salary Calculator'],[s_1+'fsbo-cost-of-living-comparisons.html','Cost of Living'],['http://climate.byowner.com/','City Climate']]}],['http://drivescore.byowner.com/','Drive Score'],['/info/about-us.htm','About Us  &raquo;',{'its': [[s_3+'fsbo-company-why.html','Why Us'],[s_3+'fsbo-testimonials.html','Success Stories'],['/info/press-room.htm','Press Room'],[s_3+'fsbo-privacy.html','Privacy &amp; Disclaimer'],['/terms-and-conditions.htm','Terms &amp; Conditions'],['/sell-home-by-owner-contacts.html','Contact Us']]}],['/info/advertise-with-byowner.htm','Advertising  &raquo;',{'its': [['/info/site-demographics.htm','Our Visitors'],['/info/advertise-with-byowner.htm','Advertising Packages'],['/info/partner-with-us.htm','Partner With Us']]}],['http://videographer.byowner.com/','Videographers'],['/sell-home-by-owner-contacts.html','Contact Us'],['/mls_contact_us.html','Information for MLSs'],['/services/byowner_xml.html','byowner.com API']]}];	
	function drMn(){	
	var i,c,l,c1,i1,c2,i2;
	var x="<li><a href=\"",y="</a></li>";
	c=mits.length;
	for(i=0;i<c;i++){
	ss="<ul>"
	c1=mits[i].its.length;
	for(i1=0;i1<c1;i1++){
	l=mits[i].its[i1]
	if(l[0].indexOf('ttp') != 1){
	l[0] = "http://www.buy-home.ws" + l[0]
	}
	if(l.length==3){
	ss+=x+l[0]+"\" >"+l[1]+"</a><ul>"
	c2=l[2].its.length;
	for(i2=0;i2<c2;i2++){
	p=l[2].its[i2][0]
	if(p.indexOf('ttp') != 1){
	p = "http://www.buy-home.ws"+p
	}
	ss+=x+p+"\">"+l[2].its[i2][1]+y;
	}
	ss+="</ul></li>"
	}else{
	ss+=x+l[0]+"\">"+l[1]+y
	}}
	ss+="</ul>"
	jQuery(ss).appendTo("#" + mits[i].add)
	}}
function getWH(){
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [myWidth, myHeight];
}

function showInfo2(tabs, show_tab, div){
	var t;	
	var c = tabs.length;
	for(i=0;i<c;i++){
		t = tabs[i] 
		if( t != show_tab){
			$("#tab_" + t).removeClass();
			if(div === true){
				$("#div_" + t).hide()
				$("#wih_" +t).hide()
			}else if(div === false){
			}else{
				$("#div_" + t + "_" + current_so_sel_house).hide();
			}
		}else{
			$("#tab_" + t).addClass('current');
			if(div === true){
				$("#div_" + t).show();
				$("#wih_" +t).show();
				cur_tab = t;
			}else if(div === false){
					
			}else{
				$("#div_" + t + "_" + current_so_sel_house).show();
			}
		}	
	}
}
function load_js(path){
	try{
		if ($("script[@src='"+path+"']").size()){
		   return;
		}
		$("<script>").attr('src', path). attr('type', 'text/javascript').appendTo("head");
	}catch(e){alert(e);}
}
function urchinTracker(url){}

function sho(id){
	if($("#"+id).css('display')=="block"){
		$("#"+id).hide();
	}else{
		$("#"+id).show();
	}
}
/* -------  TRACK ADSENSE ------	 */

function adsense_init () {
	if (document.all) {  //ie

		var el = document.getElementsByTagName("iframe");
	
		for(var i = 0; i < el.length; i++) {
			if(el[i].src.indexOf('googlesyndication.com') > -1) {
				adUnit = i+1;
				browser = "IE";
				adunitsize = el[i].width + "x" + el[i].height;
				el[i].onfocus = trackAdsense;
			}
		}
	} else {   // firefox
	
		window.addEventListener('beforeunload', doPageExit, false);
		window.addEventListener('mousemove', getMouse, true);
	}	
}
//for firefox
var px;
var py;
var adUnit = "";
var browser = "";
var adunitsize = "";

function getMouse(e) {
	px=e.pageX;
	py=e.clientY;
}

function findY(obj) {
	var y = 0;
	while (obj) {
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return(y);
}
function findX(obj) {
	var x = 0;
	while (obj) {
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return(x);
}
function doPageExit(e) {
	ad = document.getElementsByTagName("iframe");
	for (i=0; i<ad.length; i++) {
		var adLeft = findX(ad[i]);
		var adTop = findY(ad[i]);
		var inFrameX = (px > (adLeft - 10) && px < (parseInt(adLeft) + parseInt(ad[i].width) + 15));
		var inFrameY = (py > (adTop - 10) && py < (parseInt(adTop) + parseInt(ad[i].height) + 10));
		
		if (inFrameY && inFrameX) {
			adUnit = i+1;
			browser = "Firefox";
			adunitsize = ad[i].width + "x" + ad[i].height;
			trackAdsense();
		}
	}
}
//end for firefox
function trackAdsense() {
	urchinTracker('/GoogleAds_'+adUnit+'_'+adunitsize);
}
$(document).ready(adsense_init);
/* -------  end TRACK ADSENSE ------	 */

/* -------  INACCURATE DATA ------	 */

  function sendInaccurateData(){
	 var mes = $("#report_inaccurate_data_message").val();
	 var email = $("#report_inaccurate_email").val(); 
	 var name = $("#report_inaccurate_name").val();
	 var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	 if (!filter.test(email)) {
		  	$("#incorrect_mes_error").show();
			return false;
	 }
	 $.get("/services/report_inaccurate_data.html",
	 		{mes:mes, url:document.location.href, email:email,name:name});

	 $("#report_inaccurate_data").hide();
	 $("#report_inaccurate_data_send").show();
	 $("#report_inaccurate_data_message").val('');
	 $("#incorrect_mes_error").hide();
	 return false;
  }

function addHandler(object, event, handler, useCapture) {
if (object.addEventListener) {
object.addEventListener(event, handler, useCapture ? useCapture : false);
} else if (object.attachEvent) {
object.attachEvent('on' + event, handler);
} else alert("Add handler is not supported");
}

var ua = navigator.userAgent.toLowerCase();
var isIE = (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1);
var isGecko = (ua.indexOf("gecko") != -1);


if (isIE) addHandler (document, "keydown", hotSave);
else addHandler (document, "keypress", hotSave);

function hotSave(evt) {

evt = evt || window.event;
 if((evt.ctrlKey) && ((evt.keyCode == 0xA)||(evt.keyCode == 0xD)))
 {
 		showDivIncorrect();
		return false;
  }
}

function showDivIncorrect(){
	$.get("/sale-by-owner-home-services/get_html.html?file=get_inacc_data.html", {}, function(data){
		$("body").append(data);
		sdi();
		showDivIncorrect = sdi;
	});
 }
function sdi(){
	var wh = getWH();
	var d_w = wh[0];
	var df = document.getElementById('report_inaccurate_data'), dd = document.getElementById('report_inaccurate_data_send');
	var t = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + 220 + 'px';
	var l = Math.round( (d_w / 2) - 380) + 'px';  
	dd.style.top = t;
	dd.style.left = l;
	df.style.top = t;
	df.style.left = l;
	if($("#report_inaccurate_data").css('display')=='none'){
		$("#report_inaccurate_data").show();	
	}else{
		$("#report_inaccurate_data").hide();
	}
}
 /* ------- end INACCURATE DATA ------	 */
/* ------- GET QUICK SERAARCH RES ------	 */
var qrtimeout = false;
var div_opened = false;
function quickResultCount(pr_submit){
	try{
		clearTimeout(qrtimeout);
		if(div_opened){
			$("#quick_res_count").show();
		}
	}
	catch(e){}
	if(pr_submit){
		eval("quickResultCount__2(" + pr_submit + ")");
	}else{
		qrtimeout = setTimeout("quickResultCount__2(" + pr_submit + ")", 700);

			div_opened = $('#quick_res_count').css('display') == 'block';
	}
	$('quick_res_count').hide();
	return false;
}
function quickResultCount__2(pr_submit){
	var csz = document.getElementById('csz');
	if(csz.value == "City, State OR ZIP"){
		csz.value = "";
	}
	if(csz.value <2 &&  pr_submit){
		$("#quick_res_count").show().html("<span style='color:red'>Please enter city, state or zip</span>")
		return;
	}
	sendQuickResultRequest(csz.value, pr_submit);
}
function sendQuickResultRequest(csz, pr_submit){
	var search_params = {csz: csz};
	var fld_arr = ['prices_range', 'beds_bath', 'min_price', 'max_price', 'property_type',
					'sqft_value_min', 'sqft_value_max', 'price_value_max', 'price_value_min', 
					'with_photos', 'fsbo_agent','sell_sold']
	var c = fld_arr.length;
	var f1;
	for(var i=0;i<c;i++){
		f1 = document.getElementById(fld_arr[i]);
		if(f1){
			if (f1.type == "checkbox") {
				if (f1.checked) {
					search_params[fld_arr[i]] = f1.value;
				}
			}else {
				search_params[fld_arr[i]] = f1.value;
			}
		}
	}
	beds_value = new Array();
	baths_value = new Array();
	prop_type_ch = new Array();
	for(var i=1;i<5;i++){
		f1 = $("#bt" + i);
		if (f1) {
			if(f1.checked){
				baths_value[baths_value.length] = f1.value;
			}
		}
		f1 = $("#bd" + i);
		if (f1) {
			if(f1.checked){
				beds_value[beds_value.length] = f1.value;
			}
		}
	}
	for(var i=0;i<15;i++){
		f1 = $("#ptp" + i);
		if (f1) {
			if(f1.checked){
				prop_type_ch[prop_type_ch.length] = f1.value;
			}
		}
	}
	search_params['beds_value'] = beds_value.join(",");
	search_params['baths_value'] = baths_value.join(",");
	search_params['prop_type_ch'] = prop_type_ch.join(",");
		if($("#idsell_sold") && !search_params['sell_sold'])  search_params['sell_sold'] = $("#idsell_sold").val();
	$.get("/get_quick_houses_search_res.html",
		  search_params,
		  function(data){
		  	var ret = data.substring(24, data.length - 2);
			eval("ret = " + ret);
		  	setQuickSResCount(ret.text, ret.js, pr_submit);
		  }
		  );
		 
}
function setQuickSResCount(count, hash,pr_submit){
	try{
		add_str="";
		if(showSearchParams){
			add_str	= " in " + $("#csz").val();
		}
	}
	catch(e){}

	var pr_found = false;
	if(count!="error" && count!="0"){
		if(count == "cities_vars"){
			if(pr_submit || true){
				if(document.body.offsetWidth < 1100){
					var str = "<div style='z-index:100;text-align:left;padding:3px;border:1px #B6CFE2 solid;background:#FFFFFF;width:135px;margin-left:10px;'>"
				}
				else {
					var str = "<div style='z-index:100;position:relative;left:-165px;top:-70px;text-align:left;padding:3px;border:1px #B6CFE2 solid;background:#FFFFFF;width:135px;margin-left:10px;'>"
				}
				str += "Narrow your search:";
				for(var i=0;i<hash.length;i++){
					if (hash[i].id) {
						str += "<br><a href='/"+hash[i].id+"' onclick='$(\"#quick_res_count\").hide();return true;' style='padding:2px 3px;text-decoration:none;'>Listing #" + hash[i].id + "</a>";
					str += "<br><a href='#' onclick='$(\"#csz\").val(this.innerHTML);$(\"#quick_res_count\").hide();quickResultCount(true);return false;' style='padding:2px 3px;text-decoration:none;'>" + hash[i].city.toLowerCase() + ", " + hash[i].state.toUpperCase() + "</a>";
				}			
					else {
						str += "<br><a href='#' onclick='$(\"#csz\").val(this.innerHTML);$(\"#quick_res_count\").hide();quickResultCount(true);return false;' style='padding:2px 3px;text-decoration:none;'>" + hash[i].city.toLowerCase() + ", " + hash[i].state.toUpperCase() +"</a>";
					}
				}			
				$("#quick_res_count").html(str + "</div>").show();
			}else{
				$("#quick_res_count").hide();
			}
		}else{
			pr_found = true;
			$("#quick_res_count").html(count + " houses found" + add_str).show();
		}
	}else{
		$("#quick_res_count").show().html("<span style='color:red'>No houses found" + add_str + ". Try to change a search criteria.</span>");
	}	
	
	if(pr_submit && pr_found ){
		if(hash.url_str){
			document.getElementById('form_search_result').action = hash.url_str;
		}
		document.getElementById('form_search_result').submit();
	}
}

/* ------- end GET QUICK SERAARCH RES ------	 */

/* ------- MENU ------	 */
//menu fuct	
var jquerycssmenu={
fadesettings: {overduration: 200, outduration: 100}, //duration of fade in/ out animation, in milliseconds
buildmenu:function(menuid){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)")
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					$targetul.css({left:menuleft+"px"}).fadeIn(jquerycssmenu.fadesettings.overduration)
				},
				function(e){
					$(this).children("ul:eq(0)").fadeOut(jquerycssmenu.fadesettings.outduration)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}
/* ------- end MENU ------	 */

/* ------- ADV SEARCH ------	 */
function showAdvSearch(){
	$.get('/sale-by-owner-home-services/get_html.html?file=get_adv_s.html', 
					  {},
					  function (data){
					  		$('body').append(data);
					  		$("#advanced_22").show();
							showAdvSearch = function(){
								if ($("#advanced_22").is(":hidden"))
									$("#advanced_22").show();
								else 	
									 $("#advanced_22").fadeOut("slow");
								return false;
							}
					  });
	return false;
}


function advanced_search_house_id(house_id){
	$.post('/ajax_ping_house_id.html',
			{house_id:house_id},
			function(data){
			  	var ret = data.substring(24, data.length - 2);
				eval("ret = " + ret);
				if (ret.text=="yes"){
					 window.location.href = "http://byowner.com/" + house_id;	 
				}else{
					$("#message_advanced_search_house_id").html("House ID "+house_id+" not found");  
				}   
			});			
}


function index_advanced_search_house_id(e){
	
	i = document.getElementById('house_id'); 
	if (i){
		if (i.value != ''){ 
			advanced_search_house_id(i.value);
			return false;
		}
		$("#message_advanced_search_house_id").html("Please enter a valid House ID code");
	}
	return false;
}

function getRet(data){
	var ret = data.substring(24, data.length - 2);
	eval("ret = " + ret);
	return ret;
}

function getValidLocation(){
	$('#message_area').hide();
	var csz = $("#csz2").val();
	if(csz == "City, State OR ZIP"  || csz <2){
		$('#message_area').show().html("<span style='color:red'>Please enter city, state or zip</span>");
		return;
	}
	$.get("/get_quick_houses_search_res.html",{csz: csz, no_search: "1"},
	function(data){
		var ret = getRet(data)
		getValidLocationResponse(ret.text, ret.js)
	});
}
function getValidLocationResponse(count, hash){
	$("#message_area").show();
	if(count!="error"){
		if(count == "cities_vars"){
				var str = "<div style='text-align:left;padding:3px;border:1px #B6CFE2 solid;background:#FFFFFF;'>"
				str += "Narrow your search:";
				for(var i=0;i<hash.length;i++){
					str += "<br><a href='#' onclick='$(\"#csz2\").val(this.innerHTML);";
					str += "$(\"#message_area\").hide();getValidLocation();return false;";
					str += "' style='padding:2px 3px;text-decoration:none;'>";
					str += "" + hash[i].city.toLowerCase() + ", " + hash[i].state.toUpperCase() + "</a>";
				}			
				$("#message_area").html(str + "</div>");
		}else{
			select_opt = $("#find_info").val();
			url = hash.other_url;
			pref = "www";
			if(select_opt=="neigh"){
				if(hash.city_ready){
					url = "sale-by-owner-home-services/" + hash.state_ready + "-city-" +  hash.city_ready.toLowerCase() + "-profile.html";
				}else{
					url = "sale-by-owner-home-services/" + hash.state_ready + "-state-profile.html";
				}
			}else if(select_opt=="climate"){
				pref = "climate";
				if(hash.city_ready){
					url = hash.state_ready + "-city-" +  hash.city_ready.toLowerCase() + "-climate.html";
				}else{
					url = hash.state_ready + "-climate.html";
				}
			}else if(select_opt=="forsale"){
				document.location.href = hash.url_str;
			}else{
				arr = {'homest': 'homestaging', 'realtor': 'realtor', 'video': 'photo', 'events': 'events', 'schools': 'schools', 'economy': 'economy', 'ecology': 'ecology', 'safety': 'safety'};
				pref = arr[select_opt];
			}
			document.location.href = "http://" + pref + ".byowner.com/" + url;
			$("#message_area").hide();
		}
	}else{
		$("#message_area").html("<span style='color:red'>Please enter a valid location.</span>");
	}
}

function advanced_search_params(){
	 hash = {"address": $("#address").val(),
			"sq_footage_min": $("#sq_footage_min").val(),
			"sq_footage_max": $("#sq_footage_max").val(),
			"zip": $("#zip_adv_search").val(),
			"csz": $("#zip_adv_search").val(),
			"badrooms": $("#badrooms").val(),
			"city": $("#city").val(),
			"baths": $("#baths").val(),
			"state": $("#state").val(), 
			"fsbo_agent": $("#fsbo_agent_adv_search").val(), 
			"property_type": $("#property_type_adv_search").val(), 
			"min_price": $("#min_price").val(), 
			"max_price": $("#max_price").val(), 
			"with_photos": ($("#with_photos_adv_search").attr('checked'))?$("#with_photos_adv_search").val():'', 
			"sell_sold": $("#idsell_sold").val(),
			"feature": $("#feature").val()}
	 $.post('ajax_get_quick_houses_advanced_search_res.html',
	 		hash,
			function(data){
			  	var ret = data.substring(24, data.length - 2);
				eval("ret = " + ret);
				result_ping_advanced_params(ret.js, ret.text);
			});
}

function result_ping_advanced_params(data, mes){
	 //alert(mes); 
	 if (mes!="error" && mes!="0"){
		 if (mes=="1")
			 window.location.href = "http://byowner.com/" + data["house_id"];
		 else {
			fr = document.getElementById('form_adv_sch_result_params');
			fr.zip.value = $("#zip_adv_search").val(); 
			fr.submit();
		 }
		
	}else{
		$("#message_advanced_search_parrams").html("We're sorry, we found no results that closely match your search.<br/> Try using less strict search criteria.");
	}
}

function index_advanced_search_params(e){
	//i = document.getElementById('house_id'); 
	$("#message_advanced_search_parrams").html("");
	mes = check_bind_advanced_params();
	if (mes=='ok'){
		advanced_search_params();
		return false;
	} else {
		$("#message_advanced_search_parrams").html(mes);	
	}
	return false;
}

function check_bind_advanced_params(){
		 zip = $("#zip_adv_search").val();
		 city = $("#city").val();
		 state = $("#state").val();
		 if ((zip=='') && ((city=='') || (state=='')))	
			return "Pleas enter ZIP or City and State"
		else
			return "ok"
}

function applySuggestionAdv(data_to_send,data_to_fill){

	var target = "/ajax-suggestion-zip.html";
	var data = {zip: data_to_send};	
	$.post(target,
		 data,
		 function(data){
			  	var ret = data.substring(24, data.length - 2);
				eval("ret = " + ret);
				applyFill(ret.js, ret.text, {state: data_to_fill['state'], city: data_to_fill['city'] });
			});
}

function applyFill (data,text,dataToFill){
	//alert(data[0].city)
	if(text == 'error') return false;
	if(dataToFill['state']!="" && (data[0]['state'] || data[0]['zone_id'])){
		if(document.getElementById(dataToFill['state'])!='undefined'){
			var filled = 0;
			var obj = document.getElementById(dataToFill['state']);
			obj.style.display = 'block';
			for (i=0;i<obj.options.length;i++){
				if(obj.options[i].value == data[0]['state']){			
					obj.options[i].selected = 'true';
					filled = 1;
				}
			}
			if (filled!=1){
				for (i=0;i<obj.options.length;i++){
					if(obj.options[i].value == data[0]['zone_id']){			
						obj.options[i].selected = 'true';
						filled = 1;
					}
				}
			}
		}
	}
	if(dataToFill['city']!="" && data[0]['city']){
		if(document.getElementById(dataToFill['city'])){
			$("#" + dataToFill['city']).show().val(data[0]['city']);
		}
	}
}

/* ------- end ADV SEARCH ------	 */
function CheckZipMlsSell (zipCode,e) {
	if(!zipCode) return false;
	removeHandler(e);
	$.post("/check_zip_mls.html", {zip:zipCode},
		function(data){
		  	var ret = data.substring(24, data.length - 2);
			eval("ret = " + ret);
			$("#check_zip_mls").hide();
			setCheckZipMlsSell(ret.js, ret.text)
		});	 
}

function setCheckZipMlsSell (data, text) {
	if(data['is_mls'] == '1'){
		$("#check_zip_mls").show();
	}
	return false;
}
function removeHandler(e) {
if (undefined == e){e = window.event}
if (e.stopPropagation){e.stopPropagation();}
  else{e.cancelBubble = true;}
	return false;
}
function SetCookie(name, value, expires, path, domain, secure){
	expires = "01-dec-2020  01:01:01"
	var now = new Date();
	now.setTime(now.getTime() + 14 * 24 * 60 * 60 * 1000);
	expires = now;
	document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
