﻿jQuery( function( $ ){
    //set main nav active state for content pages - *currrentCategory set at server*
    $('#main_nav a img').each(function(){
        var $this = $(this);
        var menuItemTabId = queryString('tabid', $this.parent().attr('href'));
        if(currentCategory == menuItemTabId){
            swap_over($this);
            $this.parent().replaceWith($this);
        }       
    });
    
    //left menu active state and hover 
    var regex = new RegExp('tabid[/=](\\d*)', 'i'); 
    var window_location = window.location.href;  
    $('#left_nav a').each(function(){
        var $this = $(this);         
        location_tabid = regex.exec(window_location)[1];
        nav_tabid = regex.exec($this.attr('href'))[1];
        if(location_tabid == nav_tabid){
            $this.parent().css('list-style-image', 'url(/Portals/0/Skins/UHC/assets/images/bullet_small_over.gif)');
            $this.css({color: '#C10538'});
            $this.replaceWith("<span style='color:#C10538;'>" + $this.text() + "</span>");
        }
        else{
            $this.hover(function(){
                $this.parent().css('list-style-image', 'url(/Portals/0/Skins/UHC/assets/images/bullet_small_over.gif)');
            },
            function(){
                $(this).parent().css('list-style-image', 'url(/Portals/0/Skins/UHC/assets/images/bullet_small_up.gif)');
            }); 
        }
     });
    
});   
    


