jQuery(document).ready(function() {
	// IE6 & IE7 management
	if(jQuery.browser.msie && parseFloat(jQuery.browser.version) < 7){
		jQuery('#archtung').fadeIn();
		jQuery('#archtung').append('<h2>Your web browser is outdated and unsupported!</h2><p><strong>That may cause problems when viewing this site.</strong><br />You can easily upgrade to the latest version <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer 8</a>. You can even try another browser like <a href="http://mozilla.com">FireFox</a>, <a href="www.google.com/chrome">Chrome</a>, <a href="http://www.apple.com/safari/">Safari</a> or <a href="http://www.opera.com">Opera</a>.</p><br /><p><a class="closethis button" href="#"><strong>Close this warning</strong></a></p>');
		jQuery('a.closethis').click(function() {
			jQuery('#archtung').fadeOut();
		});
	}
	// header background change
	jQuery(".logo_description").hide();
	jQuery(".boxlogo").hover(
		function(){
			jQuery(".logo_description").fadeIn();
		},
		function(){
			jQuery(".logo_description").fadeOut();
		}
	);
	// Box corners
	jQuery(".box").corner("bevel");
	jQuery("#footer").corner("bevel");
	// Logo open at start
	//jQuery('.boxlogo').animate({ 'width': '586', 'height': '106'}, 0);
	jQuery('.boxlogo').animate({ 'width': '586', 'height': '346'}, 0);
	// Logo placement
	jQuery.fn.logoPlacement = function(loaded) {
		var obj = this;
		//get the position of the placeholder element
		var pos = jQuery(".boxlogo").offset();  
		var width = jQuery(".boxlogo").width();
		//show the menu directly over the placeholder
		obj.animate( { "left": (pos.left - 69) + "px", "top": (pos.top + 0) + "px" }, "fast", function() {
			
		});
	}
	jQuery("#logo").logoPlacement();
	jQuery("#social").logoPlacement();
	// backgrounds
	//jQuery('.col2, .col3, .col4').css('background-position', '-40px 0px');
	// Center element
	var screenWidth = jQuery(window).width();
	jQuery.fn.centerScreen = function(loaded) { 
		var obj = this; 
			if(!loaded) { 
				obj.css('position', 'absolute');
				obj.css('top', jQuery(window).height()/2-this.height()/2-5); 
				obj.css('left', jQuery(window).width()/2-this.width()/2-10); 
				//jQuery(window).resize(function() { obj.centerScreen(!loaded); }); 
			} else { 
				obj.stop();
				obj.animate({ top: jQuery(window).height()/2-this.height()/2-5, left: jQuery(window).width()/2-this.width()/2-10}, 200, 'linear'); 
			} 
	}
	//jQuery('#logo').centerScreen();
	// Bottom right element
	jQuery.fn.rightBottom = function(loaded) { 
		var obj = this; 
		if(!loaded) { 
			/*
			obj.css('top', jQuery(window).height()-this.height()-20); 
			obj.css('left', jQuery(window).width()-this.width()-20);
			*/ 
			obj.animate({'top': jQuery(window).height()-this.height()-20, 'left': jQuery(window).width()-this.width()-20}, "fast");
			//jQuery(window).resize(function() { obj.rightBottom(!loaded); }); 
		} else { 
			obj.stop(); 
			//obj.animate({ top: jQuery(window).height()-this.height()-50, left: jQuery(window).width()-this.width()-20}, 5000, 'linear'); 
			obj.animate({ top: jQuery(window).height()-20, left: jQuery(window).width()-20}, 250, 'linear'); 
		}
	}
	// Logo narrow open box - NOT USED
	jQuery.fn.followBox = function(loaded) {
		var posx;
		var obj = this;
		posx = jQuery('.col6').position();
		if(posx){
		if((posx.left+(obj.width()/2)) > jQuery(window).width()/2) {
			obj.animate({ "top": posx.top + 120, "left": posx.left - obj.width() }, "normal");
		} else {
			obj.animate({ "top": posx.top + 120, "left": posx.left + 600 }, "normal");
		}
		}
	}
	// Filters link
	jQuery('a.filter').click(function(event){
		//jQuery('.wrap').animate({"width": "100%"}, "fast");
		filterBoxes(this.id);
		event.preventDefault();
	})
	function filterBoxes(klass){
		if (klass == "all") { klass = "box" }
		jQuery('#holder .box').uncorner();
		jQuery('#holder .box').removeClass('col6');
		jQuery('#holder .box').find('h1').animate({"opacity": "0", "top": "100px"}, 0);
		jQuery('#holder .box:not(.boxlogo)').animate({"opacity": "0.5"}, "normal");
		jQuery('#holder').find('.' + klass)
		.hide()
		.appendTo('#primary')
		.corner("bevel")
		.fadeIn('300')
		jQuery('#primary').find('.box:not(.' + klass + ', .boxlogo)')
		.fadeOut( '300', function(){
		jQuery(this).appendTo('#holder') ;
	});
	setTimeout(function(){ jQuery('#primary').masonry() },500);}
	// Infos link
	jQuery('a#info').click(function(){
		jQuery('.wrap').animate({
				'width':'600px'
			},250,'swing', function() {
				// Animation complete
				jQuery('.box').removeClass('col6');
				jQuery('#primary').masonry();
				jQuery('nav').animate({"top": "275px", "left": "490px"}, "fast");
				jQuery('#about').fadeIn("normal");
				jQuery('#infodiv').animate({"top": "275px", "left": "48px"}, "fast");
				/*
				jQuery('#logo, #logoimg').animate({"width": "600px", "height": "329px"}, "fast", function() {
					jQuery('#logo').animate({"left": "0px", "top": jQuery(window).height()/2-jQuery('#logo').height()/2-5}, "fast");
				});
				*/
		});
	})
	// Boxes animations = fade in & out
	jQuery('.box:not(.boxlogo)').animate({"opacity": "0.5"}, 0);
	//jQuery('.boxlogo').animate({"opacity": "1"}, 0);
	/*
	jQuery('.work h1').animate({"opacity": "0"}, 0);
	jQuery('.blog h1').animate({"opacity": "0"}, 0);
	jQuery('.shop h1').animate({"opacity": "0"}, 0);
	*/
	jQuery('.box h1').animate({"opacity": "0"}, 0);
	jQuery('.box .description').animate({"opacity": "0"}, 0);
	//jQuery('.icon').animate({"opacity": "0.9"}, 0);
	
	// Box hover
	jQuery(".box:not(.boxlogo)").hoverIntent(
		function() {
			jQuery(this).animate({"opacity": "1"}, "normal");
			if(!jQuery(this).hasClass('.col6')) {
				jQuery(this).css('z-index', '999');
				jQuery(this).find('h1').animate({"top": "100px"}, 0);
				jQuery(this).find('h1').animate({"opacity": "1", "top": "30px"}, "normal");
				jQuery(this).find('.icon').animate({"top": "10px"}, "normal");
			}
			//if(jQuery(this).hasClass('.work')) {
				//jQuery(this).find('h1').stop().animate({"opacity": "1"}, "normal");
			//}
			if(jQuery(this).hasClass('.col6')) {
				jQuery(this).children('.description').stop().animate({"opacity": "1"}, "normal");
			}
		},
		function() {
			if(!jQuery(this).hasClass('.col6')) {
				if(!jQuery(this).hasClass('.boxlogo')) {
					jQuery(this).stop().animate({"opacity": "0.5"}, "normal");
					jQuery(this).find('h1').animate({"opacity": "0", "top": "100px"}, "normal");
					jQuery(this).find('.icon').animate({"top": "5px"}, "normal");
				}
				//jQuery(this).find('h1').stop().animate({"opacity": "0"}, "normal");
				jQuery(this).children('.description').animate({"opacity": "0"}, "normal");
			}
			if(!jQuery(this).hasClass('.boxlogo')) {
				jQuery(this).css('z-index', '1');
			}
		}
	);
	jQuery(".col6").hover(
		function() {
			jQuery(this).find('h1').stop().animate({"top": "360px"}, "normal");
		},
		function() {
			jQuery(this).find('h1').stop().animate({"top": "0"}, "normal");
		}
	);
	// Boxes click
	jQuery('.box:not(.boxlogo)').bind('mousedown', function(event, ui){
		//jQuery('#logo').animate({ "opacity": 0 }, 0);
		//jQuery('.wrap').css('height', jQuery(window).height());
		//jQuery('.boxlogo').animate({ 'width': '186', 'height': '106'}, "fast");
		if(!jQuery(this).hasClass('.col6')) {
		jQuery(this).find('h1').stop().animate({ "opacity": "0" }, 0);
		jQuery('.box').removeClass('col6');
		//jQuery(this).css('background-position', '0px 0px');
		jQuery(this).css('z-index', '998');
		if(jQuery(this).hasClass('.shop')) {
			jQuery(this).find('h1').animate({"top": "359px", "opacity": "1"}, 0, "swing");
		} else if(jQuery(this).hasClass('.blog')) {
			jQuery(this).find('h1').animate({"top": "359px", "opacity": "1"}, 0, "swing");
		} else if(jQuery(this).hasClass('.work')) {
			jQuery(this).find('h1').animate({"top": "359px", "opacity": "1"}, 0, "swing");
		}
		jQuery(this).siblings().not('.boxlogo').animate({"opacity": "0.5"}, "normal");
		//jQuery(this).siblings().not('.boxlogo').css('background-position', '-40px 0px');
		jQuery(this).siblings().find('.icon').animate({"top": "5px"}, "normal");
		jQuery(this).siblings().find('h1').animate({"opacity": "0", "top": "100px"}, "0");
		jQuery(this).siblings().children('.description').animate({"opacity": "0"}, "normal");
		jQuery(this).children('.description').animate({"opacity": "1"}, "normal");
		/*
		jQuery('nav').animate({"top": "195px", "left": "280px"}, "fast");
		jQuery('#infodiv').animate({"top": "195px", "left": "35px"}, "fast");
		jQuery('#about').fadeOut("fast");
		*/
		setTimeout(function(){ jQuery(event.currentTarget).toggleClass('col6'); }, 10, function() {
			
		});
		setTimeout(function(){
			jQuery('.wrap').animate({
				//'width':'120%'
				'width':'600px'
			},10,'swing', function() {
				// Animation complete
				jQuery('#primary').masonry({}, function(){
					//jQuery('#logo').followBox();
				});
			});
		}, 1)
		}
	});
	
	// Logo Click
	jQuery('#logo').click(function(){
		// panel expands
		//jQuery('.boxlogo').css('z-index', '9999');
		jQuery('.box').removeClass('col6');
		jQuery('.box').find('h1').animate({"opacity": "0", "top": "100px"}, 0);
		jQuery('.box:not(.boxlogo)').animate({"opacity": "0.5"}, "normal");
		jQuery('.boxlogo').animate({ 'width': '586', 'height': '346' }, function(){
			// masonry call back, to rearrange layout after new panel has been expanded
			jQuery('#primary').masonry({}, function(){
				setTimeout(function(){
					jQuery("#logo").logoPlacement();
					jQuery("#social").logoPlacement();
				}, 1000);
			});
		});
	});
	
	// On window resize
	jQuery(window).resize(function() {
		jQuery('#primary').masonry({}, function(){
			setTimeout(function(){
				jQuery("#logo").logoPlacement();
				jQuery("#social").logoPlacement();
			}, 1000);
		});
	});
	
	// Body Links
	//jQuery('#body a').css('color','#000');
	jQuery('.description a.button').animate({'background-position': '-22px 14px'}, 0,'swing');
	jQuery('.description a.button').hoverIntent( 
	function(){
		if(jQuery(this).parent().hasClass('.description')){
			jQuery(this).css('-moz-box-shadow', 'none');
			jQuery(this).css('-webkit-box-shadow', 'none');
			jQuery(this).css('box-shadow', 'none');
			jQuery(this).stop().animate({'color':'#fff',  'backgroundColor': '#333', 'background-position': '-22px 14px'}, 'fast','swing');
		} else {
			jQuery(this).stop().animate({'color':'#fff'}, 'normal','swing');
		}
	}, 
	function(){
		if(jQuery(this).parent().hasClass('.description')){
			jQuery(this).css('-moz-box-shadow', '0 1px 3px rgba(0,0,0,0.3)');
			jQuery(this).css('-webkit-box-shadow', '0 1px 3px rgba(0,0,0,0.3)');
			jQuery(this).css('box-shadow', '0 1px 3px rgba(0,0,0,0.3)');
			jQuery(this).stop().animate({'color':'#000', 'backgroundColor': '#ccc', 'background-position': '-22px 0px'}, 'fast','swing');
		} else {
			jQuery(this).stop().animate({'color':'#999'}, 'normal','swing');
		}
	});
});

