function showOnlineSupport() {
    var showOnlineSupportLink = document.getElementById("showonlinesupportlink");
    showOnlineSupportLink.style.visibility = "hidden";
    showOnlineSupportLink.style.height = "0px";

    var onlineSupportDynamicArea = document.getElementById("onlinesupportdynamicarea");
    onlineSupportDynamicArea.style.visibility = "visible";
    onlineSupportDynamicArea.style.height = "auto";
    onlineSupportDynamicArea.style.marginTop = "10px";
    onlineSupportDynamicArea.style.paddingTop = "16px";
    onlineSupportDynamicArea.style.paddingBottom = "20px";
    onlineSupportDynamicArea.style.marginBottom = "10px";
    var product = document.getElementById("product");
    product.focus();

    /* prevent clicked anchor that called this from actually being followed */
    return false;
}

function hideOnlineSupport() {
    var showOnlineSupportLink = document.getElementById("showonlinesupportlink");
    showOnlineSupportLink.style.visibility = "visible";
    showOnlineSupportLink.style.height = "auto";

    var onlineSupportDynamicArea = document.getElementById("onlinesupportdynamicarea");
    onlineSupportDynamicArea.style.visibility = "hidden";
    onlineSupportDynamicArea.style.height = "0px";
    onlineSupportDynamicArea.style.marginTop = "0px";
    onlineSupportDynamicArea.style.paddingTop = "0px";
    onlineSupportDynamicArea.style.paddingBottom = "0px";
    onlineSupportDynamicArea.style.marginBottom = "0px";

    /* prevent clicked anchor that called this from actually being followed */
    return false;
}

function showLostKey() {
    var showLostKeyLink = document.getElementById("showlostkeysupportlink");
    showLostKeyLink.style.visibility = "hidden";
    showLostKeyLink.style.height = "0px";

    var lostKeyArea = document.getElementById("lostkeydynamicarea");
    lostKeyArea.style.visibility = "visible";
    lostKeyArea.style.height = "auto";
    lostKeyArea.style.marginTop = "10px";
    lostKeyArea.style.paddingTop = "16px";
    lostKeyArea.style.paddingBottom = "20px";
    lostKeyArea.style.marginBottom = "10px";
    var product = document.getElementById("lostkeyproduct");
    product.focus();

    /* prevent clicked anchor that called this from actually being followed */
    return false;
}

function hideLostKey() {
    var showLostKeyLink = document.getElementById("showlostkeysupportlink");
    showLostKeyLink.style.visibility = "visible";
    showLostKeyLink.style.height = "auto";

    var lostKeyArea = document.getElementById("lostkeydynamicarea");
    lostKeyArea.style.visibility = "hidden";
    lostKeyArea.style.height = "0px";
    lostKeyArea.style.marginTop = "0px";
    lostKeyArea.style.paddingTop = "0px";
    lostKeyArea.style.paddingBottom = "0px";
    lostKeyArea.style.marginBottom = "0px";

    /* prevent clicked anchor that called this from actually being followed */
    return false;
}

function showRegister() {
    var showregisterLink = document.getElementById("showregisterlink");
    showregisterLink.style.visibility = "hidden";
    showregisterLink.style.height = "0px";

    var registerdynamicarea = document.getElementById("registerdynamicarea");
    registerdynamicarea.style.visibility = "visible";
    registerdynamicarea.style.height = "auto";
    registerdynamicarea.style.marginTop = "10px";
    registerdynamicarea.style.paddingTop = "16px";
    registerdynamicarea.style.paddingBottom = "10px";
    registerdynamicarea.style.marginBottom = "10px";
    var product = document.getElementById("registerproduct");
    product.focus();

    /* prevent clicked anchor that called this from actually being followed */
    return false;
}

function hideRegister() {
    var showregisterLink = document.getElementById("showregisterlink");
    showregisterLink.style.visibility = "visible";
    showregisterLink.style.height = "auto";

    var registerdynamicarea = document.getElementById("registerdynamicarea");
    registerdynamicarea.style.visibility = "hidden";
    registerdynamicarea.style.height = "0px";
    registerdynamicarea.style.marginTop = "0px";
    registerdynamicarea.style.paddingTop = "0px";
    registerdynamicarea.style.paddingBottom = "0px";
    registerdynamicarea.style.marginBottom = "0px";

    /* prevent clicked anchor that called this from actually being followed */
    return false;
}

