
function fillCategory(){ 
 // this function is used to fill the category list on load
addOption(document.drop_list.Category, "Chicago_Loop", "Chicago Loop", "");
addOption(document.drop_list.Category, "Chicago_Suburbs", "Chicago Suburbs", "");
addOption(document.drop_list.Category, "St_Louis", "St. Louis", "");
}

function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "Property...", "");

if(document.drop_list.Category.value == 'Chicago_Loop'){
	addOption(document.drop_list.SubCat,"/properties/chicago-apartments/55-west-chestnut/", "55 W Chestnut");
	addOption(document.drop_list.SubCat,"/properties/chicago-apartments/70-e-walton/", "70 E Walton");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/180-n-jefferson/", "180 N Jefferson");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/400-n-lasalle/", "400 N Lasalle");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/1130-s-michigan/", "1130 S Michigan");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/1350-1360-n-lake-shore-drive/", "1350-1360 N Lake Shore Drive");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/1420-n-lake-shore-drive", "1420 N Lake Shore Drive");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/5550-s-dorchester/", "5550 S Dorchester");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/the-chicagoan/", "The Chicagoan");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/island-terrace/", "Island Terrace");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/lake-meadows/", "Lake Meadows");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/lake-park-crescent/", "Lake Park Crescent");
addOption(document.drop_list.SubCat,"/properties/chicago-apartments/prairie-shores/", "Prairie Shores");
}
if(document.drop_list.Category.value == 'Chicago_Suburbs'){
addOption(document.drop_list.SubCat,"/properties/chicago-suburban-apartments/brook-run/", "Brook Run");
addOption(document.drop_list.SubCat,"/properties/chicago-suburban-apartments/fieldpointe-of-schaumburg/", "Fieldpointe of Schaumburg");
addOption(document.drop_list.SubCat,"/properties/chicago-suburban-apartments/homestead/", "Homestead");
addOption(document.drop_list.SubCat,"/properties/chicago-suburban-apartments/waterford-place/", "Waterford Place");
addOption(document.drop_list.SubCat,"/properties/chicago-suburban-apartments/wheaton-center/", "Wheaton Center");
}
if(document.drop_list.Category.value == 'St_Louis'){
addOption(document.drop_list.SubCat,"/properties/saint-louis-apartments/fieldpointe-of-st-louis/", "Fieldpointe of St. Louis");
addOption(document.drop_list.SubCat,"/properties/saint-louis-apartments/hampton-gardens/", "Hampton Gardens");
}

}
function fillCategory2(){ 
 // this function is used to fill the Category2 list on load
addOption(document.drop_list2.Category2, "Chicago_Loop", "Chicago Loop", "");
addOption(document.drop_list2.Category2, "Chicago_Suburbs", "Chicago Suburbs", "");
addOption(document.drop_list2.Category2, "St_Louis", "St. Louis", "");
}

function SelectSubCat2(){
// ON selection of Category2 this function will work

removeAllOptions(document.drop_list2.SubCat2);
addOption(document.drop_list2.SubCat2, "", "Property...", "");

if(document.drop_list2.Category2.value == 'Chicago_Loop'){
	addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/55-west-chestnut/", "55 W Chestnut");
	addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/70-e-walton/", "70 E Walton");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/180-n-jefferson/", "180 N Jefferson");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/400-n-lasalle/", "400 N Lasalle");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/1130-s-michigan/", "1130 S Michigan");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/1350-1360-n-lake-shore-drive/", "1350-1360 N Lake Shore Drive");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/1420-n-lake-shore-drive", "1420 N Lake Shore Drive");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/5550-s-dorchester/", "5550 S Dorchester");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/the-chicagoan/", "The Chicagoan");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/island-terrace/", "Island Terrace");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/lake-meadows/", "Lake Meadows");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/lake-park-crescent/", "Lake Park Crescent");
addOption(document.drop_list2.SubCat2,"/properties/chicago-apartments/prairie-shores/", "Prairie Shores");
}
if(document.drop_list2.Category2.value == 'Chicago_Suburbs'){
addOption(document.drop_list2.SubCat2,"/properties/chicago-suburban-apartments/brook-run/", "Brook Run");
addOption(document.drop_list2.SubCat2,"/properties/chicago-suburban-apartments/fieldpointe-of-schaumburg/", "Fieldpointe of Schaumburg");
addOption(document.drop_list2.SubCat2,"/properties/chicago-suburban-apartments/homestead/", "Homestead");
addOption(document.drop_list2.SubCat2,"/properties/chicago-suburban-apartments/waterford-place/", "Waterford Place");
addOption(document.drop_list2.SubCat2,"/properties/chicago-suburban-apartments/wheaton-center/", "Wheaton Center");
}
if(document.drop_list2.Category2.value == 'St_Louis'){
addOption(document.drop_list2.SubCat2,"/properties/saint-louis-apartments/fieldpointe-of-st-louis/", "Fieldpointe of St. Louis");
addOption(document.drop_list2.SubCat2,"/properties/saint-louis-apartments/hampton-gardens/", "Hampton Gardens");
}

}
////////////////// 

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}
function removeAllOptions2(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}

function addOption(selectbox, value, text )
{
	var optn2 = document.createElement("OPTION");
	optn2.text = text;
	optn2.value = value;

	selectbox.options.add(optn2);
}
function NavigateToSite(){
    var ddl = document.getElementById("SubCat2");
    var selectedVal = ddl.options[ddl.selectedIndex].value;

    window.location = selectedVal;
}

