var _error_Messages = new Array();

//----------------------------------------------------------//
//	PreventPostBack: prevents an event from bubbling		//
//				in essence, this prevents a postback		//
//----------------------------------------------------------//
function PreventPostBack()
{
	event.cancelBubble = true;
	event.returnValue = false;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Warning:
//This is a get function that will get the actual page width
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function pageWidth() 
{
    return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Warning:
//This is a get function that will get the actual page height
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function pageHeight() 
{
    return window.innerHeight != null? window.innerHeight: document.documentElement != null? document.documentElement.clientHeight:null;
}

function PreLoadImages(imageList)
{
    var imageListArray = imageList.split(',');
    var images = new Array();
    var i = 0;
    
    for(i=0;i<imageListArray.length;i++)
    {
        images[i] = new Image();
        images[i].src = imageListArray[i];
    }
}

function pageLoad()
{
    if (this.location.pathname == "/WentworthSolutions/Index.aspx")
        DetectValidBrowser();
    if (this.location.pathname == "/WentworthSolutions/Index.aspx?valid=no")
        return false;
    var b = $("lblName");
    var v = $("lblVersion");
    if (b)
        if (navigator.appName)
            b.innerText = navigator.appName;
        else
            b.className = "hide";
    if (v)
        if (navigator.appVersion)
            v.innerText = navigator.appVersion;
        else
            v.className = "hide";
}

function DetectValidBrowser()
{
    var BrowserDetect = 
    {
        init: function () 
        {
            this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
            this.version = this.searchVersion(navigator.userAgent)
            || this.searchVersion(navigator.appVersion)
            || "an unknown version";
            this.OS = this.searchString(this.dataOS) || "an unknown OS";
        },
        searchString: function (data) 
        {
            for (var i=0;i<data.length;i++)    
            {
                var dataString = data[i].string;
                var dataProp = data[i].prop;
                this.versionSearchString = data[i].versionSearch || data[i].identity;
                if (dataString) 
                {
                    if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
                }
            else if (dataProp)
                return data[i].identity;
            }
        },
        searchVersion: function (dataString) 
        {
            var index = dataString.indexOf(this.versionSearchString);
            if (index == -1) return;
            return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
        },
        dataBrowser: [
            {              
                string: navigator.userAgent,
                subString: "OmniWeb",
                versionSearch: "OmniWeb/",
                identity: "OmniWeb"
            },
            {
                string: navigator.vendor,
                subString: "Apple",
                identity: "Safari"
            },
            {
                prop: window.opera,
                identity: "Opera"
            },
            {
                string: navigator.vendor,
                subString: "iCab",
                identity: "iCab"
            },
            {
                string: navigator.vendor,
                subString: "KDE",
                identity: "Konqueror"
            },
            {
                string: navigator.userAgent,
                subString: "Firefox",
                identity: "Firefox"
            },
            {
                string: navigator.vendor,
                subString: "Camino",
                identity: "Camino"
            },
            {           // for newer Netscapes (6+)
                string: navigator.userAgent,
                subString: "Netscape",
                identity: "Netscape"
            },
            {
                string: navigator.userAgent,
                subString: "MSIE",
                identity: "Explorer",
                versionSearch: "MSIE"
            },
            {
                string: navigator.userAgent,
                subString: "Gecko",
                identity: "Mozilla",
                versionSearch: "rv"
            },
            {   // for older Netscapes (4-)
                string: navigator.userAgent,
                subString: "Mozilla",
                identity: "Netscape",
                versionSearch: "Mozilla"
            },
            {
                string: navigator.vendor,
                subString: "Google",
                identity: "Chrome"
            }
        ],
    dataOS : 
        [
            {
                string: navigator.platform,
                subString: "Win",
                identity: "Windows"
            },
            {
                string: navigator.platform,
                subString: "Mac",
                identity: "Mac"
            },
            {
                string: navigator.platform,
                subString: "Linux",
                identity: "Linux"
            }
        ]
    };
    
    BrowserDetect.init();
    //Check allowed browsers
    if (!((BrowserDetect.browser == 'Firefox' && parseFloat(BrowserDetect.version) > 2) 
        || (BrowserDetect.browser == 'Explorer' && parseFloat(BrowserDetect.version) >= 6)
        || (BrowserDetect.browser == 'Safari' && parseFloat(BrowserDetect.version)>= 2)))
    {
        //Redirect
        window.location = 'BrowserValidation.aspx';
    }
}

function setActiveStyleSheet(title)
{
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
   {
     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title"))
        {
            a.disabled = true;
            if(a.getAttribute("title") == title) a.disabled = false;
        }
   }
}

function TogglePerson(btn)
{
    var lblfn = document.getElementById("lblFirstName");
    var lblln = document.getElementById("lblLastName");
    var lblad = document.getElementById("lblAddress");
    var lblct = document.getElementById("lblCity");
    var lblst = document.getElementById("lblState");
    var lblzp = document.getElementById("lblZip");
    var lblpn = document.getElementById("lblPhoneNumber");
    var lblem = document.getElementById("lblEmail");
    var lblpw = document.getElementById("lblWebsite");
    var lblcn = document.getElementById("lblCompanyName");
    var lblca = document.getElementById("lblCompanyAddress");
    var lblcc = document.getElementById("lblCompanyCity");
    var lblcs = document.getElementById("lblCompanyState");
    var lblcz = document.getElementById("lblCompanyZip");
    var lblcp = document.getElementById("lblCompanyPhoneNumber");
    var lblcd = document.getElementById("lblCompanyDescription");
    var lblce = document.getElementById("lblCompanyEmail");
    var lbltx = document.getElementById("lblCompanyTaxIdNumber");
    var lblcw = document.getElementById("lblCompanyWebsite");

    var fn = document.getElementById("txtFirstName");
    var ln = document.getElementById("txtLastName");
    var ad = document.getElementById("txtAddress");
    var ct = document.getElementById("txtCity");
    var st = document.getElementById("txtState");
    var zp = document.getElementById("txtZip");
    var pnac = document.getElementById("txtPhoneNumberAreaCode");
    var pnex = document.getElementById("txtPhoneNumberExchange");
    var pnlf = document.getElementById("txtPhoneNumberLastFour");
    var em = document.getElementById("txtEmail");
    var pw = document.getElementById("txtWebsite");
    var ep = document.getElementById("ddlExistingProduct");
    var cn = document.getElementById("txtCompanyName");
    var ca = document.getElementById("txtCompanyAddress");
    var cc = document.getElementById("txtCompanyCity");
    var cs = document.getElementById("txtCompanyState");
    var cz = document.getElementById("txtCompanyZip");
    var cd = document.getElementById("txtCompanyDescription");
    var cpac = document.getElementById("txtCompanyPhoneNumberAreaCode");
    var cpex = document.getElementById("txtCompanyPhoneNumberExchange");
    var cplf = document.getElementById("txtCompanyPhoneNumberLastFour");
    var ce = document.getElementById("txtCompanyEmail");
    var ctx = document.getElementById("txtCompanyTaxIdNumber");
    var cw = document.getElementById("txtCompanyWebsite");
    var pnlp = document.getElementById("pnlPerson");
    var pnlc = document.getElementById("pnlCompany");
    
    if (btn && btn.id == 'rbCompany')
    {
        lblfn.className = "hide";
        lblln.className = "hide";
        lblad.className = "hide";
        lblct.className = "hide";
        lblst.className = "hide";
        lblzp.className = "hide";
        lblpn.className = "hide";
        lblem.className = "hide";
        lblpw.className = "hide";
        lblcn.className = "row_label";
        lblca.className = "row_label";
        lblcc.className = "row_label";
        lblcs.className = "row_label";
        lblcz.className = "row_label";
        lblcp.className = "row_label";
        lblcd.className = "row_label";
        lblce.className = "row_label";
        lbltx.className = "row_label";
        lblcw.className = "row_label";
        pnlp.className = "hide";
        
        fn.className = "hide";
        ln.className = "hide";
        ad.className = "hide";
        ct.className = "hide";
        st.className = "hide";
        zp.className = "hide";
        pnac.className = "hide";
        pnex.className = "hide";
        pnlf.className = "hide";
        em.className = "hide";
        pw.className = "hide";
        cn.className = "row_label";
        ca.className = "row_label";
        cc.className = "row_label";
        cs.className = "row_label";
        cz.className = "row_label";
        cd.className = "row_label";
        cpac.className = "row_phone_number";
        cpex.className = "row_phone_number";
        cplf.className = "row_phone_number";
        ce.className = "row_label";
        ctx.className = "row_label";
        cw.className = "row_label";
        pnlc.className = "row_padded";
    }
    else
    {
        lblfn.className = "row_label";
        lblln.className = "row_label";
        lblad.className = "row_label";
        lblct.className = "row_label";
        lblst.className = "row_label";
        lblzp.className = "row_label";
        lblpn.className = "row_label";
        lblem.className = "row_label";
        lblpw.className = "row_label";
        lblcn.className = "hide";
        lblca.className = "hide";
        lblcc.className = "hide";
        lblcs.className = "hide";
        lblcz.className = "hide";
        lblcp.className = "hide";
        lblcd.className = "hide";
        lblce.className = "hide";
        lbltx.className = "hide";
        lblcw.className = "hide";
        pnlp.className = "row_padded";
        
        fn.className = "row_label";
        ln.className = "row_label";
        ad.className = "row_label";
        ct.className = "row_label";
        st.className = "row_label";
        zp.className = "row_label";
        pnac.className = "row_phone_number";
        pnex.className = "row_phone_number";
        pnlf.className = "row_phone_number";
        em.className = "row_label";
        pw.className = "row_label";
        cn.className = "hide";
        ca.className = "hide";
        cc.className = "hide";
        cs.className = "hide";
        cz.className = "hide";
        cd.className = "hide";
        cpac.className = "hide";
        cpex.className = "hide";
        cplf.className = "hide";
        ce.className = "hide";
        ctx.className = "hide";
        cw.className = "hide";
        pnlc.className = "hide";
    }
}

function ToggleSignUpProduct(btn)
{
    var ep = document.getElementById("rbExistingProduct");
    var np = document.getElementById("rbNewProduct");
    var lblep = document.getElementById("lblExistingProduct");
    var lblnp = document.getElementById("lblNewProductDescription");
    var ddl = document.getElementById("ddlExistingProduct");
    var txt = document.getElementById("txtNewProductDescription");
    var divep = document.getElementById("divExistingProduct");
    var divnp = document.getElementById("divNewProduct");
    
    if (btn && btn.id == 'rbExistingProduct')
    {
        lblep.className = "row_label";
        lblnp.className = "hide";
        ddl.className = "row_label";
        txt.className = "hide";
        divep.className = "row_padded";
        divnp.className = "hide";
    }
    else
    {
        lblep.className = "hide";
        lblnp.className = "row_label";
        ddl.className = "hide";
        txt.className = "row_label";
        divep.className = "hide";
        divnp.className = "row_padded";
    }
}

function ValidateSignUp()
{
    var rb = document.getElementById("rbCompany");
    var validate = false;
    
    if(rb.checked == true)
    {
        ValidateSignUpCompany(validate);
        if (validate == true)
        {
            SignUpSubmit();
        }
    }
    else
    {
        ValidateSignUpIndividual(validate);
        if (validate == true)
        {
            SignUpSubmit();
        }
    }
}

function ValidateSignUpIndividual(validate)
{
    var fn = document.getElementById("txtFirstName");
    var ln = document.getElementById("txtLastName");
    var ad = document.getElementById("txtAddress");
    var ct = document.getElementById("txtCity");
    var st = document.getElementById("txtState");
    var zp = document.getElementById("txtZip");
    var pnac = document.getElementById("txtPhoneNumberAreaCode");
    var pnex = document.getElementById("txtPhoneNumberExchange");
    var pnlf = document.getElementById("txtPhoneNumberLastFour");
    var em = document.getElementById("txtEmail");
//    var ep = document.getElementById("ddlExistingProduct");
    
    var upst = st.value.toUpperCase();

    if(!(fn) && (ln) && (ad) && (ct) && (upst) && (zp) && (pnac) && (pnex) && (pnlf) && (em))
    {
        alert("One of the elements required for validation does not exist.");
        return false;
    }
    else
    {
        if(fn == null || fn == "" || fn.value.length <= 0)
        {
            _error_Messages.push("Please enter a first name.");
            fn.focus();
        }
        
        if(ln == null || ln == "" || ln.value.length <= 0)
        {
            _error_Messages.push("Please enter a last name.");
            ln.focus();
        }
        
        if(ad == null || ad == "" || ad.value.length <= 0)
        {
            _error_Messages.push("Please enter an address.");
            ad.focus();
        }
        
        if(ct == null || ct == "" || ct.value.length <= 0)
        {
            _error_Messages.push("Please enter a city.");
            ct.focus();
        }
        
        if(!(upst == "AL" || upst == "AK" || upst == "AZ" || upst == "AR" || upst == "CA" || upst == "CO" 
            || upst == "CT" || upst == "DE" || upst == "DC" || upst == "FL" || upst == "GA" || upst == "HI"
            || upst == "ID" || upst == "IL" || upst == "IN" || upst == "IA" || upst == "KS" || upst == "KY" 
            || upst == "LA" || upst == "ME" || upst == "MD" || upst == "MA" || upst == "MI" || upst == "MN" 
            || upst == "MS" || upst == "MO" || upst == "MT" || upst == "NE" || upst == "NV" || upst == "NH"
            || upst == "NJ" || upst == "NM" || upst == "NY" || upst == "NC" || upst == "ND" || upst == "OH" 
            || upst == "OK" || upst == "OR" || upst == "PA" || upst == "RI" || upst == "SC" || upst == "SD" 
            || upst == "TN" || upst == "TX" || upst == "UT" || upst == "VT" || upst == "VA" || upst == "WA" 
            || upst == "WV" || upst == "WI" || upst == "WY"))
        
        {
            _error_Messages.push("Please enter a state.");
            st.focus();
        }
        
        if(zp == null || zp == "" || zp.value.length <= 0 || isNaN(zp.value) || zp.value < 5)
        {
            _error_Messages.push("Please enter a zip code.");
            zp.focus();
        }
        
        if(pnac == null || pnac == "" || pnac.value.length <= 0 || isNaN(pnac.value) || pnac.value < 3)
        {
            _error_Messages.push("Please enter an area code.");
            ct.focus();
        }
        
        if(pnex == null || pnex == "" || pnex.value.length <= 0 || isNaN(pnex.value) || pnex.value < 3)
        {
            _error_Messages.push("Please enter a telephone exchange.");
            pnex.focus();
        }
        
        if(pnlf == null || pnlf == "" || pnlf.value.length <= 0 || isNaN(pnlf.value) || pnlf.value < 4)
        {
            _error_Messages.push("Please enter a phone number.");
            pnlf.focus();
        }
        
        if(em == null || em == "" || IsValidEmail(em.value) == false)
        {
            _error_Messages.push("Please enter a valid email address.");
            em.focus();
        }
        
        if(_error_Messages.length > 0)
        {
            alert(_error_Messages.join("\n"));  //display all errors, each on their own line
            _error_Messages = new Array();      //clear the array so we don't get duplicate error messages
            PreventPostBack();
            return false;
        }
        
    validate = true;
    return true;

    }
}

function ValidateSignUpCompany(validate)
{
    var cn = document.getElementById("txtCompanyName");
    var ca = document.getElementById("txtCompanyAddress");
    var cc = document.getElementById("txtCompanyCity");
    var cs = document.getElementById("txtCompanyState");
    var cz = document.getElementById("txtCompanyZip");
    var cd = document.getElementById("txtCompanyDescription");
    var cpac = document.getElementById("txtCompanyPhoneNumberAreaCode");
    var cpex = document.getElementById("txtCompanyPhoneNumberExchange");
    var cplf = document.getElementById("txtCompanyPhoneNumberLastFour");
    var ctx = document.getElementById("txtCompanyTaxIdNumber");
    var ce = document.getElementById("txtCompanyEmail");
    //var ep = document.getElementById("ddlExistingProduct");
    
    var upcs = cs.value.toUpperCase();
    
    if(!(cn) && (ca) && (cc) && (cs) && (cz) && (cd) && (cpac) && (cpex) && (cplf) && (ctx) && (ce))
    {
        alert("One of the elements required for validation does not exist.");
        return false;
    }
    else
    {    
        if(cn == null || cn == "" || cn.value.length <= 0)
        {
            _error_Messages.push("Please enter a company name.");
            cn.focus();
        }
        
        if(ca == null || ca == "" || ca.value.length <= 0)
        {
            _error_Messages.push("Please enter the company's address.");
            ca.focus();
        }
        
        if(cc == null || cc == "" || cc.value.length <= 0)
        {
            _error_Messages.push("Please enter the company's city.");
            cc.focus();
        }
        
        if(!(upcs == "AL" || upcs == "AK" || upcs == "AZ" || upcs == "AR" || upcs == "CA" || upcs == "CO" 
            || upcs == "CT" || upcs == "DE" || upcs == "DC" || upcs == "FL" || upcs == "GA" || upcs == "HI"
            || upcs == "ID" || upcs == "IL" || upcs == "IN" || upcs == "IA" || upcs == "KS" || upcs == "KY" 
            || upcs == "LA" || upcs == "ME" || upcs == "MD" || upcs == "MA" || upcs == "MI" || upcs == "MN" 
            || upcs == "MS" || upcs == "MO" || upcs == "MT" || upcs == "NE" || upcs == "NV" || upcs == "NH"
            || upcs == "NJ" || upcs == "NM" || upcs == "NY" || upcs == "NC" || upcs == "ND" || upcs == "OH" 
            || upcs == "OK" || upcs == "OR" || upcs == "PA" || upcs == "RI" || upcs == "SC" || upcs == "SD" 
            || upcs == "TN" || upcs == "TX" || upcs == "UT" || upcs == "VT" || upcs == "VA" || upcs == "WA" 
            || upcs == "WV" || upcs == "WI" || upcs == "WY"))
        
        {
            _error_Messages.push("Please enter the company's state.");
            cs.focus();
        }
        
        if(cz == null || cz == "" || cz.value.length <= 0 || isNaN(cz.value) || cz.value < 5)
        {
            _error_Messages.push("Please enter the company's zip code.");
            cz.focus();
        }
        
        if(cd == null || cd == "" || cd.value.length <= 0)
        {
            _error_Messages.push("Please enter a company description.");
            cd.focus();
        }
        
        if(cpac == null || cpac == "" || cpac.value.length <= 0 || isNaN(cpac.value) || cpac.value < 3)
        {
            _error_Messages.push("Please enter the company's area code.");
            cpac.focus();
        }
        
        if(cpex == null || cpex == "" || cpex.value.length <= 0 || isNaN(cpex.value) || cpex.value < 3)
        {
            _error_Messages.push("Please enter the company's telephone exchange.");
            cpex.focus();
        }
        
        if(cplf == null || cplf == "" || cplf.value.length <= 0 || isNaN(cplf.value) || cplf.value < 4)
        {
            _error_Messages.push("Please enter the company's phone number.");
            cplf.focus();
        }
        
        if(ce == null || ce == "" || IsValidEmail(ce.value) == false)
        {
            _error_Messages.push("Please enter a valid email address.");
            ce.focus();
        }
        
        if(ctx == null || ctx == "" || ctx.value.length <= 0 || isNaN(ctx.value))
        {
            _error_Messages.push("Please enter a valid tax identification number.");
            ctx.focus();
        }
        
        if(_error_Messages.length > 0)
        {
            alert(_error_Messages.join("\n"));  //display all errors, each on their own line
            _error_Messages = new Array();      //clear the array so we don't get duplicate error messages
            PreventPostBack();
            return false;
        }

    validate = true;                
    return true;
    
    }
}

function ValidateCareerApplication()
{
    var fn = document.getElementById("txtFirstName");
    var ln = document.getElementById("txtLastName");
    var ad = document.getElementById("txtAddress");
    var ct = document.getElementById("txtCity");
    var st = document.getElementById("txtState");
    var zp = document.getElementById("txtZip");
    var pnac = document.getElementById("txtPhoneNumberAreaCode");
    var pnex = document.getElementById("txtPhoneNumberExchange");
    var pnlf = document.getElementById("txtPhoneNumberLastFour");
    var em = document.getElementById("txtEmail");
    var ddl = document.getElementById("ddlJobs");
    var sk = document.getElementById("txtSkills");
    var ac = document.getElementById("txtAchievements");
    
    var upst = st.value.toUpperCase();
    
    if (!(fn) && (ln) && (ad) && (ct) && (st) && (zp) && (pnac) && (pnex) && (pnlf) && (em) && (ddl) && (sk) && (ac))
    {
        alert("One of the elements required for validation does not exist.");
        return false; 
    }
    else
    {
        if(fn == null || fn == "" || fn.value.length <= 0)
        {
            _error_Messages.push("Please enter a first name.");
            fn.focus();
        }
        
        if(ln == null || ln == "" || ln.value.length <= 0)
        {
            _error_Messages.push("Please enter a last name.");
            ln.focus();
        }
        
        if(ad == null || ad == "" || ad.value.length <= 0)
        {
            _error_Messages.push("Please enter an address.");
            ad.focus();
        }
        
        if(ct == null || ct == "" || ct.value.length <= 0)
        {
            _error_Messages.push("Please enter a city.");
            ct.focus();
        }
        
        if(!(upst == "AL" || upst == "AK" || upst == "AZ" || upst == "AR" || upst == "CA" || upst == "CO" 
            || upst == "CT" || upst == "DE" || upst == "DC" || upst == "FL" || upst == "GA" || upst == "HI"
            || upst == "ID" || upst == "IL" || upst == "IN" || upst == "IA" || upst == "KS" || upst == "KY" 
            || upst == "LA" || upst == "ME" || upst == "MD" || upst == "MA" || upst == "MI" || upst == "MN" 
            || upst == "MS" || upst == "MO" || upst == "MT" || upst == "NE" || upst == "NV" || upst == "NH"
            || upst == "NJ" || upst == "NM" || upst == "NY" || upst == "NC" || upst == "ND" || upst == "OH" 
            || upst == "OK" || upst == "OR" || upst == "PA" || upst == "RI" || upst == "SC" || upst == "SD" 
            || upst == "TN" || upst == "TX" || upst == "UT" || upst == "VT" || upst == "VA" || upst == "WA" 
            || upst == "WV" || upst == "WI" || upst == "WY"))
        
        {
            _error_Messages.push("Please enter a state.");
            st.focus();
        }
        
        if(zp == null || zp == "" || zp.value.length <= 0 || isNaN(zp.value) || zp.value < 5)
        {
            _error_Messages.push("Please enter a zip code.");
            zp.focus();
        }
        
        if(pnac == null || pnac == "" || pnac.value.length <= 0 || isNaN(pnac.value) || pnac.value < 3)
        {
            _error_Messages.push("Please enter an area code.");
            ct.focus();
        }
        
        if(pnex == null || pnex == "" || pnex.value.length <= 0 || isNaN(pnex.value) || pnex.value < 3)
        {
            _error_Messages.push("Please enter a telephone exchange.");
            pnex.focus();
        }
        
        if(pnlf == null || pnlf == "" || pnlf.value.length <= 0 || isNaN(pnlf.value) || pnlf.value < 4)
        {
            _error_Messages.push("Please enter a phone number.");
            pnlf.focus();
        }
        
        if(em == null || em == "" || IsValidEmail(em.value) == false)
        {
            _error_Messages.push("Please enter an email address.");
            em.focus();
        }
        
        if(sk == null || sk == "" || sk.value.length < 10)
        {
            _error_Messages.push("Please enter some skills.");
            sk.focus();
        }
        
        if(ac == null || ac == "" || ac.value.length < 10)
        {
            _error_Messages.push("Please enter some achievements.");
            ac.focus();
        }
        
        if(_error_Messages.length > 0)
        {
            alert(_error_Messages.join("\n"));  //display all errors, each on their own line
            _error_Messages = new Array();      //clear the array so we don't get duplicate error messages
            PreventPostBack();
        }
        
    return true;
    }
}

//----------------------------------------------------------//
//	IsValidEmail:											//
//	bool													//
//----------------------------------------------------------//
function IsValidEmail(val)
{
	var emailRegex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return emailRegex.test(val);
}

function ChangeClient(code)
{
    switch(code)
    {
        case "ncc":
            window.location.href = "NationalCity.aspx";
            break;
        case "skoda":
            window.location.href = "SkodaMinotti.aspx";
            break;
        case "ct4l":
            window.location.href = "Connect24Less.aspx";
            break;
        case "coad":
            window.location.href = "Coad.aspx";
            break;                        
            
    }
}

function ChangePortfolio(btn)
{
    if (btn.id == "tabShop")
    {
        window.open("ShoppingCart.aspx", "_parent");
        return true;
    }
    if (btn.id == "tabTime")
    {
        window.open("TimeMachine.aspx", "_parent");
        return true;
    }
}

function ChangeAboutUs(btn)
{
    if (btn.id == "tabAboutUs")
    {
        window.location.href = "AboutUs.aspx";
        return true;
    }
    if (btn.id == "tabCompetetiveEdge")
    {
        window.location.href = "CompetetiveEdge.aspx";
        return true;
    }
    if (btn.id == "tabEmployees")
    {
        window.location.href = "Employees.aspx";
        return true;
    }
}

function LinkHover(link)
{
    link.style.textDecoration = "underline";
}

function RemoveHover(link)
{
    link.style.textDecoration = "none";
}

function ShoweCommerceDemo()
{
    window.open("http://connect2-4less.wentinc.com", "_blank");
}

function ShowLightBox(event)
{
    if (event.innerText == "CRM Application")
    {
        var h = '681px';
        var w = '912px';
        var t = '3%';
        var l = '16%';
        var bh = $(document.documentElement.scrollHeight);
        var iframe = $('iframe_LightBox');
    }
    
    if (event.innerText == "Futures Trading Market")
    {
        window.open("http://demo.wentinc.com/reinsurance/", "_blank", "toolbar=0, menubar=0");
        return true;
    }
    
    if (event.innerText == "eCommerce" || event.innerText == "See It In Action")
    {
        window.open("http://demo.wentinc.com/ecommerce/shopping.aspx?customerkey=2", "_blank", "toolbar=0, menubar=0");
        return true;
    }
    
    if (event.innerText == "Grading Application")
    {
        window.open("http://demo.wentinc.com/coad/", "_blank", "toolbar=0, menubar=0");
        return true;
    }
    
    if (h)
        iframe.height = h;
    if (w)
        iframe.width = w;
    
    var fade = $('fade');
    fade.style.opacity = 0;	
    fade.style.filter  = 'Alpha(opacity = 0)';
    if (bh)
        fade.style.height = bh;
    
    fade.style.display='block';
    new Effect.Opacity(fade, {duration:0.5, from:0.0, to:0.8});
    
    //fade.style.opacity = .8;	
    //fade.style.filter  = 'Alpha(opacity = 80)';
    
    var light = $('light');
    light.style.display='block';
    if (h && w && t && l)
    {
        light.style.height = h;
        light.style.width = w;
        light.style.top = t;
        light.style.left = l;
    }
    //$('iframe_login').src = "Login.aspx?Source=1";
}

function MainMenuOver(nav)
{
    nav.className = "mainNavRollover";
}

function MainMenuOut(nav)
{
    nav.className = "mainNav";
}