/*
 * TipTip
 * Copyright 2010 Drew Wilson
 * www.drewwilson.com
 * code.drewwilson.com/entry/tiptip-jquery-plugin
 *
 * Version 1.3   -   Updated: Mar. 23, 2010
 *
 * This Plug-In will create a custom tooltip to replace the default
 * browser tooltip. It is extremely lightweight and very smart in
 * that it detects the edges of the browser window and will make sure
 * the tooltip stays within the current window size. As a result the
 * tooltip will adjust itself to be displayed above, below, to the left 
 * or to the right depending on what is necessary to stay within the
 * browser window. It is completely customizable as well via CSS.
 *
 * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(jQuery){jQuery.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=jQuery.extend(defaults,options);if(jQuery("#tiptip_holder").length<=0){var tiptip_holder=jQuery('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=jQuery('<div id="tiptip_content"></div>');var tiptip_arrow=jQuery('<div id="tiptip_arrow"></div>');jQuery("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=jQuery("#tiptip_holder");var tiptip_content=jQuery("#tiptip_content");var tiptip_arrow=jQuery("#tiptip_arrow")}return this.each(function(){var org_elem=jQuery(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt(jQuery(window).scrollLeft());var left_compare=(tip_w+left)>parseInt(jQuery(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt(jQuery(window).height()+jQuery(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);


/***** PRELOAD *****/

