var NJArray  =  new Array ("('Select County','All',true,true)",
"('Bergen')", "('Essex')", "('Hudson')", "('Middlesex')", "('Passaic')");

var NYArray  =  new Array("('Select County','All',true,true)",
"('Bronx')","('Brooklyn')","('Manhattan')","('Queens')","('Staten Island')");

var GAArray  =  new Array("('Select County','All',true,true)",
"('Bacon')", "('Barrow')", "('Clayton')", "('Cobb')", "('Dekalb')", "('Forsyth')", "('Fulton')", "('Gwinnett')", "('Milton')", "('Rockdale')");

var BergenArray =  new Array("('Select City','',true,true)",
"('Allendale')","('Alpine')","('Bergenfield')","('Bogota')","('Carlstadt')","('Cliffside Park')","('Closter')","('Cresskill')","('Demarest')","('Dumont')"
,"('East Rutherford')","('Edgewater')","('Elmwood Park')","('Emerson')","('Englewood')","('Englewood Cliffs')","('Fair Lawn')","('Fairview')","('Fort Lee')"
,"('Franklin Lakes')","('Garfield')","('Glen Rock')","('Hackensack')","('Harrington Park')","('Hasbrouck Heights')","('Haworth')","('Hillsdale')","('Ho-Ho-Kus')","('Leonia')","('Little Ferry')"
,"('Lodi')","('Lyndhurst')","('Mahwah')","('Maywood')","('Midland Park')","('Montvale')","('Moonachie')","('New Milford')","('North Arlington')","('Northvale')","('Norwood')","('Oakland')"
,"('Old Tappan')","('Oradell')","('Palisades Park')","('Paramus')","('Park Ridge')","('Ramsey')","('Ridgefield')","('Ridgefield Park')","('Ridgewood')","('River Edge')","('River Vale')","('Rochelle Park')","('Rockleigh')","('Rutherford')"
,"('Saddle Brook')","('Saddle River')","('South Hackensack')","('Teaneck')","('Tenafly')","('Teterboro')","('Upper Saddle River')","('Waldwick')","('Wallington')","('Washington Township')","('Westwood')","('Wood-Ridge')","('Woodcliff Lake')","('Wyckoff')");

var EssexArray =  new Array("('Select City','',true,true)",
"('Belleville')","('Bloomfield')","('Broadway')","('Caldwell')","('Cedar Grove')","('City of Orange')","('Downtown Newark')"
,"('East Orange')","('Essex Fells')","('Fairfield')","('Fairmount')","('Forest Hill')"
,"('Glen Ridge')","('Ironbound')","('Irvington')","('Livingston')","('Llewellyn Park')","('Maplewood')","('Millburn')","('Montclair')","('Newark')","('North Caldwell')","('Nutley')"
,"('Roseland')","('Roseville')","('Seventh Avenue')","('Short Hills')","('South Orange Village')","('Springfield/Belmont')","('University Heights')","('Vailsburg')","('Verona')","('Weequahic')","('West Caldwell')","('West Orange')");

var HudsonArray =  new Array("('Select City','',true,true)",
"('Bayonne')","('East Newark ')","('Exchange Place')","('Greenville')","('Guttenberg')","('Harrison')","('Hoboken')","('Jersey City')"
,"('Kearny')","('Liberty State Park')","('Newport')","('North Bergen')","('Paulus Hook')","('Secaucus')","('Union City ')","('Weehawken')","('West New York')");

var MiddlesexArray =  new Array("('Select City','',true,true)",
"('Avenel')","('Brownville')","('Carteret')","('Clearbrook Park')","('Colonia')","('Concordia')","('Cranbury')","('Dayton')","('Deans')","('Dunellen')","('East Brunswick')","('Edison')"
,"('Fords')","('Heathcote')","('Helmetta')","('Highland Park')","('Hopelawn')","('Iselin')","('Jamesburg')","('Keasbey')","('Kendall Park')","('Kingston')","('Laurence Harbor')"
,"('Madison Park')","('Menlo Park Terrace')","('Metuchen')","('Middlesex')","('Milltown')","('Monmouth Junction')","('Monroe')","('New Brunswick')"
,"('North Brunswick')","('Old Bridge')","('Perth Amboy')","('Piscataway')","('Plainsboro Center')","('Plainsboro Township')","('Port Reading')","('Princeton Meadows')"
,"('Raritan Landing')","('Rossmoor')","('Sayreville')","('Sewaren')","('Society Hill')","('South Amboy')","('South Brunswick')","('South Plainfield')","('South River')","('Spotswood')","('Whittingham')","('Woodbridge')");

