function refreshForm(){
	window.document.getElementById("toBuy").style.visibility='visible';
	window.document.getElementById("toLet").style.visibility='hidden';
	window.document.getElementById("lreg").name='';
	window.document.getElementById("sreg").name='';
	window.document.getElementById("lp").name='';
}

function validate() {
		if ( regForm.firstName.value.length < 1 ) {
			alert('Please enter your First Name');
			regForm.firstName.focus();
			return false;
		} else if ( regForm.surname.value.length < 1 ){
			alert('Please enter your Surame');
			regForm.surname.focus();
			return false;
		} else if ( regForm.telephone.value.length < 1 ){
			alert('Please enter your Surame');
			regForm.telephone.focus();
			return false;
		} else if ( regForm._fromaddr.value.indexOf('@') == -1 ||regForm._fromaddr.value.indexOf('.') == -1) {
			alert('Please enter a valid E-mail address');
			regForm._fromaddr.focus();
			return false;
		} else {
			return true;				
		}
	}

function changeToSales() {
		if ( window.document.getElementById("sreg").checked == true ){
		window.document.getElementById("lreg").checked=false;
		window.document.getElementById("toBuy").style.visibility='visible';
		window.document.getElementById("toLet").style.visibility='hidden';
		
		window.document.getElementById("bp").name='Buying Position';
		window.document.getElementById("lp").name='';
		window.document.getElementById("lp").selectedIndex=0;
		
		
		window.document.forms.regForm._recipients.value='sales@spencerknight.co.uk';
		window.document.forms.regForm._subject.value='Spencer Knight on-line sales mailing list';
		window.document.forms.regForm._redirect.value='http://www.spencerknight.co.uk/thanks.php';
		changeForm();
		}
	}
function changeToLet() {
		if ( window.document.getElementById("lreg").checked == true ){
		window.document.getElementById("sreg").checked=false;
		window.document.getElementById("toBuy").style.visibility='hidden';
		window.document.getElementById("toLet").style.visibility='visible';	

		window.document.getElementById("lp").name='When are you looking to rent?';
		window.document.getElementById("bp").name='';
		window.document.getElementById("bp").selectedIndex=0;

		//alert(window.document.getElementById("bp").name);
		//alert(window.document.getElementById("bp").selectedIndex);
		
		window.document.forms.regForm._recipients.value='lettings@spencerknight.co.uk';
		window.document.forms.regForm._subject.value='Spencer Knight on-line lettings mailing list';
		window.document.forms.regForm._redirect.value='http://www.spencerknight.co.uk/thanks.php';
		changeForm();
		}
	}
	
//arrays for min price	
// option text
var secondBox = new Array(
          new Array("£10,000","£20,000","£30,000","£40,000","£50,000","£60,000","£70,000","£80,000","£90,000","£100,000", "£110,000", "£120,000", "£130,000","£140,000", "£150,000","£160,000","£170,000","£180,000","£190,000","£200,000", "£220,000", "£240,000","£260,000","£280,000","£300,000","£320,000", "£340,000","£360,000","£380,000", "£400,000", "£420,000", "£440,000", "£460,000", "£480,000", "£500,000", "£550,000", "£600,000", "£650,000", "£700,000", "£750,000", "£800,000", "£850,000", "£900,000", "£1,000,000"), /* options for second combo when Option 1  selected in the first combo*/
          new Array("£150 pcm","£160 pcm","£170 pcm","£180 pcm","£190 pcm","£200 pcm","£210 pcm","£220 pcm","£230 pcm","£240 pcm","£250 pcm","£260 pcm","£270 pcm","£280 pcm","£290 pcm","£300 pcm","£320 pcm","£340 pcm","£360 pcm","£380 pcm","£400 pcm","£420 pcm","£440 pcm","£460 pcm","£480 pcm","£500 pcm", "£550 pcm", "£600 pcm", "£650 pcm", "£700 pcm", "£750 pcm", "£800 pcm", "£900 pcm", "£1000 pcm", "£1100 pcm", "£1200 pcm", "£1300 pcm", "£1400 pcm", "£1500 pcm", "£1750 pcm", "£2000 pcm", "£2250 pcm", "£2500 pcm", "£2750 pcm") /* options for second combo when Option 2  selected in the first combo*/);
