function textCounter()
{
	if (fo.enquirydetails.value.length > 1000)
	{	
		fo.enquirydetails.value =fo.enquirydetails.value.substring(0, 1000);
	}
	else
	 {								
		fo.remLen.value = 1000- fo.enquirydetails.value.length;
	 }
}

function isEmail(email)
{
	// Valid format: "a@b.cd"
	invalidChars = " /;,:";
	if (email=="")
	{
		return false;
	}
	for (var i=0; i<invalidChars.length; i++)
	{
		badChar=invalidChars.charAt(i);
		if (email.indexOf(badChar,0) > -1)
		{
			return false;
		}
	}
	atPos = email.indexOf("@",1);
	// there must be one "@" symbol
	if (atPos == -1)
	{
		return false;
	}

	if (email.indexOf("@", atPos+1)!=-1)
	{
		// and only one "@" symbol
		return false;
	}

	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1)
	{
		// and at least one "." after the "@"
		return false;
	}

	if (atPos+2>periodPos)
	{
		// and at least one character between "@" and "."
		return false;
	}
	if (periodPos+3>email.length)
	{
		return false;
	}
	return true;
}


function save()
{
	if (chkcmb(fo.interest.value,"Your Interest",fo.interest)) return false;
	if (chkblank(fo.enquirydetails.value,"Enquiry Details",fo.enquirydetails)) return false;
	//var flgCheck;
	//flgCheck=0;
	//for (i=0;i<9;i++)
	//{
		//if(fo.chkhear[i].checked==true)
		//{
			//flgCheck=1
		//}
	//}
	//if (flgCheck==0)
	//{
		//alert("Please tell from where did you hear about us");
		//return false;
	//}
	if (chkblank(fo.name.value,"Name",fo.name)) return false;
	if (chkblank(fo.emailid.value,"EmailID",fo.emailid)) return false;
	if (chkcmb(fo.country.value,"Country",fo.country)) return false;
	if (!isEmail(fo.emailid.value))
	{
		alert("Your Email ID is Wrong!");
		fo.emailid.focus();
		return false; 
	}

	fo.hdaction.value="Send"
}
