﻿function showLayer(layer) {
    if (document.all && document.all[layer])
        document.all[layer].style.display = 'block';
    else if (document.getElementById(layer))
        document.getElementById(layer).style.display = 'block';
}

function hideLayer(layer) {
    if (document.all && document.all[layer])
        document.all[layer].style.display = 'none';
    else if (document.getElementById(layer))
        document.getElementById(layer).style.display = 'none';
}

//---------------------------------------------------------------------------------------------------------
// Secondary functions: called during form validation process
//---------------------------------------------------------------------------------------------------------

function InitRegistration() {
    ShowState();
}

function GetUserResolution() {
    ecran_l = screen.width;
    ecran_h = screen.height;
    couleurs = (1 << screen.colorDepth);
    resolution = ecran_l + "x" + ecran_h + "x" + couleurs;
    getObjFormField("RegistrationForm", "USREG_00_Resolution").value = resolution;
}

function isPhoneNumber(aStr) {
    var index;
    var reg = "0123456789()+/\\-_. "
    for (index = 0; index < aStr.length; index++)
        if (reg.indexOf(aStr.charAt(index)) == -1)
        return false;
    return true;
}

function checkphone(champ, message) {
    if (!isPhoneNumber(champ.value)) {
        alert(message);
        champ.select();
        champ.focus();
    }
}

function ShowState() {
    if (Country.options[Country.selectedIndex].value == "1" || Country.options[Country.selectedIndex].value == "2" || Country.options[Country.selectedIndex].value == "158") {
        showLayer("state");
    }
    else {
        hideLayer("state");
        State.selectedIndex = 0;
    }
}

var emailArr = new Array(
    "@126.",
    "@163.",
    "@aliceadsl.",
    "@alicemail.",
    "@aol.",
    "@bellsouth.",
    "@comcast.",
    "@earthlink.",
    "@gmail.",
    "@hanmail.",
    "@hotmail.",
    "@msn.",
    "@orange.",
    "@rediffmail.",
    "@sbcglobal.",
    "@tiscali.",
    "@t-online.",
    "@verizon.",
    "@vsnl.",
    "@wanadoo.",
    "@yahoo.",
    "@libero.",
    "@free."
    );

function Rd(url) {
    if (url != "") {
        window.location.href = url;
    }
}

