//JAVASCRIPT THAT RUNS SEARCH FUNCS
// REL = 'BEDS' *BEDROOMS
// REL = 'BATH' *BATHROOMS
// REL = 'RSP' *RENTAL STARTING PRICE
// REL = 'REP' *RENTAL ENDING PRICE
// REL = 'PSP' *PURCHASE STARTING PRICE
// REL = 'PEP' *PURCHASE ENDING PRICE


bed_content_array = new Array();
bed_content_array['0'] = new Array();
bed_content_array['0']['value'] = '0';
bed_content_array['0']['label'] = 'Studio';
bed_content_array['1'] = new Array();
bed_content_array['1']['value'] = '9';
bed_content_array['1']['label'] = 'Convertible';
bed_content_array['2'] = new Array();
bed_content_array['2']['value'] = '1';
bed_content_array['2']['label'] = '1 Bed';
bed_content_array['3'] = new Array();
bed_content_array['3']['value'] = '2';
bed_content_array['3']['label'] = '2 Bed';

bed_aquachicagocondos_array = new Array();
bed_aquachicagocondos_array['0'] = new Array();
bed_aquachicagocondos_array['0']['value'] = '0';
bed_aquachicagocondos_array['0']['label'] = 'Studio';
bed_aquachicagocondos_array['1'] = new Array();
bed_aquachicagocondos_array['1']['value'] = '1';
bed_aquachicagocondos_array['1']['label'] = '1 Bed';
bed_aquachicagocondos_array['2'] = new Array();
bed_aquachicagocondos_array['2']['value'] = '2';
bed_aquachicagocondos_array['2']['label'] = '2 Bed';
bed_aquachicagocondos_array['3'] = new Array();
bed_aquachicagocondos_array['3']['value'] = '3';
bed_aquachicagocondos_array['3']['label'] = '3 Bed';
bed_aquachicagocondos_array['4'] = new Array();
bed_aquachicagocondos_array['4']['value'] = '4';
bed_aquachicagocondos_array['4']['label'] = '4 Bed';

bed_aquaparkhomes_array = new Array();
bed_aquaparkhomes_array['0'] = new Array();
bed_aquaparkhomes_array['0']['value'] = '3';
bed_aquaparkhomes_array['0']['label'] = '3 Bed';

bed_bentonplaceparkhomes_array = new Array();
bed_bentonplaceparkhomes_array['0'] = new Array();
bed_bentonplaceparkhomes_array['0']['value'] = '1';
bed_bentonplaceparkhomes_array['0']['label'] = '1 Bed';
bed_bentonplaceparkhomes_array['1'] = new Array();
bed_bentonplaceparkhomes_array['1']['value'] = '2';
bed_bentonplaceparkhomes_array['1']['label'] = '2 Bed';
bed_bentonplaceparkhomes_array['2'] = new Array();
bed_bentonplaceparkhomes_array['2']['value'] = '3';
bed_bentonplaceparkhomes_array['2']['label'] = '3 Bed';
bed_bentonplaceparkhomes_array['3'] = new Array();
bed_bentonplaceparkhomes_array['3']['value'] = '4';
bed_bentonplaceparkhomes_array['3']['label'] = '4 Bed';
bed_bentonplaceparkhomes_array['4'] = new Array();
bed_bentonplaceparkhomes_array['4']['value'] = '5';
bed_bentonplaceparkhomes_array['4']['label'] = '5+ Bed';

bath_aquaparkhomes_array = new Array();
bath_aquaparkhomes_array['1'] = new Array();
bath_aquaparkhomes_array['1']['value'] = '3';
bath_aquaparkhomes_array['1']['label'] = '3+ Bath';

