jQuery.noConflict();
jQuery(document).ready(function(){
	// navigation **************************************************************
	jQuery('#nav').NavDropDown();
});



jQuery.fn.NavDropDown=function(j){
	var j=jQuery.extend({
		duration:500,
		hoverElement:'li',
		dropHolder:'div.drop',
		hoverClass:'hover',
		showEffect:'slide',
		timer : 100
	},j);
	
	return this.each(function(){
		var f=jQuery(this);
		var g=jQuery(j.hoverElement+':has('+j.dropHolder+')',f);
		var h=j.duration;
		var _time;
		g.each(function(i,a){
			a=jQuery(a);
			var b=jQuery(j.dropHolder+' :first',a);
			var c=jQuery(j.dropHolder,a);
			a.h=b.outerHeight(true);
			var d={};
			var e={};
			if(j.showEffect=='slide'){
				c.css({'height':0,'overflow':'hidden'});
				b.css({'marginTop':-a.h,'overflow':'hidden'});
				d.SE={height:a.h};
				d.ME={marginTop:0};
				e.SE={height:0};
				e.ME={marginTop:-a.h}
			}
			if(j.showEffect=='fade'){
				c.css({'opacity':0});
				d.SE={opacity:1};
				e.SE={opacity:0};
				d.ME={};
				e.ME={}
			}
			if(j.showEffect=='slide&fade'){
				c.css({'height':0,'overflow':'hidden','opacity':0});
				b.css({'marginTop':-a.h,'overflow':'hidden'});
				d.SE={height:a.h,opacity:1};d.ME={marginTop:0};
				e.SE={height:0,opacity:0};
				e.ME={marginTop:-a.h}
			}
			a.hoverEl=false;
			a.hover(function(){
				var ty = jQuery(this);
				if(this.timer)clearTimeout(this.timer);
				_time = setTimeout(function(){
					a.hoverEl=true;
					ty.addClass(j.hoverClass);
					c.animate(d.SE,{queue:false,duration:h});
					b.animate(d.ME,{queue:false,duration:h})
				}, a.timer);
			},function(){
				if(_time) clearTimeout(_time);
				this.timer=setTimeout(function(){
					a.hoverEl=false;
					b.animate(e.ME,{queue:false,duration:h});
					c.animate(e.SE,{queue:false,duration:h,complete:function(){
						if(!a.hoverEl)jQuery(a).removeClass(j.hoverClass)
					}})
				},a.timer)
			})
		})
	})
};
