/*
	Programmer: Lukasz Czerwinski
	CodeCanyon: http://codecanyon.net/user/Lukasz_Czerwinski
	
	If this script you like, please put a comment on codecanyon.
	
*/
var _0xa69c=["\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x4D\x65\x6E\x75","\x66\x6E","\x73\x6C\x69\x64\x65","\x6D\x6F\x75\x73\x65\x6F\x76\x65\x72","\x65\x78\x74\x65\x6E\x64","\x61","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x6C\x69","\x70\x61\x72\x65\x6E\x74","\x75\x6C","\x6D\x65\x6E\x75\x4C\x69\x74\x73","\x61\x64\x64\x43\x6C\x61\x73\x73","\x3E\x75\x6C","\x66\x69\x6E\x64","\x65\x66\x66\x65\x63\x74\x53\x68\x6F\x77","\x73\x6C\x69\x64\x65\x44\x6F\x77\x6E","\x66\x61\x64\x65\x49\x6E","\x66\x61\x64\x65","\x65\x66\x66\x65\x63\x74\x48\x69\x64\x65","\x73\x6C\x69\x64\x65\x55\x70","\x66\x61\x64\x65\x4F\x75\x74","\x53\x70\x65\x65\x64","\x69\x6E\x61\x63\x74\x69\x76\x65","\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73","\x2E\x61\x63\x74\x69\x76\x65","\x61\x75\x74\x6F\x68\x69\x64\x65","\x74\x69\x6D\x65\x48\x69\x64\x65","\x6D\x6F\x75\x73\x65\x6C\x65\x61\x76\x65","\x62\x69\x6E\x64","\x31\x35\x30","\x64\x65\x6C\x61\x79","\x68\x61\x73\x43\x6C\x61\x73\x73","\x61\x63\x74\x69\x76\x65","\x6D\x65\x74\x68\x6F\x64","\x75\x6E\x62\x69\x6E\x64"];(function (_0xc76bx1){_0xc76bx1[_0xa69c[1]][_0xa69c[0]]=function (_0xc76bx2){var _0xc76bx3,_0xc76bx4;_0xc76bx2=jQuery[_0xa69c[4]]({Speed:220,autohide:1,timeHide:1000,effectShow:_0xa69c[2],effectHide:_0xa69c[2],method:_0xa69c[3]},_0xc76bx2);_0xc76bx3=_0xc76bx1(this);_0xc76bx4=_0xc76bx3[_0xa69c[6]](_0xa69c[9])[_0xa69c[8]](_0xa69c[7])[_0xa69c[6]](_0xa69c[5]);_0xc76bx3[_0xa69c[13]](_0xa69c[12])[_0xa69c[11]](_0xa69c[10]);_0xc76bx1[_0xa69c[1]][_0xa69c[14]]=function (_0xc76bx5,_0xc76bx6){switch(_0xc76bx2[_0xa69c[14]]){case _0xa69c[2]:return _0xc76bx1(this)[_0xa69c[15]](_0xc76bx5,_0xc76bx6);break ;;case _0xa69c[17]:return _0xc76bx1(this)[_0xa69c[16]](_0xc76bx5,_0xc76bx6);break ;;} ;} ;_0xc76bx1[_0xa69c[1]][_0xa69c[18]]=function (_0xc76bx5,_0xc76bx6){switch(_0xc76bx2[_0xa69c[18]]){case _0xa69c[2]:return _0xc76bx1(this)[_0xa69c[19]](_0xc76bx5,_0xc76bx6);break ;;case _0xa69c[17]:return _0xc76bx1(this)[_0xa69c[20]](_0xc76bx5,_0xc76bx6);break ;;} ;} ;function _0xc76bx7(_0xc76bx8){_0xc76bx8[_0xa69c[8]]()[_0xa69c[8]]()[_0xa69c[13]](_0xa69c[24])[_0xa69c[8]](_0xa69c[7])[_0xa69c[6]](_0xa69c[9])[_0xa69c[18]](_0xc76bx2[_0xa69c[21]]/1.2,function (){_0xc76bx1(this)[_0xa69c[8]](_0xa69c[7])[_0xa69c[6]](_0xa69c[5])[_0xa69c[23]]()[_0xa69c[11]](_0xa69c[22]);} );} ;_0xc76bx4[_0xa69c[11]](_0xa69c[22]);function _0xc76bx9(){var _0xc76bxa=_0xc76bx1(this);if(_0xc76bx2[_0xa69c[25]]){_0xc76bx7(_0xc76bxa);} ;if(_0xc76bx2[_0xa69c[26]]){_0xc76bx3[_0xa69c[13]](_0xa69c[12])[_0xa69c[30]](_0xa69c[29])[_0xa69c[28]](_0xa69c[27],function (){setTimeout(function (){_0xc76bx7(_0xc76bxa);} ,_0xc76bx2[_0xa69c[26]]);} );} ;if(_0xc76bxa[_0xa69c[31]](_0xa69c[22])){_0xc76bxa[_0xa69c[23]]()[_0xa69c[11]](_0xa69c[32]);_0xc76bxa[_0xa69c[8]](_0xa69c[7])[_0xa69c[6]](_0xa69c[9])[_0xa69c[14]](_0xc76bx2.Speed);} else {_0xc76bxa[_0xa69c[23]]()[_0xa69c[11]](_0xa69c[22]);_0xc76bxa[_0xa69c[8]](_0xa69c[7])[_0xa69c[6]](_0xa69c[9])[_0xa69c[18]](_0xc76bx2.Speed);} ;return false;} ;_0xc76bx4[_0xa69c[34]](_0xc76bx2[_0xa69c[33]])[_0xa69c[28]](_0xc76bx2[_0xa69c[33]],_0xc76bx9);} ;} )(jQuery);

