﻿<!--
// 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);
    }
}

function PopEventCode(strValue)
{
    // pull the first four characters from the passed string and give to the event code text box
    var strEvtCode = "";
    strEvtCode = strValue.substring(0,4);
    alert(strEvtCode);
}

//VALIDATION FUNCTIONS
function PopState()
{
    document.getElementById("adr_state_hidden").value = document.getElementById("adr_state").value;
}

function CancelCheck()
{
    if (confirm('Are you sure you wish to cancel? All changes will be lost.') == true)
    {
        parent.location.href = "/bankingstrategies/webcasts/";
    }
}

function valPassword(source, arguments)
{
    if (arguments.Value.length > 0)
    {
        arguments.IsValid = true;
    }
    else
    {
        arguments.IsValid = false;
    }
}

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("adr_country"))
    {
       if(document.getElementById("adr_country").value == "UNITED STATES" || document.getElementById("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("adr_country").value != "UNITED STATES" && document.getElementById("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("phn_number").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;
    }
}

//-->
