(function($){
	var ua = ($.browser.mozilla?'mozilla':($.browser.opera?'opera':($.browser.webkit?'webkit':'ie')));
	$('html').addClass(ua).addClass(ua+'-'+parseInt($.browser.version)).addClass(ua+'-'+$.browser.version);

	jQuery.extend( jQuery.easing,
	{
		def: 'easeOutQuad',
		swing: function (x, t, b, c, d) {
			return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
		},
		easeInQuad: function (x, t, b, c, d) {
			return c*(t/=d)*t + b;
		},
		easeOutQuad: function (x, t, b, c, d) {
			return -c *(t/=d)*(t-2) + b;
		},
		easeInOutQuad: function (x, t, b, c, d) {
			if ((t/=d/2) < 1) return c/2*t*t + b;
			return -c/2 * ((--t)*(t-2) - 1) + b;
		},
		easeInCubic: function (x, t, b, c, d) {
			return c*(t/=d)*t*t + b;
		},
		easeOutCubic: function (x, t, b, c, d) {
			return c*((t=t/d-1)*t*t + 1) + b;
		},
		easeInOutCubic: function (x, t, b, c, d) {
			if ((t/=d/2) < 1) return c/2*t*t*t + b;
			return c/2*((t-=2)*t*t + 2) + b;
		}
	});
	
	$(".toggle_content").hide();
	$("h3.toggle").click(function(){
		if($(this).hasClass('active')){$(this).removeClass("active");}
		else{$(this).addClass("active");}
		$(this).next(".toggle_content").slideToggle();
		return false;
	});
	
	$("a.externe, a[rel=externe], a[rel=external]").live('click',function(){
		window.open($(this).attr('href'));
		return false;
	});
	
	$(".origami-title").css({marginTop:parseInt((110 - $(".origami-title").height())/2)+20+'px'});
	$("header .pnav > div").css({width:$("header .pnav ul.menu").outerWidth()+3,margin:'0 auto'});
	
	$('a[href^=#]').bind('click',function(){
		var ancre = $(this).attr('href');
       	if( ancre != '#'){
            if($(ancre).length > 0){
            	var offset = $(ancre).offset().top;
            }else if($("a[name="+ ancre.replace('#','') +"]").length > 0){
            	var offset = $("a[name="+ ancre.replace('#','') +"]").offset().top;
            }else{ return false; }
        }else{ var offset = 0; }
        
        jQuery('html,body').animate(
			{scrollTop:offset},
			2000,
			'easeOutCubic',
			function(){
				if( ancre != '#' ){
					window.location.hash = ancre;
		       		$(ancre).focus();
				}
			});
        return false;
    });
    	
	$(".wpcf7 table br").remove();
	
	$("li:last-child").addClass("last");
	
	$(".contact-hydrocosmos").css({cursor:'pointer'}).click(function(){
		window.open($(this).data('href'));
		return false;
	});
	
})(jQuery);
