﻿function validate_online() {
    //alert("Hello");
    //return false;
    if (!is_email(document.getElementById('email'), 'E-mail Address')) { return false; }
    
    if (!is_blank_prompt(document.getElementById('ddlTitle'), 'Title')) {return false;  }

    if (!is_blank_prompt(document.getElementById('surname'), 'Surname') || !no_special_characters(document.getElementById('surname'), 'Surname')) { return false; }
    if (!is_blank_prompt(document.getElementById('name'), 'First Name') || !no_special_characters(document.getElementById('name'), 'First Name')) { return false; }
    if (!is_blank_prompt(document.getElementById('idno'), 'ID Number') || !no_special_characters(document.getElementById('idno'), 'ID Number')) { return false; }
    if (!is_blank_prompt(document.getElementById('contactno'), 'Contact Number') || !no_special_characters(document.getElementById('contact'), 'Contact Number')) { return false; }
    if (!is_blank_prompt(document.getElementById('ddlProduct'), 'Products')) {return false;  }
    if (!is_blank_prompt(document.getElementById('ddlAbout'), 'About Us')) {return false;  }
    return true;
}

function validate_alert() {
    
    
    
    if (!is_blank_prompt(document.getElementById('name'), 'First Name') || !no_special_characters(document.getElementById('name'), 'First Name')) { return false; }
    if (!is_blank_prompt(document.getElementById('surname'), 'Surname') || !no_special_characters(document.getElementById('surname'), 'Surname')) { return false; }
    if (!is_blank_prompt(document.getElementById('daytimeno'), 'Daytime Number') || !no_special_characters(document.getElementById('daytimeno'), 'Daytime Number')) { return false; }
    if (!is_blank_prompt(document.getElementById('contactno'), 'Contact Number') || !no_special_characters(document.getElementById('contactno'), 'Contact Number')) { return false; }
    if (!is_email(document.getElementById('email'), 'E-mail Address')) { return false; }
    

   if ($("input[name='q1yesno']:checked").length == 0) {
        alertOutput("Please tell us if you would like to receive a copy of the annual report.");
        return false;
    } else if ($('input[name="q1yesno"]')[0].checked) {
        if (!is_blank_prompt(document.getElementById('ddlq1'), 'Preferred Medium')) { return false; }
    }
     if ($("input[name='q2yesno']:checked").length == 0) {
         alertOutput("Please tell us if you would like tobe notified when SENS is released.");
         return false;
     } else if ($('input[name="q2yesno"]')[0].checked) {
         if (!is_blank_prompt(document.getElementById('ddlq2'), 'Preferred Medium')) { return false; }

     }

     if ($("input[name='q3yesno']:checked").length == 0) {
         alertOutput("Please tell us if you would like to receive the monthly investor newsletter.");
         return false;
     } else if ($('input[name="q3yesno"]')[0].checked) {
     if (!is_blank_prompt(document.getElementById('ddlq3'), 'Preferred Medium')) { return false; }
     }

     if ($("input[name='q4yesno']:checked").length == 0) {
         alertOutput("Please tell us if you would like to be notified about the next Blue Financial Services road show.");
         return false;
     } else if ($('input[name="q4yesno"]')[0].checked) {
         if (!is_blank_prompt(document.getElementById('ddlq4'), 'Preferred Medium')) { return false; }
     }
   
}
$(document).ready(function() {
$("#send").click(function() {
 if (($('#ddlAbout').val() == "other") && ($('#other').val().length < 1)) {
            alertOutput("Please enter information for: Please sepecify");
            $('#other').focus();
            return false;
        }
        if (isNaN($('#contactno').val())) {
            alertOutput("Invalid Number cellphone number");
            return false;
        }
    });
});
$(document).ready(function() {
$("#online").click(function() {
 if (($('#email').val().length > 1) && ($('#confemail').val().length < 1) || ($('#confemail').val()) != ($('#email').val())) {
     alertOutput("Please enter information for: Confirm E-mail");
            $('#confemail').focus();
            return false;
        }
        if (isNaN($('#contactno').val())) {
            alertOutput("Invalid cellphone number");
            return false;
        }  
    });
});
function val_ref() {
    if (!is_blank_prompt(document.getElementById('refnum'), 'Ref Number')){ return false; }
    return true;
}
function fraud_ref() {
    if (!is_blank_prompt(document.getElementById('ReporterName'), 'Name')) { return false; }
    if (!is_email(document.getElementById('ReporterEmail'), 'E-mail Address')) { return false; }
    if (!is_blank_prompt(document.getElementById('ReporterTel'), 'Contact Numbers')) { return false; }
    if (isNaN(document.getElementById('ReporterTel').value)) {
        alertOutput("Invalid cellphone number");
        return false;
    }
    if (!is_blank_prompt(document.getElementById('ReporterLocation'), 'Location')) { return false; }
    if (!is_blank_prompt(document.getElementById('ReporterDate'), 'Date')) { return false; }
    if (document.getElementById('ReporterDescription').value == "") {
        alertOutput("Fraud description.");
        return false;
    }
    return true;
}
function val_Country() {
    if (!is_blank_prompt(document.getElementById('Country'), 'Country')) { return false; }
    return true;
}