var QueryLoader = {
	/*
	 * QueryLoader		Preload your site before displaying it!
	 * Author:			Gaya Kessler
	 * Date:			23-09-09
	 * URL:				http://www.gayadesign.com
	 * Version:			1.0
	 * 
	 * A simple jQuery powered preloader to load every image on the page and in the CSS
	 * before displaying the page to the user.
	 */
	
	overlay: "",
	loadBar: "",
	preloader: "",
	items: new Array(),
	doneStatus: 0,
	doneNow: 0,
	selectorPreload: "body",
	ieLoadFixTime: 2000,
	ieTimeout: "",
		
	init: function() {
		if (navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/) == "MSIE 6.0,6.0") {
			//break if IE6			
			return false;
		}
		if (QueryLoader.selectorPreload == "body") {
			QueryLoader.spawnLoader();
			QueryLoader.getImages(QueryLoader.selectorPreload);
			QueryLoader.createPreloading();
		} else {
			jQuery(document).ready(function() {
				QueryLoader.spawnLoader();
				QueryLoader.getImages(QueryLoader.selectorPreload);
				QueryLoader.createPreloading();
			});
		}
		
		//help IE drown if it is trying to die :)
		QueryLoader.ieTimeout = setTimeout("QueryLoader.ieLoadFix()", QueryLoader.ieLoadFixTime);
	},
	
	ieLoadFix: function() {
		//var ie = navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/);
		//if (ie[0].match("MSIE")) {
		if(jQuery.browser.msie) {
			while ((100 / QueryLoader.doneStatus) * QueryLoader.doneNow < 100) {
				QueryLoader.imgCallback();
			}
		}
	},
	
	imgCallback: function() {
		QueryLoader.doneNow ++;
		QueryLoader.animateLoader();
	},
	
	getImages: function(selector) {
		var everything = jQuery(selector).find("*:not(script)").each(function() {
			var url = "";
			
			if (jQuery(this).css("background-image") != "none") {
				var url = jQuery(this).css("background-image");
			} else if (typeof(jQuery(this).attr("src")) != "undefined" && jQuery(this).attr("tagName").toLowerCase() == "img") {
				var url = jQuery(this).attr("src");
			}
			
			url = url.replace("url(\"", "");
			url = url.replace("url(", "");
			url = url.replace("\")", "");
			url = url.replace(")", "");
			
			if (url.length > 0) {
				QueryLoader.items.push(url);
			}
		});
	},
	
	createPreloading: function() {
		QueryLoader.preloader = jQuery("<div></div>").appendTo(QueryLoader.selectorPreload);
		jQuery(QueryLoader.preloader).css({
			height: 	"0px",
			width:		"0px",
			overflow:	"hidden"
		});
		
		var length = QueryLoader.items.length; 
		QueryLoader.doneStatus = length;
		
		for (var i = 0; i < length; i++) {
			var imgLoad = jQuery("<img></img>");
			jQuery(imgLoad).attr("src", QueryLoader.items[i]);
			jQuery(imgLoad).unbind("load");
			jQuery(imgLoad).bind("load", function() {
				QueryLoader.imgCallback();
			});
			jQuery(imgLoad).appendTo(jQuery(QueryLoader.preloader));
		}
	},

	spawnLoader: function() {
		if (QueryLoader.selectorPreload == "body") {
			var height = jQuery(window).height();
			var width = jQuery(window).width();
			var position = "fixed";
		} else {
			var height = jQuery(QueryLoader.selectorPreload).outerHeight();
			var width = jQuery(QueryLoader.selectorPreload).outerWidth();
			var position = "absolute";
		}
		var left = jQuery(QueryLoader.selectorPreload).offset()['left'];
		var top = jQuery(QueryLoader.selectorPreload).offset()['top'];
		
		QueryLoader.overlay = jQuery("<div></div>").appendTo(jQuery(QueryLoader.selectorPreload));
		jQuery(QueryLoader.overlay).addClass("QOverlay");
		jQuery(QueryLoader.overlay).css({
			position: position,
			top: top,
			left: left,
			width: width + "px",
			height: height + "px"
		});
		
		QueryLoader.loadBar = jQuery("<div></div>").appendTo(jQuery(QueryLoader.overlay));
		jQuery(QueryLoader.loadBar).addClass("QLoader");
		
		jQuery(QueryLoader.loadBar).css({
			position: "relative",
			top: "50%",
			width: "0%"
		});
	},
	
	animateLoader: function() {
		var perc = (100 / QueryLoader.doneStatus) * QueryLoader.doneNow;
		if (perc > 99) {
			jQuery(QueryLoader.loadBar).stop().animate({
				width: perc + "%"
			}, 500, "linear", function() { 
				QueryLoader.doneLoad();
			});
		} else {
			jQuery(QueryLoader.loadBar).stop().animate({
				width: perc + "%"
			}, 500, "linear", function() { });
		}
	},
	
	doneLoad: function() {
		//prevent IE from calling the fix
		clearTimeout(QueryLoader.ieTimeout);
		
		//determine the height of the preloader for the effect
		if (QueryLoader.selectorPreload == "body") {
			var height = jQuery(window).height();
		} else {
			var height = jQuery(QueryLoader.selectorPreload).outerHeight();
		}
		
		//The end animation, adjust to your likings
		jQuery(QueryLoader.loadBar).animate({
			height: height + "px",
			top: 0
		}, 500, "linear", function() {
			jQuery("body").css('background', '#000 url(/theme/fr/templates/home/img/bg_bg.jpg) no-repeat center top fixed');
			jQuery("#body").css({visibility:"visible"});
			jQuery(QueryLoader.overlay).fadeOut(800);
			jQuery(QueryLoader.preloader).remove();
		});
	}
}

