function headerDate()
{
	var months=new Array(13);
		months[1]="January";
		months[2]="February";
		months[3]="March";
		months[4]="April";
		months[5]="May";
		months[6]="June";
		months[7]="July";
		months[8]="August";
		months[9]="September";
		months[10]="October";
		months[11]="November";
		months[12]="December";
				
		var time=new Date();
		var lmonth=months[time.getMonth() + 1];
		var date=time.getDate();
		var year=time.getFullYear();
				
		document.write('<p>' + lmonth + " ");
		document.write(date + ", " + year + "</p>");
}

function randomBanner() 
{ 
upper_limit=6;
var ID;
ID=Math.round(upper_limit * Math.random()); 
document.write('<object type="application/x-shockwave-flash" data="http://www.wentworthestateagents.co.uk/flash_files/pic_anim_4.swf?pageID='+ID+'" width="570" height="119"><param name="movie" value="http://www.wentworthestateagents.co.uk/flash_files/pic_anim_4.swf?pageID='+ID+'" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /></object>')
}

function greeting()
{
	helixtime = new Date()
	hrstime = helixtime.getHours()
					
		if (hrstime < 7)
		{document.write('<h2 class="body_title">An EARLY Good Morning and Welcome to WentWorth Estate Agents</h2>')}
		if (hrstime > 6 && hrstime <12)
		{document.write('<h2 class="body_title">Good Morning and Welcome to WentWorth Estate Agents</h2>')}
		if (hrstime > 11 && hrstime <18)
		{document.write('<h2 class="body_title">Good Afternoon and Welcome to WentWorth Estate Agents</h2>')}
		if (hrstime >17)
		{document.write('<h2 class="body_title">Good Evening and Welcome to WentWorth Estate Agents</h2>')}
}

function EvalSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Stop();
  thissound.Play();
}

function soundStop(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Stop();
}	

function regForm_validate() {
	var formname = window.document.forms.regForm;
		
		if (!formname.Enq_type[0].checked && !formname.Enq_type[1].checked)
		{
			alert("Please indicate the purpose of your enquiry");
			formname.Enq_type[0].focus();
			return;
		}
			
		if (formname.Title.value == "Not Selected"){
			alert("Please select your title");
			formname.Title.focus();
			return;
		}
		if (formname.Title.value == "Other" && formname.Other_title.value == ""){
			alert("Please fill in your 'other' title");
			formname.Other_title.focus();
			return;
		}
		if (formname.Last_name.value == ""){
			alert("Please fill in your surname");
			formname.Last_name.focus();
			return;
		}
		if (formname.Home_tel.value == "" && formname.Work_tel.value == "" && formname.Mobile.value == ""){
			alert("Please enter a contact telephone number");
			formname.Home_tel.focus();
			return;
		}
		if (formname.Email.value.indexOf('@') == -1 || formname.Email.value.indexOf('.') == -1) {
			alert('Please enter a valid email address');
			formname.Email.focus();
			return;
		}
		
		if (formname.Mobile.value != "" && (!formname.SMS_request[0].checked && !formname.SMS_request[1].checked)){
			alert('You have provided a mobile phone number. \nMay we send you information via SMS messaging?');
			formname.SMS_request[0].focus();
			return;
		}
		if (formname.Mobile.value == "" && formname.SMS_request[0].checked){
			alert('You have requested information via SMS messaging, \nplease enter a mobile telephone number');
			formname.Mobile.focus();
			return;
		}
		
		
		if (formname.Enq_type[0].checked && formname.Property_type.value == ""){
			alert("You have made a property sales enquiry. \nPlease choose a property type");
			formname.Property_type.focus();
			return;
		}
		if (formname.Enq_type[0].checked && formname.Minimum_beds.value == ""){
			alert("You have made a property sales enquiry. \nPlease specify minimum number of beds required");
			formname.Minimum_beds.focus();
			return;
		}
		if (formname.Enq_type[0].checked && formname.Price_range_from.value == "£"){
			alert("You have made a property sales enquiry. \nPlease specify a minimum price");
			formname.Price_range_from.focus();
			return;
		}
		if (formname.Enq_type[0].checked && formname.Price_range_to.value == "£"){
			alert("You have made a property sales enquiry. \nPlease specify a maximum price");
			formname.Price_range_to.focus();
			return;
		}
		
		var counter = 0;
		for (i=0;i<=7;i++){
			if (formname.Areas_of_interest[i].checked)
			{
				counter++;
			}
		}
		if (formname.Enq_type[0].checked && counter == 0){
			alert('You have made a property sales enquiry. \nPlease select an area(s) of interest');
			formname.Areas_of_interest[0].focus();
			return;
		}
		if (!formname.Property_to_sell[0].checked && !formname.Property_to_sell[1].checked) {
			alert('Do you have a property to sell?');
			formname.Property_to_sell[0].focus();
			return;
		}
		if (formname.Property_to_sell[0].checked && (!formname.Sale_agreed[0].checked && !formname.Sale_agreed[1].checked)) {
			alert('You have indicated you have a property to sell. \nPlease indicate whether a sale has been agreed');
			formname.Sale_agreed[0].focus();
			return;
		}
		
	formname.submit();
}
