/* Released: 2010-03-11 16:50:57 */
/* *********** Modified by VLC *********** */
if (!$gJQ)
    var $gJQ = jQuery.noConflict();

$gJQ(document).ready(function () {
    var leftNavigation = document.getElementById('left-navigation');
    $gJQ('.toggle-icon ul', leftNavigation).hide();
    if (typeof(gActiveMenuLabel) != 'undefined') { 
        var arrLevels = gActiveMenuLabel.split('/');
        if (arrLevels.length > 1) {
            $gJQ('a:textEquals(' + arrLevels[1] + ')', leftNavigation).each(function(){
                if ($gJQ(this).parent().hasClass('toggle-icon')) {
                    $gJQ('ul', $gJQ(this).parent()).show();
                }
            });
            if (arrLevels.length == 3) {
                $gJQ('a:textEquals(' + $gJQ.trim(arrLevels[2]) + ')', leftNavigation).each(function(){        
                    $gJQ(this).parent().addClass('active');
                });   
            }           
        }
    }
    else if (typeof(gActiveURL) != 'undefined') { 
        var arrLevels = gActiveURL.split('/');
        if (arrLevels.length > 4) {
            $gJQ('a:hrefEquals(' + gActiveURL + ')', leftNavigation).each(function(){
                if ($gJQ(this).parent().hasClass('toggle-icon')) {
					$gJQ('a', ($gJQ(this).parent()).addClass('open'));
					$gJQ('a', $gJQ(this).addClass('active'));
					$gJQ('ul', $gJQ(this).parent()).show();
				}
            });
            if (arrLevels.length >= 6) {
                $gJQ('a:hrefEquals(' + gActiveURL + ')', leftNavigation).each(function(){      
                    $gJQ(this).closest('ul').show();
					$gJQ(this).parent().parent().parent().addClass('open');
                    $gJQ(this).parent().not('.toggle-icon').addClass('active');
                });   
            }           
        }        
    }
	
    $gJQ('h2.sub-nav-header').css('visibility', 'visible');
    $gJQ('#left-navigation').css('visibility', 'visible');    
});

$gJQ.expr[':'].textEquals = function(a, i, m) {  
    return $gJQ(a).text().match("^" + m[3] + "$");   
};

$gJQ.expr[':'].hrefEquals = function(a, i, m) {  
if ($gJQ(a).attr('href')){
    return $gJQ(a).attr('href').match("^" + m[3] + "$");   
}else {return false;}
};
/* *********** End of VLC modification *********** */
