// JavaScript Document
function validate_signup(thisform)
{
	with (thisform)
	{
		if(!swim_ins.checked && !life_guard.checked )
		{
			alert("Please Select Your Choice For News Letter");
			return false; 
		}
		
	if (emptyvalidation(s_email,"Woops! You forgot to fill in your Email Address")==false) 
		{
		s_email.focus();
		return false;	
		}	
  var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = thisform.s_email.value;
	  
		if(reg.test(address) == false) 
		{ 
		  alert('Woops! You have entered an invalid Email Address');
		  s_email.focus();
		  s_email.select();
		  return false;
	   }
	}
thisform.submit();
}	

function validate(thisform)
{
	with (thisform)
	{
	//	if(fname.value=="Name")fname.value="";	
		if (emptyvalidation(c_name,"Woops! You forgot to fill in your Name")==false) 
		{
			c_name.select();
			c_name.focus();
			return false;	
		}
		if (emptyvalidation(c_phone,"Woops! You forgot to fill in your Phone")==false) 
		{
			c_phone.select();
			c_phone.focus();
			return false;	
		}
		var ph1 = thisform.c_phone.value;
		var res1=IsPhoneNumber(ph1);
		if(res1==false)
		{
			alert("Enter Phone Number");
			c_phone.select();
			c_phone.focus();
			return false;		
		}
	
		if (emptyvalidation(c_email,"Woops! You forgot to fill in your Email Address")==false) 
		{
			c_email.focus();
			return false;	
		}	
  		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   		var address = thisform.c_email.value;
  
		if(reg.test(address) == false) 
		{ 
      		alert('Woops! You have entered an invalid Email Address');
	  		c_email.focus();
	  		c_email.select();
      		return false;
  		 }
   
		
		if (emptyvalidation(c_comments,"Woops! You forgot to fill in your Comments")==false) 
		{
			c_comments.select();
			c_comments.focus();
			return false;	
		}
		
		
	}
	
	thisform.submit();
}

function validatecontact(thisform)
{
	with (thisform)
	{
	//	if(fname.value=="Name")fname.value="";	
		if (emptyvalidation(name,"Woops! You forgot to fill in your Name")==false) 
		{
			name.select();
			name.focus();
			return false;	
		}
		if (emptyvalidation(phone,"Woops! You forgot to fill in your Phone")==false) 
		{
			phone.select();
			phone.focus();
			return false;	
		}
		var ph1 = thisform.phone.value;
		var res1=IsPhoneNumber(ph1);
		if(res1==false)
		{
			alert("Enter Phone Number");
			phone.select();
			phone.focus();
			return false;		
		}
	
		if (emptyvalidation(date,"Woops! You forgot to fill in your Date of the event")==false) 
		{
			date.select();
			date.focus();
			return false;	
		}
		if (emptyvalidation(about,"Woops! You forgot to fill in your How did you hear about us")==false) 
		{
			about.select();
			about.focus();
			return false;	
		}
		
		if (emptyvalidation(email,"Woops! You forgot to fill in your Email Address")==false) 
		{
			email.focus();
			return false;	
		}	
  		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   		var address = thisform.email.value;
  
		if(reg.test(address) == false) 
		{ 
      		alert('Woops! You have entered an invalid Email Address');
	  		email.focus();
	  		email.select();
      		return false;
  		 }
   		
		
		if (emptyvalidation(comments,"Woops! You forgot to fill in your Comments")==false) 
		{
			comments.select();
			comments.focus();
			return false;	
		}
		
		
	}
	
	thisform.submit();
}	
function emptyvalidation(entered, alertbox)
{
	with (entered)
	{
		while (value.charAt(0) == ' ')
			value = value.substring(1);
		while (value.charAt(value.length - 1) == ' ')
			value = value.substring(0, value.length - 1);
		if (value==null || value=="")
		{
			if (alertbox!="") alert(alertbox);
			return false;
		}
		else return true;
	}
}
function IsPhoneNumber(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.- []()";
   var strChar;
   var blnResult = true;

  // if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		         blnResult = false;
         }
      }
   return blnResult;
   }	
function formReset()
{
    var x=document.forms.continfo
    x.reset()
}
