// This files validates the contactus.php

// File Path : Z:\WEBSITES\shaaditimes.com\dev\ssi\contactus_validation.js

// these tow functions are for the email validations


function form_validation(frm)
{
	var focus,msg = "";
	var re = new RegExp("script|[0-9]", "i");
	var re1 = new RegExp("script", "i");

	if(document.getElementById("contact_name").value == "")
	{
		msg = msg + "Please enter Name.\r\n";
		document.getElementById("contact_name").focus();
		focus = true;
	}
	else
	{
		if(re.exec(document.getElementById("contact_name").value))
		{
			msg = msg + "Please enter Valid Name.\r\n";
			document.getElementById("contact_name").focus();
			document.getElementById("contact_name").value = "";
			focus = true;
		}
	}
	if(document.getElementById("contact_email").value == "")
	{
		msg = msg + "Please enter Email.\r\n";
		if(!focus)
		{
			document.getElementById("contact_email").focus();
			focus = true;
		}
	}
	
	if(document.getElementById("contact_comments").value == "")
	{
		msg = msg + "Please enter your Comments.\r\n";
		if(!focus)
		{
			document.getElementById("contact_comments").focus();
			focus = true;
		}
	}
	else
	{
		if(re1.exec(document.getElementById("contact_comments").value))
		{
			msg = msg + "Please enter Valid Comments.\r\n";
			
				document.getElementById("contact_comments").value = "";
			if(!focus)
			{
				document.getElementById("contact_comments").focus();
				focus = true;
			}
		}
	}
	if(msg)
	{
		alert(msg);
		return false;
	}
	return true;
}