function registartion(dateStr)
{
	with (document.reg) 
	{
		 if (!email.value) 
		 	{
					alert("You must enter a valid email address."); 
					!email.focus();  
					return false 
			} 
		  if (!email.value.match(/^\w+((-\w+)|(\.\w+|-))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)) 
		  	{
		  		alert("Please enter a valid email address"); 
					!email.focus();  
					return false; 
			} 
		  if(!confmail.value)
		 	{
		  			alert("Please re-enter your email address.");
					!confmail.focus();
					return false;
		  	}
		  if(email.value!=confmail.value)
		  	{
				alert("Confirmation email address doesn't match");
				confmail.focus();
				return false;
		 	}
	      if (!password.value) 
		  	{
					alert("Please enter your Password."); 
					!password.focus();  
					return false;
			}  
	   	  if (password.value.length<6) 
		  	{
					alert("Password must be a minimum 6 characters."); 
					!password.focus(); 
					return false;
			} 
	    if (password.value.length >15) 
		  	{
					alert("Password must not exceed 15 characters"); 
					!password.focus(); 
					return false;
			} 
	  
	   if (!repassword.value) 
		  	{
					alert("Please enter your password confirmation."); 
					!repassword.focus();  
					return false;
			}
	    if (password.value!=repassword.value || repassword.value=="" )  
        	{
                alert("Password confirmation must match original password");
                repassword.focus();
                return false;
        	}
			
		if (!fname.value) 
		 	{
			 	alert("Please enter your first name."); 
				!fname.focus();  
				return false;
			}  
		var iChars = "0123456789!@#$%^&*()+=[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.fname.value.length; i++)
 		   {
  				if (iChars.indexOf(document.reg.fname.value.charAt(i)) != -1) 
				{
  					alert ("Your first name has special characters or digits. \n These are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }
		 
		if (!lname.value) 
		 	{
			 	alert("Please enter your last name."); 
				!lname.focus();  
				return false;
			}  
		var iChars = "0123456789!@#$%^&*()+=[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.lname.value.length; i++)
 		   {
  				if (iChars.indexOf(document.reg.lname.value.charAt(i)) != -1) 
				{
  					alert ("Your last name has special characters or digits. \n These are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }

	 if (!bdate.value=='') 
		 	{
			 	var iChars =  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ!@#$%^&*()+=[]\\\';,./{}|\":<>?";

				for (var i = 0; i < document.reg.bdate.value.length; i++)
				   {
						if (iChars.indexOf(document.reg.bdate.value.charAt(i)) != -1) 
						{
							alert ("Your birth date has special characters or digits. \nThese are not allowed.\n Please remove them and try again.");
							return false;
						}
				   }
		/*	 if (!bdate.value.match(/^(\d{1,2})(-)(\d{1,2})(-)(\d{4})$/)) 
				{
					
					alert("Your birth date format should be this MM-DD-YYYY"); 
						!bdate.focus();  
						return false; 
				} */
			
				var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
				var matchArray = dateStr.match(datePat); 
				if (matchArray == null) 
				{
					alert("Please re-enter your birth date in the correct format MM-DD-YYYY.")
					return false;
				}
				month = matchArray[1]; 
				day = matchArray[3];
				year = matchArray[4];
				if (month < 1 || month > 12)
				{ 
					alert("Month must be between 1 and 12.");
					return false;
				}
				if (day < 1 || day > 31) 
				{
					alert("Day must be between 1 and 31.");
					return false;
				}
				if ((month==4 || month==6 || month==9 || month==11) && day==31) 
				{
					alert("Month "+month+" doesn't have 31 days!")
					return false;
				}
				if (month == 2) 
				{
					var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
					if (day>29 || (day==29 && !isleap)) 
					{
						alert("February " + year + " doesn't have " + day + " days!");
						return false;
					}
				}
				if (year < 1900 )
				{ 
					alert("Year is not less than 1900 .");
					return false;
				}

			} 
		
		if (!hphone.value) 
		 	{
			 	alert("Please enter your day time phone number."); 
				!hphone.focus();  
				return false;
			}  
		var iCharval = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ!@#$%^&*()+=[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.hphone.value.length; i++)
 		   {
  				if (iCharval.indexOf(document.reg.hphone.value.charAt(i)) != -1) 
				{
  					alert ("Your day time contact no  has special characters or alphabetic characters . \n These are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }
		if (!hphone.value.match(/^(\d{3,3})(-)(\d{3,3})(-)(\d{4})$/)) 
		  	{
		  		alert("Please re-enter your day time phone number in the correct format 999-999-9999."); 
					!hphone.focus();  
					return false; 
			} 
	 
	   if (hphone.value.length<12 || hphone.value.length >12 ) 
		   	{
					alert("Day time phone number must have 10 digits without (-)."); 
					!hphone.focus(); 
					return false; 
			} 
		
	  if (!bphone.value=="") 
		 	{
			 
			 	var iCharval = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ!@#$%^&*()+=[]\\\';,./{}|\":<>?";
			    for (var i = 0; i < document.reg.bphone.value.length; i++)
 				   {
  						if (iCharval.indexOf(document.reg.bphone.value.charAt(i)) != -1) 
						{
  								alert ("Your evening contact no  has special characters or alphabetic characters. \nThese are not allowed.\n Please remove them and try again.");
  					return false;
  						}
 		  		   }
		   		if (bphone.value.length<12 || bphone.value.length >12 ) 
		   		   {
						alert("Evening phone number must have 10 digits  without  (-)"); 
						!bphone.focus(); 
						return false; 
				   } 
				if (!bphone.value.match(/^(\d{3,3})(-)(\d{3,3})(-)(\d{4})$/)) 
		  		   {
		  				alert("Please re-enter your evening phone number in the correct format 999-999-9999."); 
						!bphone.focus();  
						return false; 
				   } 
			} 


		if(accept.checked!=true)
			{
					alert("James VII members must obey the terms of our policy agreement.\n Please check the box to accept our policy terms to continue");
					accept.focus();
					return false;
			}
	}
return true;
	
}

function checkboxlimit()
{
		var maxsel=4;
		var count=0;
		var lmt=document.getElementsByName('product[]').length;
		var coll=document.getElementsByName('product[]');
		for(i=0;i<lmt;i++)
		{
				if(coll[i].checked==true)
				{
						count++;
				}
		}
		if(count>maxsel)
		{
			alert("You can only select maximum of 4 fabrics ");
			return false;
		}
		if(count==0)
		{
		alert(" No fabrics have been selected.\n Please select one or more fabrics to continue to designing your custom shirt.");
			return false;
		}
}
function toggle()
	{
		var policyCheck = document.getElementById('policyCheck')
		if (policyCheck.style.display == 'none')
			 {
				policyCheck.style.display = 'block'
			 } 
		 else 
			 {
				policyCheck.style.display = 'none'
			 }
	}
function registartiondel()
{
	with (document.reg) 
	{
		if (!name.value=="") 
		 	{
			 	/*alert("Please enter contact person  name."); 
				!name.focus();  
				return false;
			} */
			
		var iChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.name.value.length; i++)
 		   {
  				if (iChars.indexOf(document.reg.name.value.charAt(i)) != -1) 
				{
  					alert ("Your contact name has special characters or digits. \nThese are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }}
		/* if (!address1.value=="") 
		 	{*/
			 	/*alert("Please enter first address."); 
				!address1.focus();  
				return false;
			} */
/*		if (!address2.value) 
		 	{
			 	alert("Please enter second address."); 
				!address2.focus();  
				return false;
			}*/ 
	
		   
		if (!city.value=="") 
		 	{
			 	/*alert("Please enter city name."); 
				!city.focus();  
				return false;
			}  */
		var iChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.city.value.length; i++)
 		   {
  				if (iChars.indexOf(document.reg.city.value.charAt(i)) != -1) 
				{
  					alert ("Your city field has special characters. \n These are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }}	
		if (!state.value=="") 
		 	{
			 	/*alert("Please enter state name."); 
				!state.focus();  
				return false;
			}  */
		var iChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.state.value.length; i++)
 		   {
  				if (iChars.indexOf(document.reg.state.value.charAt(i)) != -1) 
				{
  					alert ("Your state field has special characters or digits. \nThese are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }}
		if (!country.value=="") 
		{
			if (country.value=="1") 
				{
							var iCharval = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	
				for (var i = 0; i < document.reg.zipcode.value.length; i++)
			   {
					if (iCharval.indexOf(document.reg.zipcode.value.charAt(i)) != -1) 
					{
						alert ("Your zip code  has special characters . \nThese are not allowed.\n Please remove them and try again.");
						return false;
					}
			   }
						if (zipcode.value.length<6|| zipcode.value.length >6 ) 
							{
									alert("Zipcode must have between 6 digits ."); 
									!zipcode.focus(); 
									return false; 
							}
							
				}
			if (country.value =="2")
				{
					if (zipcode.value.length<5 || zipcode.value.length >5 ) 
							{
									alert("Zipcode must have between 5 digits ."); 
									!zipcode.focus(); 
									return false; 
							}
			var iCharval = "ABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrst!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	
			for (var i = 0; i < document.reg.zipcode.value.length; i++)
				   {
						if (iCharval.indexOf(document.reg.zipcode.value.charAt(i)) != -1) 
						{
							alert ("364Your zip code  has special characters or alphabetic characters. \nThese are not allowed.\n Please remove them and try again.");
							return false;
						}
				   }
					
				}
		}
	
			
		if (!zipcode.value=="") 
		 	{
			 	//alert("Please enter zip code."); 
//				!zipcode.focus();  
//				return false;
			  
			 		var iCharval = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.zipcode.value.length; i++)
 		   {
  				if (iCharval.indexOf(document.reg.zipcode.value.charAt(i)) != -1) 
				{
  					alert ("Your zip code  has special characters or alphabetic characters. \nThese are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   } 

		   	if (zipcode.value.length<4 || zipcode.value.length >10 ) 
						{
								alert("Zipcode must have between 4-10 digits ."); 
								!zipcode.focus(); 
								return false; 
						}
 
	}
		if (!contactno.value=="") 
		 	{
			 	
		var iCharval = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ!@#$%^&*()+=[]\\\';,./{}|\":<>?";

	    for (var i = 0; i < document.reg.contactno.value.length; i++)
 		   {
  				if (iCharval.indexOf(document.reg.contactno.value.charAt(i)) != -1) 
				{
  					alert ("Your  contact no  has special characters or alphabetic characters . \nThese are not allowed.\n Please remove them and try again.");
  					return false;
  				}
 		   }
				 
	   if (contactno.value.length<12 || contactno.value.length >12 ) 
		   	{
					alert("Contact no must have 10 digits long without (-) . "); 
					!contactno.focus(); 
					return false; 
			} 
	   if (!contactno.value.match(/^(\d{3,3})(-)(\d{3,3})(-)(\d{4})$/)) 
		  	{
		  		alert("Your Contact no format should be this 986-021-0120"); 
					!contactno.focus();  
					return false; 
			} 
			}


	}
return true;
	
}