// jQEm v0.2: http://davecardwell.co.uk/javascript/jquery/plugins/jquery-em/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(c/a))+String.fromCharCode(c%a+161)};while(c--){if(k[c]){p=p.replace(new RegExp(e(c),'g'),k[c])}}return p}('× ¢(){¿ ¾={\'²\':¢(»){£ »!=¤?¡.²=»:¡.²},\'¬\':¢(){£ ¡.¬()},\'«\':¢(¥){£ ¡.«(¥)},\'¯\':¢(¥){£ ¡.¯(¥)},\'¨\':¢(­,¶){£ ¡.¨(­,¶)},\'ª\':¢(){£ ¡.ª},\'³\':¢(¸){£ ¸?¡.³=¸:¡.³},\'©\':¢(){£ ¡.©()},\'°\':¢(){£ ¡.°()},\'§\':¢(){£ ¡.§},\'±\':¢(){£ ¡.±}};$.Ã=¾;¿ ¡={\'e\':$(Á.Ç(\'i\')),\'ª\':·,\'´\':¤,\'§\':¤,\'³\':È,\'½\':¤,\'±\':¤,\'²\':Å,\'¬\':¬,\'«\':«,\'¯\':¯,\'¨\':¨,\'º\':¢(){¡.¨(·);£\'¼\'},\'©\':©,\'°\':°};$(Á).É(¢(){¦(¡.²)¬()});¢ ¬(){$(\'Ê\').Ë(¡.e.Ì({\'Í\':\'Î\',\'Ï\':\'-¼\',\'Ð\':\'Ñ\',\'Ó\':\'Ô\',\'®\':\'¼\'}));¡.´=(¡.e.µ!=¤&&¡.e.µ.Â!=¤);¡.©()};¢ «(¥){¡.e.«(\'¹\',¥)};¢ ¯(¥){¡.e.¯(\'¹\',¥)};¢ ¨(­,¶){¦(­==¤)­=·;¦(­||¡.e.®()!=¡.§){¡.±=¡.§;¡.§=¡.e.®();$.Æ.¨(\'¹\',¶)}};¢ ©(){¦(¡.ª)£;¡.§=¡.±=¡.e.®();¦(¡.´){¡.e.µ.Â(\'®\',\'$.Ã.º();\')}À{¡.½=Ä.Ò(¡.º,¡.³)}¡.ª=Å};¢ °(){¦(!¡.ª)£;¦(¡.´){¡.e.µ.Õ(\'®\')}À{Ä.Ö(¡.½)}}}();',55,55,'Private|function|return|undefined|callback|if|current|trigger|start|active|bind|init|force|width|unbind|stop|previous|auto|delay|canExp|style|args|false|milliseconds|emchange|update|bool|1em|iid|Public|var|else|document|setExpression|jqem|window|true|event|createElement|100|ready|body|prepend|css|display|block|left|position|absolute|setInterval|visibility|hidden|removeExpression|removeInterval|new'.split('|')))


jQuery.extend( jQuery.easing,
{
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	}
});

(function($){
	$.fn.lava=function(options){
		options=$.extend({
			easing:"swing",
			duration:500,
			defaultLiClass:"active"		
		},options || {});
		return this.each(function(){
			var active=$("li."+options.defaultLiClass,this);
			if(active.length>0){
				var template="<li id='lvbg' style='width:50px'><a></a></li>";
				var menuItems=$("li",this).not("#lvbg");
				$(this).append(template);

				var caret=$("#lvbg");



				_setCurrent(active);


				menuItems.hover(function(){
					_move($(this));
				},function(){

				});

				$(this).hover(function(){},
				function(){
					_move(active);
				}
				)

				//window resize
				var resizeTimer = null;
				$(window).bind('resize', function() {
				    if (resizeTimer) clearTimeout(resizeTimer);
				    resizeTimer = setTimeout(function(){
						_move(active);
					}, 100);
				});

				$(window).bind("emchange",function(){
					_move(active);
				})
			}
			
			function _setCurrent(el){
				setTimeout(function(){
					_move(el);
				},1)

			}

			function _move(el){
				caret.stop().animate({
						top:(el.offset().top + 3)+"px",
						width: (el.width() - 8)+"px",
						left: (el.offset().left - 8)+"px"
				}, options.duration, options.easing);

			}
			
			
		});
	}
	
	
	
})(jQuery);


(function($){
	$.fn.gallerize=function(o){
		
		return this.each(function(){
			_this=this;
			//make components float
			$(".component",this).css("float","left");
			//relativize outer container
			$(".components_outer",this).css({
				position:"relative",
				height:$(".component",_this).eq(0).outerHeight()+"px"
			});
			
			//absolutize inner container
			$(".components_inner",this).css("position","absolute");
			
			//float thumbnails
			$('.component_thumbnails').css("float","left")
			
			//attach behaviour
			$(".component_thumbnails img",this).each(function(i){
				$(this).bind("click",function(){
					_animate(i)
				}).css("cursor","pointer");
			});
			
			
			
			
			function _animate(i){
				$(".components_inner",_this).stop().animate({
					left:-(i)*540+"px"
				},"easeOutQuad",function(){
						$(".components_outer",_this).animate({
							height:$(".component",_this).eq(i).outerHeight()+"px"
						});				
				})
			}
			
			
		});
		
	}
})(jQuery);



$(document).ready(function() {
	$("#menu_bar_inner ul").lava({easing:"easeOutQuad",duration:400});
});
