// JavaScript Document

function checkMandatory()
{
    var error_string = "";
    // check the text field
   
  
   if (window.document.contact.First_Name.value == "")
    {
        error_string += "Please Give Your First Name.\n";error_string = "We found the following ommisions in your form: \n" + error_string;alert(error_string);
		window.document.contact.First_Name.focus();return false;
    }
  
  
  if (window.document.contact.Last_Name.value == "")
    {
        error_string += "Please Give Your Last Name.\n";error_string = "We found the following ommisions in your form: \n" + error_string;alert(error_string);
		window.document.contact.Last_Name.focus();return false;
    }
	
  
    if (window.document.contact.replyemail.value == "")
    {
        error_string += "Please Enter Your Email.\n";error_string = "We found the following ommisions in your form: \n" + error_string;alert(error_string);
		window.document.contact.replyemail.focus();return false;
    }
   
	 if (window.document.contact.Special_Instuctions.value == "")
    {
        error_string += "Please Enter What You Need Done To The Photo.\n";error_string = "We found the following ommisions in your form: \n" + error_string;alert(error_string);
		window.document.contact.Special_Instuctions.focus();return false;
    }
	
	
	
	
   
   if (error_string == "")
    {
       var result = checkEmail(window.document.contact.replyemail.value); return result; 
    } else {
        error_string = "We found the following ommisions in your form: \n" + error_string;
        alert(error_string);
        return false;
    } 
}





function checkEmail(the_email)
{
    var the_at = the_email.indexOf("@");
    var the_dot = the_email.lastIndexOf(".");
    var a_space = the_email.indexOf(" ");
    if ((the_at != -1) &&  // if there's an '@'
        (the_at != 0) &&  // and it's not at position 0
        (the_dot != -1) && // and there's a '.'
        (the_dot > the_at + 1) &&  // and something between the '@' and '.'
        (the_dot < the_email.length - 1) && // and something after the '.'
        (a_space  == -1))  // and there're no spaces
    	{
        	    
        	    return true;
    	}  else {
        	    alert("sorry, your email address is invalid!");
				window.document.contact.replyemail.value="";
				window.document.contact.replyemail.focus();
        	    return false;
    	}
}