function echeck1(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID!");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID!");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID!");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID!");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID!");
		    return false;
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID!");
		    return false;
		 }

 		 return true
}
function chkfri()
{
	var emailID=document.tellfrm.friend;
	if ((emailID.value==null)||(emailID.value==""))
	{
		alert("Email cannot be blank!");
		emailID.focus();
		return false;
	}
	else if (echeck1(emailID.value)==false)
	{
		emailID.value="";
		emailID.focus();
		return false;
	}

}
function field_clear()
{
	if(window.document.tellfrm.friend.value=="Enter your friend's email here")
	{
		window.document.tellfrm.friend.value ='';
	}
}
function field_check(name)
{
	if(window.document.tellfrm.friend.value =='')
	{
		window.document.tellfrm.friend.value="Enter your friend's email here";
	}
}
function field_clear2()
{
	if(window.document.tellfrm.friend.value=="Enter friend's email")
	{
		window.document.tellfrm.friend.value ='';
	}
}
function field_check2(name)
{
	if(window.document.tellfrm.friend.value =='')
	{
		window.document.tellfrm.friend.value="Enter friend's email";
	}
}
function popup()
{
	var friend = document.tellfrm.friend.value;
	if((friend=="")||(friend=="Enter friend's email")||(friend=="Enter your friend's email here"))
	{
		alert("Please enter a Friend Email Id.");
		document.tellfrm.friend.focus();
	}
	else if((echeck1(friend)==false))
	{
		document.tellfrm.friend.focus();
	}
	else
	{
		var url = "http://www.projectsatcollege.com/tell-a-friend.php?f="+friend;
		window.open(url,'popupWindow','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=600,height=430,screenX=150,screenY=150,top=150,left=150')
	}
	return false;
}