// JavaScript Document

function chkEmail(eml)

{

	var re = /^[0-9a-zA-Z\-\.\_]+@[0-9a-zA-Z\-]+\.[0-9a-zA-Z\-\.]+$/;

	if (!eml.match(re)) 

	return 0;

	else

	return 1;



}



function chkText(text)

{

var rexpr =/^[0-9a-zA-Z\s]+$/;

if (!text.match(rexpr))

return 0;

else

return 1;

}



function chkCharacter(charr)

{

	var expch =/^[a-zA-Z]+$/;

	if (!charr.match(expch))

	return 0;

	else

	return 1;

}





function chkEmpty(txt)

{

if (txt=="")

   return 0;

else

  return 1;

}



function chkNum(num)

{

	var rexp = /^[0-9]+$/;

	if (!num.match(rexp))

	return 0;

	else

	return 1;

}







function CheckForm()

{

	var  errormsg = "";

	Form = document.form1;

	

	if (!chkEmpty(Form.contact.value))

		errormsg = errormsg + "Error: Please Enter Contact Name. \n";

		

		if (chkEmpty(Form.contact.value))

		if(!chkText(Form.contact.value))

			errormsg = errormsg + "Error: Invalid Input For Contact Name. \n";

	

	if (!chkEmpty(Form.companyname.value))

		errormsg = errormsg + "Error: Please Enter Company Name. \n";

	

	if (chkEmpty(Form.companyname.value))

		if(!chkText(Form.companyname.value))

			errormsg = errormsg + "Error: Invalid Input For Company Name. \n";

	

		



	//if (!chkEmpty(Form.address.value))

//		errormsg = errormsg + "Enter Address. \n";

//		

//		if (chkEmpty(Form.address.value))

//		if(!chkText(Form.address.value))

//			errormsg = errormsg + "Invalid input for address. \n";

//	

//

//		

//	if (!chkEmpty(Form.city.value))

//		errormsg = errormsg + "Enter City. \n";

//		

//		if (chkEmpty(Form.city.value))

//		if(!chkText(Form.city.value))

//			errormsg = errormsg + "Invalid input for city. \n";

//			

//		

//	if (!chkEmpty(Form.zip.value))

//		errormsg = errormsg + "Enter Zip. \n";

//		

//		if (chkEmpty(Form.zip.value))

//		if(!chkNum(Form.zip.value))

//			errormsg = errormsg + "Zip code should be in Number. \n";



	if (!chkEmpty(Form.phone.value))

		errormsg = errormsg + "Error: Please Enter Phone Number. \n";

		

		if (chkEmpty(Form.phone.value))

		if(!chkNum(Form.phone.value))

			errormsg = errormsg + "Error: Phone Number Should Be In Number. \n"; 



	if (!chkEmpty(Form.email.value))

		errormsg = errormsg + "Error: Please Enter Email Address. \n";



	if (chkEmpty(Form.email.value))

		if (!chkEmail(Form.email.value))

			errormsg = errormsg + "Error: Please Enter Valid Email Address. \n";



	//if (!chkEmpty(Form.url.value))

//		errormsg = errormsg + "Enter URL. \n";



	//var count = 0;

	//alert(document.Form.pur_time.length);

//	for (i = 0 ; i < document.Form.pur_time.length ; i++)

//		{

//			if (document.Form.pur_time[i].selected == true)

//			{

//				count = count + 1;

//			}

//		}

	//if (count > 1)

//		errormsg = errormsg + "Error: Please Select One Option. \n";



	if (errormsg == "")

	{

		Form.action = "http://www.logodesignguru.com/smallbusiness/Business.aspx" ;

		Form.submit();

	}

	else

	{

		alert ( errormsg );

	}



}

	

	function checkemail()

	{

	var  errormsg = "";

	Form = document.form2;

	

	

	if (!chkEmpty(Form.emailFld.value))

		errormsg = errormsg + "Error: Please Enter Email Address. \n";



	if (chkEmpty(Form.emailFld.value))

		if (!chkEmail(Form.emailFld.value))

			errormsg = errormsg + "Error: Please Enter Valid Email Address. \n";

			

	if (!chkEmpty(Form.nameFld.value))

		errormsg = errormsg + "Error: Please Enter Name. \n";

		

			if (chkEmpty(Form.nameFld.value))

				if(!chkText(Form.nameFld.value))

			errormsg = errormsg + "Error: Invalid Input For Name. \n";

	

		

	if (!chkEmpty(Form.messageFld.value))

		errormsg = errormsg + "Error: Please Enter Message. \n";

		

		if (chkEmpty(Form.messageFld.value))

		if(!chkText(Form.messageFld.value))

			errormsg = errormsg + "Error: Invalid Input For Message. \n";

	





	if (errormsg == "")

	{

		Form.action = "http://www.logodesignguru.com/smallbusiness/EmailArticle.aspx" ;

		Form.submit();

		alert("Thanks. The Article has been sent.");



	}

	else

	{

		alert ( errormsg );

	}



}





function CheckContact()

	{

	var  errormsg = "";

	Form = document.form1;

	

	if (!chkEmpty(Form.fName.value))

		errormsg = errormsg + "Enter First Name. \n";

		

		if (chkEmpty(Form.fName.value))

		if(!chkCharacter(Form.fName.value))

			errormsg = errormsg + "Enter Character Only. \n";

			

		

		if (chkEmpty(Form.lName.value))

		if(!chkCharacter(Form.lName.value))

			errormsg = errormsg + "Enter Character Only. \n";

		

		

	if (!chkEmpty(Form.eMail.value))

		errormsg = errormsg + "Enter E-Mail. \n";



	if (chkEmpty(Form.eMail.value))

		if (!chkEmail(Form.eMail.value))

			errormsg = errormsg + "Enter Valid Email Address. \n";

			

	if (!chkEmpty(Form.messageFld.value))

		errormsg = errormsg + "Enter Message. \n";

		

		if (chkEmpty(Form.messageFld.value))

		if(!chkText(Form.messageFld.value))

			errormsg = errormsg + "Invalid input for message. \n";

		

	if (chkEmpty(Form.phoneNo.value))

		if(!chkNum(Form.phoneNo.value))

			errormsg = errormsg + "Phone number should be in Number. \n";





	if (errormsg == "")

	{

		Form.action = "contact1.asp" ;

//"http://www.logodesignguru.com/smallbusiness/contact.aspx" ;

		Form.submit();

		

	}

	else

	{

		alert ( errormsg );

	}



}

	

	

	

	function CheckSearch()

	{

	var  errormsg = "";

	Form = document.frm_search;

	

	if (!chkEmpty(Form.textFld.value))

		errormsg = errormsg + "Enter Keyword. \n";

		

	if (errormsg == "")

	{

		Form.action = "http://www.logodesignguru.com/smallbusiness/search.aspx" ;

		Form.submit();

		

	}

	else

	{

		alert ( errormsg );

	}



}
