function fnContact()
{
	if(document.form.name.value=="")
	{
		alert("Enter your name please")
		document.form.name.focus()
		return false
	}

	else if(document.form.email.value=="")
	{
		alert("Enter e-mail please")	
		document.form.email.focus()	
		return false
	}
	else if(!fnEmail(document.form.email))
	{
		return false
	}
	else if(document.form.refer_by.selectedIndex==0)
	{
		alert("Please select where did you hear about us")	
		document.form.email.focus()	
		return false
	}
	else if(document.form.refer_by.selectedIndex==5)
	{
		if(document.form.refer_by_other.value=="")
		{
			alert("Enter Where did you hear about us please?")
			document.form.refer_by_other.focus()
			return false
		}
	}
}
function fnEmail(txtEmail)

{

	if (txtEmail.value!="")

	{

		var intLen=txtEmail.value.length

		var blnFlag=0

		if (txtEmail.value.charAt(0)=="@" || txtEmail.value.charAt(0)==".")

		{

			alert("Invalid E-Mail Address")

			txtEmail.focus()

			return false

		}

		if (txtEmail.value.charAt(intLen-1)=="@" || txtEmail.value.charAt(intLen-1)==".")

		{

			alert("Invalid E-Mail Address")

			txtEmail.focus()

			return false

		}

		for (var i=0;i<intLen;i++)

		{

			if (txtEmail.value.charAt(i)=="@")

			{

				blnFlag=blnFlag+1

			}

		}

		if (blnFlag>=0 && blnFlag<1 || blnFlag>1)

		{

			alert("Invalid E-Mail Address")

			txtEmail.focus()

			return false

		}

		strSplit=(txtEmail.value).split("@")

		intSptLen=strSplit[1].length

		var intCnt=0

		for(var j=0;j<intSptLen;j++)

		{

			if (strSplit[1].charAt(j)==".")

			{

				intCnt=intCnt+1

			}

		}

		if (intCnt<=0)

		{

			alert("Invalid E-Mail Address")

			txtEmail.focus()

			return false

		}

		return true

	}

}