var PassaicArray = new Array("('Select City','',true,true)",
"('Bloomingdale')","('Haledon')","('Hawthorne')","('North Haledon')","('Pompton Lakes')","('Prospect Park')","('Ringwood')","('Totowa')","('Wanaque')","('West Paterson')"
,"('Clifton')","('Passaic')","('Paterson')"
,"('Little Falls')","('Wayne')","('West Milford')");

var QueensArray = new Array("('Select City','',true,true)",
"('Bayside')", "('Flushing')", "('North Flushing')");

var BaconArray = new Array("('Select City','',true,true)",
"('Alma')");

var BarrowArray = new Array("('Select City','',true,true)",
"('Winder')");

var ClaytonArray = new Array("('Select City','',true,true)",
"('Forest Park')");

var CobbArray = new Array("('Select City','',true,true)",
"('Marietta')");

var DekalbArray = new Array("('Select City','',true,true)",
"('Clarkston')", "('Stone Mountain')", "('Tucker')");

var ForsythArray = new Array("('Select City','',true,true)",
"('Cumming')");

var FultonArray = new Array("('Select City','',true,true)",
"('Alpharetta')", "('Atlanta')", "('Roswell')");

var GwinnettArray = new Array("('Select City','',true,true)",
"('Buford')", "('Dacula')", "('Duluth')", "('Grayson')", "('Lawrenceville')", "('Lilburn')", "('Loganville')","('Norcross')", "('Snellville')", "('Sugar Hill')", "('Suwanee')");

var MiltonArray = new Array("('Select City','',true,true)",
"('Chamblee')");

var RockdaleArray = new Array("('Select City','',true,true)",
"('Conyers')");

function populateCounty(inForm,selected)
{
	var selectedArray = eval(selected + "Array");
	while (selectedArray.length < inForm.scounty.options.length)
	{
		inForm.scounty.options[(inForm.scounty.options.length - 1)] = null;
	}
	for (var i=0; i < selectedArray.length; i++)
	{
		eval("inForm.scounty.options[i]=" + "new Option" + selectedArray[i]);
	}
}

function populateCity(inForm,selected) 
{
	if (selected != "View All")
	{
		var selectedArray = eval(selected + "Array");
		
		/*
		while (selectedArray.length < inForm.scity.options.length)
		{
			inForm.scity.options[(inForm.scity.options.length - 1)] = null;
		}
		*/
		inForm.scity.options.length = 0;
		for (var i=0; i < selectedArray.length; i++)
		{
			// inForm.scity.options[0] = new Option(selectedArray[i],selectedArray[i]);
			eval("inForm.scity.options[i]=" + "new Option" + selectedArray[i]);
		}
	}
	else
	{
		inForm.scity.options.length = 0;
		inForm.scity.options[0] = new Option('View All','All');
	}	
}


function beginSearch()
{
	var process = true;
	var form = document.globe;
	if (form.slow.value != "All" && form.shigh.value != "All")
	{
		if (parseInt(form.slow.value) > parseInt(form.shigh.value))
		{
			alert('최저 매매가는 최고 매매가 보다 낮아야 합니다.');
			process = false;
		}
	}
	
	var scounty = form.scounty.options[form.scounty.selectedIndex].text;
	var scity = form.scity.options[form.scity.selectedIndex].text;
	
	if ((scounty != "View All") && (scity == "Select City"))
	{
		alert("도시를 선택해 주세요.");
		process = false;
	}
	
	if (form.scounty.value == "All")
	{
		form.scity.value = "All";
	}
	
	if (process)
		form.submit();
}

function loading(margin)
{
	return "<div style='text-align:center; margin: "+margin+"px 0px;'><img src=\"images/working.gif\" /><br/>Please Wait...</div>";
}

function loading2(top, bottom)
{
	return "<div style='text-align:center; margin: "+top+"px 0px "+bottom+"px 0px;'><img src=\"images/working.gif\" /><br/>Please Wait...</div>";
}
function searchProcess()
{
	document.getElementById('search').style.border = "1px solid #fff";
	document.getElementById('search_wrap').style.border = "1px solid #fff";
	document.getElementById('search_wrap').style.background = "#fff";
	document.getElementById('search').innerHTML = loading2(130, 133);
	//document.getElementById('search2').innerHTML = loading(80);
	setTimeout(function()
	{
		location.href("properties.html");
	},1500);
}

