/*$(document).ready(function(){  

    $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
  
  // $("#nav")
    $("ul.topnav li span").click(function() { //When trigger is clicked...  
  
        //Following events are applied to the subnav itself (moving subnav up and down)  
        $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click  
  
        $(this).parent().hover(function() {  
        }, function(){  
        	
            $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up  
        });  
  
        //Following events are applied to the trigger (Hover events for the trigger)  
        }).hover(function() {  
            $(this).addClass("subhover"); //On hover over, add class "subhover"  
        }, function(){  //On Hover Out  
            $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
    });  
  
});  */

var menus = new Array();

function mainmenu(){
//$(" #nav ul ").css({display: "none"}); // Opera Fix
		$.each($('ul.nav'), function(){
			//$('#' + this.id + '.expandfirst ul:first').show();
		});
		
		$.each($('ul.nav'), function () {
			if(menus[this.id] == null){
				//alert('register menu' + this.id);
		//alert('id: ' + this.id);
			$('#' + this.id).click(function(){
		//alert('clicked'  + this.id);
			$(this).find('ul:first').css({visibility: "hidden"});
		})
		.hover(function(){
			
		// $(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		$('#' + this.id).find('ul:first').css({opacity:0, visibility: "visible"}).animate({opacity:0.8},400);
		//	$.blockUI( {message: $('#nav'),centerX: false, centerY: false, width: '100%',
	     //       css: { top: '0px', left: '0px', border:'0px'}
		//	});
			
			
		},function(){
			//alert(this.id);
			$(this).find('ul:first').css({visibility: "hidden"});
		//	$.unblockUI();
		});
		//menus[this.id] = "set";
		}
		});
		/*
		$('ul.nav ul').hide();
		
	$.each($('ul.nav'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
	});
	$('ul.nav').hover(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().css({opacity:0, visibility: "visible"}).animate({opacity:0.8},400);
				return false;
			}
			
			if((checkElement.is('ul'))) {
				checkElement.css({opacity:0, visibility: "visible"}).animate({opacity:0.8},400);
				return false;
			}
		},function(){
		
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;
	
			if((checkElement.is('ul'))) {
				checkElement.css({visibility: "hidden"});
				return;
			}
		}
	)*/
}
 
 $(document).ready(function(){				
	//mainmenu();
});