function verifySupportForm(tf) {
    var returnVal = false;

    if (tf.product.selectedIndex === 0) {
        alert("Please select a product.");
    }
    else if (tf.serial.value === "") {
        alert("Please enter your serial number.");
        tf.serial.focus();
    }
    else if (!(tf.serial.value.match(/^[0-9]+$/)) && tf.serial.value.toLowerCase() !== "demo") {
        alert("Your serial number should only contain 7 numbers. You may have accidentally entered your activation key.");
        tf.serial.focus();
        tf.serial.select();
    }
    else if (tf.serial.value.length !== 7 && tf.serial.value.toLowerCase() !== "demo") {
        alert("Your serial number should be a 7 digit number.");
        tf.serial.focus();
        tf.serial.select();
    }
    else if (tf.osversion.selectedIndex === 0) {
        alert("Please select an OS.");
        tf.osversion.focus();
    }
    else if (tf.computer.value === "") {
        alert("Please enter the make/model of your computer.");
        tf.computer.focus();
    }
    else if (tf.firstname.value === "") {
        alert("Please enter your first name.");
        tf.firstname.focus();
    }
    else if (tf.lastname.value === "") {
        alert("Please enter your last name.");
        tf.lastname.focus();
    }
    else if (tf.address.value === "") {
        alert("Please enter your address.");
        tf.address.focus();
    }
    else if (tf.city.value === "") {
        alert("Please enter your city.");
        tf.city.focus();
    }
    else if (tf.zip.value === "") {
        alert("Please enter your zip/postal code.");
        tf.zip.focus();
    }
    else if (tf.country.selectedIndex === 0) {
        alert("Please select your country.");
        tf.country.focus();
    }
    else if (tf.country[tf.country.selectedIndex].value === "USA" && tf.state.value === "") {
        alert("Please enter your state.");
        tf.state.focus();
    }
    else if (tf.country[tf.country.selectedIndex].value === "Canada" && tf.state.value === "") {
        alert("Please enter your province.");
        tf.state.focus();
    }
    else if ((tf.email.value === "") || (tf.email.value.match(/^.+@(.+\.\w{2,4})$/) === null)) {
        alert("Please enter a valid e-mail address.");
        tf.email.focus();
        tf.email.select();
    }
    else if (tf.issue.value === "" || tf.issue.value === tf.issue.defaultValue) {
        alert("Please enter a description of the problem.");
        tf.issue.focus();
        tf.issue.select();
    }
    else {
        returnVal = true;
    }

    return returnVal;
}

function verifyLostKeyForm(tf) {
    var returnVal = false;

    if (tf.product.selectedIndex === 0) {
        alert("Please select a product.");
        tf.product.focus();
    }
    else if (tf.version.selectedIndex === 0) {
        alert("Please select a version.");
        tf.version.focus();
    }
    else if (!(tf.serial.value.match(/^[0-9]+$/)) && tf.serial.value !== "") {
        alert("Your serial number should only contain 7 numbers. You may have accidentally entered your activation key.");
        tf.serial.focus();
        tf.serial.select();
    }
    else if (tf.serial.value.length !== 7 && tf.serial.value !== "") {
        alert("Your serial number should be a 7 digit number.");
        tf.serial.focus();
        tf.serial.select();
    }
    else if (tf.firstname.value === "") {
        alert("Please enter your first name.");
        tf.firstname.focus();
    }
    else if (tf.lastname.value === "") {
        alert("Please enter your last name.");
        tf.lastname.focus();
    }
    else if (tf.address.value === "") {
        alert("Please enter your address.");
        tf.address.focus();
    }
    else if (tf.city.value === "") {
        alert("Please enter your city.");
        tf.city.focus();
    }
    else if (tf.zip.value === "") {
        alert("Please enter your zip/postal code.");
        tf.zip.focus();
    }
    else if (tf.country.selectedIndex === 0) {
        alert("Please select your country.");
        tf.country.focus();
    }
    else if (tf.country[tf.country.selectedIndex].value === "USA" && tf.state.value === "") {
        alert("Please enter your state.");
        tf.state.focus();
    }
    else if (tf.country[tf.country.selectedIndex].value === "Canada" && tf.state.value === "") {
        alert("Please enter your province.");
        tf.state.focus();
    }
    else if ((tf.email.value === "") || (tf.email.value.match(/^.+@(.+\.\w{2,4})$/) === null)) {
        alert("Please enter a valid e-mail address.");
        tf.email.focus();
        tf.email.select();
    }
    else if (tf.serial.value === "" && (tf.problem.value === "" || tf.problem.value === tf.problem.defaultValue)) {
        alert("To best help locate your activation key, please provide either your serial number or detailed notes on your situation.");
        tf.serial.focus();
    }
    else {
        returnVal = true;
        if (tf.problem.value === tf.problem.defaultValue) {
            tf.problem.value = "";
        }
    }

    return returnVal;
}