function priceRange()
{
	var html_code = "";
	
	/*
	html_code += "<OPTION VALUE=\"0\">$0</OPTION>";
	html_code += "<OPTION VALUE=\"500\">$500</OPTION>";
	html_code += "<OPTION VALUE=\"1000\">$1,000</OPTION>";
	html_code += "<OPTION VALUE=\"1400\">$1,400</OPTION>";
	html_code += "<OPTION VALUE=\"2000\">$2,000</OPTION>";
	html_code += "<OPTION VALUE=\"5000\">$5,000</OPTION>";
	html_code += "<OPTION VALUE=\"10000\">$10,000</OPTION>";
	html_code += "<OPTION VALUE=\"20000\">$20,000</OPTION>";
	html_code += "<OPTION VALUE=\"30000\">$30,000</OPTION>";
	html_code += "<OPTION VALUE=\"40000\">$40,000</OPTION>";
	html_code += "<OPTION VALUE=\"45000\">$45,000</OPTION>";
	html_code += "<OPTION VALUE=\"50000\">$50,000</OPTION>";
	html_code += "<OPTION VALUE=\"55000\">$55,000</OPTION>";
	html_code += "<OPTION VALUE=\"60000\">$60,000</OPTION>";
	html_code += "<OPTION VALUE=\"70000\">$70,000</OPTION>";
	html_code += "<OPTION VALUE=\"75000\">$75,000</OPTION>";
	*/
	html_code += "<OPTION VALUE=\"100000\">$100,000</OPTION>";
	html_code += "<OPTION VALUE=\"125000\">$125,000</OPTION>";
	html_code += "<OPTION VALUE=\"150000\">$150,000</OPTION>";
	html_code += "<OPTION VALUE=\"175000\">$175,000</OPTION>";
	html_code += "<OPTION VALUE=\"200000\">$200,000</OPTION>";
	html_code += "<OPTION VALUE=\"225000\">$225,000</OPTION>";
	html_code += "<OPTION VALUE=\"250000\">$250,000</OPTION>";
	html_code += "<OPTION VALUE=\"275000\">$275,000</OPTION>";
	html_code += "<OPTION VALUE=\"300000\">$300,000</OPTION>";
	html_code += "<OPTION VALUE=\"325000\">$325,000</OPTION>";
	html_code += "<OPTION VALUE=\"350000\">$350,000</OPTION>";
	html_code += "<OPTION VALUE=\"400000\">$400,000</OPTION>";
	html_code += "<OPTION VALUE=\"450000\">$450,000</OPTION>";
	html_code += "<OPTION VALUE=\"500000\">$500,000</OPTION>";
	html_code += "<OPTION VALUE=\"550000\">$550,000</OPTION>";
	html_code += "<OPTION VALUE=\"600000\">$600,000</OPTION>";
	html_code += "<OPTION VALUE=\"650000\">$650,000</OPTION>";
	html_code += "<OPTION VALUE=\"700000\">$700,000</OPTION>";
	html_code += "<OPTION VALUE=\"750000\">$750,000</OPTION>";
	html_code += "<OPTION VALUE=\"800000\">$800,000</OPTION>";
	html_code += "<OPTION VALUE=\"850000\">$850,000</OPTION>";
	html_code += "<OPTION VALUE=\"900000\">$900,000</OPTION>";
	html_code += "<OPTION VALUE=\"1000000\">$1,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"1250000\">$1,250,000</OPTION>";
	html_code += "<OPTION VALUE=\"1500000\">$1,500,000</OPTION>";
	html_code += "<OPTION VALUE=\"1750000\">$1,750,000</OPTION>";
	html_code += "<OPTION VALUE=\"2000000\">$2,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"2250000\">$2,250,000</OPTION>";
	html_code += "<OPTION VALUE=\"2500000\">$2,500,000</OPTION>";
	html_code += "<OPTION VALUE=\"2750000\">$2,750,000</OPTION>";
	html_code += "<OPTION VALUE=\"3000000\">$3,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"3500000\">$3,500,000</OPTION>";
	html_code += "<OPTION VALUE=\"4000000\">$4,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"4500000\">$4,500,000</OPTION>";
	html_code += "<OPTION VALUE=\"5000000\">$5,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"6000000\">$6,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"8000000\">$8,000,000</OPTION>";
	html_code += "<OPTION VALUE=\"10000000\">$10,000,000</OPTION>";
	
	document.write(html_code);
}