jQuery(document).ready(function() {
$('#nlp2 #nlbutton').bind("click",nlchksubmit);
});
var nlerrlg='';
function nlchkname()
{
	if ($.trim($('#nlp2 #nlName').val()) == "" || $.trim($('#nlp2 #nlName').val()) == "Name")
	{
	
	nlerrlg='* Name';
	document.getElementById('nlName').focus();
	document.getElementById('nlName').value="";
	document.nlp2.nlName.style.background = "#FEFF80";
	 return true;
	}
	else
	{
	document.nlp2.nlName.style.background = "#FFFFFF";
	return false;
	}
}
function nlchkmail()
{
	if ($.trim($('#nlp2 #nlEmail').val()) == "")
	{
	 nlerrlg=nlerrlg+'* Email';
	document.getElementById('nlEmail').focus();
	document.getElementById('nlEmail').value="";
	document.nlp2.nlEmail.style.background = "#FEFF80";
	 return true;
	}
	else
	{
		 var emails = $.trim($("#nlp2 #nlEmail").val());	
		 if(isValidnlEmailAddress(emails))
		 {
		 
		 document.nlp2.nlEmail.style.background = "#FFFFFF";
		 return false;
		 }
		 else
		 {
		 nlerrlg=nlerrlg+'* Email';
		document.getElementById('nlEmail').focus();
		document.getElementById('nlEmail').value="";
		document.nlp2.nlEmail.style.background = "#FEFF80";
		 return true;
		 }
	}	
}

function isValidnlEmailAddress(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 nlchksubmit()
{
	nlerrlg='';
	if(nlchkname()==false && nlchkmail()==false)
	{
	$('#errornlcontact').html('');
	return true;
	}
	else
	{
	$('#errornlcontact').html(nlerrlg);
	return false;
	}
}