/*
' Copyright (c) 2007 Affno (Pvt) Ltd, . All rights reserved.
'
' This software is the confidential and proprietary information of        
' Affno  ("Confidential Information").  You shall not disclose such 
' Confidential Information and shall use it only in accordance with
' the terms of the license agreement you entered into with Affno.
'
'Module Name	: AFFWEB3
' File Name		: contact_us.js
' Description	: This is the page where we validatethe form.
' Created By	: NISHAN SHANAKA
' Created Date	: 
' Modified By	: 
' Modified Date	: 
' Version		: 1.00.000
*/

function checkForm(){
//Company
	strCompany = document.ContactUs.Company.value		
	if (isEmpty(strCompany)) 
	{
		alert(msgError_emptyCompany);
		document.ContactUs.Company.focus();
		return false;
	}	
	else if (isSpace(strCompany))
	{
		alert(msgError_spaceCompany);
		document.ContactUs.Company.value="";
		document.ContactUs.Company.focus();
		return false;
	}

//Address
strAddress = document.ContactUs.Address.value
	if (isSpace(strAddress)||(isEmpty(strAddress))) 
	{
		alert(msgError_emptyAddress)
		document.ContactUs.Address.value = "";
		document.ContactUs.Address.focus();
		return false;
	}

//Fax
	strFax = document.ContactUs.Fax.value
	if (isEmpty(strFax)) 
	{
		alert(msgError_emptyFax);
		document.ContactUs.Fax.focus();
		return false;
	}
	else if (!isFax(strFax))
	{
		alert(msgError_validFax);
		document.ContactUs.Fax.focus();
		return false;
	}
	else if (isSpace(strFax))
	{
		alert(msgError_spaceFax);
		document.ContactUs.Fax.value="";
		document.ContactUs.Fax.focus();
		return false;
	}	
//Telephone
    strTelephone = document.ContactUs.Telephone.value		
	if (!isEmpty(strTelephone)) {
		if (!isTelephone(strTelephone)) {
		alert(msgError_validTelephone);
		document.ContactUs.Telephone.focus();
		return false;
		}
	}
	if (isSpace(strTelephone)) {
		alert(msgError_spaceTelephone);
		document.ContactUs.Telephone.focus();
		document.ContactUs.Telephone.value=""
		return false;
	}
	
//FName
	strFName = document.ContactUs.FName.value
	if (!isEmpty(strFName)) {
		if (!isName(strFName)) {
		alert(msgError_validName);
		document.ContactUs.FName.focus();
		return false;
		}
	}
	if (isSpace(strFName)) {
		alert(msgError_spaceName);
		document.ContactUs.FName.focus();
		document.ContactUs.FName.value=""
		return false;
	}
//LName
	strLName = document.ContactUs.LName.value
	if (!isEmpty(strLName)) {
		if (!isName(strLName)) {
		alert(msgError_validName);
		document.ContactUs.LName.focus();
		return false;
		}
	}
	if (isSpace(strLName)) {
		alert(msgError_spaceName);
		document.ContactUs.LName.focus();
		document.ContactUs.LName.value=""
		return false;
	}
//Email
strEmail = document.ContactUs.Email.value
	if (isEmpty(strEmail)){
		alert(msgError_emptyEmail);
		document.ContactUs.Email.focus();
		return false;
		}

	else if (!isEmail(strEmail))
	{
		alert(msgError_validEmail);
		document.ContactUs.Email.focus();
		return false;
	}
	else if (isSpace(strEmail))
	{
		alert(msgError_spaceEmail);
		document.ContactUs.Email.value="";
		document.ContactUs.Email.focus();
		return false;
	}
//Comment
strComment = document.ContactUs.Comment.value
if (isEmpty(strComment)) 
	{
		alert(msgError_emptyComment);
		document.ContactUs.Comment.focus();
		return false;
	}
	else if (isSpace(strComment))
	{
		alert(msgError_spaceComment);
		document.ContactUs.Comment.value="";
		document.ContactUs.Comment.focus();
		return false;
	}
	else if(strComment.length>1000)
	{
		alert(msgError_lengthOfComment);
		document.contactus_form.Comments.focus();
		return false;
	}
//code
strCode = document.ContactUs.code.value
if (isEmpty(strCode)) 
	{
		alert("Please enter the Verification Code");
		document.ContactUs.code.focus();
		return false;
	}
	else if (isSpace(strCode))
	{
		alert("Please enter a valid Verification Code");
		document.ContactUs.code.value="";
		document.ContactUs.code.focus();
		return false;
	}	
	
//	return false;
}
