var _activeNum = -1;
var itemArr = new Array();

$(document).ready(function () {
    itemArr[0] = "<strong>STARLINE Busway</strong> is a simple, versatile, fast and economical solution for supplying power to electrical loads.  Best of all, our track busway can be tapped instantly at any location - without losing any uptime.";
    itemArr[1] = "<strong>STARLINE Plug-in Raceway</strong> offers the ability to add or relocate plug-in modules anywhere on the electrical raceway quickly and easily, eliminating the need for costly electricians.  No other product offers you that.";
    itemArr[2] = "<strong>U-S Safety Trolley</strong> pioneered no-joint electric conductor bars with such innovative crane electrification products as Span-Guard and Tri-Bar/Four Bar, PowerGlide and TightWire.  By choosing USST, your company can greatly reduce the total cost of ownership with quick installation and low maintenance.";
    itemArr[3] = "<strong>STARLINE DC Solutions</strong> is a turnkey system for safe, reliable use of 380V DC in data center applications.  It yields 200% increase in reliability, up to 15% energy savings, up to 33% space reduction, and operating expense decrease up to 35% as compared to conventional AC powering solutions.";

    $("#chooserItem1").append('<img src="/images/chooser/chooserItem1_ovr.png" id="chooserItem1Over" alt="" border="0" class="png" />');
    $("#chooserItem1Over").hide();
    $("#chooserItem1").mouseover(function () { setActiveNum(1); });
    $("#chooserItem1").mouseout(function () { showRollOut($(this)) });
    
    $("#chooserItem2").append('<img src="/images/chooser/chooserItem2_ovr.png" id="chooserItem2Over" alt="" border="0" class="png" />');
    $("#chooserItem2Over").hide();
    $("#chooserItem2").mouseover(function () { setActiveNum(2); });
    $("#chooserItem2").mouseout(function () { showRollOut($(this)) });
    
    $("#chooserItem3").append('<img src="/images/chooser/chooserItem3_ovr.png" id="chooserItem3Over" alt="" border="0" class="png" />');
    $("#chooserItem3Over").hide();
    $("#chooserItem3").mouseover(function () { setActiveNum(3); });
    $("#chooserItem3").mouseout(function () { showRollOut($(this)) });
    
    $("#chooserItem4").append('<img src="/images/chooser/chooserItem4_ovr.png" id="chooserItem4Over" alt="" border="0" class="png" />');
    $("#chooserItem4Over").hide();
    $("#chooserItem4").mouseover(function () { setActiveNum(4); });
    $("#chooserItem4").mouseout(function () { showRollOut($(this)) });
    
    if (isIE6()) {
        //enable png support on IE6
        $(".png").supersleight();
        $(".ieDivClear").html("&nbsp;");
    }

    setActiveNum(1);
});

function showRollOver(e,n) {
    $("#" + e.attr("id") + " img:first").hide();
    $("#" + e.attr("id") + " img:eq(1)").show();
}
function showRollOut(e) {
    if (e.attr("id").indexOf(_activeNum) == -1) {
        $("#" + e.attr("id") + " img:first").show();
        $("#" + e.attr("id") + " img:eq(1)").hide();
    }
}
function setActiveNum(n) {
    _activeNum = n;

    $("#chooserItems a").each(function () {
        showRollOut($(this));
    });

    showRollOver($("#chooserItem" + n));

    showDetail(n - 1);
}
function showDetail(n) {
    $("#itemDescrip").html(itemArr[n]);
}
//***************************************************************************************************
//ie6 detection
//***************************************************************************************************
function isIE6() {
    if ($.browser.msie && $.browser.version == "6.0") {
        return true;
    } else {
        return false;
    }
}
