 
  // Declare variables
  var ErrorMessage, englishPattern, emailPattern;
  var engStr, emaStr;
  ErrorMessage = "";
  engStr = " ";
  emaStr = " ";
  englishPattern = new RegExp(/\<|\>/gi);
  ErrorTextFieldBg = "url(images/redtextfield.jpg)";
  NormalTextFieldBg = "url(psd-template/images/wgr-quick-form_13.jpg)";
  BgName="";
  er=0;

  function init_form() {
   // document.getElementById("subbutton").innerHTML = '<button name="Submit" type="button" class="submitbut" id="submit" value="Submit" onclick="validateForm()" ></button></td>';
    if( document.getElementById("subbutton") )
      document.getElementById("subbutton").innerHTML = '<input name="Submit" type="button" class="submitbut1" onclick="validateForm()" /></td>';
  }

  function init_feedbackform() {
    if( document.getElementById("subbutton") )
      document.getElementById("subbutton").innerHTML = '<input name="Submit" type="button" class="submitbut"  style="margin-top:16px!important;margin-right:19px;" onclick="validate_FeedbackForm()"/>';
  }
  
  function init_homeforms() {
    if( document.getElementById("subbutton1") )
      document.getElementById("subbutton1").innerHTML = '<img  src="images/submit1.jpg" id="submit1" onclick="validate_HomePageForm1()" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('+ "'submit1','','images/submit2.jpg'"+',1)" style="padding-top:5px;cursor:pointer;margin-right:7px" />';
    if( document.getElementById("subbutton1") )
      document.getElementById("subbutton2").innerHTML = '<img  src="images/submit1.jpg" id="submit2" onclick="validate_HomePageForm2()" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('+"'submit2','','images/submit2.jpg'"+',1)" style="padding-top:5px;cursor:pointer;margin-right:3px" />';
  }

  // Get and retieve values

  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
  } 

  function removeUnsafeChars(englishStr) {
    // remove <> characters
    englishPattern = new RegExp(/\<|\>/gi);
    engStr = englishStr.replace(englishPattern, " ");
    return engStr;
  } 

  function getFieldValues_BasicForm() {
    console.group( 'getFieldValues_BasicForm()' );

    // Get field values.
    FullName = document.forms[0].fullname.value;
    Phone = document.forms[0].phone.value;
    Urmail = document.forms[0].urmail.value;
    Postcode = document.forms[0].postcode.value;
    Comments = document.forms[0].comments.value;

    // Trim fields
    FullName = FullName.trim();
    Phone = Phone.trim();
    Urmail = Urmail.trim();
    Postcode = Postcode.trim();
    Comments = Comments.trim();

    // Remove unsafe characters
    FullName = removeUnsafeChars(FullName);
    Phone = removeUnsafeChars(Phone);
    Urmail = removeUnsafeChars(Urmail);
    Postcode = removeUnsafeChars(Postcode);
    Comments = removeUnsafeChars(Comments);
    
    console.groupEnd();
  }


  function getFieldValues_HomePageForm1() {


    // Get field values.
    FullName = document.forms[0].fullname.value;
    Phone = document.forms[0].phone.value;

    // Trim fields
    FullName = FullName.trim();
    Phone = Phone.trim();

    // Remove unsafe characters
    FullName = removeUnsafeChars(FullName);
    Phone = removeUnsafeChars(Phone);

    // Get field values.
    Bestcontacttime = document.forms[0].bestcontacttime.value;
    Enquirytype = document.forms[0].enquirytype.value;

    // Trim fields
    Bestcontacttime = Bestcontacttime.trim();
    Enquirytype = Enquirytype.trim();

    // Remove unsafe characters
    Bestcontacttime = removeUnsafeChars(Bestcontacttime);
    Enquirytype = removeUnsafeChars(Enquirytype);
  }

  function getFieldValues_HomePageForm2() {

    // Get field values.
    FullName = document.forms[1].fullname.value;
    Urmail = document.forms[1].urmail.value;
    Comments = document.forms[1].comments.value;

    // Trim fields
    FullName = FullName.trim();
    Urmail = Urmail.trim();
    Comments = Comments.trim();

    // Remove unsafe characters
    FullName = removeUnsafeChars(FullName);
    Urmail = removeUnsafeChars(Urmail);
    Comments = removeUnsafeChars(Comments);
  }

  function getFieldValues_FeedbackForm() {

    // Get field values.
    Urmail = document.forms[0].urmail.value;
    Fullname = document.forms[0].fullname.value;

    // Trim fields
    Urmail = Urmail.trim();
    Fullname = Fullname.trim();

    // Remove unsafe characters
    Urmail = removeUnsafeChars(Urmail);
    Fullname = removeUnsafeChars(Fullname);

  }

  function getFieldValues_ContactForm() {

    // Get field values.
    Where = document.forms[0].where.value;
    //Email_list = document.forms[0].email_list.value;

    // Trim fields
    Where = Where.trim();

    // Remove unsafe characters
    Where = removeUnsafeChars(Where);
  }

  function getFieldValues_GenericForm() {
    console.group( 'getFieldValues_GenericForm()' );

    // Get field values.
    Loan_purpose = document.forms[0].loan_purpose.value;
    //Where = document.forms[0].where.value;

    console.groupEnd();
  }

  function getFieldValues_GlossaryForm() {
    // Get field values.
    FullName = document.forms[0].fullname.value;
    Urmail = document.forms[0].urmail.value;
    Postcode = document.forms[0].postcode.value;
    Comments = document.forms[0].comments.value;

    // Trim fields
    FullName = FullName.trim();
    Urmail = Urmail.trim();
    Postcode = Postcode.trim();
    Comments = Comments.trim();

    // Remove unsafe characters
    FullName = removeUnsafeChars(FullName);
    Urmail = removeUnsafeChars(Urmail);
    Postcode = removeUnsafeChars(Postcode);
    Comments = removeUnsafeChars(Comments);
  }

  function getFieldValues_FirstHomeOwnersForm() {

    // Get field values.
    Loan_amount = document.forms[0].loan_amount.value;
    Loan_type = document.forms[0].loan_type.value;
    Total_savings = "0";
    if( document.forms[0].total_savings )
      Total_savings = document.forms[0].total_savings.value;
    Current_status = "";
    if( document.forms[0].current_status )
      Current_status = document.forms[0].current_status.value;
    Clean_credit = document.forms[0].clean_credit.value;

    // Trim fields
    Loan_amount = Loan_amount.trim();
    Loan_type = Loan_type.trim();
    Total_savings = Total_savings.trim();
    Current_status = Current_status.trim();
    Clean_credit = Clean_credit.trim();

    // Remove unsafe characters
    Loan_type = removeUnsafeChars(Loan_type);
    Total_savings = removeUnsafeChars(Total_savings);
    Current_status = removeUnsafeChars(Current_status);
    Clean_credit = removeUnsafeChars(Clean_credit);

  }
  
  function getFieldValues_SelfEmployedForm() {

    // Get field values.
    Loan_amount = document.forms[0].loan_amount.value;
    Loan_purpose = document.forms[0].loan_purpose.value;
    Loan_type = document.forms[0].loan_type.value;
    Property_value = document.forms[0].property_value.value;
    Clean_credit = document.forms[0].clean_credit.value;

    // Trim fields
    Loan_amount = Loan_amount.trim();
    Loan_purpose = Loan_purpose.trim();
    Loan_type = Loan_type.trim();
    Property_value = Property_value.trim();
    Clean_credit = Clean_credit.trim();


  }

  function getFieldValues_CommercialForm() {

    // Get field values.
    Loan_amount = document.forms[0].loan_amount.value;
    Loan_purpose = document.forms[0].loan_purpose.value;
    Loan_type = document.forms[0].loan_type.value;
    Property = document.forms[0].property.value;

    // Trim fields
    Loan_amount = Loan_amount.trim();
    Loan_purpose = Loan_purpose.trim();
    Loan_type = Loan_type.trim();
    Property_value = Property.trim();

    // Remove unsafe characters
    Loan_amount = removeUnsafeChars(Loan_amount);
    Loan_purpose = removeUnsafeChars(Loan_purpose);
    Loan_type = removeUnsafeChars(Loan_type);
    Property = removeUnsafeChars(Property);
  }

  function getFieldValues_BadCreditForm() {

    // Get field values.
    Loan_amount = document.forms[0].loan_amount.value;
    Loan_purpose = document.forms[0].loan_purpose.value;
    Loan_type = document.forms[0].loan_type.value;
    Property_value = document.forms[0].property_value.value;
    Credit_defaults = document.forms[0].credit_defaults.value;
    Loan_arrears = document.forms[0].loan_arrears.value;
    Past_bankruptcy = document.forms[0].past_bankruptcy.value;

    // Trim fields
    Loan_amount = Loan_amount.trim();
    Loan_purpose = Loan_purpose.trim();
    Loan_type = Loan_type.trim();
    Property_value = Property_value.trim();
    Credit_defaults = Credit_defaults.trim();
    Loan_arrears = Loan_arrears.trim();
    Past_bankruptcy = Past_bankruptcy.trim();

    // Remove unsafe characters
    Loan_amount = removeUnsafeChars(Loan_amount);
    Loan_purpose = removeUnsafeChars(Loan_purpose);
    Loan_type = removeUnsafeChars(Loan_type);
    Property_value = removeUnsafeChars(Property_value);
    Credit_defaults = removeUnsafeChars(Credit_defaults);
    Loan_arrears = removeUnsafeChars(Loan_arrears);
    Past_bankruptcy = removeUnsafeChars(Past_bankruptcy);
  }

  function validateEmail(emailStr) {
    emailPattern = new RegExp(/^\S+@\S+\.\S+$/gi);
    return emailPattern.test(emailStr);   // true or false will be returned 
  }

  function validateDigits(digitStr) {
    digitPattern = new RegExp(/^\d+$/gi);
    return digitPattern.test(digitStr);   // true or false will be returned 
  }

  function validate_BasicForm() {
    document.forms[0].submit();
  }

  function validate_HomePageForm1() {

    getFieldValues_HomePageForm1();

    if ((FullName.length == 0) || (Phone.length == 0) ||  (Bestcontacttime == "Please select...") || (Enquirytype == "Please select...")) {

      BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
      document.forms[0].fullname.style.backgroundImage=BgName;
      BgName = (Phone.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
      document.forms[0].phone.style.backgroundImage=BgName;
      BgName = (Bestcontacttime == "Please select...") ? "redBody":"selectBody";
      document.forms[0].bestcontacttime.setAttribute("class", BgName);
      BgName = (Enquirytype == "Please select...") ? "redBody":"selectBody";
      document.forms[0].enquirytype.setAttribute("class", BgName);

      ErrorMessage = "images/errorMessage1.jpg";
      document.getElementById("requiredfield1").src=ErrorMessage;
      document.getElementById("requiredfield1a").src=ErrorMessage;

      showCallBackScreen1();
    } else {
      document.forms[0].submit();
    }

  }

  function validate_HomePageForm2() {

    getFieldValues_HomePageForm2();

    if ((FullName.length == 0) || (Urmail.length == 0) || (Comments.length == 0)) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[1].fullname.style.backgroundImage=BgName;

    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[1].urmail.style.backgroundImage=BgName;

    BgName = (Comments.length == 0) ? "url(images/redcommentfield.jpg)":"url(images/smallcommentfield.jpg)";
    document.forms[1].comments.style.backgroundImage=BgName;

    ErrorMessage = "images/errorMessage1.jpg";
    document.getElementById("requiredfield2").src=ErrorMessage;
    document.getElementById("requiredfield2a").src=ErrorMessage;

    showAskQuestionScreen1();
    } else {
      document.forms[1].submit();
    }
  }

  function validate_FeedbackForm() {
    getFieldValues_FeedbackForm();

    NormalTextFieldBg = "url(images/textfieldbg.jpg)";
    ErrorTextFieldBg = "url(images/redtextfield2.jpg)";

    if ((Fullname.length == 0) || (Urmail.length == 0)) {

    BgName = (Fullname.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;

    document.getElementById("feedbackfooter").style.backgroundImage = "url(images/feedbackformfooter_error.jpg)";

    } else {
      document.forms[0].submit();
    }
  }

  function validate_ContactForm() {
    getFieldValues_BasicForm();
    getFieldValues_ContactForm();
    if ((FullName.length == 0) || (Phone.length == 0) || (Urmail.length == 0) || (Postcode.length == 0)) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Phone.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].phone.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;
    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;

    return ErrorMessage = "images/errorMessage.jpg";

    } else {
      document.forms[0].submit();
    }
  }

  function validate_GenericForm() {
    console.group( 'validate_GenericForm()' );
    getFieldValues_BasicForm();
    getFieldValues_GenericForm();

    if ((FullName.length == 0) ||
      (Phone.length == 0) ||  
      (Urmail.length == 0) || 
      (Postcode.length == 0) || (Loan_purpose  == "Please select..")) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Phone.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].phone.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;
    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;

    BgName = (Loan_purpose == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_purpose.setAttribute("class", BgName);
    
    ErrorMessage = "images/errorMessage.jpg";

    console.log( 'Returning "%s"' , ErrorMessage );
    console.groupEnd();
    return ErrorMessage;

    } else {
      document.forms[0].submit();
    }

  }

  function validate_GlossaryForm() {

    getFieldValues_GlossaryForm(); 
    if ((FullName.length == 0) || (Urmail.length == 0) || (Postcode.length == 0) || (Comments.length == 0)) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;
    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;
    BgName = (Comments.length == 0) ? "url(images/redcommentfield1.jpg)":"url(images/smallcommentfield.jpg)";
    document.getElementById("fieldArea2i").style.backgroundImage=BgName;

    return ErrorMessage = "images/errorMessage.jpg";

    } else {
    document.forms[0].submit();

   }
  }

  function validate_FirstHomeOwnersForm() {
    getFieldValues_BasicForm();
    getFieldValues_FirstHomeOwnersForm();
    if ((FullName.length == 0) ||
      (Phone.length == 0) ||  
      (Urmail.length == 0) || 
      (Postcode.length == 0)||
      (Loan_amount == "$") ||
      (Loan_type  == "Please select..") ||
      (Current_status  == "Please select..") ||
      (Clean_credit  == "Please select..")) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Phone.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].phone.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;
    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;

    BgName = (Loan_amount == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].loan_amount.style.backgroundImage=BgName;
    BgName = (Loan_type == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_type.setAttribute("class", BgName);
    //BgName = (Total_savings == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    //document.forms[0].total_savings.style.backgroundImage=BgName;
    if( document.forms[0].current_status ){
      BgName = (Current_status == "Please select..") ? "redBody":"selectBody";
      document.forms[0].current_status.setAttribute("class", BgName);
    }
    BgName = (Clean_credit == "Please select..") ? "redBody":"selectBody";
    document.forms[0].clean_credit.setAttribute("class", BgName);

    return ErrorMessage = "images/errorMessage.jpg";

    } else {
      document.forms[0].submit();
    }
  }

  function validate_SelfEmployedForm() {
    getFieldValues_BasicForm();
    getFieldValues_SelfEmployedForm();
    if ((FullName.length == 0) ||
      (Phone.length == 0) ||  
      (Urmail.length == 0) || 
      (Postcode.length == 0) ||
      (Loan_amount == "$") ||
      (Loan_purpose  == "Please select..") ||
      (Loan_type == "Please select..") ||
      (Clean_credit == "Please select..")) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Phone.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].phone.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;
    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;

    BgName = (Loan_amount == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].loan_amount.style.backgroundImage=BgName;

    BgName = (Loan_purpose == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_purpose.setAttribute("class", BgName);
    BgName = (Loan_type == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_type.setAttribute("class", BgName);
    //BgName = (Property_value == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    //document.forms[0].property_value.style.backgroundImage=BgName;
    BgName = (Clean_credit == "Please select..") ? "redBody":"selectBody";
    document.forms[0].clean_credit.setAttribute("class", BgName);

    return ErrorMessage = "images/errorMessage.jpg";

    } else {
      document.forms[0].submit();
    }
  }

  function validate_CommercialForm() {
    getFieldValues_BasicForm();
    getFieldValues_CommercialForm();
    if ((FullName.length == 0) ||
      (Phone.length == 0) ||  
      (Urmail.length == 0) || 
      (Postcode.length == 0) ||
      (Loan_amount == "$") ||
      (Loan_purpose == "Please select..") ||
      (Loan_type == "Please select..") ||
      (Property == "Please select..")) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;
    BgName = (Phone.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].phone.style.backgroundImage=BgName;
    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;
    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;

    BgName = (Loan_amount == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].loan_amount.style.backgroundImage=BgName;
    BgName = (Loan_purpose == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_purpose.setAttribute("class", BgName);
    BgName = (Loan_type == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_type.setAttribute("class", BgName);
    BgName = (Property == "Please select..") ? "redBody":"selectBody";
    document.forms[0].property.setAttribute("class", BgName);

    //BgName = (Comments.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    //document.forms[0].comments.style.backgroundImage=BgName;

    return ErrorMessage = "images/errorMessage.jpg";
    } else {
      document.forms[0].submit();
    }

  }

  function validate_BadCreditForm() {
    getFieldValues_BasicForm();
   // getFieldValues_BadCreditForm();   


    // Get field values.
    Loan_amount = document.forms[0].loan_amount.value;
    Loan_purpose = document.forms[0].loan_purpose.value;
    Loan_type = document.forms[0].loan_type.value;
    Property_value = document.forms[0].property_value.value;
    Credit_defaults = document.forms[0].credit_defaults.value;
    Loan_arrears = document.forms[0].loan_arrears.value;
    Past_bankruptcy = document.forms[0].past_bankruptcy.value;

    // Trim fields
    Loan_amount = Loan_amount.trim();
    Loan_purpose = Loan_purpose.trim();
    Loan_type = Loan_type.trim();
    Property_value = Property_value.trim();
    Credit_defaults = Credit_defaults.trim();
    Loan_arrears = Loan_arrears.trim();
    Past_bankruptcy = Past_bankruptcy.trim();

    // Remove unsafe characters
    Loan_amount = removeUnsafeChars(Loan_amount);
    Loan_purpose = removeUnsafeChars(Loan_purpose);
    Loan_type = removeUnsafeChars(Loan_type);
    Property_value = removeUnsafeChars(Property_value);
    Credit_defaults = removeUnsafeChars(Credit_defaults);
    Loan_arrears = removeUnsafeChars(Loan_arrears);
    Past_bankruptcy = removeUnsafeChars(Past_bankruptcy);

    if ((FullName.length == 0) ||
      (Phone.length == 0) ||  
      (Urmail.length == 0) || 
      (Postcode.length == 0) ||
      (Loan_amount == "$") ||
      (Loan_purpose == "Please select..") ||
      (Loan_type == "Please select..") ||
      (Credit_defaults == "Please select..") ||
      (Loan_arrears == "Please select..") ||
      (Past_bankruptcy == "Please select..")) {

    BgName = (FullName.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].fullname.style.backgroundImage=BgName;

    BgName = (Phone.length == 0) ?  ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].phone.style.backgroundImage=BgName;

    BgName = (Urmail.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].urmail.style.backgroundImage=BgName;

    BgName = (Postcode.length == 0) ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].postcode.style.backgroundImage=BgName;

    BgName = (Loan_amount == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    document.forms[0].loan_amount.style.backgroundImage=BgName;

    BgName = (Loan_purpose == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_purpose.setAttribute("class", BgName);

    BgName = (Loan_type == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_type.setAttribute("class", BgName);

    //BgName = (Property_value == "$") ? ErrorTextFieldBg:NormalTextFieldBg;
    //document.forms[0].property_value.style.backgroundImage=BgName;

    BgName = (Credit_defaults == "Please select..") ? "redBody":"selectBody";
    document.forms[0].credit_defaults.setAttribute("class", BgName);

    BgName = (Loan_arrears == "Please select..") ? "redBody":"selectBody";
    document.forms[0].loan_arrears.setAttribute("class", BgName);

    BgName = (Past_bankruptcy == "Please select..") ? "redBody":"selectBody";
    document.forms[0].past_bankruptcy.setAttribute("class", BgName);

    return ErrorMessage = "images/errorMessage.jpg";

    } else {

      document.forms[0].submit();
    }
  }

  function validateForm() {
    PageName = document.forms[0].page.value;
    console.info( 'PageName = "%s"' , PageName );
    switch (PageName) {
      case "bad-credit-mortgages.html":
        validate_BadCreditForm();
        break;
      case "feedbackform.html":
        validate_FeedbackForm();
        break;
      case "mortgage-glossary.html":
        validate_GlossaryForm();
        break;
      case "self-employed-mortgages.html":
        validate_SelfEmployedForm();
        break;
      case "commercial-mortgages.html":
        validate_CommercialForm();
        break;
      case "first-home-mortgages.html":
      case "debt-consolidation-loans.html":
        validate_FirstHomeOwnersForm();
        break;
      case "contact.html":
        validate_ContactForm();
        break;
      case "index.html":
        validate_HomePageForm1();
        break;
      case "residex.html":
        validate_FirstHomeOwnersForm();
        break;
      case "resources-mortgage-insurance.html":
      case "resources.html":
      case "offers.html":
      case "solutions.html":
      case "site-map.html":
      case "resources.html":
      case "resources-state-of-bad-credit.html":
      case "resources-10-simple-ways-bad-credit-proof.html":
      case "resources-wise-ways-reduce-eliminate-credit-card-debt.html":
        validate_GenericForm();
        break;
     }
     //validate_BadCreditForm();
     //validate_CommercialForm();
     //validate_SelfEmployedForm();
     //validate_FirstHomeOwnersForm();
     //validate_GlossaryForm();
     //validate_GenericForm();
     //validate_ContactForm();
     //validate_FeedbackForm();
     //validate_HomePageForm2();
     //validate_HomePageForm1();

     document.requiredfield.src=ErrorMessage;

  }