bath_aquachicagocondos_array = new Array();
bath_aquachicagocondos_array['1'] = new Array();
bath_aquachicagocondos_array['1']['value'] = '1';
bath_aquachicagocondos_array['1']['label'] = '1 Bath';
bath_aquachicagocondos_array['2'] = new Array();
bath_aquachicagocondos_array['2']['value'] = '1.5';
bath_aquachicagocondos_array['2']['label'] = '1.5 Bath';
bath_aquachicagocondos_array['3'] = new Array();
bath_aquachicagocondos_array['3']['value'] = '2';
bath_aquachicagocondos_array['3']['label'] = '2 Bath';
bath_aquachicagocondos_array['4'] = new Array();
bath_aquachicagocondos_array['4']['value'] = '2.5';
bath_aquachicagocondos_array['4']['label'] = '2.5 Bath';
bath_aquachicagocondos_array['5'] = new Array();
bath_aquachicagocondos_array['5']['value'] = '3';
bath_aquachicagocondos_array['5']['label'] = '3 Bath';
bath_aquachicagocondos_array['6'] = new Array();
bath_aquachicagocondos_array['6']['value'] = '3.5';
bath_aquachicagocondos_array['6']['label'] = '3.5 Bath';
bath_aquachicagocondos_array['7'] = new Array();
bath_aquachicagocondos_array['7']['value'] = '4';
bath_aquachicagocondos_array['7']['label'] = '4 Bath';

bath_bentonplaceparkhomes_array = new Array();
bath_bentonplaceparkhomes_array['1'] = new Array();
bath_bentonplaceparkhomes_array['1']['value'] = '1';
bath_bentonplaceparkhomes_array['1']['label'] = '1 Bath';
bath_bentonplaceparkhomes_array['2'] = new Array();
bath_bentonplaceparkhomes_array['2']['value'] = '1.5';
bath_bentonplaceparkhomes_array['2']['label'] = '1.5 Bath';
bath_bentonplaceparkhomes_array['3'] = new Array();
bath_bentonplaceparkhomes_array['3']['value'] = '2';
bath_bentonplaceparkhomes_array['3']['label'] = '2 Bath';
bath_bentonplaceparkhomes_array['4'] = new Array();
bath_bentonplaceparkhomes_array['4']['value'] = '2.5';
bath_bentonplaceparkhomes_array['4']['label'] = '2.5 Bath';
bath_bentonplaceparkhomes_array['5'] = new Array();
bath_bentonplaceparkhomes_array['5']['value'] = '3';
bath_bentonplaceparkhomes_array['5']['label'] = '3 Bath';
bath_bentonplaceparkhomes_array['6'] = new Array();
bath_bentonplaceparkhomes_array['6']['value'] = '3.5';
bath_bentonplaceparkhomes_array['6']['label'] = '3.5 Bath';
bath_bentonplaceparkhomes_array['7'] = new Array();
bath_bentonplaceparkhomes_array['7']['value'] = '4';
bath_bentonplaceparkhomes_array['7']['label'] = '4 Bath';
bath_bentonplaceparkhomes_array['8'] = new Array();
bath_bentonplaceparkhomes_array['8']['value'] = '4.5';
bath_bentonplaceparkhomes_array['8']['label'] = '4.5 Bath';
bath_bentonplaceparkhomes_array['9'] = new Array();
bath_bentonplaceparkhomes_array['9']['value'] = '5';
bath_bentonplaceparkhomes_array['9']['label'] = '5+ Bath';

bath_content_array = new Array();
bath_content_array['1'] = new Array();
bath_content_array['1']['value'] = '1';
bath_content_array['1']['label'] = '1 Bath';
bath_content_array['2'] = new Array();
bath_content_array['2']['value'] = '2';
bath_content_array['2']['label'] = '2 Bath';


