jQuery(document).ready(function() {
$('#bowp2 #BOWSubscribeButton').bind("click",bowchksubmit);
});
var bowerrlg='';
function bowchkname()
{
	if ($.trim($('#bowp2 #bowName').val()) == "" || $.trim($('#bowp2 #bowName').val()) == "Enter Your Name")
	{
	
	bowerrlg='* Name';
	document.getElementById('bowName').focus();
	document.getElementById('bowName').value="";
	document.bowp2.bowName.style.background = "#FEFF80";
	 return true;
	}
	else
	{
	document.bowp2.bowName.style.background = "#FFFFFF";
	return false;
	}
}
function bowchkmail()
{
	if ($.trim($('#bowp2 #bowEmail').val()) == "")
	{
	 bowerrlg=bowerrlg+'* Email';
	document.getElementById('bowEmail').focus();
	document.getElementById('bowEmail').value="";
	document.bowp2.bowEmail.style.background = "#FEFF80";
	 return true;
	}
	else
	{
		 var emails = $.trim($("#bowp2 #bowEmail").val());	
		 if(isValidbowEmailAddress(emails))
		 {
		 
		 document.bowp2.bowEmail.style.background = "#FFFFFF";
		 return false;
		 }
		 else
		 {
		 bowerrlg=bowerrlg+'* Email';
		document.getElementById('bowEmail').focus();
		document.getElementById('bowEmail').value="";
		document.bowp2.bowEmail.style.background = "#FEFF80";
		 return true;
		 }
	}	
}

function isValidbowEmailAddress(emailAddress) {
 		var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
 		return pattern.test(emailAddress);
	} 

function bowchksubmit()
{
	bowerrlg='';
	if(bowchkname()==false && bowchkmail()==false)
	{
	$('#errorbowcontact').html('');
	return true;
	}
	else
	{
	$('#errorbowcontact').html(bowerrlg);
	return false;
	}
}
