﻿$(document).ready(function() {

    var current = '#ctl00_LeftHolder_TTPanel';

    $(".products li:contains('Roll Trailers')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_RTPanel').show('slow');
        current = "#ctl00_LeftHolder_RTPanel";
    });
    $(".products li:contains('Terminal Trailers')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_TTPanel').show('slow');
        current = "#ctl00_LeftHolder_TTPanel";
    });
    $(".products li:contains('Cassette')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_CassettePanel').show('slow');
        current = "#ctl00_LeftHolder_CassettePanel";
    });
    $(".products li:contains('Trestles')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_TrestlesPanel').show('slow');
        current = "#ctl00_LeftHolder_TrestlesPanel";
    });
    $(".products li:contains('Flats')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_FlatsPanel').show('slow');
        current = "#ctl00_LeftHolder_FlatsPanel";
    });
    $(".products li:contains('Gooseneck')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_GooseneckPanel').show('slow');
        current = "#ctl00_LeftHolder_GooseneckPanel";
    });
    $(".products li:contains('Special Trailers')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_STPanel').show('slow');
        current = "#ctl00_LeftHolder_STPanel";
    });
    $(".products li:contains('Industrial Products')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_IPPanel').show('slow');
        current = "#ctl00_LeftHolder_IPPanel";
    });
    $(".products li:contains('Magnetic Lifters')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_MFPanel').show('slow');
        current = "#ctl00_LeftHolder_MFPanel";
    });
    $(".products li:contains('Flexmasters')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_FlexPanel').show('slow');
        current = "#ctl00_LeftHolder_FlexPanel";
    });
    $(".products li:contains('Hydraulic Lift Trailers')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_HLTPanel').show('slow');
        current = "#ctl00_LeftHolder_HLTPanel";
    });
    $(".products li:contains('Second Hand')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_SHPanel').show('slow');

        current = "#ctl00_LeftHolder_SHPanel";
    });
    $(".products li:contains('Spare Parts')").click(function() {
        $(current).hide('slow');
        $('#ctl00_LeftHolder_SPPanel').show('slow');
        current = "#ctl00_LeftHolder_SPPanel";
    });


    // On Click for 2nd level menu

    $(".products_right li li").click(function() {

        
        
        if ($(this).text() == "Roll Trailer Parts") {
            window.location = "products/spareparts/RollTrailer.aspx";
        }
        else if ($(this).text() == "Roll Trailer Parts ") {
            window.location = "products/spareparts/RollTrailer.aspx";
        }
        else if ($(this).text() == "Inquiry") {
            window.location = "Query.aspx";
        }
        else if ($(this).text() == "Inquiry ") {
            window.location = "Query.aspx";
        }
        else if ($(this).text() == "Windmil Transport Equipment") {
            window.location = "products/industrial/TransportEquiptment.aspx";
        }
        else if ($(this).text() == "Windmil Transport Equipment ") {
            window.location = "products/industrial/TransportEquiptment.aspx";
        }
        else if ($(this).text() == "Terminal Trailer - Special") {
            window.location = "products/terminaltrailers/TerminalSpecial.aspx";
        }
        else if ($(this).text() == "Terminal Trailer - Special ") {
            window.location = "products/terminaltrailers/TerminalSpecial.aspx";
        }

        else {
            //var y =
            //alert('foo');
            window.location = "product.aspx?cat=" + $(this).parents().attr("class")
                     + "&product=" + $(this).text();
        }
    });

    var x = "products.aspx?catback=" + $.jqURL.get("cat");


    // controls back button image
    $(".prod_back").click(function() {
        window.location = x
    });



    // controls the menu when moving back 1 page   
    if ($.jqURL.get("catback") == "Roll_Trailer") {
        $("#ctl00_LeftHolder_RTPanel").show("slow");
        current = "#ctl00_LeftHolder_RTPanel";
    }
    else if ($.jqURL.get("catback") == "Terminal_Trailers") {
        $("#ctl00_LeftHolder_TTPanel").show("slow");
        current = "#ctl00_LeftHolder_TTPanel";
    }
    else if ($.jqURL.get("catback") == "cassettes") {
        $("#ctl00_LeftHolder_CassettePanel").show("slow");
        current = "#ctl00_LeftHolder_CassettePanel";
    }
    else if ($.jqURL.get("catback") == "Trestles") {
        $("#ctl00_LeftHolder_TrestlesPanel").show("slow");
        current = "#ctl00_LeftHolder_TrestlesPanel";
    }
    else if ($.jqURL.get("catback") == "flats") {
        $("#ctl00_LeftHolder_FlatsPanel").show("slow");
        current = "#ctl00_LeftHolder_FlatsPanel";
    }
    else if ($.jqURL.get("catback") == "goosenecks") {
        $("#ctl00_LeftHolder_GooseneckPanel").show("slow");
        current = "#ctl00_LeftHolder_GooseneckPanel";
    }
    else if ($.jqURL.get("catback") == "special") {
        $("#ctl00_LeftHolder_STPanel").show("slow");
        current = "#ctl00_LeftHolder_STPanel";
    }
    else if ($.jqURL.get("catback") == "industrial") {
        $("#ctl00_LeftHolder_IPPanel").show("slow");
        current = "#ctl00_LeftHolder_IPPanel";
    }
    else if ($.jqURL.get("catback") == "magnetic") {
        $("#ctl00_LeftHolder_MFPanel").show("slow");
        current = "#ctl00_LeftHolder_MFPanel";
    }
    else if ($.jqURL.get("catback") == "flexmaster") {
        $("#ctl00_LeftHolder_FlexPanel").show("slow");
        current = "#ctl00_LeftHolder_FlexPanel";
    }
    else if ($.jqURL.get("catback") == "hydraulic") {
        $("#ctl00_LeftHolder_HLTPanel").show("slow");
        current = "#ctl00_LeftHolder_HLTPanel";
    }
    else if ($.jqURL.get("catback") == "second") {
        $("#ctl00_LeftHolder_SHPanel").show("slow");
        current = "#ctl00_LeftHolder_SHPanel";
    }
    else if ($.jqURL.get("catback") == "spare") {
        $("#ctl00_LeftHolder_SPPanel").show("slow");
        current = "#ctl00_LeftHolder_SPPanel";
    }
});
        
        
