$(function() 
{

	/** Set Choose Language selector --------------------------------------------------------*/
	
	$("#choose-language .choose-language").hover(function() 
	{
			var ul = $('#choose-language ul');
			ul.slideDown('fast'); //Drop down the subnav on click  
			ul.css('z-index', 1000);
			ul.hover(
				function() {}, 
				function(){  
					ul.hide(); //When the mouse hovers out of the subnav, move it back up  
				}
			); 
		},
		function(){}
	)
	
	$('#choose-language a.choose-language').click(function(e){
		e.preventDefault();
	});
	
	
	
	/** sub navigator --------------------------------------------------------*/
	$("ul.subnav").parent('li').find("a").hover(function() {
			var liObj = $(this).parent();
			liObj.find("ul.subnav").show(); //Drop down the subnav on click  
	
			liObj.hover(
				function() {}, 
				function(){  
					$(this).parent().find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up  
				}
			);  
		},
		function(){}
	)
	
	
	
	/** communities block --------------------------------------------------------*/
	$('#sidebar .communities a').click(function(e){
		e.preventDefault(); //Cancel the link behavior
		
		$('#sidebar .communities a').each(function(){ $(this).removeClass('current'); });
		$('#sidebar .communities div').each(function(){ $(this).removeClass('current'); });
		
		$(this).addClass('current');
		$('#' + $(this).attr('href').substr(1) + '-panel').addClass('current');
		//alert(this);
	});
});
