function lblogin_check(LBLogin) {
var lbname = LBLogin.lbname.value;
var lbpw = LBLogin.lbpw.value;
if (lbname == "")
   {
   alert("Please enter your Lightbox name ");
   return false;
   }
else if (lbpw == "")
   {
   alert("Please enter your Lightbox password ");
   return false;
   }
else
   return true;
}


function lbchangepass_check(LBChangePass) {
var lbpwo = LBChangePass.lbpwo.value;
var lbpwn = LBChangePass.lbpwn.value;
var lbpwc = LBChangePass.lbpwc.value;
var re = /[\W_]/;
if (lbpwo == "")
   {
   alert("Please enter your current password ");
   return false;
   }
else if (lbpwn == "")
   {
   alert("Please enter a new password ");
   return false;
   }
   if(re.test(lbpwn)) 
   { 
   alert("Please make sure your password contains only letters and numbers ");  
   return false; 
   } 
else if (lbpwc == "")
   {
   alert("Please confirm your new password ");
   return false;
   }
   if(re.test(lbpwc)) 
   { 
   alert("Please make sure your password contains only letters and numbers ");  
   return false; 
   } 
else if (lbpwn != lbpwc)
   {
   alert("Please enter the same new password twice ");
   return false;
   }
else
   return true;
}


function lbcreate_check(LBCreate) {
var lbname = LBCreate.lbname.value;
var lbpw = LBCreate.lbpw.value;
var lbpwc = LBCreate.lbpwc.value;
var lbemail = LBCreate.lbemail.value;
var emailfilter = /^.+@.+\..{2,3}$/;
var illegalchars = /[\W_]/;
if (lbname == "")
   {
   alert("Please choose a name for your Lightbox, using only letters and numbers ");
   return false;
   }
   if(illegalchars.test(lbname))
   { 
   alert("Please make sure your Lightbox name contains only letters and numbers ");  
   return false;
   }    
else if (lbpw == "")
   {
   alert("Please choose a password ");
   return false;
   }
   if(illegalchars.test(lbpw))
   { 
   alert("Please make sure your password contains only letters and numbers ");  
   return false;
   } 
else if (lbpwc == "")
   {
   alert("Please confirm your password ");
   return false;
   }
   if(illegalchars.test(lbpwc))
   { 
   alert("Please make sure your password contains only letters and numbers ");  
   return false;
   } 
else if (lbpw != lbpwc)
   {
   alert("Please enter the same new password twice ");
   return false;
   }
else if (lbemail == "")
   {
   alert("Please enter your email address");
   return false;
   }   
else if (!(emailfilter.test(lbemail))) 
   { 
   alert("Please enter a vaild email address in the you@domain.com format");
   return false;
   }    
else
   return true;
}


function sharephoto_check(SPCheck) {
var sharefromname = SPCheck.sharefromname.value;
var sharefromemail = SPCheck.sharefromemail.value;
var sharetoname = SPCheck.sharetoname.value;
var sharetoemail = SPCheck.sharetoemail.value;
var sharemsg = SPCheck.sharemsg.value;
var sharecheck = SPCheck.sharecheck.value;
var emailfilter = /^.+@.+\..{2,3}$/;
var illegalchars = /[\W_]/;
var numbers = /^\d+$/;
if (sharefromname == "")
   {
   alert("Please enter your name");
   return false;
   }
else if (sharefromemail == "")
   {
   alert("Please enter your email address");
   return false;
   }
   if (!(emailfilter.test(sharefromemail))) 
   { 
   alert("Please enter a vaild email address in the you@domain.com format");
   return false;
   }    
else if (sharetoname == "")
   {
   alert("Please enter the recipient's name");
   return false;
   }
else if (sharetoemail == "")
   {
   alert("Please enter the recipient's email address");
   return false;
   }
   if (!(emailfilter.test(sharetoemail))) 
   { 
   alert("Please enter a vaild email address for the recipient in the you@domain.com format");
   return false;
   }    
else if (sharemsg == "")
   {
   alert("Please enter a message");
   return false;
   }   
else if (sharecheck == "")
   {
   alert("Please enter the ID Number of this photo as a quick security check");
   return false;
   }
   if (!(numbers.test(sharecheck))) 
   { 
   alert("Please use numbers only to answer the security check question");
   return false;
   }
else
   return true;
}



function mljoin_check(MLJoin) {
var mlname = MLJoin.mlname.value;
var mlemail = MLJoin.mlemail.value;
var emailfilter = /^.+@.+\..{2,3}$/;
if (mlname == "")
   {
   alert("Please enter your name ");
   return false;
   }
else if (mlemail == "")
   {
   alert("Please enter your your email address ");
   return false;
   }
   if (!(emailfilter.test(mlemail))) 
   { 
   alert("Please enter a vaild email address in the you@domain.com format");
   return false;
   }   
else
   return true;
}



function contactform_check(ContactForm) {
var contactname = ContactForm.contactname.value;
var contactemail = ContactForm.contactemail.value;
var contactmsg = ContactForm.contactmsg.value;
var emailfilter = /^.+@.+\..{2,3}$/;
if (contactname == "")
   {
   alert("Please enter your name");
   return false;
   }
else if (contactemail == "")
   {
   alert("Please enter your email address");
   return false;
   }
   if (!(emailfilter.test(contactemail))) 
   { 
   alert("Please enter a vaild email address in the you@domain.com format");
   return false;
   }    
else if (contactmsg == "")
   {
   alert("Please enter your message");
   return false;
   }
else
   return true;
}



function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=0,resizable=1,width=700,height=582');");
}


