// option text Minimum Price -  What the user sees
var minPriceOps = new Array(
          new Array("£0","£25000","£50000","£75000","£100000","£125000","£150000","£175000","£200000","£225000","£250000","£300000","£400000","£500000","£600000","£700000","£800000","£900000","£1000000","£3000000","£5000000"), /* sales category */
          new Array("£0","£200 pcm","£250 pcm","£300 pcm","£350 pcm","£400 pcm","£450 pcm","£500 pcm","£550 pcm","£600 pcm","£650 pcm","£700 pcm","£750 pcm","£800 pcm","£850 pcm","£900 pcm","£1000 pcm","£1100 pcm","£1200 pcm") /* lettings category */);
// option values Minimum Price -  What is processed
var minPriceVals = new Array(
          new Array("0","25000","50000","75000","100000","125000","150000","175000","200000","225000","250000","300000","400000","500000","600000","700000","800000","900000","1000000","3000000","5000000"), /* sales category */
          new Array("0","200","250","300","350","400","450","500","550","600","650","700","750","800","850","900","1000","1100","1200") /* lettings category */);


// option text Maximum Price -  What the user sees
var maxPriceOps = new Array(
          new Array("£25000","£50000","£75000","£100000","£125000","£150000","£175000","£200000","£225000","£250000","£300000","£400000","£500000","£600000","£700000","£800000","£900000","£1000000","£3000000","£5000000","£6000000+"), /* sales category */
          new Array("£250 pcm","£300 pcm","£350 pcm","£400 pcm","£450 pcm","£500 pcm","£550 pcm","£600 pcm","£650 pcm","£700 pcm","£750 pcm","£800 pcm","£850 pcm","£900 pcm","£1000 pcm","£1100 pcm","£1200 pcm","£1500 pcm","£2000 pcm") /* lettings category */);
// option values Maximum Price -  What is processed
var maxPriceVals = new Array(
          new Array("25000","50000","75000","100000","125000","150000","175000","200000","225000","250000","300000","400000","500000","600000","700000","800000","900000","1000000","3000000","5000000","6000000+"), /* sales category */
          new Array("250","300","350","400","450","500","550","600","650","700","750","800","850","900","1000","1100","1200","1500","2000") /* lettings category */);

// option text 
var areaOps = new Array("All Areas", "BD1", "BD2", "BD3", "BD4", "BD5", "BD6", "BD7", "BD8", "BD9", "BD10", "BD11", "BD12", "BD13", "BD14", "BD15", "BD16", "BD17", "BD18", "BD19","LS28");
// option values
var areaVals = new Array("", "BD1", "BD2", "BD3", "BD4", "BD5", "BD6", "BD7", "BD8", "BD9", "BD10", "BD11", "BD12", "BD13", "BD14", "BD15", "BD16", "BD17", "BD18", "BD19","LS28");

// option text
var TypeOps = new Array("All Types", "Apartment / Flat", "Detached Bungalow", "Detached House", "Semi - Detached House","Terrace House", "Town House");
// option values
var TypeVals = new Array("", "'Apartment / Flat'", "'Detached Bungalow'", "'Detached House'", "'Semi - Detached House'","'Terrace House'", "'Town House'");

// ------------------------------------------------------------------
// ------------------ dynamic select menus ------------------------

function createMenu(theMenuType){
var index,i,theMenuArray_op,theMenuArray_val,selectOp,selectVal,theareaOps,theareaVals;

	if (document.myform.category[0].checked==true){index=0;}else{index=1;}

		if (theMenuType=='alo'){
		theMenuArray_op=areaOps;
		theMenuArray_val=areaVals;
		}
		if (theMenuType=='lop'){
		theMenuArray_op=minPriceOps[index];
		theMenuArray_val=minPriceVals[index];
		}
		if (theMenuType=='hip'){
		theMenuArray_op=maxPriceOps[index];
		theMenuArray_val=maxPriceVals[index];
		}
		if (theMenuType=='typ'){
		theMenuArray_op=TypeOps;
		theMenuArray_val=TypeVals;
		}
		for(i=0;i<theMenuArray_op.length;i++){
		selectOp=theMenuArray_op[i];
		selectVal=theMenuArray_val[i];
		document.write('<option value="' + selectVal + '">' + selectOp + '</option>');
		}
}
//-------------------------------------------------------------------

function changeForm()
{
var i,index,theminPriceOps,theminPriceVals,themaxPriceOps,themaxPriceVals,theTypeOps,theTypeVals;

	if (document.myform.category[0].checked==true){index=0;}else{index=1;}

		 theminPriceOps = minPriceOps[index];
		 theminPriceVals = minPriceVals[index];
		document.forms.myform.lop.options.length=theminPriceOps.length-1;
		 for (i = 0; i<theminPriceOps.length; i++)
		 {
		 document.myform.lop[i] = new Option (theminPriceOps[i], theminPriceVals[i]);
		 }
		
		 themaxPriceOps = maxPriceOps[index];
		 themaxPriceVals = maxPriceVals[index];
		document.forms.myform.hip.options.length=themaxPriceOps.length-1;
		 for (i = 0; i<themaxPriceOps.length; i++)
		{
		
		document.myform.hip[i] = new Option (themaxPriceOps[i], themaxPriceVals[i]);
		 }
		document.forms.myform.hip.options.selectedIndex=themaxPriceOps.length-1
		
		
		 if (index==0)
		 {document.myform.dbt.value='1'}
		 if (index==1)
		 {document.myform.dbt.value='2'}
}

// resets the select menus to default buy values
function refreshSelects(){
	document.myform.category[0].checked=true;
	document.getElementById("alo").selectedIndex=0;
	document.getElementById("typ").selectedIndex=0;
	document.getElementById("lop").selectedIndex=0;
	document.getElementById("hip").selectedIndex=10;
	document.getElementById("bed").selectedIndex=0;
	document.myform.dbt.value=1;

changeForm();
}

//function whatVariables(){
//document.write(

//	"category= " + document.forms.myform.category.value + ", " +
//	"typ= " + document.getElementById("typ").value + ", " +
//	"lop= " + document.getElementById("lop").value + ", " +
//	"hip= " + document.getElementById("hip").value + ", " +
//	"bed= " + document.getElementById("bed").value + ", " +
//	"dbt= " + document.myform.dbt.value


//);
//}







