
function validate_required(field)	{
	with (field)	{
	  if (value==null||value=="")	{
			return false;
		}  else	{
			return true;
		}
	  }
}

function validate_email(field)	{
	with (field)	{
	  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value))	{
			return true;
		}  else	{
			return false;
		}
	  }
}




function validate_form(thisform){

	var formValid = true;
	
	with (thisform)	{ 
	
		if (validate_required(firstname) == false){
			firstname.style.backgroundColor = '#9F9';
			var obj = document.getElementById('indicator1');
			obj.style.display = 'inline';
			 formValid = false;
		 }  else {
			 firstname.style.backgroundColor = '#ffffff';
			 var obj = document.getElementById('indicator1');
			obj.style.display = 'none';
		 }
		 
		 if (validate_required(lastname) == false){ 
		 	lastname.style.backgroundColor = '#9F9';
			var obj = document.getElementById('indicator2');
			obj.style.display = 'inline';
			 formValid = false;
		}   else {
			lastname.style.backgroundColor = '#ffffff';
			 var obj = document.getElementById('indicator2');
			obj.style.display = 'none';
		 }

		if (validate_email(emailaddress) == false){ 
			emailaddress.style.backgroundColor = '#9F9';
			var obj = document.getElementById('indicator3');
			obj.style.display = 'inline';
			 formValid = false;
		}  else {
			emailaddress.style.backgroundColor = '#ffffff';
			 var obj = document.getElementById('indicator3');
			obj.style.display = 'none';
		 }

		if (timeslotCombo.value == "" || timeslotCombo.value == null || timeslotCombo.value == 0){ 
			timeslotCombo.style.backgroundColor = '#9F9';
			var obj = document.getElementById('indicator4');
			obj.style.display = 'inline';
			 formValid = false;
		 }   else {
			 timeslotCombo.style.backgroundColor = '#ffffff';
			 var obj = document.getElementById('indicator4');
			obj.style.display = 'none';
		 }
		 
  	}

	
	if (formValid){
		return true; 
	} else {
		return false;
	}
	
	
	
}






