
function validateRegForm( )
{
	//alert("==");
	var objFV = new FormValidator("frmRegister");
	
	if (!objFV.validate("txtFullName", "B", "Please enter your Full Name."))
		return false;		
	
	if (!objFV.validate("txtEmail", "B,E", "Please enter your valid Email Address."))
		return false;
		
	if (!objFV.validate("txtPassword", "B,L(4)", "Please enter the valid Password (Min Length = 4)."))
		return false;
		
	if (!objFV.validate("txtConfirmPassword", "B,L(4)", "Please enter the valid Confirm Password (Min Length = 4)."))
		return false;		

	if (objFV.value("txtPassword") != objFV.value("txtConfirmPassword"))
	{
		alert("The Password does not MATCH with the Confirm Password.");

		objFV.focus("txtConfirmPassword");
		objFV.select("txtConfirmPassword");

		return false;
	}		
	
	if (!objFV.validate("day", "B", "Please Select Day."))
		return false;		
		
	if (!objFV.validate("mon", "B", "Please select Month."))
		return false;				
		
	if (!objFV.validate("year", "B", "Please select Year."))
		return false;
	
	if (!objFV.validate("txtAddress", "B", "Please enter your Address."))
		return false;
		
	if (!objFV.validate("txtCountry", "B", "Please enter Country."))
		return false;
		
	if (!objFV.validate("txtPhone", "B", "Please enter Phone."))
		return false;		


	return true;
}



	function contact_inquary()
	{
		//alert("fdas");

	var myform=document.frminq;
	var myemail=document.frminq.email.value;
	
		if(myform.username.value=="")
		{
		alert("Enter Your Name.");
		myform.username.focus();
		return false;
		}
		else if(IsNumeric(myform.username.value))
		{
		alert("Only Characters are allowed.");
		myform.username.focus();
		return false;
		}
		else if(myemail=="" || !validateEmailFormat(myemail) )
		{
		alert("The Email should be valid.");
		myform.email.focus();
		return false;
		}
		else if(myform.phone.value=="")
		{
		alert("Enter Phone Number.");
		myform.phone.focus();
		return false;	
		}
		else if(!IsNumeric(myform.phone.value) )
		{
		alert("Phone Number should be numaric.");
		myform.phone.focus();
		return false;	
		}
		else if(myform.inquiry.value=="")
		{
		alert("Enter your message.");
		myform.inquiry.focus();
		return false;
		}
		else
		{
		myform.submit();
		}
		
	}
	
function ValidateQuickInquiry( )
{
	var myform=document.frmQuickInquiry;
	var myemail=document.frmQuickInquiry.email.value;
	
		if(myform.username.value=="" || myform.username.value=="Enter Your Name"  )
		{
		alert("Enter Your Name.");
		myform.username.focus();
		return false;
		}
		else if(IsNumeric(myform.username.value))
		{
		alert("Only Characters are allowed.");
		myform.username.focus();
		return false;
		}
		else if(myemail=="" || myemail=="Enter Your Email"  || !validateEmailFormat(myemail) )
		{
		alert("The Email should be valid.");
		myform.email.focus();
		return false;
		}
		else if(myform.phone.value=="" || myform.phone.value=="Enter Your Phone" )
		{
		alert("Enter Phone Number.");
		myform.phone.focus();
		return false;	
		}
		else if(!IsNumeric(myform.phone.value) )
		{
		alert("Phone Number should be numaric.");
		myform.phone.focus();
		return false;	
		}
		else if(myform.inquiry.value=="")
		{
		alert("Enter your message.");
		myform.inquiry.focus();
		return false;
		}
		else
		{
		
		return true;
		}
}
		

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   
function validateEmailFormat(sEmail)
{
	var iLength = sEmail.length;

	if (iLength == 0)
		return true;

	if (iLength < 5)
		return false;

	var sValidChars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";

	for (var i = 0; i < iLength; i++)
	{
		var sLetter = sEmail.charAt(i).toLowerCase( );

		if (sValidChars.indexOf(sLetter) != -1)
			continue;

		return false;
	}

	var iPosition = sEmail.indexOf('@');

	if (iPosition == -1 || iPosition == 0)
		return false;

	var sFirstPart = sEmail.substring(0, iPosition);

	sEmail = sEmail.substring((iPosition + 1));

	iPosition = sEmail.indexOf('.');

	if (iPosition == -1 || iPosition == 0)
		return false;

	var sSecondPart = sEmail.substring(0, iPosition);

	var sThirdPart = sEmail.substring((iPosition + 1));

	if(sSecondPart.indexOf('@') != -1 || sSecondPart.indexOf('_') != -1)
		return false;

	if(sThirdPart.indexOf('@') != -1 || sThirdPart.indexOf('_') != -1 || sThirdPart.indexOf('-') != -1 || sThirdPart.length < 2)
		return false;

	return true;
}
	
function chknewsletter()
{
var myemail=document.newletterform.txtEmail.value;	

		if(document.newletterform.txtName.value=="" || IsNumeric(document.newletterform.txtName.value))
		{
		alert("Enter Valid Email.");
		myform.username.focus();
		return false;
		}
		else if(myemail=="" || myemail=="Enter Your Email"  || !validateEmailFormat(myemail) )
		{
		alert("The Email should be valid.");
		myform.email.focus();
		return false;
		}
}
