function detectBrowser() {
    var browser = navigator.appName;
    var b_version = navigator.appVersion;
    var version = parseFloat(b_version);
    if ((browser == "Microsoft Internet Explorer") && (version >= 4)) {
        document.getElementById('why_links').style.marginTop = '8px';
        document.getElementById('customer_links').style.marginTop = '8px';
        document.getElementById('tools_links').style.marginTop = '8px';
    }
}

function display_subnav(sub_div) {
    document.getElementById('why_wrapper').style.display = 'none';
    document.getElementById('customer_wrapper').style.display = 'none';
    document.getElementById('tools_wrapper').style.display = 'none';
    document.getElementById(sub_div).style.display = 'block';
}

function hide_subnav() {
    document.getElementById('why_wrapper').style.display = 'none';
    document.getElementById('customer_wrapper').style.display = 'none';
    document.getElementById('tools_wrapper').style.display = 'none';
}

//Dreamweaver canned schtuff
function MM_swapImgRestore() {
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_preloadImages() {
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj(n, d) {
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() {
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

function display_answer(sub_div) {
    document.getElementById(sub_div).style.display = 'block';
}

function hide_answer() {
    for (i = 1; i < 26; i++) {
        var elem = 'a' + i;
        document.getElementById(elem).style.display = 'none';
    }
}

function display_basic() {
    for (i = 1; i < 13; i++) {
        var col = 'basic' + i;
        document.getElementById(col).style.backgroundColor = '#FFE79E';
        document.getElementById('back_button').src = '../images/application/quote_back_basic.gif';
        document.getElementById('basic_verbage').style.display = 'block';
        document.getElementById('standard_verbage').style.display = 'none';
        document.getElementById('plus_verbage').style.display = 'none';
    }
}

function display_standard() {
    for (i = 1; i < 13; i++) {
        var col = 'standard' + i;
        document.getElementById(col).style.backgroundColor = '#FFE79E';
        document.getElementById('back_button').src = '../images/application/quote_back_standard.gif';
        document.getElementById('next_button').src = '../images/application/quote_next_standard.gif';
        document.getElementById('standard_verbage').style.display = 'block';
        document.getElementById('basic_verbage').style.display = 'none';
        document.getElementById('plus_verbage').style.display = 'none';
    }
}

function display_plus() {
    for (i = 1; i < 13; i++) {
        var col = 'plus' + i;
        document.getElementById(col).style.backgroundColor = '#FFE79E';
        document.getElementById('next_button').src = '../images/application/quote_next_plus.gif';
        document.getElementById('btm_corner').src = '../images/application/quote_btm_plus.gif';
        document.getElementById('top_corner').src = '../images/application/quote_box_top_plus.gif';
        document.getElementById('basic_verbage').style.display = 'none';
        document.getElementById('standard_verbage').style.display = 'none';
        document.getElementById('plus_verbage').style.display = 'block';
    }
}


function hide_coverage() {
    for (i = 1; i < 13; i++) {
        var col = 'basic' + i;
        var col2 = 'standard' + i;
        var col3 = 'plus' + i;
        document.getElementById(col).style.backgroundColor = '#ffffff';
        document.getElementById(col2).style.backgroundColor = '#ffffff';
        document.getElementById(col3).style.backgroundColor = '#ffffff';
        document.getElementById('back_button').src = '../images/application/quote_back.gif';
        document.getElementById('next_button').src = '../images/application/quote_next.gif';
        document.getElementById('btm_corner').src = '../images/application/quote_btm_02.gif';
        document.getElementById('top_corner').src = '../images/application/quote_box_rtcrnr.gif';
    }
}

function validateFormOnSubmit(theForm) {
    var reason = "";

    reason += name(theForm.name);
    reason += create(theForm.create);
    reason += retype(theForm.retype);

    if (reason != "") {
        alert("Some fields need completing:\n" + reason);
        return false;
    }

    return true;
}

function name(fld) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = '#F4FD74';
        error = "- Name:\n"
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function create(fld) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = '#F4FD74';
        error = "- Create a password:\n"
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function retype(fld) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = '#F4FD74';
        error = "- Retype password:\n"
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validateForm2OnSubmit(theForm) {
    var reason = "";

    reason += name(theForm.name);
    reason += password(theForm.password);

    if (reason != "") {
        alert("Some fields need completing:\n" + reason);
        return false;
    }

    return true;
}

function name(fld) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = '#F4FD74';
        error = "- Name:\n"
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function password(fld) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = '#F4FD74';
        error = "- Create a password:\n"
    } else {
        fld.style.background = 'White';
    }
    return error;
}





