// JavaScript Document
function sendme(to,subject,prop) 
{ 
    window.open("sendme.php?to="+to+"&subject="+subject+"&prop="+prop,"myNewWin","status=0,width=300,height=310,left=200,top=200,screenX=100,screenY=100,toolbar=no,resizable=no"); 
} 
function validate_email(email) {
//alert(email);
    if(-1 == email.indexOf("@")) { 
       //document.form1.email.focus(); 
       alert("Your email must have a '@'."); 
       return false; 
       }
    if(-1 != email.indexOf(",")) { 
       //document.form1.email.focus(); 
       alert("Your email must not have a ',' in it"); 
       return false; 
       }
    if(-1 != email.indexOf("#")) { 
      // document.form1.email.focus(); 
       alert("Your email must not have an '#' in it." ); 
       return false; 
       }
    if(-1 != email.indexOf("!")) { 
       //document.form1.email.focus(); 
       alert("Your email must not have a '!' in it." ); 
       return false; 
       }
    if(-1 != email.indexOf(" ")) { 
       //document.form1.email.focus(); 
       alert("Your email must not have a space in it." ); 
       return false; 
       }
    if(email.length == (email.indexOf("@")+1) ) {
       //document.form1.email.focus();
       alert("Your email must have a domain name after the '@'.");
       return false;
       }

    if(email.length == 0) { 
      //document.form1.email.focus(); 
      alert("Please enter your email."); 
      return false; 
      }

    return true;
}

function validate_form ( )
{
//alert(document.form1.code.value);
    if ( document.form1.name.value == "" || document.form1.address.value == "" || document.form1.msgs.value == "" )//|| document.form1.code.value == "" || document.form1.code.value == "Type code here!" )
    {

		//alert("em"+validate_email(a));
        alert ( "Some of the fields are empty" );
        return false;
    }else{
		 var a = document.form1.address.value;
		 if(!validate_email(a))
		 {
			return false;
		 }else{
			 //		alert("good");
    				return true;
			}
		}
		
}
function clear_txt()
{
	if(document.form1.code.value = "Type code here!")
	{
		document.form1.code.value = "";
	}
}