// option values
var secondBox1 = new Array(
          new Array("10000","20000","30000","40000","50000","60000","70000","80000","90000","100000", "110000", "120000", "130000","140000", "150000","160000","170000","180000","190000","200000", "220000", "240000","260000","280000","300000","320000", "340000","360000","380000", "400000", "420000", "440000", "460000", "480000", "500000", "550000", "600000", "650000", "700000", "750000", "800000", "850000", "900000", "1000000"), /* options for second combo when Option 1  selected in the first combo*/
          new Array("150","160","170","180","190","200","210","220","230","240","250","260","270","280","290","300","320","340","360","380","400","420","440","460","480","500", "550", "600", "650", "700", "750", "800", "900", "1000", "1100", "1200", "1300", "1400", "1500", "1750", "2000", "2250", "2500", "2750") /* options for second combo when Option 2  selected in the first combo*/);

//arrays for max price
// option text
var thirdBox = new Array(
          new Array("£20,000","£30,000","£40,000","£50,000","£60,000","£70,000","£80,000","£90,000","£100,000", "£110,000", "£120,000", "£130,000","£140,000", "£150,000","£160,000","£170,000","£180,000","£190,000","£200,000", "£220,000", "£240,000","£260,000","£280,000","£300,000","£320,000", "£340,000","£360,000","£380,000", "£400,000", "£420,000", "£440,000", "£460,000", "£480,000", "£500,000", "£550,000", "£600,000", "£650,000", "£700,000", "£750,000", "£800,000", "£850,000", "£900,000", "£1,000,000", "£2,000,000"), /* options for second combo when Option 1  selected in the first combo*/
          new Array("£160 pcm","£170 pcm","£180 pcm","£190 pcm","£200 pcm","£210 pcm","£220 pcm","£230 pcm","£240 pcm","£250 pcm","£260 pcm","£270 pcm","£280 pcm","£290 pcm","£300 pcm","£320 pcm","£340 pcm","£360 pcm","£380 pcm","£400 pcm","£420 pcm","£440 pcm","£460 pcm","£480 pcm","£500 pcm", "£550 pcm", "£600 pcm", "£650 pcm", "£700 pcm", "£750 pcm", "£800 pcm", "£900 pcm", "£1000 pcm", "£1100 pcm", "£1200 pcm", "£1300 pcm", "£1400 pcm", "£1500 pcm", "£1750 pcm", "£2000 pcm", "£2250 pcm", "£2500 pcm", "£2750 pcm", "£3000 pcm") /* options for second combo when Option 2  selected in the first combo*/);
// option values
var thirdBox1 = new Array(
          new Array("20000","30000","40000","50000","60000","70000","80000","90000","100000", "110000", "120000", "130000","140000", "150000","160000","170000","180000","190000","200000", "220000", "240000","260000","280000","300000","320000", "340000","360000","380000", "400000", "420000", "440000", "460000", "480000", "500000", "550000", "600000", "650000", "700000", "750000", "800000", "850000", "900000", "1000000","2000000"), /* options for second combo when Option 1  selected in the first combo*/
          new Array("160","170","180","190","200","210","220","230","240","250","260","270","280","290","300","320","340","360","380","400","420","440","460","480","500", "550", "600", "650", "700", "750", "800", "900", "1000", "1100", "1200", "1300", "1400", "1500", "1750", "2000", "2250", "2500", "2750","3000") /* options for second combo when Option 2  selected in the first combo*/);

var theApprBox = new Array(
			new Array("I would like a Sales Valuation","Not Required"),
			new Array("I would like a Lettings Appraisal","Not Required"));
var theApprBox2 = new Array(
			new Array("I would like a Sales Valuation","Not Required"),
			new Array("I would like a Lettings Appraisal","Not Required"));

function changeForm()
{ 
if(window.document.getElementById("sreg").checked==true){
	var index = 0;
	}else if(window.document.getElementById("lreg").checked==true){
	var index = 1;
	}

		appraisalBox_values = theApprBox[index];
		theappraisalBox_values = theApprBox2[index];
		for (i = 0; i<appraisalBox_values.length; i++)
		 {
		document.forms.regForm.requestAssessmentType[i] = new Option (appraisalBox_values[i], theappraisalBox_values[i]);
		 }
	
         values = secondBox[index];
	     thevalues = secondBox1[index];
		 for (i = 0; i<values.length; i++)
		 {
		document.forms.regForm.minPrice[i] = new Option (values[i], thevalues[i]);
		 }

		 values2 = thirdBox[index];
		 thevalues2 = thirdBox1[index];
		 for (i = 0; i<values2.length; i++)
		 {
		document.forms.regForm.maxPrice[i] = new Option (values2[i], thevalues2[i]);
		 }
		document.forms.regForm.maxPrice.selectedIndex=values2.length-1
	 }