rental_sp_array = new Array();
rental_sp_array['0'] = new Array();
rental_sp_array['0']['value'] = '1200';
rental_sp_array['0']['label'] = '$1200';
rental_sp_array['1'] = new Array();
rental_sp_array['1']['value'] = '1400';
rental_sp_array['1']['label'] = '$1400';
rental_sp_array['2'] = new Array();
rental_sp_array['2']['value'] = '1600';
rental_sp_array['2']['label'] = '$1600';
rental_sp_array['3'] = new Array();
rental_sp_array['3']['value'] = '1800';
rental_sp_array['3']['label'] = '$1800';
rental_sp_array['4'] = new Array();
rental_sp_array['4']['value'] = '2000';
rental_sp_array['4']['label'] = '$2000';
rental_sp_array['5'] = new Array();
rental_sp_array['5']['value'] = '2200';
rental_sp_array['5']['label'] = '$2200';
rental_sp_array['6'] = new Array();
rental_sp_array['6']['value'] = '2400';
rental_sp_array['6']['label'] = '$2400';

rental_ep_array = new Array();
rental_ep_array['0'] = new Array();
rental_ep_array['0']['value'] = '2400';
rental_ep_array['0']['label'] = '$2400';
rental_ep_array['1'] = new Array();
rental_ep_array['1']['value'] = '2600';
rental_ep_array['1']['label'] = '$2600';
rental_ep_array['2'] = new Array();
rental_ep_array['2']['value'] = '2800';
rental_ep_array['2']['label'] = '$2800';
rental_ep_array['3'] = new Array();
rental_ep_array['3']['value'] = '3000';
rental_ep_array['3']['label'] = '$3000';
rental_ep_array['4'] = new Array();
rental_ep_array['4']['value'] = '3200';
rental_ep_array['4']['label'] = '$3200';
rental_ep_array['5'] = new Array();
rental_ep_array['5']['value'] = '3400';
rental_ep_array['5']['label'] = '$3400';
rental_ep_array['6'] = new Array();
rental_ep_array['6']['value'] = '3600';
rental_ep_array['6']['label'] = '$3600';


purch_sp_array = new Array();
purch_sp_array['0'] = new Array();
purch_sp_array['0']['value'] = '299000';
purch_sp_array['0']['label'] = '$299,000';
purch_sp_array['1'] = new Array();
purch_sp_array['1']['value'] = '600000';
purch_sp_array['1']['label'] = '$600,000';
purch_sp_array['2'] = new Array();
purch_sp_array['2']['value'] = '900000';
purch_sp_array['2']['label'] = '$900,000';
purch_sp_array['3'] = new Array();
purch_sp_array['3']['value'] = '1200000';
purch_sp_array['3']['label'] = '$1,200,000';
purch_sp_array['4'] = new Array();
purch_sp_array['4']['value'] = '1500000';
purch_sp_array['4']['label'] = '$1,500,000';
purch_sp_array['5'] = new Array();
purch_sp_array['5']['value'] = '1800000';
purch_sp_array['5']['label'] = '$1,800,000';
purch_sp_array['6'] = new Array();
purch_sp_array['6']['value'] = '2100000';
purch_sp_array['6']['label'] = '$2,100,000';
purch_sp_array['7'] = new Array();
purch_sp_array['7']['value'] = '2400000';
purch_sp_array['7']['label'] = '$2,400,000';
purch_sp_array['8'] = new Array();
purch_sp_array['8']['value'] = '2700000';
purch_sp_array['8']['label'] = '$2,700,000';

purch_sp_bentonplaceparkhomes_array = new Array();
purch_sp_bentonplaceparkhomes_array['0'] = new Array();
purch_sp_bentonplaceparkhomes_array['0']['value'] = '1200000';
purch_sp_bentonplaceparkhomes_array['0']['label'] = '$1,200,000';
purch_sp_bentonplaceparkhomes_array['1'] = new Array();
purch_sp_bentonplaceparkhomes_array['1']['value'] = '1500000';
purch_sp_bentonplaceparkhomes_array['1']['label'] = '$1,500,000';
purch_sp_bentonplaceparkhomes_array['2'] = new Array();
purch_sp_bentonplaceparkhomes_array['2']['value'] = '1800000';
purch_sp_bentonplaceparkhomes_array['2']['label'] = '$1,800,000';
purch_sp_bentonplaceparkhomes_array['3'] = new Array();
purch_sp_bentonplaceparkhomes_array['3']['value'] = '2100000';
purch_sp_bentonplaceparkhomes_array['3']['label'] = '$2,100,000';
purch_sp_bentonplaceparkhomes_array['4'] = new Array();
purch_sp_bentonplaceparkhomes_array['4']['value'] = '2400000';
purch_sp_bentonplaceparkhomes_array['4']['label'] = '$2,400,000';
purch_sp_bentonplaceparkhomes_array['5'] = new Array();
purch_sp_bentonplaceparkhomes_array['5']['value'] = '2700000';
purch_sp_bentonplaceparkhomes_array['5']['label'] = '$2,700,000';

