function initMenu() { $('#navigation ul').hide(); $('.show-submenu').show(); $('#navigation li a').click(function() { var checkElement = $(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { return false; } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $('#navigation ul:visible').slideUp('fast'); checkElement.slideDown('fast'); return false; } }); $('#navigation a').click(function() { var rel = $(this).attr("rel"); if( rel == "scroller" ) { var href = $(this).attr("href"); // remove the #scroll from href if( href.substring( href.length - 7, href.length ) == "#scroll" ) { href = href.substring(0, href.length - 7); } href = href + "#scroll"; $(this).attr("href",href); } }); } $(document).ready(function() { initMenu(); // check if we have #scroll var location = document.location.toString(); if( location.substring( location.length - 7, location.length ) == "#scroll" ) { $.scrollTo("#content", 800 ); } });