//form  validation for netscape 6.0 and i.e 5.0x and greater
//chris collinge 2002

//cache in image for required fields

var one = new Image(8,8);
one.src="images/redstar.gif";

// store customer inputs in array
function validateinfo()
{
 var complete=true;
 var form_element = new Array();
 form_element[0]=document.customer.name.value;
 form_element[1]=document.customer.address1.value;
 //form_element[2]=document.customer.address2.value;
 form_element[3]=document.customer.city.value;
 //form_element[4]=document.customer.county.value;
 form_element[5]=document.customer.postcode.value;
 form_element[6]=document.customer.email.value;
 form_element[7]=document.customer.phone.value;


//get the length of the array
var max = form_element.length;

//loop through the array to see what is missing in the fields. for instance a blank input box
for(i=0;i<max;i++)
{
	switch (form_element[i])	
	{
		case "":

		document.getElementById(i).childNodes[0].setAttribute("src","images/redstar.gif");
		document.getElementById("required").childNodes[0].data="required fields = *";
		complete=false;
		break;
		
		default:
		document.getElementById(i).childNodes[0].setAttribute("src","images/transparent.gif");
	   
	}
	
}


if(complete==false)
{

//return false if form is not complete otherwise return true and submit the form.
return complete;
}
}

function displaydate()
{

//create a new date object
var d=new Date();

//store text days of the week and months in an array 
	var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	
	//build up a string to display the date
	var mydate=(" " + weekday[d.getDay()] + " ");
	mydate+=(d.getDate() + ". ");
	mydate+=(monthname[d.getMonth()] + " ");
	mydate+=(d.getFullYear());
	return mydate;

	// return the date string to display the form.

}

