var me={timeout:null,bubbleOne:null,bubbleTwo:null,init:function(){me.bubbleOne=$("#bubble-social");me.bubbleTwo=$("#bubble-vcard");me.makeScrollable();me.makeReel();me.makeBlend();me.makeBind()},makeBind:function(){$("a.bubbles","#socials").hover(function(){clearTimeout(me.timeout);me.showBubble(me.bubbleOne,$(this))},function(){me.timeout=setTimeout(function(){me.hideBubble(me.bubbleOne)},200)});$("#vcard").hover(function(){if(jQuery.support.opacity){me.bubbleTwo.show().animate({top:308,opacity:1},300)}else{me.bubbleTwo.css("top",308).fadeIn(400)}},function(){if(jQuery.support.opacity){me.bubbleTwo.fadeOut(400,function(){me.bubbleTwo.css("opacity",0).css("top",328)})}else{me.bubbleTwo.fadeOut(400)}});$("a.bubbles, a.milky, #studio a").click(function(){window.open(this.href);return false})},showBubble:function(a,c){var b=c.attr("id");if(jQuery.support.opacity){a.find("div.bubble-content").html('<div><img id="loader" src="img/ajax-loader.gif" alt="Chargement en cours..." /></div>').end().show().animate({top:206,opacity:1},300,function(){clearTimeout(me.timeout);me.timeout=setTimeout(function(){me.statusRequest(b)},300)})}else{a.find("div.bubble-content").html('<div><img id="loader" src="img/ajax-loader.gif" alt="Chargement en cours..." /></div>').end().fadeIn(500,function(){clearTimeout(me.timeout);me.timeout=setTimeout(function(){me.statusRequest(b)},300)})}},hideBubble:function(a){if(jQuery.support.opacity){a.animate({top:180,opacity:0},300,function(){a.hide()})}else{a.fadeOut(500)}},makeScrollable:function(){$("#scrollable").scrollable({vertical:true,items:"#items",keyboard:true,clickable:false,next:"#down",prev:"#up",mousewheel:true,speed:600,onBeforeSeek:function(b,a){var c=$("#items").find("div.item").eq(a).attr("id");if(a==0){me.bubbleTwo.fadeOut(500).hide()}if((jQuery.support.opacity)&&(a<3)){$("div.item:not(#"+c+")").animate({opacity:0.1},450);$("#"+c).animate({opacity:1},800)}}})},makeBlend:function(){$("#logo").find("a").blend({speed:500});$("a.partners","#partners").blend({speed:500});$("a.bubbles","#socials").blend({speed:400})},makeReel:function(){if(navigator.userAgent.indexOf("iPhone")==-1&&navigator.userAgent.indexOf("iPad")==-1&&navigator.userAgent.indexOf("iPod")&&-1){var b=null;var a=$("#rotate");a.reel({frames:23,revolution:$("page").width(),reversed:false,footage:6,spacing:0,clickfree:true,area:$("#page"),laziness:8,})}},statusRequest:function(c){var b="lib/ajax.php";var a=$("div.bubble-content div","#bubble-social");$.ajax({type:"POST",data:"get="+c,async:true,url:b,dataType:"html",success:function(d){me.statusCallback(a,d)},error:function(){me.statusCallback(a,"Une erreur inconnue est survenue, ça surprend toujours...")}})},statusCallback:function(b,a){$(b).hide().html(a).fadeIn(300)}};$(document).ready(function(){me.init()});
