//***************************************************************
//  Security Validation
//***************************************************************
function isValidEmail(s) {
	var regexp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	return regexp.test(s);}

function isUrl(s) {
	var regexp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/
	return regexp.test(s);
}
//**END OF SECURITY VALIDATION***********************************

//***************************************************************
//  Registration Form Validation - REGISTER.ASP
//***************************************************************
function chkRegistrationForm(frmObj)
{
	var frm = frmObj;
	var chk = false;
    var formDOMObj = document.frmEmail;


if (frm.name.value == "")
	{
	        document.frmEmail.name.focus(); 
    	    document.getElementById('name').style.color="red"; 
			alert('Please enter your full name.');
	}
	else if (frm.primaryEmail.value == "")
		{
	        document.frmEmail.primaryEmail.focus(); 
    	    document.getElementById('primaryEmail').style.color="red"; 
			alert('Please enter your email address.');
		}
	else if (!isValidEmail(frm.primaryEmail.value))
		{
	        document.frmEmail.primaryEmail.focus(); 
    	    document.getElementById('primaryEmail').style.color="red"; 
			alert('Your email address is not valid. Please make sure it is correct.');
		}
	else if (frm.address.value == "" )
		{
	        document.frmEmail.address.focus(); 
    	    document.getElementById('address').style.color="red"; 
			alert('Please enter your address.');
		}

	else if (frm.phone.value == "" )
		{
	        document.frmEmail.phone.focus(); 
    	    document.getElementById('phone').style.color="red"; 
			alert('Please enter your phone number.');
		}

	else if (frm.birthdate.value == "" )
		{
	        document.frmEmail.birthdate.focus(); 
    	    document.getElementById('birthdate').style.color="red"; 
			alert('Please enter your date of birth.');
		}

	else if (frm.drinkname.value == "" )
		{
	        document.frmEmail.drinkname.focus(); 
    	    document.getElementById('drinkname').style.color="red"; 
			alert('Please enter your drink name.');
		}

	else if (frm.ingredients.value == "" )
		{
	        document.frmEmail.ingredients.focus(); 
    	    document.getElementById('ingredients').style.color="red"; 
			alert('Please enter your ingredients.');
		}

	else if (frm.directions.value == "" )
		{
	        document.frmEmail.directions.focus(); 
    	    document.getElementById('directions').style.color="red"; 
			alert('Please enter your directions.');
		}

	else if ((document.frmEmail.professionalbartender[0].checked == false) && (document.frmEmail.professionalbartender[1].checked == false))
		{
			alert('Please let us know if you are a professional bartender.');
		}

	else if (frm.agreeRules.checked == false)
		{
	        document.frmEmail.agreeRules.focus(); 
    	    document.getElementById('agreeRules').style.color="red"; 
			alert('Please ensure you agree to the rules and regulations of this contest.');
		}
	else
    {
		chk=true;
	}

   if (chk)
		{
			alert('Thank you for your submission. All entries will be reviewed prior to posting on the website.\n');
			document.forms['frmEmail'].submit();
		}
	else
		{
			return -1;
		}
}
//**END OF REGISTRATION FORM VALIDATION**************************
function winPop2(fl)
{
  window.open(fl, "popup","status=no,width=400,height=400,locationbar=no,scrollbars=yes,menubar=no");
}