purch_ep_bentonplaceparkhomes_array = new Array();
purch_ep_bentonplaceparkhomes_array['0'] = new Array();
purch_ep_bentonplaceparkhomes_array['0']['value'] = '1500000';
purch_ep_bentonplaceparkhomes_array['0']['label'] = '$1,500,000';
purch_ep_bentonplaceparkhomes_array['1'] = new Array();
purch_ep_bentonplaceparkhomes_array['1']['value'] = '1800000';
purch_ep_bentonplaceparkhomes_array['1']['label'] = '$1,800,000';
purch_ep_bentonplaceparkhomes_array['2'] = new Array();
purch_ep_bentonplaceparkhomes_array['2']['value'] = '2100000';
purch_ep_bentonplaceparkhomes_array['2']['label'] = '$2,100,000';
purch_ep_bentonplaceparkhomes_array['3'] = new Array();
purch_ep_bentonplaceparkhomes_array['3']['value'] = '2400000';
purch_ep_bentonplaceparkhomes_array['3']['label'] = '$2,400,000';
purch_ep_bentonplaceparkhomes_array['4'] = new Array();
purch_ep_bentonplaceparkhomes_array['4']['value'] = '2700000';
purch_ep_bentonplaceparkhomes_array['4']['label'] = '$2,700,000';
purch_ep_bentonplaceparkhomes_array['5'] = new Array();
purch_ep_bentonplaceparkhomes_array['5']['value'] = '3000000';
purch_ep_bentonplaceparkhomes_array['5']['label'] = '$3,000,000';

purch_ep_array = new Array();
purch_ep_array['0'] = new Array();
purch_ep_array['0']['value'] = '600000';
purch_ep_array['0']['label'] = '$600,000';
purch_ep_array['1'] = new Array();
purch_ep_array['1']['value'] = '900000';
purch_ep_array['1']['label'] = '$900,000';
purch_ep_array['2'] = new Array();
purch_ep_array['2']['value'] = '1200000';
purch_ep_array['2']['label'] = '$1,200,000';
purch_ep_array['3'] = new Array();
purch_ep_array['3']['value'] = '1500000';
purch_ep_array['3']['label'] = '$1,500,000';
purch_ep_array['4'] = new Array();
purch_ep_array['4']['value'] = '1800000';
purch_ep_array['4']['label'] = '$1,800,000';
purch_ep_array['5'] = new Array();
purch_ep_array['5']['value'] = '2100000';
purch_ep_array['5']['label'] = '$2,100,000';
purch_ep_array['6'] = new Array();
purch_ep_array['6']['value'] = '2400000';
purch_ep_array['6']['label'] = '$2,400,000';
purch_ep_array['7'] = new Array();
purch_ep_array['7']['value'] = '2700000';
purch_ep_array['7']['label'] = '$2,700,000';
purch_ep_array['8'] = new Array();
purch_ep_array['8']['value'] = '3000000';
purch_ep_array['8']['label'] = '$3,000,000';

function removeAllOptions(selectbox)
{
	var i;
	if(selectbox){
		for(i=selectbox.options.length-1;i>=0;i--)
		{
			selectbox.remove(i);
		}
	}
}

