/*
file name: Validate.js
called by: 
redirected to: 
author: Phill Gibson
date: 05-30-2006
comments: Verifies that email is at least of the proper form.
*/


function emailCheck() {

  /*user=document.form_SubscribeEmail.user_name;
  if ( (user.value == null) || (user.value == "") || (isBlank(user.value))|| (user.value == "Choose a user name here") )
  {
   alert("Please include a user name");
	form_SubscribeEmail.user_name.focus()
    document.form_SubscribeEmail.user_name.value = "Choose a user name here";
    return false
  }*/	

  email=document.form1.email_address;
  if ( (email.value == null) || (email.value == "") || (isBlank(email.value))|| (email.value == "Your Email Here") )
  {
   alert("Please include your email address");
	form1.email_address.focus()
    document.form1.email_address.value = "Your email here";
    return false
  }	
  else if(isValidEmail(email.value)<=0){
   alert("Sorry, this email address seems wrong. Please"
   +" contact us via email at 'webmaster@MiikoGibson.com' if you feel this is in error.");
	form1.email_address.focus()
    document.form1.email_address.value = "Your email here";  
  	return false
  }
  return true
}

function isBlank(s)
{
    for(var i = 0; i < s.length; i++)
    {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

function blankOutUserName(){
	document.form1.user_name.value = "";
}
function blankOutEmail(){
	document.form1.email_address.value = "";
}

function isValidEmail(str) {
//alert(str.indexOf("."));
//alert(str.indexOf("@"));
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);}

