function showMenuLevel1(element)
{
$('#submenus').show();
$('#submenu1').show();
$(element).replaceWith('' + $(element).text() + '');
$('#submenus').css('background-image', "url('/img/raydown.png')");
$('#submenus').css('background-repeat', "no-repeat");
$('#submenus').css('background-position', "115px 0px");
$('#menu > a').filter(function() {
return ($(this).css('text-decoration') == 'none')
}).css('color', '#006699').css('text-decoration', 'underline');
return false;
}
function hideMenuAll(domElement)
{
$('#submenus').hide();
//$('#menu').find('span').each(function() {
//$(this).replaceWith('' + $(this).text() +'');
//});
$('#submenu1').siblings().hide();
$('#submenu1').css('background', 'none');
if (domElement) {
$(domElement).css('color', 'black');
$(domElement).css('text-decoration', 'none');
}
return false;
}
function showMenuLevel2(level, element)
{
var top = 10 * level;
if (level > 1) {
top += 16;
}
$('#submenu1').css('background-image', "url('/img/rayright.png')");
$('#submenu1').css('background-repeat', "no-repeat");
$('#submenu1').css('background-position', "170px " + top + "px");
$('#submenu1').siblings().hide();
$('#submenu' + (level + 1)).show();
$('#submenu1').children().attr('class', 'submenu2');
$(element).attr('class', 'submenu showSubmenu');
return false;
}
$(document).ready(function() {
var isSubmenu1 = false;
var isSubmenu2 = false;
var domElementShow = false;
$('#submenu2').find('a').each(function() {
if ($(this).attr('href') == location.pathname) {
isSubmenu1 = true;
}
});
$('#submenu3').find('a').each(function() {
if ($(this).attr('href') == location.pathname) {
isSubmenu2 = true;
}
});
$('#menu a').each(function() {
if($(this).attr('href')==location.pathname) {
domElementShow = this;
}
});
if (isSubmenu1) {
showMenuLevel1($('#menu').find('a').eq(1));
showMenuLevel2(1, $('#submenu1 > a').eq(0));
var elem = $('a[href="' + location.pathname + '"]')
elem.replaceWith('');
} else if (isSubmenu2) {
showMenuLevel1($('#menu').find('a').eq(1));
showMenuLevel2(2, $('#submenu1 > a').eq(1));
var elem = $('a[href="' + location.pathname + '"]')
elem.replaceWith('');
} else if(domElementShow !=false) {
hideMenuAll(domElementShow);
}