// Validate Form
function checkQuickContactForm(){

	var errorMsg = "";
	var errorMsgLong = "";

	//Check for a Full Name
	if (document.quickContactForm.txtUserFullname.value == ""){
		errorMsg += "\n\tName \t\t- Please enter your Name";
		document.quickContactForm.txtUserFullname.className = "formValidateErrorTextBoxStyle";
	}


	//Check for a Phone
	if (document.quickContactForm.txtUserPhone.value == ""){
		errorMsg += "\n\tPhone \t\t- Please enter your Phone or Mobile";
		document.csquickContactForm.txtUserPhone.className = "formValidateErrorTextBoxStyle";
	}	
	
	 //If an e-mail is entered check that the e-mail address is valid
	if (document.quickContactForm.txtUserEmail.value == "" || (document.quickContactForm.txtUserEmail.value.indexOf("@",0) == -1||document.quickContactForm.txtUserEmail.value.indexOf(".",0) == -1) || document.quickContactForm.txtUserEmail.value == "Enter a valid Email") { 
		errorMsg +="\n\tE-mail \t\t- Enter your valid e-mail address";
		document.quickContactForm.txtUserEmail.className = "formValidateErrorTextBoxStyle";
	}	
	
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "_____________________________________________________________\n\n";
		msg += "\t\tWilly Banjo Quick Contact Form\n\n";
		msg += "An Error on the Form, please correct and re-submit the form.\n";
		msg += "_____________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}else{
	document.quickContactForm.submit();
	}
	
	return true;	     
}    

// Validate Form
function checkForm(){

	var errorMsg = "";
	var errorMsgLong = "";

	//Check for a Title
	if (document.csEnquiryForm.txtUserTitle.value == "Please Select"){
		errorMsg += "\n\tTitle \t\t- Please select a Title";
		document.csEnquiryForm.txtUserTitle.className = "formValidateErrorTextBoxStyle";
	}


	//Check for a First Name
	if (document.csEnquiryForm.txtUserFirstName.value.length == "" || document.csEnquiryForm.txtUserFirstName.value == "Enter your Forename"){
		errorMsg += "\n\tFirst Name \t- Please Enter a First Name";
		document.csEnquiryForm.txtUserFirstName.className = "formValidateErrorTextBoxStyle";
	}	
	
	//Check for a Surname
	if (document.csEnquiryForm.txtUserSurname.value.length == "" || document.csEnquiryForm.txtUserSurname.value == "Enter your Surname"){
		errorMsg += "\n\tSurname \t\t- Please Enter a Surname";
		document.csEnquiryForm.txtUserSurname.className = "formValidateErrorTextBoxStyle";
	}	
	
	//Check for a Address
	if (document.csEnquiryForm.txtUserAddress1.value.length == "" || document.csEnquiryForm.txtUserAddress1.value == "Enter your Address"){
		errorMsg += "\n\tAddress \t\t- Please Enter an Address";
		document.csEnquiryForm.txtUserAddress1.className = "formValidateErrorTextBoxStyle";
	}	
	
	//Check for a Town
	if (document.csEnquiryForm.txtTown.value.length == "" || document.csEnquiryForm.txtTown.value == "Enter your Town"){
		errorMsg += "\n\tTown \t\t- Please Enter a Town";
		document.csEnquiryForm.txtTown.className = "formValidateErrorTextBoxStyle";
	}	
	
	//Check for a Postcode
	if (document.csEnquiryForm.txtPostcode.value.length == "" || document.csEnquiryForm.txtPostcode.value == "Enter Postcode/Zip"){
		errorMsg += "\n\tPostcode \t- Please Enter a Postcode";
		document.csEnquiryForm.txtPostcode.className = "formValidateErrorTextBoxStyle";
	}	
	
	 //If an e-mail is entered check that the e-mail address is valid
	if (document.csEnquiryForm.txtUserEmail.value == "" || (document.csEnquiryForm.txtUserEmail.value.indexOf("@",0) == -1||document.csEnquiryForm.txtUserEmail.value.indexOf(".",0) == -1) || document.csEnquiryForm.txtUserEmail.value == "Enter a valid Email") { 
		errorMsg +="\n\tE-mail \t\t- Enter your valid e-mail address";
		document.csEnquiryForm.txtUserEmail.className = "formValidateErrorTextBoxStyle";
	}

	
	//Check for a Link Description
	if (document.csEnquiryForm.txtComments.value == ""){
		errorMsg += "\n\tComments \t- Please Enter a Comment";
		document.csEnquiryForm.txtComments.className = "formValidateErrorTextBoxStyle";
	}	
	
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "_____________________________________________________________\n\n";
		msg += "\t\tAvos Watersports Den Contact Form\n\n";
		msg += "An Error on the Form, please correct and re-submit the form.\n";
		msg += "_____________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	
	return true;	     
}


	function setVisible(obj)
	{
		//obj = document.getElementById(obj);
		//obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
		
		var theSummary = document.getElementById('extSpecsDetails');
		var theData = document.getElementById(obj);
		
		theSummary.innerHTML = theData.innerHTML;		
	}	
	

	function setDivVisible(obj)
	{
		obj = document.getElementById(obj);
		obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
		
		//var theSummary = document.getElementById('extSpecsDetails');
		//var theData = document.getElementById(obj);
		
		//theSummary.innerHTML = "";		
	}