function set_prices(formid){
var browser = navigator.appName;
if(browser == 'Microsoft Internet Explorer'){
}else{
	//alert(formid);
	var query_type = '';

	var thisform = document.getElementById(formid);
	for(i in thisform.elements){
		var thiselement = thisform.elements[i];
		if(typeof(thiselement) == 'object'){
			
		
			var thisrel = thiselement.getAttribute('rel');
			
			
			if(thisrel == 'rsp'){
				query_type = 'rental';
				var rsp = thiselement;
			}
			if(thisrel == 'rep'){
				query_type = 'rental';
				var rep = thiselement;
			}
			if(thisrel == 'psp'){
				query_type = 'purch';
				var psp = thiselement;
			}
			if(thisrel == 'pep'){
				query_type = 'purch';
				var pep = thiselement;
			}
		}
	}
	//alert(query_type);
	if(query_type == 'rental'){
		if(parseInt(rsp.value) > parseInt(rep.value)){
			rsp.selectedIndex = rep.selectedIndex;
		}
	}
	if(query_type == 'purch'){
		//alert(psp.value);
		//alert(pep.value);
		if(parseInt(psp.value) > parseInt(pep.value)){
			//alert(pep.selectedIndex);
			psp.selectedIndex = pep.selectedIndex;
		}
	}
}
}

function sf_redir(formid,boxname,hasrentsale){

	if(!boxname){
		box = 0;
	}else{
		box = document.getElementById(boxname).value;
	}
	if(!hasrentsale){
		hasrentsale = 0;
	}
	
	var query_string = '';
	var num_strings = 0;

	var form = document.getElementById(formid);
	for(i in form.elements){
		var thiselement = form.elements[i];
		if(typeof(thiselement) == 'object' && thiselement != null){
			//alert(thiselement.id);
			var browser = navigator.appName;
			if(browser == 'Microsoft Internet Explorer'){
				
					try{
						var thisrel = thiselement.rel;
					}
					catch(error){
						//var thisrel = 'submit_to';
						var thisrel = thiselement.getAttribute('rel');
					}
				
			}else{
				var thisrel = thiselement.getAttribute('rel');
			}
		
			if(thisrel == 'submit_to'){
				if(hasrentsale == 0){
					var submitto = thiselement.value;
				}else{
					if(box == 'box1'){
						if(thiselement.id == 'sale_dev'){
							var submitto = thiselement.value;
						}
					}
					if(box == 'box2'){
						if(thiselement.id == 'rent_dev'){
							var submitto = thiselement.value;
						}
					}
				}
			}
			if(thisrel == 'beds'){
				if(num_strings == 0){
					query_string += '?bed=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&bed=' + thiselement.value;
				}
			}
			if(thisrel == 'bath'){
				if(num_strings == 0){
					query_string += '?bath=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&bath=' + thiselement.value;
				}
			}
			if(thisrel == 'rsp'){
				if(num_strings == 0){
					query_string += '?sp=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&sp=' + thiselement.value;
				}
			}
			if(thisrel == 'rep'){
				if(num_strings == 0){
					query_string += '?ep=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&ep=' + thiselement.value;
				}
			}
			if(thisrel == 'psp'){
				if(num_strings == 0){
					query_string += '?sp=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&sp=' + thiselement.value;
				}
			}
			if(thisrel == 'pep'){
				if(num_strings == 0){
					query_string += '?ep=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&ep=' + thiselement.value;
				}
			}
		}
	}
	
	if(typeof(submitto) !== 'undefined' && submitto != null) {
	
		var url = 'http://www.magellandevelopment.com/' + submitto + '/floorplans/' + query_string;
		//alert(url);
		window.location = url;
	
	}else{
	
		//need to get location to submit to
		var box1disp = document.getElementById("box1").style.display;
		var box2disp = document.getElementById("box2").style.display;
		
		if(box1disp == 'none'){
			box = 'box2';
		}else{
			box = 'box1';
		}
		
		if(box == 'box1'){
			var submitto = document.getElementById('sale_dev').value;
		}
		if(box == 'box2'){
			var submitto = document.getElementById('rent_dev').value;
		}
		
		var url = 'http://www.magellandevelopment.com/' + submitto + '/floorplans/' + query_string;
		//alert(url);
		window.location = url;
	
	}

}


