		(function($){
			$.fn.extend({
				realWidth:function(){return ($(this).width()+parseInt($(this).css('margin-left'))+parseInt($(this).css('margin-right')));}
				,realHeight:function(){return ($(this).height()+parseInt($(this).css('margin-top'))+parseInt($(this).css('margin-bottom')));}
			}); 
		})(jQuery);

	    jQuery(document).ready(function(){
		  // CLEAN NAVIGATION
			jQuery('#nav li.level0').each(function(i){
				if(i!=0){jQuery(this).removeClass('first');}
				if(jQuery('#nav').children('li.level0').length!=(i+1)){jQuery(this).removeClass('last');}
			});
		  // GLOBAL HEIGHT
			var globalnavheight=jQuery('#nav').css('height');
			/*jQuery('#nav ul.level0').masonry({
				itemSelector : 'li.level1',
				isAnimated: true,
				isFitWidth: true,
				columnWidth: 0
			});*/
			//jQuery('#nav').css('height',globalnavheight);
		  // NAVIGATION DROP FUNCTIONS
			var naviShowDrop=function(){
				jQuery(this).find('ul:first').css('z-index','1000000').slideDown(500);
				jQuery(this).unbind('mouseenter');
			};
			var naviHideDrop=function(){
				jQuery('#nav').css('height',globalnavheight);
				jQuery(this).find('ul:first').css('z-index','100000').slideUp(300,function(){
					jQuery(this).parent().mouseenter(naviShowDrop);
				});
			};
		  // BIND NAVIGATION DROPS
			jQuery("#nav li.level0").mouseenter(naviShowDrop);
			jQuery("#nav li.level0").mouseleave(naviHideDrop);
		  // ARRAGE ALL NAVI DROPS
			jQuery('ul.level0').each(function(){
				jQuery(this).data('col',Math.floor(jQuery(this).width()/jQuery(this).children(':nth-child(1)').realWidth()));
				jQuery(this).data('ch',{'0':0});
			  // SET ORDER
				jQuery(this).children().each(function(i){
					i++;
					var v=(i>jQuery(this).parent().data('col')?jQuery(this).realHeight():jQuery(this).height()+jQuery(this).parent().height());
					jQuery(this).attr('value',v);
				});
				jQuery(this).children('li.level1').qsort({digits: true, order: "desc"});
			  // PLACE BLOCKS
				jQuery(this).children().each(function(i){
					var wrap={
						 w:jQuery(this).parent().width()
						,h:jQuery(this).parent().height()
						,c:jQuery(this).parent().children().size()
					};
					var me={
						 w:jQuery(this).realWidth()
						,h:jQuery(this).realHeight()
						,c:jQuery(this).parent().data('col')
					};
				  // SET FIRST ELEMENT
					var ccol=i;
					var ch=jQuery(this).parent().data('ch');
					if(i==0){
						jQuery(this).css({position:'absolute',float:'none',left:'0px',top:'0px'});
					}else{
					  // CALC POSITION
						var n={
							 t:0
							,l:jQuery(this).parent().children(':nth-child('+i+')').realWidth()+parseInt(jQuery(this).parent().children(':nth-child('+i+')').css('left'))
						};
						if(i>=me.c){
							var lowest=wrap.h,index=-1;
							for(var p in ch){if(ch[p]<lowest){lowest=ch[p];index=p;}}
							n.l=index*me.w;
							n.t=lowest;
							ccol=index;
						}
						jQuery(this).css({position:'absolute',float:'none',left:n.l+'px',top:n.t+'px'});
					}
				  // SET NEW COLUMN HEIGHT
					ch[ccol]=(ch[ccol]!=undefined?ch[ccol]:0)+jQuery(this).realHeight();
					jQuery(this).parent().data('ch',ch);
				});
				var cols=jQuery(this).data('ch');
				var hx=0;
				for(var c in cols){
					if(cols[c]>hx){hx=cols[c];}
				}
				jQuery(this).css('height',(hx+20)+'px');
			});
			jQuery('#navigation_top ul li.level0 ul.level0').each(function(){
				jQuery(this).hide();
			});
		});
