
liste_update=0;sortable=0;box_appearance=false;just_added=false;bc_timer=false;hs_timer=false;sm_timer=false;noclick=false;$(document).ready(function(){$('tr.lu').each(function(){$(this).fadeTo('slow',0.33);});notificationChecker();$('.context').live('click',function(){$(this).fadeOut();return false;})
$(document).click(function(){if(box_appearance==true){$('.box').css('display','none');$('.subs').css('display','none');box_appearance=false;}});$(document).keyup(function(e){if(e.keyCode==191&&e.srcElement.nodeName=='BODY'){$('input[name=header_search]').focus();}
if(e.keyCode==27){faceboxClose();}});$('input[name=header_search]').keyup(function(e){clearTimeout(hs_timer);hs_timer=setTimeout(function(){checkSearch(e);},500);});$('#header.mini').click(function(){$(this).removeClass('mini');});$('#growl').live('mouseover',function(){$('#growl .close').show();});$('#growl').live('mouseout',function(){$('#growl .close').hide();});showContexts();$('textarea').keydown(function(e){if(e.keyCode==9){var start=$(this).get(0).selectionStart;$(this).val($(this).val().substring(0,start)+"\t"+$(this).val().substring($(this).get(0).selectionEnd));$(this).get(0).selectionStart=$(this).get(0).selectionEnd=start+1;return false;}});$('.ask-confirmation').live('click',function(e){var ctext=$(this).attr('data-text')?$(this).attr('data-text'):'Confirmez-vous cette action ?';var href=$(this).attr('href');popupAlert('Confirmation',ctext,function(){window.location=href;},function(){return true;});e.preventDefault();});});function checkSearch(e){var search;search=$('input[name=header_search]').val();if(search.length>0&&e.keyCode!=40&&e.keyCode!=38){$.get("/ajax/header/search.php",{"q":search},function(xml){$('#header_search_resultat .title').remove();$('#header_search_resultat .item').remove();type=null;$('item',xml).each(function(){if($('type',this).text()!=type){type=$('type',this).text();if(type=='planning'){$('#header_search_resultat').append('<div class="title"><p>Séries</p></div>');}else{$('#header_search_resultat').append('<div class="title"><p>Membres</p></div>');}}
$('#header_search_resultat').append('<div class="item '+$('type',this).text()+'"><p><a href="/'+$('type',this).text()+'/'+$('url',this).text()+'">'+$('titre',this).text()+'</a></p></div>');});$('input[name=header_search]').unbind('keydown');$('input[name=header_search]').bind('keydown',function(e){if(e.keyCode==40){current_item=$('#header_search_resultat .item.hl');if(current_item.length==0){$('#header_search_resultat .item:first').addClass('hl');}else{next_item=$('#header_search_resultat .item.hl').next('div');if(next_item.attr('class')=='title'){next_item=next_item.next('div');}
current_item.removeClass('hl');next_item.addClass('hl');}
return false;}
if(e.keyCode==38){current_item=$('#header_search_resultat .item.hl');if(current_item.length!=0){prev_item=$('#header_search_resultat .item.hl').prev('div');if(prev_item.attr('class')=='title'){prev_item=prev_item.prev('div');}
current_item.removeClass('hl');prev_item.addClass('hl');}
return false;}
if(e.keyCode==13){current_item=$('#header_search_resultat .item.hl');if(current_item.length!=0){url=current_item.find('a').attr('href');document.location=url;}else{current_item=$('#header_search_resultat .item:first');url=current_item.find('a').attr('href');document.location=url;}
return false;}
if(e.keyCode==27){$('#header_search_resultat .item').remove();$('#header_search_resultat .title').remove();$('input[name=header_search]').attr('value','').blur();return false;}});});}else if(e.keyCode!=40&&e.keyCode!=38){$('#header_search_resultat .item').remove();$('#header_search_resultat .title').remove();$('input[name=header_search]').unbind('keydown');}}
function reportItem(target,type){faceboxDisplay('report',{target:target,type:type});}
function showContexts(){$('.context').each(function(){if($(this).css('opacity')=='0'){$(this).animate({'opacity':0.8},500);}});}
function breadcrumbAlert(alert){if(bc_timer==false)text=$('.breadcrumb').html();$('.breadcrumb').css('background','#eeeeee').animate({paddingLeft:6},200).css('text-align','center').css('position','absolute').animate({width:968},500).animate({backgroundColor:'#C1E0FA'},500,function(){$(this).addClass('alert').html(alert);});bc_timer=setTimeout(function(){$('.breadcrumb').animate({backgroundColor:'#eeeeee'},500).animate({width:650},500,function(){$(this).animate({paddingLeft:22},200,function(){$(this).removeClass('alert').html(text);$(this).css({'text-align':'left','background':'url(/images/site/location.png) no-repeat 6px 5px #eeeeee','position':'static'});});});},30000);}
function breadCrumbClose(){if(bc_timer==false)return false;clearTimeout(bc_timer);$('.breadcrumb').animate({backgroundColor:'#eeeeee'},500).animate({width:650},500,function(){$(this).animate({paddingLeft:22},200,function(){$(this).removeClass('alert').html(text);$(this).css({'text-align':'left','background':'url(/images/site/location.png) no-repeat 6px 5px #eeeeee','position':'static'});});});}
function popupAlert(titre,texte,callback_yes,callback_no){$('#popup #content h3').html(titre);$('#popup #content p').html(texte);if(callback_no){$('#popup #content input[id=yes]').attr('value','Oui');$('#popup #content input[id=no]').show();}else{$('#popup #content input[id=yes]').attr('value','D\'accord');$('#popup #content input[id=no]').hide();}
$('#popup-bg').css('display','block').animate({opacity:0.6},500,function(){$('#popup').css('top',-$('#popup').height()).animate({top:0},500);});$('#popup #content input[type=button]').unbind('click');$('#popup #content input[type=button]').bind('click',function(){input_id=$(this).attr('id');$('#popup').animate({top:-$('#popup').height()},500,function(){$('#popup').css('top',-5000);$('#popup-bg').animate({opacity:0},500,function(){$(this).css('display','none');});if(input_id=='yes'){if(callback_yes)callback_yes.call(this);}else{if(callback_no)callback_no.call(this);}});});}
function growlAlert(id,titre,texte){if(texte.length==0)return false;if(id==parseFloat(id)){id=id;}else{var newDate=new Date;id=newDate.getTime();}
$('#growl .close').before('<div class="item" id="i'+id+'"><a href="javascript:;" onclick="growlClose('+id+');"><img src="/images/site/growlclose.gif" /></a><h4>'+titre+'</h4><p>'+texte+'</p></div>');$('#growl .item:last').fadeIn('slow');}
function growlClose(id){if($('#growl .item#i'+id).length>0){$('#growl .item#i'+id).fadeOut(function(){$(this).remove();if($('#growl .item').length==0)$('#growl .close').hide();});}else if(id=='all'){$('#growl .close').fadeOut();$('#growl .item').fadeOut();}
$.post('/ajax/notifications/seen.php',{id:id});}
function notificationChecker(){total=0;$.get("/ajax/notifications/get.php",function(xml){ids=[];textes=[];i=0;$('root notifications notification',xml).each(function(){ids[i]=$('id',this).text();textes[i]=$('texte',this).text();++i;});for(i in textes){growlAlert(ids[i],'Notifications',textes[i]);}
nb_friend=parseInt($('root summary friend',xml).text());nb_recommend=parseInt($('root summary recommend',xml).text());nb_episode=parseInt($('root summary episode',xml).text());nb_badge=parseInt($('root summary badge',xml).text());if(nb_friend>0){$('#header #navigation a#amis strong').remove();$('#header #navigation a#amis').append(' <strong>('+nb_friend+')</strong>');}
if(nb_recommend>0){$('#header #navigation a#compte strong').remove();$('#header #navigation a#compte').append(' <strong>('+nb_recommend+')</strong>');}
if(nb_episode>0){$('#header #navigation a#episodes strong').remove();$('#header #navigation a#episodes').append(' <strong>('+nb_episode+')</strong>');}
if(nb_badge>0){$('#header #navigation a#badges strong').remove();$('#header #navigation a#badges').append(' <strong>('+nb_badge+')</strong>');}});}
function addSerie(titre,url){$('.show#'+url+' .record').css('opacity',0.5);popupAlert('Ajout de '+titre,'Souhaitez-vous ajouter la série '+titre+' dans votre compte ?',function(){$.get('/ajax/series/add.php',{url:url},function(){_gaq.push(['_trackEvent','Actions','Série ajoutée (inline)',url]);$('.show#'+url+' .record').remove();growlAlert('no','Succès','La série '+titre+' a bien été ajoutée !');});},function(){$('.show#'+url+' .record').css('opacity',1);});}
function deleteSerie(titre,url){$('.show#'+url+' .record').css('opacity',0.5);popupAlert('Suppression de '+titre,'Souhaitez-vous supprimer la série '+titre+' de votre compte ?',function(){$.post("/ajax/series/delete.php",{'url':url},function(){_gaq.push(['_trackEvent','Actions','Série supprimée (inline)',url]);$('.show#'+url+' .record').remove();growlAlert('no','Succès','La série '+titre+' a bien été supprimée !');});},function(){$('.show#'+url+' .record').css('opacity',1);});}
function srtInaccurate(id){_gaq.push(['_trackEvent',"Actions","Sous-titres incorrects"]);$.get('/ajax/episodes/inaccurate_dialog.php',{id:id},function(xml){popupAlert($('titre',xml).text(),$('texte',xml).text(),function(){$.post('/ajax/episodes/inaccurate.php',{id:id,description:$('input[name=description]').attr('value')},function(html){$('a#srt'+id).parent().remove();});},function(){return true;});});}
function boxToggle(id){el=$(id);if(el.css('display')=='block'){el.css('display','none');box_appearance=false;}else{box_appearance=false;$('.box').css('display','none');el.css('display','block');$('.no-closing').bind('click',function(){return false;});setTimeout(function(){box_appearance=true;},500);}}
function ep_markasRead(serie,url,saison,episode){div=$('.episodes .item#ep_'+url+saison+episode);if(notation==1){$('.side .markas',div).animate({width:69},500,function(){$(this).css('padding','2px');$(this).html('<img id="1" src="/images/site/star_off.png" /> <img id="2" src="/images/site/star_off.png" /> <img id="3" src="/images/site/star_off.png" /> <img id="4" src="/images/site/star_off.png" /> <img id="5" src="/images/site/star_off.png" />');$(this).css('cursor','pointer');content=this;$('img',this).bind('mouseover',function(){note=parseInt($(this).attr('id'));$('img',content).each(function(){iid=parseInt($(this).attr('id'));if(iid<=note){$(this).attr('src','/images/site/star_on.png');}else{$(this).attr('src','/images/site/star_off.png');}});});$('img',this).bind('click',function(){markasRead(serie,url,saison,episode,$(this).attr('id'));});});}else{markasRead(serie,url,saison,episode,0);}}
function markasRead(serie,url,saison,episode,note){div=$('.episodes .item#ep_'+url+saison+episode);$('.markas img',div).unbind('click').css('cursor','default');$('.markas',div).css('opacity',0.5);$('.dl',div).remove();$.post("/ajax/episodes/markas.php",{"serie":serie,"url":url,"saison":saison,"episode":episode,"note":note,"update_tl":"yes"},function(xml){_gaq.push(['_trackEvent',"Actions","Episode vu",serie+' '+$('numero',xml).text()]);orig_saison=saison;$('.markas',div).remove();$('.vu',div).remove();if(display_type=='partial')$('span.srtlinks',div).append(' &mdash; <a href="javascript:;" onclick="compte_episodes(\''+srt+'\');">Suivant &rarr;</a>');if($('facebook',xml).text()=='0')$('.share img.facebook',div).remove();if($('twitter',xml).text()=='0')$('.share img.twitter',div).remove();$('.share',div).removeClass('hidden');$('.share img.clickable',div).bind('click',function(){img=$(this);img.removeClass('clickable').css('opacity',0.5);type=img.attr('class');if(type=='betaseries'){img.animate({'opacity':0},500);faceboxDisplay('comment',{url:url,saison:saison,episode:episode});return false;}
if(type=='twitter')twitter_click('','');_gaq.push(['_trackEvent',"Actions","Partage "+type]);$.get('/ajax/episodes/share.php',{type:type,"serie":serie,"url":url,"saison":orig_saison,"episode":episode,"note":note},function(xml){img.animate({'opacity':0},500);if(type=='facebook'){FB.ui({method:'feed',name:$('link',xml).text(),link:$('url',xml).text(),picture:$('img',xml).text(),caption:'',description:'',message:$('text',xml).text(),actions:{name:'Profil BetaSeries',link:$('member',xml).text()}});}else if(type=='twitter'){twitter_click($('url',xml).text(),$('text',xml).text());}});});if(display_type!='partial'){ep_next=parseInt(episode)+1;if($('#ep_'+url+saison+ep_next).length==0){saison=parseInt(saison)+1;ep_next=1;}
$('#ep_'+url+saison+ep_next).find('.markas').removeClass('hidden');}});}
function replyTo(id){if(id=='0'){$('#in_reply_to').html('');$('input[name=in_reply_to]').attr('value','0');$('input[name=editing]').attr('value','0');$('form[id=commentaires-post] input[type=submit]').attr('value','Ajouter le commentaire');}else{$('#in_reply_to').html('En réponse à #'+id+'. <a href="javascript:;" onclick="replyTo(0);">Annuler</a>');$('input[name=editing]').attr('value','0');$('input[name=in_reply_to]').attr('value',id);$('form#commentaires-post textarea').val('').focus();document.location='#commentaires-post';$('form[id=commentaires-post] input[type=submit]').attr('value','Ajouter le commentaire');}}
function commentEdit(id,el){if(id=='0'){$('#in_reply_to').html('');$('form#commentaires-post textarea').val('');$('input[name=in_reply_to]').attr('value','0');$('input[name=editing]').attr('value','0');$('form[id=commentaires-post] input[type=submit]').attr('value','Ajouter le commentaire');}else{$('#in_reply_to').html('Edition de #'+id+'. <a href="javascript:;" onclick="commentEdit(0);">Annuler</a>');$('input[name=in_reply_to]').attr('value','0');$('input[name=editing]').attr('value',id);text=$(el).parent().parent().find('.c_clear').html();text=text.replace(/&lt;/g,'<');text=text.replace(/&gt;/g,'>');text=text.replace(/<br>/g,'');$('form#commentaires-post textarea').val(text).focus();document.location='#commentaires-post';$('form[id=commentaires-post] input[type=submit]').attr('value','Éditer le commentaire');}}
function commentDelete(id){popupAlert('Supprimer un commentaire','Êtes-vous sûr de vouloir supprimer votre commentaire ?',function(){document.location='/apps/commentaire_delete.php?id='+id;},function(){return true;});}
function addslashes(str){return(str+'').replace(/([\\"'])/g,"\\$1");}
function stripslashes(str){return str.replace('/\(.)/g','$1');}
function headerVote(url){$.post("/ajax/header/vote.php",{url:url},function(){$('.headervote p').fadeOut();});}
function standardAjaxForm(formid){return{beforeSubmit:function(){$('form#mail').css('opacity',0.5);$('form#mail input').attr('disabled',true);$('form#mail img').remove();$('form#mail input.submit').after('<img src="/images/site/ajax-loader.gif" />');},success:function(html){$('form#mail img').remove();$('form#mail').css('opacity',1);$('form#mail input').removeAttr('disabled');growlAlert('no','Notifications',html);}};}
function alerteOptToggle(url,opt){title=$('a#'+url+'_'+opt).html();$('a#'+url+'_'+opt).html('...');$.post('/ajax/account/alertes.php',{'url':url,'option':opt},function(html){$('a#'+url+'_'+opt).html(title);if(html=='on'){$('a#'+url+'_'+opt).addClass('on');}else{$('a#'+url+'_'+opt).removeClass('on');}
if(url=='all'){if(html=='on'){$('.download a.opt.'+opt).addClass('on');}else{$('.download a.opt.'+opt).removeClass('on');}}});}
function alerteSerieToggle(url){title=$('#item_'+url+' .details a').html();$('#item_'+url+' .details a').html('Mise à jour...');$.post('/ajax/account/alertes.php',{'url':url,'option':'all'},function(html){$('#item_'+url+' .details a').html(title);if(html=='on'){$('#item_'+url+' .download a.opt').addClass('on');}else{$('#item_'+url+' .download a.opt').removeClass('on');}});}
function fbs_click(u,t){window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');_gaq.push(['_trackEvent','Actions',"Partage facebook"]);return false;}
function twitter_click(u,t){window.open('http://twitter.com/share?_=1299848225517&count=none&related=betaseries%3ACompte%20officiel%20de%20BetaSeries.com&text='+encodeURIComponent(t)+'&url='+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=550,height=475');return false;}
function addToFriends(ami,inline){popupAlert('Ajouter '+ami,'Voulez-vous ajouter '+ami+' à vos amis BetaSeries ?',function(){$('span#wrapper_friend_add_'+ami).html('ajout en cours...');$.get('/ajax/friends/add.php',{ami:ami},function(html){_gaq.push(['_trackEvent',"Actions","Ami","Ajout"]);if(inline==true){$('span#wrapper_friend_add_'+ami).html('ami ajouté !');}else{document.location=document.location;}});},function(){return true;});}
function deleteFromFriends(ami,inline){popupAlert('Supprimer '+ami,'Êtes-vous sûr de vouloir supprimer '+ami+' de vos amis BetaSeries ?',function(){$.get('/ajax/friends/delete.php',{ami:ami},function(html){_gaq.push(['_trackEvent',"Actions","Ami","Suppression"]);if(inline==true){$('span#wrapper_friend_add_'+ami).html('ami supprimé !');}else{document.location=document.location;}});},function(){return true;});}
function blockUser(login,inline){popupAlert('Bloquer '+login,'Êtes-vous sûr de vouloir bloquer '+login+' ?',function(){$.get('/ajax/friends/block.php',{login:login},function(html){_gaq.push(['_trackEvent',"Actions","Ami","Bloquage"]);if(inline==true){$('span#wrapper_friend_add_'+login).html('bloqué !');}else{document.location=document.location;}});},function(){return true;});}
function unblockUser(login,inline){popupAlert('Débloquer '+login,'Êtes-vous sûr de vouloir débloquer '+login+' ?',function(){$.get('/ajax/friends/unblock.php',{login:login},function(html){_gaq.push(['_trackEvent',"Actions","Ami","Débloquage"]);if(inline==true){$('span#wrapper_friend_add_'+login).html('débloqué !');}else{document.location=document.location;}});},function(){return true;});}
function setNewNote(url,saison,episode){div=$('.episodes .item#ep_'+url+saison+episode);$('.side .markas',div).animate({width:69},500,function(){$(this).css('padding','2px');$(this).html('<img id="1" src="/images/site/star_off.png" /> <img id="2" src="/images/site/star_off.png" /> <img id="3" src="/images/site/star_off.png" /> <img id="4" src="/images/site/star_off.png" /> <img id="5" src="/images/site/star_off.png" />');$(this).css('cursor','pointer');content=this;$('img',this).bind('mouseover',function(){note=parseInt($(this).attr('id'));$('img',content).each(function(){iid=parseInt($(this).attr('id'));if(iid<=note){$(this).attr('src','/images/site/star_on.png');}else{$(this).attr('src','/images/site/star_off.png');}});});$('img',this).bind('click',function(){vote=$(this).attr('id');$('.markas',div).css('opacity',0.5);$.post('/ajax/episodes/note.php',{url:url,saison:saison,episode:episode,vote:vote},function(){$('.markas img',div).unbind('click').css('cursor','default');$('.markas',div).html('<img src="/images/site/vote_'+vote+'.png" />').animate({'opacity':1,'width':30},500);});});});}
function faceboxDisplay(type,params,callback){noclick=true;if(params['large']){$('#facebox').addClass('large');}else{$('#facebox').removeClass('large');}
$.get('/ajax/facebox/'+type+'.php',params,function(html){$('#facebox').html(html).css('top',200).css('top',(window.innerHeight-$('#facebox').height())/2);if(typeof callback=='function')callback.call();});setTimeout(function(){noclick=false;},500);}
function faceboxClose(){$('#facebox').html('');}
eval(function(p,a,c,k,e,r){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--)r[e(c)]=k[c]||e(c);k=[function(e){return r[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}('q 6=e;2 t(){6=4;$.7(\'/8/1/u.9\',2(){v();w()});5 4}2 x(){$.7(\'/8/1/z.9\',2(){$(\'3.f\').A()});5 4}2 B(){b(!C||!6)5 e;$.7(\'/8/1/D.9\',2(a){g=$(\'3.1 c\').d();$(\'3.1 c\').d(a);b(g==a){E(\'F !\',\'G H I\\\'J n\\\'y K h i Léo à M j l\\\'k. N O réP Q R S.\')}m()});5 4}2 m(){$(\'3.f\').p();$(\'3.1\').T(\'U\').V(\'W\').X(\'Y\',\'Z i 10és 11 j l\\\'k, 12 h 13 :)\');b($(\'3.1 c\').d()==\'0\')$(\'3.1\').p();5 4}',62,66,'|dons|function|div|true|return|bs_beead_launched|get|ajax|php||if|span|html|false|don|current|plus|de|pour|instant||beead_noAds|||hide|var|||bs_beead_view|open|faceboxClose|beead_show|bs_beead_cap||close|fadeOut|bs_beead_valid|beead_launched|valid|popupAlert|Oups|Il|semblerait|qu|il|ait|vid|regarder|Vous|pouvez|essayer|dans|quelques|instants|removeAttr|onclick|removeClass|hover|attr|title|Pas|publicit|disponibles|retentez|tard'.split('|'),0,{}))