function sf_redirx(formid,boxname,hasrentsale){

	if(!boxname){
		box = 0;
	}else{
		box = document.getElementById(boxname).value;
	}
	if(!hasrentsale){
		hasrentsale = 0;
	}
	
	var query_string = '';
	var num_strings = 0;

	var form = document.getElementById(formid);
	for(i in form.elements){
		var thiselement = form.elements[i];
		if(typeof(thiselement) == 'object'){
			var browser = navigator.appName;
			if(browser == 'Microsoft Internet Explorer'){
				var thisrel = thiselement.rel;
			}else{
				var thisrel = thiselement.getAttribute('rel');
			}
			
			if(thisrel == 'submit_to'){
				if(hasrentsale == 0){
					var submitto = thiselement.value;
				}else{
					if(box == 'box1'){
						if(thiselement.id == 'sale_dev'){
							var submitto = thiselement.value;
						}
					}
					if(box == 'box2'){
						if(thiselement.id == 'rent_dev'){
							var submitto = thiselement.value;
						}
					}
				}
			}
			if(thisrel == 'beds'){
				if(num_strings == 0){
					query_string += '?bed=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&bed=' + thiselement.value;
				}
			}
			if(thisrel == 'bath'){
				if(num_strings == 0){
					query_string += '?bath=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&bath=' + thiselement.value;
				}
			}
			if(thisrel == 'rsp'){
				if(num_strings == 0){
					query_string += '?sp=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&sp=' + thiselement.value;
				}
			}
			if(thisrel == 'rep'){
				if(num_strings == 0){
					query_string += '?ep=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&ep=' + thiselement.value;
				}
			}
			if(thisrel == 'psp'){
				if(num_strings == 0){
					query_string += '?sp=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&sp=' + thiselement.value;
				}
			}
			if(thisrel == 'pep'){
				if(num_strings == 0){
					query_string += '?ep=' + thiselement.value;
					num_strings++;
				}else{
					query_string += '&ep=' + thiselement.value;
				}
			}
		}
	}
	
	var url = query_string;
	//alert(url);
	window.location = url;

}

function reload_dd(){
		//alert('reloading');
		var choice = document.getElementById("thechoices").value;
		var startselect = document.getElementById("ssp");
		var endselect = document.getElementById("sep");
		var beds = document.getElementById("bed");
		var bath = document.getElementById("bath");
		removeAllOptions(startselect);
		removeAllOptions(endselect);
		removeAllOptions(beds);
		removeAllOptions(bath);
		//alert(choice);
		if(startselect && endselect){
			if(choice == 'box1'){
				startselect.setAttribute('rel','psp');
				endselect.setAttribute('rel','pep');
			}
			if(choice == 'box2'){
				startselect.setAttribute('rel','rsp');
				endselect.setAttribute('rel','rep');
			}
		}
		init_dd('','','','');
}



