$(document).ready(function(){function a(c){var b=$("body").attr("class");b=b&&b!="sous-dossier"?"http://www.barakaflims.com/"+b:$(location).attr("href");b=b.replace(/barakaflims.com\/fr\//g,"barakaflims.com/");b=b.replace(/barakaflims.com\/en\//g,"barakaflims.com/");b=b.replace(/barakaflims.com\//g,"barakaflims.com/"+c);$(location).attr("href",b)}function d(c,b){c=c.indexOf("?")==-1?c+"?random="+Math.random():c+"&random="+Math.random();$.ajax({url:c,cache:false,success:function(g){split=g.split('<div id="corps">');
split=split[1].split('</div><div id="corps-fin"></div>');if(b=="gauche"){$("#corps").wrapInner('<div id="corps-ajax" />');$("#corps-ajax").css({width:"900px"});$("#corps").append('<div id="corps-temp-gauche">'+split[0]+"</div>");$("#corps-temp-gauche .ad-gallery.photos").length>0&&$("#corps-temp-gauche .ad-gallery.photos").adGallery({thumb_opacity:0.3});$("#corps-temp-gauche .ad-gallery.blog").length>0&&$("#corps-temp-gauche .ad-gallery.blog").adGallery();hauteur=parseInt($("#corps-temp-gauche").css("height"));
$("#corps").animate({height:hauteur+"px"},600);$("#corps-ajax").animate({"margin-left":"-1000px"},600);$("#corps-temp-gauche").animate({left:"0px"},600,function(){$("#corps-ajax").remove();$("#corps-temp-gauche").removeAttr("id");zoombox.init();$("#corps").css({height:"auto"})})}else{$("#corps").wrapInner('<div id="corps-ajax" />');$("#corps-ajax").css({width:"900px"});$("#corps").append('<div id="corps-temp-droite">'+split[0]+"</div>");$("#corps-temp-droite .ad-gallery.photos").length>0&&$("#corps-temp-droite .ad-gallery.photos").adGallery({thumb_opacity:0.3});
$("#corps-temp-droite .ad-gallery.blog").length>0&&$("#corps-temp-droite .ad-gallery.blog").adGallery();hauteur=parseInt($("#corps-temp-droite").css("height"));$("#corps").animate({height:hauteur+"px"},600);$("#corps-ajax").animate({"margin-left":"1000px"},600);$("#corps-temp-droite").animate({right:"0px"},600,function(){$("#corps-ajax").remove();$("#corps-temp-droite").removeAttr("id");zoombox.init();$("#corps").css({height:"auto"})})}},error:function(){alert("Une erreur est survenue lors du chargement de la page.")}})}
function f(c){c=c.indexOf("?")==-1?c+"?random="+Math.random():c+"&random="+Math.random();$.ajax({url:c,cache:false,success:function(b){split=b.split('<div id="corps">');split=split[1].split('</div><div id="corps-fin"></div>');$("object[type=application/x-shockwave-flash]").remove();$("#corps").slideUp(600,function(){$("#corps").html(split[0]);$(".ad-gallery.blog").length>0&&$(".ad-gallery.blog").adGallery();$("#corps").slideDown(600);$(".ad-gallery.photos").length>0&&$(".ad-gallery.photos").adGallery({thumb_opacity:0.3});
zoombox.init()})},error:function(){alert("Une erreur est survenue lors du chargement de la page.")}})}var e=$(location).attr("href");if(e.indexOf("www")==-1){e=e.replace(/www.barakaflims.com/g,"barakaflims.com");e=e.replace(/barakaflims.com/g,"www.barakaflims.com");$(location).attr("href",e)}zoombox.init();$(".ad-gallery.photos").length>0&&$(".ad-gallery").adGallery({thumb_opacity:0.3});$(".ad-gallery.blog").length>0&&$(".ad-gallery").adGallery();if(window.location.pathname=="/"||window.location.pathname==
"/index.php")$("body").attr("class","index.php");$("a[rel!=pasEffet]").live("mouseover",function(){$(this).animate({color:"#999"},300)});$("a[rel!=pasEffet]").live("mouseout",function(){$(this).stop().animate({color:"#FFF"},400)});$("a[id=language-fr]").click(function(){a("");return false});$("a[id=language-en]").click(function(){a("en/");return false});$("#menu ul li a").click(function(){$("iframe").remove();if($.browser.msie)return true;else{cible=$(this).attr("href");source=$("body").attr("class");
ordreS=source=="index.php"||source=="en/index.php"?1:source=="films.php"||source=="en/films.php"?2:source=="photos.php"||source=="en/photos"?3:source=="blog.php"||source=="en/blog.php"?4:source=="clips.php"||source=="en/clips.php"?5:source=="sous-dossier"?6:0;ordreC=cible=="index.php"||cible=="en/index.php"?1:cible=="films.php"||cible=="en/films.php"?2:cible=="photos.php"||cible=="en/photos.php"?3:cible=="blog.php"||cible=="en/blog.php"?4:cible=="clips.php"||cible=="en/clips.php"?5:0;if(ordreC==ordreS)return false;
ordreS<ordreC?d(cible,"gauche"):d(cible,"droite");$("#menu a").stop().removeClass("actif").attr("rel","").css({color:"#fff"});$(this).stop().addClass("actif").attr("rel","pasEffet").css({color:"#8D4811"});$("body").attr("class",cible);return false}});$("#pied ul li a").click(function(){cible=$(this).attr("href");$("#menu a").removeClass("actif");f(cible);$("body").removeClass();$("body").attr("class",cible);return false});$("a[class~=afficher]").live("click",function(){if($.browser.msie)return true;
else{cible=$(this).attr("href");d(cible,"gauche");$("body").attr("class","sous-dossier");return false}});$("a[class~=afficher-films]").click(function(){if($.browser.msie)return true;else{cible=$(this).attr("href");d(cible,"gauche");$("#menu a[href=films.php]").addClass("actif");$("body").attr("class","films.php");return false}})});function surligne(a,d){a.style.backgroundColor=d=="blanc"?"":d=="rouge"?"#FCC":"#CFC"}
function verif_nom(a){if(a.value.length==0){surligne(a,"rouge");document.getElementById("XHR_nom").innerHTML='<span class="XHR_erreur">Champ requis</span>';return false}else if(a.value.length<2){surligne(a,"rouge");document.getElementById("XHR_nom").innerHTML='<span class="XHR_erreur">Trop court</span>';return false}else if(a.value.length>50){surligne(a,"rouge");document.getElementById("XHR_nom").innerHTML='<span class="XHR_erreur">Trop long</span>';return false}else{surligne(a,"vert");document.getElementById("XHR_nom").innerHTML=
'<span class="XHR_ok">Ok</span>';return true}}
function verif_prenom(a){if(a.value.length==0){surligne(a,"rouge");document.getElementById("XHR_prenom").innerHTML='<span class="XHR_erreur">Champ requis</span>';return false}else if(a.value.length<2){surligne(a,"rouge");document.getElementById("XHR_prenom").innerHTML='<span class="XHR_erreur">Trop court</span>';return false}else if(a.value.length>30){surligne(a,"rouge");document.getElementById("XHR_prenom").innerHTML='<span class="XHR_erreur">Trop long</span>';return false}else{surligne(a,"vert");
document.getElementById("XHR_prenom").innerHTML='<span class="XHR_ok">Ok</span>';return true}}
function verif_email(a){var d=/^[a-zA-Z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$/;if(a.value.length==0){surligne(a,"rouge");document.getElementById("XHR_email").innerHTML='<span class="XHR_erreur">Champ requis</span>';return false}else if(d.test(a.value)){surligne(a,"vert");document.getElementById("XHR_email").innerHTML='<span class="XHR_ok">Ok</span>';return true}else{surligne(a,"rouge");document.getElementById("XHR_email").innerHTML='<span class="XHR_erreur">Email incorrect</span>';return false}}
function verif_message(a){if(a.value.length==0){surligne(a,"rouge");document.getElementById("XHR_message").innerHTML='<span class="XHR_erreur_text">Champ requis</span>';return false}else if(a.value.length<2){surligne(a,"rouge");document.getElementById("XHR_message").innerHTML='<span class="XHR_erreur_text">Trop court</span>';return false}else{surligne(a,"vert");document.getElementById("XHR_message").innerHTML='<span class="XHR_ok_text">Ok</span>';return true}}
function verification_message(){var a=verif_nom(document.forms[0].nom),d=verif_prenom(document.forms[0].prenom),f=verif_email(document.forms[0].email),e=verif_message(document.forms[0].message);return a&&d&&f&&e?true:false};
