$(document).ready(function () {
    $("#zone-bar .level0 > LI").each(function (){ // top level li's only
				
				$(this).mouseover(function (event) {
					$(this).addClass('zoneCur');
        });//end mouseenter
				
				$(this).mouseleave(function (event) {
					$(this).removeClass('zoneCur');	
					if (!$(this).children("UL").is(":hidden")) {
            $("UL", $(this)).toggle()
          }
        });//end mouseenter		
        
				if (!$(this).children("ul").length) {
					  $('EM', $(this)).html("<img src='wp-content/themes/magazine-basic/images/menu/t.gif' align='absbottom' width='1' height='8' >");
            $('A', $(this)).addClass('nochildren');
        } 
				else {
            $('EM', $(this)).html("<img src='wp-content/themes/magazine-basic/images/menu/zonebar-downarrow.gif' align='absbottom' width='10' height='8'>");
            $(this).click(function (event) {
                event.preventDefault();
                $("#zone-bar>UL>LI>UL").hide()
                $("#zone-bar>UL>LI").removeClass();
                if ($(this).children("UL").is(":hidden")) {
                    $(this).addClass("zoneCur");
                    $("UL", $(this)).toggle()
                }
            });//end click
        }
    }); //end each

    $("#zone-bar .level1 > LI").click(function (event){
        event.stopPropagation();
    });

    // Simple tabContent for product details  
    showhide = function (containerId) {
        var index = -1;
        var current = 0;
        var effectDuration = 600;
        var container = $(containerId);

        $('#tabs LI A', container).each(function () {

            index++;

            $(this).attr('tabIndex', index).css({
                cursor: 'pointer'
            }).click(function (event) {
                //event.preventDefault();
                newIndex = $(this).attr('tabIndex');

                if (newIndex == current) return;

                $(this).css({
                    backgroundPositionY: 'top'
                });

                $('.mid:eq(' + current + ')', container).hide();

                $('.#tabs LI A:eq(' + current + ')', container).css({
                    backgroundPositionY: 'bottom'
                });

                $('.mid:eq(' + newIndex + ')', container).show();

                current = newIndex;
            }).hover(function (event) {
                //event.preventDefault();
                newIndex = $(this).attr('tabIndex');

                if (newIndex == current) return;

                $(this).css({
                    backgroundPositionY: 'top'
                });

                $('.mid:eq(' + current + ')', container).hide();

                $('.#tabs LI A:eq(' + current + ')', container).css({
                    backgroundPositionY: 'bottom'
                });

                $('.mid:eq(' + newIndex + ')', container).show();

                current = newIndex;
            })

        });

        $('.mid:eq(0)', container).show();
        $('.#tabs LI A:eq(0)', container).css({
            backgroundPositionY: 'top'
        });
        $('.mid:gt(0)', container).hide();
        $('.#tabs LI A:gt(0)', container).css({
            backgroundPositionY: 'bottom'
        });
    };

    new showhide('.tab_hero');
		
		$(".account_menu > li").each(function (){ // top level li's only
				if($(this).children("UL").length) 
				{
					 $(".account_menu li a").addClass("norm"); 
           
					 $(this).click(function (event)
					 {
		          event.preventDefault();
							if ($(this).children("UL").is(":hidden")) 
							{
								$(this).children("UL").show("normal");
								$("a",$(this)).removeClass("norm");
								$("a",$(this)).addClass("sel");
							}
							else
							{
								$(this).children("UL").hide("normal");
								$("a",$(this)).removeClass("sel");
								$("a",$(this)).addClass("norm");
							}
           });//end click
        } 
    }); //end each
		
		$(".account_menu1 > LI").click(function (event){
        event.stopPropagation();
    });		
});