function init_dd(bed,bath,start,end){
	//alert('running init');
	var sale_rent = document.getElementById("thechoices").value;
	if(sale_rent == 'box1'){
		var prop = document.getElementById("sale_dev").value;
	}else{
		var prop = document.getElementById("rent_dev").value;
	}
	var bed_array = document.getElementsByTagName("SELECT");
	for(x in bed_array){
		var bed_drop = bed_array[x];
		if(typeof(bed_drop) == 'object'){
		var browser = navigator.appName;
		if(browser == 'Microsoft Internet Explorer'){
			var thisrel = bed_drop.rel;
		}else{
			var thisrel = bed_drop.getAttribute("rel");
		}
			//alert(thisrel);
			if(thisrel == 'beds'){
				switch(prop){
				case 'bentonplaceparkhomes':
					var thisbed_array = bed_bentonplaceparkhomes_array;
				break;
				case 'aquachicagocondos':
					var thisbed_array = bed_aquachicagocondos_array;
				break;
				case 'aquaparkhomes':
					var thisbed_array = bed_aquaparkhomes_array;
				break;
				default:
					var thisbed_array = bed_content_array;
				}
				//for(z in bed_content_array){
				for(z in thisbed_array){
					var thisoption = document.createElement("OPTION");
					var thistextnode = document.createTextNode(thisbed_array[z]['label']);
					thisoption.value = thisbed_array[z]['value'];
					thisoption.appendChild(thistextnode);
					bed_drop.appendChild(thisoption);
					if(bed != '' && bed == thisoption.value){
						thisoption.setAttribute('selected','selected');
					}
				}
			}
			if(thisrel == 'bath'){
				switch(prop){
				case 'bentonplaceparkhomes':
					var thisbath_array = bath_bentonplaceparkhomes_array;
				break;
				case 'aquachicagocondos':
					var thisbath_array = bath_aquachicagocondos_array;
				break;
				case 'aquaparkhomes':
					var thisbath_array = bath_aquaparkhomes_array;
				break;
				default:
					var thisbath_array = bath_content_array;
				}
				for(z in thisbath_array){
					var thisoption = document.createElement("OPTION");
					var thistextnode = document.createTextNode(thisbath_array[z]['label']);
					thisoption.value = thisbath_array[z]['value'];
					thisoption.appendChild(thistextnode);
					bed_drop.appendChild(thisoption);
					if(bath != '' && bath == thisoption.value){
						thisoption.setAttribute('selected','selected');
					}
				}
			}
			if(thisrel == 'rsp'){
				for(z in rental_sp_array){
					var thisoption = document.createElement("OPTION");
					var thistextnode = document.createTextNode(rental_sp_array[z]['label']);
					thisoption.value = rental_sp_array[z]['value'];
					thisoption.appendChild(thistextnode);
					bed_drop.appendChild(thisoption);
					if(start != '' && start == thisoption.value){
						thisoption.setAttribute('selected','selected');
					}
				}
			}
			if(thisrel == 'rep'){
				for(z in rental_ep_array){
					var thisoption = document.createElement("OPTION");
					var thistextnode = document.createTextNode(rental_ep_array[z]['label']);
					thisoption.value = rental_ep_array[z]['value'];
					thisoption.appendChild(thistextnode);
					bed_drop.appendChild(thisoption);
					if(end != '' && end == thisoption.value){
						thisoption.setAttribute('selected','selected');
					}
					if(end == '' && rental_ep_array[z]['value'] == '4000'){
						thisoption.setAttribute('selected','selected');
					}
					
				}
			}
			if(thisrel == 'psp'){
				switch(prop){
				case 'bentonplaceparkhomes':
					var thispurchsp_array = purch_sp_bentonplaceparkhomes_array;
				break;
				default:
					var thispurchsp_array = purch_sp_array;
				}
				for(z in thispurchsp_array){
					var thisoption = document.createElement("OPTION");
					var thistextnode = document.createTextNode(thispurchsp_array[z]['label']);
					thisoption.value = thispurchsp_array[z]['value'];
					thisoption.appendChild(thistextnode);
					bed_drop.appendChild(thisoption);
					if(start != '' && start == thisoption.value){
						thisoption.setAttribute('selected','selected');
					}
				}
			}
			if(thisrel == 'pep'){
				switch(prop){
				case 'bentonplaceparkhomes':
					var thispurchep_array = purch_ep_bentonplaceparkhomes_array;
				break;
				default:
					var thispurchep_array = purch_ep_array;
				}
				for(z in thispurchep_array){
					var thisoption = document.createElement("OPTION");
					var thistextnode = document.createTextNode(thispurchep_array[z]['label']);
					thisoption.value = thispurchep_array[z]['value'];
					thisoption.appendChild(thistextnode);
					bed_drop.appendChild(thisoption);
					if(end != '' && end == thisoption.value){
						thisoption.setAttribute('selected','selected');
					}
					if(end == '' && thispurchep_array[z]['value'] == '3000000'){
						thisoption.setAttribute('selected','selected');
					}
				}
			}
		}
	}	
}
