function checktellfriendform(frm)
{
	var error=false;
	var str="";
    if(frm.from_name.value.length==0)
	{
	    str=str+"Please Enter Your Name \n";
		error=true;
	}
	if(frm.from_email_address.value.length==0)
    {
		 str=str+"Please Enter your email \n";
		error=true;
	}
	var eres=echeck(frm.to_email_address.value);
	if (eres!=true){
		str=str+eres+"\n";
		error=true;
	}
    
	if(frm.to_name.value.length==0)
	 {

	    str=str+"Please Enter Friend Name \n";
		error=true;
	 }

    if(frm.to_email_address.value.length==0)
	    {
		 str=str+"Please Enter Friend email \n";
		error=true;
	    }
	 var eres=echeck(frm.to_email_address.value);
	if (eres!=true){
		str=str+eres+"\n";
		error=true;
	}
    
	
	if(frm.mcspvalue.value=='')
	   {
		str=str+"Please Enter Security Code \n";
		error=true;
	   }
	   if(frm.mcspvalue.value!=frm.sum.value)
	   {
		str=str+"Invalid  Security Code\n";
		error=true;
	   }
 
	//mcspvalue

	   if(error==true)
	   {
	  alert(str);
	  return false;
	  }
	  else
	  {
	  return true;
	  }
   }

    function echeck(str) {

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

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

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

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

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

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

 		 return true					
	}