/************************************************************************************************************
 *
 *  Background-Position Animations - http://www.corrupt-system.de/jquery/backgroundPosition/
 * 
*************************************************************************************************************/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(f($){$.G($.5.x,{e:f(5){H(5.v==0&&A 5.7==\'B\'){b 6=$.q(5.m,\'e\');6=h(6);5.6=[6[0],6[2]];b 7=h(5.7);5.7=[7[0],7[2]];5.i=[7[1],7[3]]}b 9=[];9[0]=((5.7[0]-5.6[0])*5.n)+5.6[0]+5.i[0];9[1]=((5.7[1]-5.6[1])*5.n)+5.6[1]+5.i[1];5.m.F.e=9[0]+\' \'+9[1];f h(8){8=8.c(/r|t/g,\'u\');8=8.c(/w|y/g,\'z%\');8=8.c(/(\\d+)(\\s|\\)|$)/g,"$D$2");b a=8.p(/(\\d+)(k|\\%|l|j)\\s(\\d+)(k|\\%|l|j)/);C[o(a[1]),a[2],o(a[3]),a[4]]}}})})(E);',44,44,'|||||fx|start|end|strg|nowPosX|res|var|replace||backgroundPosition|function||toArray|unit|pt|px|em|elem|pos|parseFloat|match|curCSS|left||top|0px|state|right|step|bottom|100|typeof|string|return|1px|jQuery|style|extend|if'.split('|'),0,{}));

/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.11 (15-JUN-2010)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style,
    moz = style['MozBorderRadius'] !== undefined,
    webkit = style['WebkitBorderRadius'] !== undefined,
    radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
    mode = document.documentMode || 0,
    noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),

    expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
        catch(e) { return false; }
        return true;
    })();

$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do:  if (!$.support.borderRadius) $('#myDiv').corner();

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    var s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor'), rgb;
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
            if (v.indexOf('rgb') >= 0) { 
                rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            return v;
        }
        if (node.nodeName.toLowerCase() == 'html')
            break;
        node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return Math.round(width*(1-Math.cos(Math.acos(i/width))));
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevelfold':
    case 'bevel':  return i+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
    if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
    }

    return this.each(function(index){
        var $this = $(this),
            // meta values override options
            o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
            keep = /keep/.test(o),                       // keep borders?
            cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]),  // corner color
            sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]),  // strip color
            width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width
            re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/,
            fx = ((o.match(re)||['round'])[0]),
            fold = /dogfold|bevelfold/.test(o),
            edges = { T:0, B:1 },
            opts = {
                TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
                BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
            },
            // vars used in func later
            strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
        
        if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
            opts = { TL:1, TR:1, BL:1, BR:1 };
            
        // support native rounding
        if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
            if (opts.TL)
                $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
            if (opts.TR)
                $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
            if (opts.BL)
                $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
            if (opts.BR)
                $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
            return;
        }
            
        strip = document.createElement('div');
        $(strip).css({
            overflow: 'hidden',
            height: '1px',
            minHeight: '1px',
            fontSize: '1px',
            backgroundColor: sc || 'transparent',
            borderStyle: 'solid'
        });
    
        pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        cssHeight = $(this).outerHeight();

        for (j in edges) {
            bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                d = document.createElement('div');
                $(d).addClass('jquery-corner');
                ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (i=0; i < width; i++) {
                    w = Math.max(0,getWidth(fx,i, width));
                    e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
                
                if (fold && $.support.boxModel) {
                    if (bot && noBottomFold) continue;
                    for (c in opts) {
                        if (!opts[c]) continue;
                        if (bot && (c == 'TL' || c == 'TR')) continue;
                        if (!bot && (c == 'BL' || c == 'BR')) continue;
                        
                        common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                        $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                        switch(c) {
                        case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                        case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                        case 'BL': $horz.css({ top: 0, left: 0 }); break;
                        case 'BR': $horz.css({ top: 0, right: 0 }); break;
                        }
                        d.appendChild($horz[0]);
                        
                        var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                        switch(c) {
                        case 'TL': $vert.css({ left: width }); break;
                        case 'TR': $vert.css({ right: width }); break;
                        case 'BL': $vert.css({ left: width }); break;
                        case 'BR': $vert.css({ right: width }); break;
                        }
                        d.appendChild($vert[0]);
                    }
                }
            }
        }
    });
};

$.fn.uncorner = function() { 
    if (radius || moz || webkit)
        this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
    $('div.jquery-corner', this).remove();
    return this;
};

// expose options
$.fn.corner.defaults = {
    useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
    metaAttr:  'data-corner' // name of meta attribute to use for options
};

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:50,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
    
})(jQuery);
