

// BR
//-------------------------------------------------------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
} // end of function
//------------------------------------------------------------------------------
function verify_chng_det_login(form)  { //online/change_details/index.asp
if (!is_empty(form.password)) return false;
if (!is_empty(form.postcode)) return false;
if (!space_needed(form.postcode)) return false;
if (!is_empty(form.security_code)) return false;
// this were we submit the form!!
form.submit();	// un-comment to submit form
form.Submit.disabled=true;	
return;
}// end of function
//-------------------------------------------------------------------------------
function is_empty(form) { // has anything been entered in the form field - adding Enter??
Ctrl = form;
ctrl_enter_test = Ctrl.value.slice(0,5);
ctrl_enter_test = ctrl_enter_test.toLowerCase();
if (Ctrl.value == "" || ctrl_enter_test == "enter" || ctrl_enter_test == "keywo") {
validatePrompt (Ctrl, "Please enter ")
return (false);
} 
return (true);
} // end of function
//------------------------------------------------------------------------------

//-----------------------------------------------------
function human_message(Ctrl) { // change name of form field to something more human for the purpose of an error message
new_name = Ctrl.name;
var field_names = new Array("q5","q4","q3","q2","q1","job_number","line1","line6","source_category","source_category_details","fname","lname","affinity_ref","memno","orig_postcode","searchword", "name", "email", "message", "expirydate", "sec_code","card_number");
var new_values = new Array("Question 5","Question 4","Question 3","Question 2","Question 1","job number","Address line 1","Post code","where you heard about us","hear about us - more details","First name","Surname","Affinity membership number","Membership Number","Postcode","Search Word", "Name", "Email", "Message", "Expiry Date","Security Code","Card Number");
for (i=0; i<field_names.length; i++)
{
if(field_names[i] == Ctrl.name){new_name = new_values[i];}
}
return new_name;
}// end of function
//-----------------------------------------------------
function greyShade(Ctrl){ // turn form field grey
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
Ctrl.style.background = "#F3F3F3";
}
}// end of function
//-----------------------------------------------------
function validatePrompt (Ctrl, PromptStr) { //focus on form field and cause error message
// make sure the form is not submitted
Ctrl.focus();
field_name = human_message(Ctrl);
message = PromptStr+field_name;
alert (message)
greyShade(Ctrl);
return;
}// end of function


//-------------------------------------------------------------------------------
function verify_search(form)  { // SEARCH CHECKER
if (!is_empty(form.searchword)) return false;
// this were we submit the form!!
form.submit();
form.Submit.disabled=true;	
}// end of function
//-------------------------------------------------------------------------------


//-------------------------------------------------------------------------------
function verify_contact(form)  { // EMAIL FORM CHECKER
if (!is_empty(form.name)) return false;
if (!is_empty(form.telephone)) return false;
if (!is_empty(form.message)) return false;
// this were we submit the form!!

form.action = '/cgi-bin/FormMail.pl';

form.submit();
form.Submit.disabled=true;	
}// end of function
//-------------------------------------------------------------------------------


