function showContact(a){var b=$('<div id="blanket">');b.click(function(a){if(a.target==this)removePopUp()});var c=$(".contactPop").clone();contactWidth=contactWidth;contactHeight=contactHeight;var d=$(window).width()/2;d-=popMaximalWidth/2;var e=$(window).height()/2;e-=popMaximalHeight/2;c.appendTo(b.appendTo("body")).css({width:a.width(),height:a.height(),left:a.offset().left,top:a.offset().top}).show().animate({width:contactWidth,height:contactHeight,left:d,top:e},{complete:function(){$(this).find(".btClose").show().click(function(){removePopUp();return false})}})}function showLoader(a){if(a){$(".activepopup .audios").append($(".ajaxloader").clone().show())}else{$(".activepopup .ajaxloader").remove()}}function prepareInfos(a,b){a.find("h3").text(b.find(".titre").text()).end().find("p").text(b.find(".description").text());if(b.find(".description").text()!=""){$("<h4>"+b.find(".contribution").text()+"</h4>").insertAfter(a.find("p"))}}function removePopUp(){$("#blanket").empty().remove()}function apparaitre(a,b){var c=b.offset().left;var d=b.offset().top;var e=b.width();var f=b.height();var g=$(window).width()/2;g-=popMaximalWidth/2;var h=$(window).height()/2;h-=popMaximalHeight/2;projetId=b.closest("li").find(".id").text();activePop=a;a.css({left:c,top:d,width:e,height:f}).show().animate({width:popMaximalWidth,height:popMaximalHeight,left:g,top:h},{complete:function(){$(this).find(".btClose").click(function(){removePopUp();return false}).show();showLoader(true);$.getJSON(relPath+"script/ajax.php",{getproject:projetId},function(a){var b=iFrameFirst+a[0].embed+iFrameSecond+a[0].couleur+iFrameThird+iFrameWidth+iFrameFourth+iFrameHeight+iFrameFifth;activePop.append($(b));showLoader(false)})}})}function showPopUp(a){var b=$(".pop").clone();var c=$('<div id="blanket">');c.click(function(a){if(a.target==this)removePopUp()});b.addClass("activepopup").find("btClose").show().end().appendTo(c);$("body").append(c);prepareInfos(b,a);apparaitre(b,a.find("h3"))}var popMinimalWidth=287;var popMinimalHeight=162;var popMaximalWidth=627;var popMaximalHeight=514;var contactWidth=735;var contactHeight=465;var iFrameFirst='<iframe src="http://player.vimeo.com/video/';var iFrameSecond="?title=0&autoplay=1&byline=0&portrait=0&color=";var iFrameThird='" width="';var iFrameFourth='" height="';var iFrameFifth='" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>';var iFrameWidth=629;var iFrameHeight=354;$(function(){$("#videoInit").click(function(){$(this).replaceWith('<iframe src="http://player.vimeo.com/video/29207411?title=0&byline=0&portrait=0&color=ff9933&autoplay=1" width="629" height="354" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>');return false});$(".send_mail").live("click",function(){form$=$(this).closest("form");form$.find('[class$="_requis"]').hide();var a=form$.find('[name="name"]').val();var b=form$.find('[name="company"]').val();var c=form$.find('[name="email"]').val();var d=form$.find('[name="phone"]').val();var e=form$.find('[name="message"]').val();if(a!=""&&c!=""&&d!=""&&e!=""){showLoader(true);$.post(relPath+"script/ajax.php",{sendmail:true,name:a,company:b,email:c,phone:d,message:e},function(a){if(a){form$.find(".confirm .invalid").show();form$.find(".confirm .valid").hide()}else{form$.find(".confirm .invalid").hide();form$.find(".confirm .valid").show()}form$.find(".send_mail").die().hide();showLoader(false)})}else{if(e==""){form$.find(".message_requis").show();form$.find('[name="message"]').get(0).focus()}if(d==""){form$.find(".phone_requis").show();form$.find('[name="phone"]').get(0).focus()}if(c==""){form$.find(".email_requis").show();form$.find('[name="email"]').get(0).focus()}if(a==""){form$.find(".name_requis").show();form$.find('[name="name"]').get(0).focus()}}return false});if($("#quote").size()){var a=$("#quote").height();var b=$("#primetime").height();var c=(b-a)/2;$("#quote").css({marginTop:c})}$(".index #aside li").hover(function(){$(this).addClass("selected")},function(){$(this).removeClass("selected")}).click(function(){showPopUp($(this))});$(".project-thumbs li").click(function(){showPopUp($(this))});$(".lnkContact").click(function(){showContact($(this))})})
