// avoid Prototype(LightCMS CP) and JQuery conflict
var $j = jQuery.noConflict();

// on dom ready
$j(function() {

	/* START: ul.nav2 manipulation */
	/* what a wonderful mess we love to create */

$j('ul.level2 li').each( function() {
var thisWidth = $j(this).width();
$j(this).not('ul.nav2 li:eq(1)').css({'width' : thisWidth + 16});
});

	
	/* wrap innerHTML of each li a with span tags to get the styling we need */
	$j('ul.nav2 li a').wrapInner('<span></span>');
	
	/* 
	add class sub to second li child of ul.nav2
	in order to style it differently in LightCMS menu structure 
	*/
	$j('ul.nav2 > li:eq(1)').addClass('sub');
	
	/* swap the GreenGuard logo for the GreenGuard text */
	$j('ul.nav2 > li:eq(1) > ul li:eq(0) a span')
		.replaceWith('<span><img src=\"/Websites/hertzlergeorge/templates/lightcms/images/ico-home.gif\" alt=\"GreenGuard\" /></span>');
		
	/* END: ul.nav2 manipulation */
	
	
	/* START: dropdown menus */
	
	/* hide the third level ul drop downs */
	$j('ul.nav2 li ul li ul').hide();
	
	$j('ul.nav2 li ul li').hover(
      function () {
        $j(this).children('ul').show();
$j(this).css('position' , 'relative');
      }, 
      function () {
        $j(this).children('ul').hide();
$j(this).css('position' , '');
      }
    );
	
	/* END: dropdown menus */


});