var message;
	
jQuery(function(){
	$('.click').live('click', function() {
			$('.login_box').fadeOut('fast', function(){$('.login_box').remove();});
			
			$(this).remove();
		});
	$('.login').click(function(){
		//if( !$(this).hasClass('mybewatec') )
		//{
			if( $('.login_box').length <= 0)
			{			
				$.ajax({
					type: "POST",
					async: false,
				    data: "link="+$(this).attr('href'),
					url: "/mahout_cms/project/themes/default/login_box.php",
					success: function(msg)
					{
						message = msg;	
				    }
				});
				$(this).parent('li').append(message);
				$(this).parent('li').children('div.login_box').fadeIn('fast');
			}
			
			return false;
		//}
		
	});
	$('.hasSubSubSubNav').hover(function(){
		var counter = $(this).children('ul').children('li').length;
		
		if( $(this).children('ul').hasClass('subSub1Nav'))
		{
			var left = -counter*79;
			var width = counter*79;
			$(this).children('ul').css('left', left);
			$(this).children('ul').css('width', width);
			$(this).children('ul').fadeIn('fast');
		}
			
		if( $(this).children('ul').hasClass('subSub2Nav'))
		{
			var top = counter*79;
			var height = counter*79;
			$(this).children('ul').css('top', left);
			$(this).children('ul').css('height', width);
			$(this).children('ul').fadeIn('fast');
		}
										
	},function(){
		$(this).children('ul').fadeOut('fast');	
	});
	$('#formMessages').css('display','none');
	$('#formMessages').fadeIn('fast').delay(1500).fadeOut('fast');
	
	
	$('.logout').click(function(){
		$.ajax({
				type: "POST",
				async: false,
			    data: "a_logout=true",
				url: "/mahout_cms/core/ajax/ajax_login.php",
				success: function(msg)
				{
					message = msg;	
			    }
		});
		 if (message == 'true') 
				{
					window.location.href = '/';	
				}
		return false;
	});
	
});
