// JavaScript Document

function showPopup(callbackFunc,human1,human2,answer1) {
  s = '';
  s += '<style>';
  s += '  #formDiv {';  
  s += '	position: absolute;';
  s += '	left: 400;';
  s += '	top: 300px;';
  s += '	background-color: #D51218;';
  s += '	color: #FF9999;';
  s += '	border: 1px solid #660000;';
  s += '	padding: 10px;';
  s += '	font-family: Verdana, Arial, Helvetica, sans-serif;';
  s += '	font-size: 9pt;';
  s += '	text-align: right;';
  s += '	width: 300px;';
  s += '	line-height: 2em;';
  s += '  }';
  s += '</style>';
  s += '';
  s += '<div id="formDiv">';
  s += '  <strong>Purposeful Africa Newsletter Sign Up</strong><br />';
  s += '  <FORM name="PANewsletterSignUpForm" ACTION="http://www.topica.com/f/p.html" METHOD="POST">';
  s += '  <INPUT TYPE="HIDDEN" NAME="lid" VALUE="900115826"><INPUT TYPE="HIDDEN" NAME="fid" VALUE="900085695">';
  s += '  First Name: <INPUT CLASS="input-text" TYPE="TEXT" NAME="f:900505147" VALUE="" alt="blank"  id="First NameNL">';
  s += '  &nbsp;<INPUT TYPE="HIDDEN" NAME="f#900505147" VALUE="TEXT:First%20Name"><br />';
  s += '  Last Name: <INPUT CLASS="input-text" TYPE="TEXT" NAME="f:900505153" VALUE="" alt="blank"  id="Last NameNL">';
  s += '  &nbsp;<INPUT TYPE="HIDDEN" NAME="f#900505153" VALUE="TEXT:Last%20Name"><br />';
  s += '  Email Address: <INPUT CLASS="input-text" TYPE="TEXT" NAME="f:31" VALUE="" MAXLENGTH=128  alt="email|0"  id="Email AddressNL">';
  s += '  &nbsp;<INPUT TYPE="HIDDEN" NAME="f#31" VALUE="TEXT:Email%20Address"><br />';
  s += '  '+human1+'+'+human2+'= <input type="text" id="nlhumano" name="nlhumano" CLASS="input-text" />';
  s += '  &nbsp;<INPUT TYPE="HIDDEN" NAME="humanooo" VALUE=""><br />';
  s += '  <INPUT TYPE="button" NAME="Submit" CLASS="input-submit" VALUE="Submit" onClick="validnl()">&nbsp;&nbsp;<input type="button" name="btnCancel" id="btnCancel" value="Cancel">';
  s += '  &nbsp;<INPUT TYPE="HIDDEN" NAME="humanooo" VALUE=""><br />';
  s += '  </form>';
  s += '</div>';
  s += '';
  s += '<script type="text/javascript">';
  s += '  formInfo = "";';
  s += '  $("#btnCancel").click(function(){';
  s += '    returnResponse("Cancelled");';
  s += '  });';
  s += '  $("#PANewsletterSignUpForm").submit(function(){';
  s += '    formInfo = new Object;';
  s += '    formInfo.firstName = $("#firstName").val();';
  s += '    formInfo.lastName = $("#lastName").val();';
  s += '    formInfo.email = $("#email").val();';
  s += '    returnResponse(formInfo);';
  s += '  });';
  s += '  function returnResponse(fI){';
  s += '    $("#formDiv").remove();';
  s += '    ' + callbackFunc + '(fI);';
  s += '  }';
  s += 'function validnl() {';
  s += 'var nlemail = document.getElementById("Email AddressNL").value;';
  s += 'var nlemailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;';
  s += 'if (document.getElementById("First NameNL").value == "")';
  s += '	{';
  s += '		alert("Please enter your first name.");';
  s += '		document.getElementById("First NameNL").style.background = "Yellow";';
  s += '		document.getElementById("First NameNL").focus();';
  s += '		return false;';
  s += '	}';
  s += '	else if (document.getElementById("Last NameNL").value == "") ';
  s += '	{';
  s += '		alert("Please enter your last name.");';
  s += '		document.getElementById("Last NameNL").style.background = "Yellow";';
  s += '		document.getElementById("Last NameNL").focus();';
  s += '		return false;';
  s += '	}';
  s += '	else if (document.getElementById("Email AddressNL").value == "") ';
  s += '	{';
  s += '		alert("Please enter your email.");';
  s += '		document.getElementById("Email AddressNL").style.background = "Yellow";';
  s += '		document.getElementById("Email AddressNL").focus();';
  s += '		return false;';
  s += '	}';
  s += '	else if (document.PANewsletterSignUpForm.nlhumano.value != "'+answer1+'")';
  s += '	{';
  s += '	    alert("Your human verifyer is wrong.");';
  s += '		document.PANewsletterSignUpForm.nlhumano.style.background = "Yellow";';
  s += '		document.PANewsletterSignUpForm.nlhumano.focus();';
  s += '		return false;';
  s += '	}';
  s += '	document.getElementById("First NameNL").style.background = "White";';
  s += '	document.getElementById("Last NameNL").style.background = "White";';
  s += '  	document.getElementById("Email AddressNL").style.background = "White";';
  s += '  	document.PANewsletterSignUpForm.nlhumano.style.background = "White";';
  s += '	document.PANewsletterSignUpForm.submit();';
  s += '}';
  s += '</script>';
  $("body").append(s);
}