function verifyRegisterForm(tf) {
    var returnVal = false;
    var year = 0;
    var currentYear = new Date();

    if (tf.r_year.value.length === 4) {
        year = parseInt(tf.r_year.value, 10);
    }

    if (tf.r_product.selectedIndex === 0) {
        alert("Please select a product.");
        tf.r_product.focus();
    }
    else if (tf.r_version.selectedIndex === 0) {
        alert("Please select a version.");
        tf.r_version.focus();
    }
    else if (tf.r_serial.value.length !== 7) {
        var serialLen = tf.r_serial.value.length;
        if (serialLen < 7) {
            alert("Your serial number should be 7 digits in length.");
        }
        tf.r_serial.focus();
        tf.r_serial.select();
    }
    else if (!(tf.r_serial.value.match(/^[0-9]+$/))) {
        alert("Your serial number should only contain 7 numbers. You may have accidentally entered your activation key.");
        tf.r_serial.focus();
        tf.r_serial.select();
    }
    else if (tf.r_month.selectedIndex === 0) {
        alert("Please enter the month of your purchase.");
        tf.r_month.focus();
    }
    else if (tf.r_day.selectedIndex === 0) {
        alert("Please enter the day of your purchase.");
        tf.r_day.focus();
    }
    else if ((tf.r_year.value.length !== 4) || (isNaN(year)) || (year < 1984) || (year > currentYear.getFullYear())) {
        alert("Please enter the year of your purchase.");
        tf.r_year.focus();
        tf.r_year.select();
    }
    else if (tf.r_firstname.value === "") {
        alert("Please enter your first name.");
        tf.r_firstname.focus();
    }
    else if (tf.r_lastname.value === "") {
        alert("Please enter your last name.");
        tf.r_lastname.focus();
    }
    else if (tf.r_address.value === "") {
        alert("Please enter your address.");
        tf.r_address.focus();
    }
    else if (tf.r_city.value === "") {
        alert("Please enter your city.");
        tf.r_city.focus();
    }
    else if (tf.r_zip.value === "") {
        alert("Please enter your zip/postal code.");
        tf.r_zip.focus();
    }
    else if (tf.country.selectedIndex === 0) {
        alert("Please select your country.");
        tf.country.focus();
    }
    else if (tf.country[tf.country.selectedIndex].value === "USA" && tf.r_state.value === "") {
        alert("Please enter your state.");
        tf.r_state.focus();
    }
    else if (tf.country[tf.country.selectedIndex].value === "Canada" && tf.r_state.value === "") {
        alert("Please enter your province.");
        tf.r_state.focus();
    }
    else if ((tf.r_email.value === "") || (tf.r_email.value.match(/^.+@(.+\.\w{2,4})$/) === null)) {
        alert("Please enter a valid e-mail address.");
        tf.r_email.focus();
        tf.r_email.select();
    }
    else {
        returnVal = true;
    }

    return returnVal;
}
