// this function will execute and check the value of a parameter set on some page that is ultimataly including
// this file.  Depending on the value of the parameter, it will write out some context specific html
// for a table that will appear on the left nav.  The table contains links and the 'destination' of those
// links will depend on the value of the parameter.  If the parameter is not present, then this function
// will not write anything to the document
function writeSmartNav() {

    if ((typeof contextMod == 'undefined')) {
        document.write('&nbsp;');
        return;
    }

    writeNeedAHand();

    //writeSelectByFeatures();

}



function writeSelectByFeatures() {

    if ((typeof needSelectByFeatures == 'undefined')) {
        document.write('&nbsp;');
        return;
    } else {
        document.write('<img ');
        document.write('src=\"/images/spacer.gif\" width=\"1\" height=\"8\" alt=\"\" border=\"0\"><div');
        document.write(' id=\"spiff-leftNav-yellow\">');
        document.write('<div id=\"spiff-header\"><img src=\"/images/spiffhdr-selectbyfeatures.gif\" width=\"131\" height=\"15\" alt=\"Select by Features\" border=\"0\"></div>')
        document.write('<ul>');
        document.write('<li><a href=\"/onlinecatalog/product_search.jsp?module=Shower+Doors&rescom=professional&contextModule=SHOWERDOOR\">Shower Doors</a></li>');
        document.write('<li><a href=\"/onlinecatalog/product_search.jsp?module=Bath+Doors&rescom=professional&contextModule=BATHDOOR\">Bath/Shower Doors</a></li>');
        document.write('</ul>');
        document.write('</div>');
    }

}

function writeNeedAHand(){
    document.write('<div id=\"spiff-leftNav-grey\">');
    document.write('<div id=\"spiff-header\"><img src=\"/images/spiffhdr-needahand.gif\" width=\"101\" height=\"12\" alt=\"Need a Hand\" border=\"0\"></div>');
    document.write('<ul>');

    var customVideoLocation = '<li><a href="#" onclick=\"window.open(\'measureVideo_custom.jsp\',\'videos\',\'left=0,top=0,width=730,height=840,location=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes\');\">How to Measure</a></li>';
    var cornerVideoLocation = '<li><a href="#" onclick=\"window.open(\'measureVideo_corner.jsp\',\'videos\',\'left=0,top=0,width=730,height=840,location=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes\');\">How to Measure</a></li>';
    var showerVideoLocation = '<li><a href="#" onclick=\"window.open(\'measureVideo_shower.jsp\',\'videos\',\'left=0,top=0,width=730,height=840,location=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes\');\">How to Measure</a></li>';
    var bathShowerVideoLocation = '<li><a href="#" onclick=\"window.open(\'measureVideo_bath.jsp\',\'videos\',\'left=0,top=0,width=730,height=840,location=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes\');\">How to Measure</a></li>';

    var findADoorBath = '<li><a href=\"/onlinecatalog/selectionGuide.jsp?module=Bath%20Doors&contextModule=BATHDOOR\">Find a Door Using the Selection Guide</a></li>';
    var findADoorShower = '<li><a href=\"/onlinecatalog/selectionGuide.jsp?module=Shower%20Doors&contextModule=SHOWERDOOR\">Find a Door Using the Selection Guide</a></li>';

     if (contextMod == 'SHOWERDOOR') {
            document.write(showerVideoLocation);
    } else if ( contextMod == 'BATHDOOR' ) {
        document.write(bathShowerVideoLocation);
    } else if ( contextMod == 'CORNERDOOR' ) {
        document.write(cornerVideoLocation);
    } else if ( contextMod == 'CUSTOMDOOR' ) {
        document.write(customVideoLocation);
    }

    // only write out the link to the FAQ if we are not on the FAQ page
    if ((typeof isFAQ == 'undefined')) {
        document.write('<li><a href=\"/onlinecatalog/faq.jsp\">Frequently Asked Questions</a></li>');
    }

    if (typeof localContextMod == 'undefined'){
        // do nothing
    } else {
        if (localContextMod == "SELECTIONGUIDE"){
            if (contextMod == 'SHOWERDOOR') {
                document.write(findADoorShower);
            } else if ( contextMod == 'BATHDOOR' ) {
                document.write(findADoorBath);
            }
        }
    }
    document.write('</ul>');
    document.write('</div>');

}