function menu()
{
	this.param = new Object;
}

menu.prototype =
{	
	customAjaxHandleError: function ()
	{
		menu.prototype.lastUrlRequested = null;
		ajaxHandleError();		
	},
	
	overMainLI: function ()
	{
		$(this).siblings().removeClass('sfHover');
	},
	
	outMainLI: function ()
	{
	},
	
	onClickLI: function ()
	{
		var self = this;
		
		// we are in the SUB UL LI
		if($(this).find('ul li').size() == 0)
		{
			$(this).addClass('sfHover');
		}
		// we clicked on a MAIN LI
		else
		{	
			$(this).find('>ul li:first').addClass('sfHover');
		}
		
		ajaxRequest = 
		{
			type: 'GET',
			dataType: 'html',
			async: true,
			error: menu.prototype.customAjaxHandleError,	// Callback when the request fails
			data: new Object
		};
		$.ajax(ajaxRequest);
	
		return true;
		
	},

	init: function()
	{
		var self = this;
		this.param.superfish = $('.ust-menuler-liste')
			.superfish({
				pathClass : 'current',
				animation : {opacity:'show'},
				delay : 100
			});
		this.param.superfish.find("li")
			.click( self.onClickLI )
			;
			
		this.param.superfish
			.find("li:has(ul)")
			.hover(self.overMainLI, self.outMainLI)
			;
	},
	
	loadFirstSection: function()
	{
		var self=this;
		$('li:first', self.param.superfish)
			.click()
			.each(function(){
				$(this).showSuperfishUl(); 
		});
	}
}

$(document).ready( function(){
	MetinMETE = new menu();
	MetinMETE.init();
	MetinMETE.loadFirstSection();
});