function checkifEnter(e)
{
var key;
key = e.keyCode; //firefox & IE
if (key == 13){
if (false == nameSearchCheckForm()){
return false;
}
else{
return true;
}
}
else {
return true;
}
}
function checkifEnterEmail(e)
{
var key;
key = e.keyCode; //firefox & IE
if (key == 13){
if (false == nameSearchCheckFormEmail()){
return false;
}
else{
return true;
}
}
else {
return true;
}
}
function nameSearchCheckForm(){
var sForename = document.getElementById('forename').value;
var sSurname = document.getElementById('surname').value;
var sEmail = document.getElementById('searchemail').value;
var sPx = document.getElementById('px').value;
var sCountry;
try{
sCountry = $('country_name_key').value;
}catch(e){
sCountry = '';
}
var errMsg = "";
if(sForename.length < 1){
errMsg = "Please enter at least 1 character in the forename field.<br><br>";
}
if(sSurname.length < 2){
errMsg += "Please enter at least 2 characters in the surname field.<br><br>";
}
if(errMsg != ""){
msgBox('warning',errMsg);
return false;
}
else {
document.getElementById('submit1').onclick = "";
document.getElementById('submit1').disabled = true;
document.searchform.action = document.searchform.action + '&forename=' + encodeURIComponent(sForename);
document.searchform.action = document.searchform.action + '&surname=' + encodeURIComponent(sSurname);
document.searchform.action = document.searchform.action + '&country=' + encodeURIComponent(sCountry);
document.searchform.action = document.searchform.action + '&searchemail='
document.searchform.action = document.searchform.action + '&px=' + encodeURIComponent(sPx);
document.searchform.action = document.searchform.action + '&is_sub_s=' + "1";
document.searchform.action = document.searchform.action + '&is_sub_e=' + "0";
document.searchform.submit();
return true;
}
}
function nameSearchCheckFormEmail(){
var sEmail = document.getElementById('searchemail').value;
var sPx = document.getElementById('px').value;
var errMsg = "";
AtPos = sEmail.indexOf("@")
StopPos = sEmail.lastIndexOf(".")
if (sEmail == "") {
errMsg = "Not a valid Email address" + "<br>"
}
if (AtPos == -1 || StopPos == -1) {
errMsg = "Not a valid email address<br>"
}
if (StopPos < AtPos) {
errMsg = "Not a valid email address<br>"
}
if (StopPos - AtPos == 1) {
errMsg = "Not a valid email address<br>"
}
if(errMsg != ""){
msgBox('warning',errMsg);
return false;
}else {
document.getElementById('submit2').onclick = "";
document.getElementById('submit2').disabled = true;
document.searchformemail.action = document.searchformemail.action + '&forename='
document.searchformemail.action = document.searchformemail.action + '&surname='
document.searchformemail.action = document.searchformemail.action + '&country='
document.searchformemail.action = document.searchformemail.action + '&searchemail=' + encodeURIComponent(sEmail);
document.searchformemail.action = document.searchformemail.action + '&px=' + encodeURIComponent(sPx);
document.searchformemail.action = document.searchformemail.action + '&is_sub_e=' + "1";
document.searchformemail.action = document.searchformemail.action + '&is_sub_s=' + "0";
document.searchformemail.submit();
return true;
}
}
function LoadPage(px){
document.getElementById('px').value = px;
document.searchtab.action = document.getElementById('url').value + '&px=' + px;
document.searchtab.submit();
}
