﻿// JScript File
jQuery.noConflict();
jQuery(document).ready(function() {
    //Check if this browser is IE6
    if ( document.all && !window.opera && !window.XMLHttpRequest && jQuery.browser.msie ) 
        {var isIE6 = true;}
    else
        { var isIE6 = false;} ;
    jQuery.browser.msie6 = isIE6; 
    var sNavSpacer = '<img src="/images/submenu_divider.gif" style="padding: 0px 4px 0px 4px; margin: 0px 0px 0px 0px; border: none; color: #fff;" alt="" border="0" />';
    for (i = 1; i < 8; i++) {
       jQuery('#ctl00_Menu' + i +' ul.AspNet-Menu li.AspNet-Menu-Leaf').append(sNavSpacer);
       jQuery('#ctl00_Menu' + i +' ul.AspNet-Menu li.AspNet-Menu-Leaf:last img').remove();
       jQuery('#ctl00_Menu' + i +' ul.AspNet-Menu').replaceWith(jQuery('#ctl00_Menu' + i +' ul.AspNet-Menu').html());
    }
	jQuery('#topmenu1 a').mouseover(function() {
		toggleMenu(1);
	});
	jQuery('#topmenu2 a').mouseover(function() {
		toggleMenu(2);
	});
	jQuery('#topmenu3 a').mouseover(function() {
		toggleMenu(3);
	});
	jQuery('#topmenu4 a').mouseover(function() {
		toggleMenu(4);
	});
	jQuery('#topmenu5 a').mouseover(function() {
		toggleMenu(5);
	});
	jQuery('#topmenu6 a').mouseover(function() {
		toggleMenu(6);
	});
	jQuery('#topmenu7 a').mouseover(function() {
		toggleMenu(7);
	});
	
	jQuery('#rightmenublock li.AspNet-Menu-Leaf:last').css({'border-bottom':'1px solid #87cff4'});

});

function toggleMenu(argId){
	hideSubMenuItems("#topmenu", "#tllink", "#submenu", 8);
	strTopMenuId = "#topmenu" + argId;
	objTopMenu = jQuery(strTopMenuId);
	objLink = jQuery("#tllink" + argId);
	if (objTopMenu.length > 0) {
		if (objTopMenu.attr("class") == "tn_button") {
			objTopMenu.removeClass("tn_button");
			objTopMenu.addClass("tn_button" + argId);
			if (objLink.length > 0) {
				objLink.css({"color": "#ffffff"});
			}
		} else {
			objTopMenu.removeClass();
			objTopMenu.addClass("tn_button");
			if (objLink.length > 0) {
				objLink.css({"color": "#55a9d3"});
			}
		}
	}
	strSubMenuId = "#submenu" + argId;
	objSubMenu = jQuery(strSubMenuId);
	//alert(objSubMenu.is(':hidden'));
	if (objSubMenu.is(':hidden')) {
		objSubMenu.css({"z-index": 1000});
		objSubMenu.show(); //slideDown("normal");
	}
} // end function

function hideSubMenuItems(sTopMenuName, sLinkName, sSubMenuName, iTotal) {
	for (i = 1; i < iTotal; i++) {
	    jQuery(sSubMenuName + i).hide();
		jQuery(sTopMenuName + i).removeClass();
		jQuery(sTopMenuName + i).addClass("tn_button");
		jQuery(sLinkName + i).css({"color": "#55a9d3"});
	}
}
function setTopNavOn(argId){
    strTopMenuId = "#topmenu" + argId;
    objTopMenu = jQuery(strTopMenuId);
    objLink = jQuery("#tllink" + argId);
    if (objTopMenu.length > 0) {
        if (objTopMenu.attr("class") == "tn_button") {
	        objTopMenu.removeClass("tn_button");
	        objTopMenu.addClass("tn_button" + argId);
	        //objTopMenu.onmouseover(function(){return false;});
            //objTopMenu.onmouseout(function(){return false;});
	        if (objLink.length > 0) {
		        objLink.css({"color": "#ffffff"});
	        }
        }
    }

    strSubMenuId = "#submenu" + argId;
    objSubMenu = jQuery(strSubMenuId);
    if (objSubMenu.length > 0) {
        if (objSubMenu.is(':hidden')) {
            objSubMenu.css({"z-index": 1000});
            objSubMenu.show(); //slideDown("normal");
        }
    }
}