﻿<!--
function objExists(e)
{
    var exists = eval(e);
    if(exists)
    {
        return true;
    }
    else
    {
        return false;
    }        
}

// The PageQuery object simply splits the key-value
// pairs of the querystring into arrays.
function PageQuery(q)
{
    if(q.length > 1) this.q = q.substring(1, q.length);
    else this.q = null;
    this.keyValuePairs = new Array();
    
    if(q)
    {
        for(var i=0; i < this.q.split("&").length; i++)
        {
            this.keyValuePairs[i] = this.q.split("&")[i];
        }
    }
    
    this.getKeyValuePairs = function() { return this.keyValuePairs; }
    this.getValue = function(s) {
                            for(var j=0; j < this.keyValuePairs.length; j++)
                            {
                                if(this.keyValuePairs[j].split("=")[0] == s)
                                return this.keyValuePairs[j].split("=")[1];
                            }
                            return false;
                    }
                    
    this.getParameters = function() {
                        var a = new Array(this.getLength());
                        for(var j=0; j < this.keyValuePairs.length; j++)
                        {
                            a[j] = this.keyValuePairs[j].split("=")[0];
                        }
                        return a;
                    }
                    
    this.getLength = function() { return this.keyValuePairs.length; }
}

// The queryString function passes the key that we
// want to search for and the querystring to the
// PageQuery() object.
function queryString(key)
{
    var page = new PageQuery(window.location.search);
    return unescape(page.getValue(key));
}

// The displayItem function merely shows the value found for
// the querystring key.
function displayItem(key)
{
    if(queryString(key)!='false')
    {
        // document.write("you didn't enter a ?name=value querystring item.");
        return queryString(key);
    }
}

//validation functions
function PopState()
{
    document.getElementById("ctl00_MainContent_requestbrochure_adr_state_hidden").value = document.getElementById("ctl00_MainContent_requestbrochure_adr_state").value;
}

function PopStateRegister()
{
    document.getElementById("ctl00_MainContent_RegistrationForm_adr_state_hidden").value = document.getElementById("ctl00_MainContent_RegistrationForm_adr_state").value;
}

function PopStateProposals()
{
    document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_state_hidden").value = document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_state").value;
}

function PopStateProposalsCoSpkr()
{
    document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_state_hidden").value = document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_state").value;
}

function CancelCheck()
{
    if (confirm('Are you sure you wish to cancel? All changes will be lost.') == true)
    {
        parent.location.href = "/services/";
    }
}

function valWebCastOptIn()
{
    if(objExists(document.forms[0].OptIn) == true)
    {
        if(document.forms[0].OptIn.checked == false)
        {
            alert("You must accept the BAI terms for webcast registration before you can register.");
            showMe('divOptInMsg','');
            arguments.IsValid = false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valCardDropDowns(source, arguments)
{
    if (arguments.Value != "None Chosen")
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid=false;
    }
}

function valPassword(source, arguments)
{
    if(displayItem("ca") != "add")
    {
        if (arguments.Value.length > 0)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid = false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPasswordLength(source, arguments)
{
    if (arguments.Value.length >= 8)
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid = false;
    }
}

function valPasswordContent(source, arguments)
{
    if (arguments.Value.indexOf(" ") == -1)
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid=false;
    }
}

function valMgmtLevel(source, arguments)
{
    if (arguments.Value != "-Management Level-")
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid=false;
    }
}

function valCountry(source, arguments)
{
    if (arguments.Value != "-Country-")
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid=false;
    }
}

function valState(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_requestbrochure_adr_country"))
    {
       if(document.getElementById("ctl00_MainContent_requestbrochure_adr_country").value == "UNITED STATES" || document.getElementById("ctl00_MainContent_requestbrochure_adr_country").value == "CANADA")
        {
            if (arguments.Value != "-State-")
            {
                arguments.IsValid = true;
            }
            else
            {
                arguments.IsValid=false;
            }
        }
    }
    else
    {
    arguments.IsValid = true;
    }
}

function valStateRegister(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_RegistrationForm_adr_country"))
    {
        if(document.getElementById("ctl00_MainContent_RegistrationForm_adr_country").value == "UNITED STATES" || document.getElementById("ctl00_MainContent_RegistrationForm_adr_country").value == "CANADA")
        {
            if (arguments.Value != "-State-")
            {
                arguments.IsValid = true;
            }
            else
            {
                arguments.IsValid = false;
            }
        }
    }
    else
    {
    arguments.IsValid = true;
    }
}

function valStateProposals(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_country"))
    {
        if(document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_country").value == "UNITED STATES" || document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_country").value == "CANADA")
        {
            if (arguments.Value != "-State-")
            {
                arguments.IsValid = true;
            }
            else
            {
                arguments.IsValid=false;
            }
        }
    }
    else
    {
    arguments.IsValid = true;
    }
}

function valStateProposalsCoSpkr(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_country"))
    {
        if(document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_country").value == "UNITED STATES" || document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_country").value == "CANADA")
        {
            if (arguments.Value != "-State-")
            {
                arguments.IsValid = true;
            }
            else
            {
                arguments.IsValid=false;
            }
        }
    }
    else
    {
    arguments.IsValid = true;
    }
}

function valProvince(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_requestbrochure_adr_country").value != "UNITED STATES" && document.getElementById("ctl00_MainContent_requestbrochure_adr_country").value != "CANADA")
    {
        if (arguments.Value != "- Or - Province")
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valProvinceRegister(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_RegistrationForm_adr_country").value != "UNITED STATES" && document.getElementById("ctl00_MainContent_RegistrationForm_adr_country").value != "CANADA")
    {
        if (arguments.Value != "- Or - Province")
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valProvinceProposals(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_country").value != "UNITED STATES" && document.getElementById("ctl00_MainContent_spkProposals_spkr_adr_country").value != "CANADA")
    {
        if (arguments.Value != "- Or - Province")
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valProvinceProposalsCoSpkr(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_country").value != "UNITED STATES" && document.getElementById("ctl00_MainContent_spkProposals_cospkr_adr_country").value != "CANADA")
    {
        if (arguments.Value != "- Or - Province")
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneContent(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_requestbrochure_phn_number").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneExtContent(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_requestbrochure_cph_extension").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneContentRegister(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_RegistrationForm_phn_number").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneExtContentRegister(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_RegistrationForm_cph_extension").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneContentProposals(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_spkr_phn_number").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneExtContentProposals(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_spkr_phn_extension").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneContentProposalsCoSpkr(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_cospkr_phn_number").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneExtContentProposalsCoSpkr(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_cospkr_phn_extension").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneContentProposalsSubmitting(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_submitting_phone").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPhoneExtContentProposalsSubmitting(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_spkProposals_submitting_phone_extension").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}


function valFaxContent(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_requestbrochure_fax_number").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valFaxExtContent(source, arguments)
{
    if(document.getElementById("ctl00_MainContent_requestbrochure_cfx_extension").value != "")
    {
        if (isNaN(parseInt(arguments.Value)) == false)
        {
            arguments.IsValid = true;
        }
        else
        {
            arguments.IsValid=false;
        }
    }
    else
    {
        arguments.IsValid = true;
    }
}

function valPrimaryFunction(source, arguments)
{
    if (arguments.Value != "-Primary Function-")
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid=false;
    }
}

function showMe(divName,divState)
{
    var ListingPanel = document.getElementById(divName);
    
    if(ListingPanel.className == "CollapseDivOpen")
    {
        ListingPanel.className = "CollapseDiv";
    }
    else
    {
        ListingPanel.className = "CollapseDivOpen";
    }
}
//-->