(function($){
$.fn.horizontalMenu = function(settings){
	//Global variables 
	var el, items;
	//Default settings
	settings = jQuery.extend({
		Speed			: 220,			//Speed animations 
		autohide		: 1,			//(true) hide active items
		timeHide 		: 1000,			//seconds to hide when mouse is outside
		effectShow		: "slide",		//Default show effect
		effectHide		: "slide", 		//Default hide effect
		method			: "click"	//The method of showing and hiding
	}, settings);
	//Basic element
	el = $(this);
	//Items with subitems
	items = el.children("ul").parent("li").children("a");
	el.find(">ul").addClass("menuLits");
	//Create new jQ function to show
	$.fn.effectShow = function (speed, callback) {
		switch(settings.effectShow) {
			//Slid effect
			case "slide":
				return $(this).slideDown(speed, callback);
				break;
			//Fade effect
			case "fade":
				return $(this).fadeIn(speed, callback);
				break;
		}
	};
	//Create new jQ function to hide
	$.fn.effectHide = function (speed, callback) {
		switch(settings.effectHide) {
			//Slide effect
			case "slide":
				return $(this).slideUp(speed, callback);
				break;
			//Fade effect	
			case "fade":
				return $(this).fadeOut(speed, callback);
				break;
		}
	};
	
	//Function to hide
	function HideItems (els) {
		//Hide actives
			els.parent().parent().find(".active").parent("li").children("ul").effectHide(settings.Speed/1.2, function(){
				//Replace class to "inactive"
				$(this).parent("li").children("a").removeClass().addClass("inactive");	
			}); 
	}
	
	//Add class
	items.addClass("inactive");
	//Hide and show the subitem
	function _item (){
		var thisEl = $(this);
		
		if(settings.autohide) {
			HideItems(thisEl);
		}
		
		if(settings.timeHide) {
			el.find(">ul").delay("150").bind("mouseleave", function() {
					setTimeout(function(){
						HideItems(thisEl);
					}, settings.timeHide);
			}); 	
		}
		
		if (thisEl.hasClass("inactive")) {
			//Replace class to "active"
			thisEl.removeClass().addClass("active");
			//Show subitems
			thisEl.parent("li").children("ul").effectShow(settings.Speed);
		} else {
				//Replace class to "inactive"
				thisEl.removeClass().addClass("inactive");
				//Show subitems
				thisEl.parent("li").children("ul").effectHide(settings.Speed);
		}
		return false;
	}
	
	//Mouseover or Click
	items.unbind(settings.method).bind(settings.method, _item); 
}
})(jQuery);
$(document).ready(function (){ 
	$(".menu ul li").horizontalMenu({
		timeHide: 0
	});
});
