﻿function OpenPositions(opt) {
    if (opt == 1) {
        window.radopen("TermsOfUseWindow.aspx", "rwOpenPositions");
        return false;
    }
    if (opt == 2) {
        window.radopen("PrivacyPolicyWindow.aspx", "rwOpenPositions");
        return false;
    }

}



//Check Textbox Field is Blank or not
function checkTextBlank(id, msg) {
    if (document.getElementById(id).value == '') {
        alert(msg);
        document.getElementById(id).focus();
        return false;
    }
} //function


function OpenLearnMore(id) {
    location.href = "LearnMore.aspx?AppID=" + id;
}

function GotoContactUs(id) {
    location.href = "ContactUs.aspx?PageValue=" + id;
}

function ValidateOrder() {
    var retVal = true;
    //Check Company Name is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtCompanyName', 'Please enter the Name of the Company.') == false) {
        retVal = false;
        return false;
    }
    //Check First Name is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtFirstName', 'Please enter the First Name.') == false) {
        retVal = false;
        return false;
    }
    //Check  Last Name is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtLastName', 'Please enter the Last Name.') == false) {
        retVal = false;
        return false;
    }
    //Check Email is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtEmail', 'Please enter the Email Adderess.') == false) {
        retVal = false;
        return false;
    }
    if (document.getElementById('ctl00_ContentPlaceHolderMain_txtEmail').value != "") {
        if (document.getElementById('ctl00_ContentPlaceHolderMain_txtEmail').value.indexOf("@") != "-1" && document.getElementById('ctl00_ContentPlaceHolderMain_txtEmail').value.indexOf(".") != "-1") {
            retVal = true;
        }
        else {
            alert('Please enter proper email address');
            document.getElementById('ctl00_ContentPlaceHolderMain_txtEmail').focus();
            retVal = false;
            return false;
        }
    }
    //Check Email is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtUrl', 'Please enter the Account Name.') == false) {
        retVal = false;
        return false;
    }

    //Check Email is already taken or not
    if(document.getElementById("hidtxtUrl").value == "false")
    {
        alert("Account Name is already taken.");
        retVal=false;
        return false;
    }

    if (document.getElementById('ctl00_ContentPlaceHolderMain_txtUrl').value != "") {
        var filter = /^[0-9a-zA-Z]{1,10}$/;
        if (!filter.test(document.getElementById('ctl00_ContentPlaceHolderMain_txtUrl').value)) {
            alert('Please enter valid Account Name.');
            document.getElementById('ctl00_ContentPlaceHolderMain_txtUrl').focus();
            retVal = false;
            return false;
        }
    }
    
    
    
    if (retVal == true)
        return true;
}

function ValidatePayment() {
    var retVal = true;
    //Check Name is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtName', 'Please enter the Name.') == false) {
        retVal = false;
        return false;
    }
    //Check Address Line is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtAddressLine1', 'Please enter the Address Line1.') == false) {
        retVal = false;
        return false;
    }
    //Check City is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtCity', 'Please enter the City.') == false) {
        retVal = false;
        return false;
    }
    //Check State is blank or not
    if (document.getElementById('ctl00_ContentPlaceHolderMain_rcbStateCode').value == " ") {
        alert('Please select the State.')
        retVal = false;
        return false;
    }
    //Check ZipCode is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtZip', 'Zip/Postal Code.') == false) {
        retVal = false;
        return false;
    }
    //Check Phon is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtPhoneNumber', 'Please enter thePhone Number.') == false) {
        retVal = false;
        return false;
    }
    //Check State is blank or not
    if (document.getElementById('ctl00_ContentPlaceHolderMain_rcbCardType').value == "Select from list . . .") {
        alert('Please select the Card Type.');
        retVal = false;
        return false;
    }
    //Check Card Number is blank or not
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtCardNumber', 'Please enter the Card Name.') == false) {
        retVal = false;
        return false;
    }
    if (document.getElementById('ctl00_ContentPlaceHolderMain_txtCardNumber').value.length < 15) {
        alert("Please enter at least 15 characters in the Card Number field.");
        retVal = false;
        return false;
    }
    if (document.getElementById('ctl00_ContentPlaceHolderMain_rcbMonth').value == "") {
        alert('Please select the Expiration Month.');
        retVal = false;
        return false;
    }
    if (document.getElementById('ctl00_ContentPlaceHolderMain_rcbYear').value == "") {
        alert('Please select the Expiration Year.');
        retVal = false;
        return false;
    }

    if (retVal == true)
        return true;
}


function ValidateContactUs() {
    var retVal = true;
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtName', 'Please enter the Name.') == false) {
        retVal = false;
        return false
    }
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtEmail', 'Please enter the Email Address.') == false) {
        retVal = false;
        return false
    }
    if (checkTextBlank('ctl00_ContentPlaceHolderMain_txtMessage', 'Please enter the Message.') == false) {
        retVal = false;
        return false
    }
    if (retVal == true)
        return true;
}


function ValidateMail() {
    if ((document.getElementById('txtEmail').value == "") || (document.getElementById('txtEmail').value == 'Enter your email address')) {
        alert("Please Enter your Email Address");
        return false;
    }
    return true;
}