/*///////////////////////////////////////////////////////////////////////////////////////////////////////
///// Code mixing by Molokoloco ..... 2010 ......... [EVER IN PROGRESS (it's not done yet)]  ///////////
////  SOURCES here : https://github.com/molokoloco/FastWebStart/                            ///////////
////  My WIKI here : http://code.google.com/p/molokoloco-coding-project/wiki/WikiMenu      /////////// 
////////////////////////////////////////////////////////////////////////////////////////////////// */
$(function(){$.extend(jQuery.easing,{easeInOutCirc:function(a,c,d,e,f){if((c/=f/2)<1)return-e/2*(Math.sqrt(1-c*c)-1)+d;return e/2*(Math.sqrt(1-(c-=2)*c)+1)+d},easeInQuad:function(a,c,d,e,f){return e*(c/=f)*c+d}});$.fn.extend({selectRange:function(a,c){var d=document.getElementById($(this).attr("id"));if(d)if(d.setSelectionRange)d.focus(),d.setSelectionRange(a,c);else if(d.createTextRange)d=d.createTextRange(),d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",a),d.select();else if(d.selectionStart)d.selectionStart= a,d.selectionEnd=c},center:function(){return this.each(function(){var a=($(window).height()-$(this).outerHeight())/2,c=($(window).width()-$(this).outerWidth())/2;$(this).css({position:"absolute",margin:0,top:(a>20?a:20)+"px",left:(c>0?c:0)+"px"})})},styleSwitch:function(a){var c=!1,d=[];$("link[@rel*=style][id]").each(function(){a==$(this).attr("href")?($(this).removeAttr("disabled"),c=!0):d.push(this)});c===!1&&$("head").append('<link rel="stylesheet" type="text/css" href="'+a+'" id="theme'+Math.random()+ '"/>');setTimeout(function(){$(d).each(function(){$(this).attr("disabled","disabled")})},900);$.cookie&&$.cookie("css",a,cookieOptions)},styleInit:function(){if($.cookie&&$.cookie("css")){var a=!1;$("link[rel*=style][id]").each(function(){$.cookie("css")==$(this).attr("href")&&(a=!0)});a===!1&&$.fn.styleSwitch($.cookie("css"))}return $(this).click(function(a){a.preventDefault();$.fn.styleSwitch($(this).attr("rel"));$(this).blur()})}})}); var db=function(){"console"in window&&console.log.call(console,arguments)},trim=function(a){return a.replace(/^\s+|\s+$/g,"")},escapeURI=function(a){return encodeURIComponent(a)||encodeURI(a)||escape(a)||a},event2key={97:"a",98:"b",99:"c",100:"d",101:"e",102:"f",103:"g",104:"h",105:"i",106:"j",107:"k",108:"l",109:"m",110:"n",111:"o",112:"p",113:"q",114:"r",115:"s",116:"t",117:"u",118:"v",119:"w",120:"x",121:"y",122:"z"},pad=function(a){return a<10?"0"+a:a},addslashes=function(a){return(a+"").replace(/\'/g, "\\'").replace(/"/g,"&quot;").replace(/\u0000/g,"\\0")},html2input=function(a){return unescape(a+"").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},input2html=function(a){return(a+"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')},_vars={},getUrlVars=function(){if(_vars.length>0)return _vars;window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(a,c,d){_vars[c]=d});return _vars},objSortByTitle=function(a,c){var d=a.title.toLowerCase(),e=c.title.toLowerCase(); return d<e?-1:d>e?1:0},loadJs=function(a){var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("src",a);document.getElementsByTagName("head")[0].appendChild(c)},loadCss=function(a){$("head").append('<link rel="stylesheet" type="text/css" href="'+a+'"/>')},getScript=function(a,c){$.ajax({dataType:"script",async:!1,cache:!0,url:a,success:function(){c&&typeof c=="function"&&c()}})},$H={}; $H.WWW=/localhost\//.test(document.location)?"http://localhost/www.b2bweb.fr/home/":"http://home.b2bweb.fr/"; $(function(){var a=null,c=null,d=null,e=null,f=$.cookie("isAnonymous")=="yes"?!0:!1;maxSearchLength=250;cookieOptions={expires:360,path:"/"};var i=800,m=600,v=800,w=600,h=!0,n=!0,x=null,o=0,p=0,g=0,q=0,y=0,r=!0,k=!1,s=!1,t="page",z=!1,A=!1,P=3,u=function(){if($.cookie("searchHistory")!="no"){var b=null,a="",c="";(b=$.cookie("search"))&&$.each(b.split("##"),function(b,d){d!=""&&(c=html2input(d),a+='<span id="term_'+b+'"><a href="javascript:void(0)" onclick="$(\'input#q\').val(\''+addslashes(c)+'\').select();" class="lien2" title="Ajouter">'+ c+'</a><a href="javascript:void(0)" onclick="$H.cookieDeleteTerm(\''+d+"', '"+b+'\');" title="Effacer">&#10006;</a>, </span>')});a!=""&&$("div#searhTerms").html(a.substr(0,a.length-9))}},B=function(b){if($.cookie("searchHistory")!="no")if(b){$.cookie("emptySearch","no",cookieOptions);var a=null,c=!1,d=[],e=b.length,b=escape(b);(a=$.cookie("search"))&&$.each(a.split("##"),function(a,l){l==b?c=!0:e+=unescape(l).length;l!=""&&e<maxSearchLength&&d.push(l)});c||(d.push(b),$.cookie("search",d.join("##"), cookieOptions),u())}else $.cookie("emptySearch","yes",cookieOptions)};$H.cookieDeleteTerm=function(b,a){var c=null,d=[];if(c=$.cookie("search"))$.each(c.split("##"),function(a,c){c!=""&&c!=b&&d.push(c)}),$.cookie("search",d.join("##"),cookieOptions);$("span#term_"+a).remove()};var C=function(){return document.location.hash.replace(/^#/,"")||$.cookie("hash")||"home"},Q=function(b){window.location.replace($H.WWW+"#"+b);$.cookie("hash",b,cookieOptions)},D=function(b){$.browser.msie?$("span#editmode").html(" D&eacute;sol&eacute;, <strong>Internet Explorer</strong> n'est pas support&eacute; :-( ! | "): b?$("span#editmode").html('<a href="javascript:void(0);" onclick="$H.editSites();" title="Editer les liens de cette page (Connexion avec Facebook, pour sauvegarder)">Editer</a> | '):$("span#editmode").html('<a href="javascript:void(0);" onclick="$E.quitEditMode();" title="Effacer les modifications sans enregistrer">Quitter mode &eacute;dition</a> | ')};$H.toggleCookiesTerms=function(){(r=$.cookie("searchHistory")=="no"?!0:!1)?(u(),$("div#searhTerms").show()):($.cookie("search","",cookieOptions),$("div#searhTerms").hide()); $.cookie("searchHistory",r?"yes":"no",cookieOptions);$("a#toggleCookiesTerms").html(r?"Effacer":"Sauver")};$H.toggleFoxy=function(){(h=!h)?(d.show(),$(document).trigger("mousemove")):d.hide();$.cookie("foxy",h?"yes":"no",cookieOptions);$("a#toggleCookiesTerms").html(h?"Masquer":"Afficher")};var E=function(){var b=C();$("div#menu a").removeClass("bold");$("div#menu a#"+b).addClass("bold")},R=function(b){$("<div />").attr({id:"overlay"}).css({top:0,left:0,width:v+"px",height:w+"px"}).appendTo("body").delay(b|| 5E3).fadeOut(400,function(){$(this).remove()})},S=function(){var b=new Date;$("span#heure").html(pad(b.getHours())+":"+pad(b.getMinutes())+":"+pad(b.getSeconds()))},F=function(){a.toggleClass("classQfocus",!0);t="input"},G=function(){a.focus()},H=function(){a.toggleClass("classQfocus",!1);t="page"},I=function(){if(a.val()){if(!z){var b=a.val().length;a.selectRange(b,b)}}else a.blur()},J=function(){},K=function(){var b=a.val(),c=$(this).attr("rel");B(b);if(b!=""&&c!=""&&c.indexOf("{R}")!=-1)return!window.open($(this).attr("rel").replace(/{R}/g, escapeURI(b)));return!0},L=function(){A||(A=!0,a.autocomplete({suggestUrl:$H.WWW+"_google_suggest.php",seedsUrl:$H.WWW+"_veryrelated.php",minChars:1,delimiter:/(,|\+|-|AND)\s*/,autoSubmit:!1,maxHeight:600,deferRequestBy:0}));!k&&a.val()!=""?(k=!0,c.each(function(){$(this).attr("rel")==""&&$(this).fadeTo("slow",0.2)})):k&&a.val()==""&&(k=!1,c.each(function(){$(this).attr("rel")==""&&$(this).fadeTo("slow",1)}));z=!1},M=function(b){var d=b.which||b.keyCode;d==27&&($("div#info,div#prefs").hide(),$("div#divEdit").is(":visible")&& $("div#divEdit").dialog("close"));t=="input"&&a.val().length>=1?c.each(function(){$(this).attr("class","l")}):event2key[d]&&c.each(function(){event2key[d]!=""&&$(this).text().charAt(0).toLowerCase()==event2key[d]?$(this).attr("class","l hightlight"):$(this).attr("class","l")})},T=function(b){!$(b.target).is("a#preferences")&&!$(this).parents().is("div#prefs")&&$("div#prefs").hide();!$(b.target).is("a#aide")&&!$(this).parents().is("div#info")&&$("div#info").hide()},U=function(b){if(n)n=!1,a.focus(), h=="1"?d.animate({top:0,left:b.pageX-120,opacity:1},1E3,function(){x=setInterval(function(){o+=0.06;q=0.4+Math.abs(Math.cos(o)*0.6);y=-p+Math.abs(Math.cos(o)*p);d.css({top:y+"px",opacity:q});$("div#footerBg").css({opacity:q});g>=222?(clearInterval(x),d.stop(!0,!0).animate({top:"-"+d.height()+"px",opacity:0},function(){n=!0;g=0}),$("div#footerBg").css({opacity:0.8})):g%parseInt(Math.random()*20)==0&&(p=Math.abs(Math.cos(g/100))*10);g++},50)}):(d.hide(),d.css({top:0}));else if(h&&!d.is(":animated")){var b= (b.pageX||360)-120,c=i/2-120;b<c?(b+=c,b>i-250&&(b=i-240)):(b-=c,b<0&&(b=0));d.animate({left:b},{duration:1400,easing:"easeInQuad"});g=0}},O=function(){c.unbind("click",K).unbind("mouseenter",I).unbind("mouseleave",J);a.unbind("keyup",L).unbind("mouseenter",G).unbind("focus",F).unbind("blur",H);$("select#searcher").unbind("change",N);$(document).unbind("keypress",M);$().keynavReset()},V=function(b){B(a.val());if($("form#f").attr("action")!="http://www.google.fr/search"&&/(home\.b2bweb\.fr)/.test("http://www.google.fr/search"))b.preventDeafult(), window.document.location.href="http://fr.wiktionary.org/wiki/".escapeURI(a.val())};$H.setFormAction=function(b){typeof b!=="boolean"&&(b=f);b=!b;$("form#f").attr("action",b?"http://google.b2bweb.fr/search":"http://www.google.fr/search");$("a#anonyme").text(b?"Recherche anonyme":"Recherche normale");$.cookie("isAnonymous",b?"yes":"no",cookieOptions);f=b;return!1};var N=function(){$H.setFormAction(!f);var b=$("select#searcher option:selected").val();b!=""&&(b.indexOf("|")>=0&&(b=b.split("|"),$("form#f").attr("action", b[0]),b=b[1]),!s&&a.val()!=""&&(b=="{mot}"||b=="{tag}")?(a.selectRange(0,a.val().length+1),s=!1):(a.val(b),a.selectRange(b.indexOf("{"),b.indexOf("}")+1),s=!0))};$H.setUlColSize=function(b){var a=e.width(),c=SITES.length,d=Math.floor(c/2),f=Math.floor(a/d),a=Math.floor(a/(c-d));$("ul#L1 ul.sortUlLink,ul#L1 ul.sortUlLink li").css({width:f+"px"});$("ul#L2 ul.sortUlLink,ul#L2 ul.sortUlLink li").css({width:a+"px"});var j=$("ul#L1").height();$("ul#L1 li ul.sortUlLink").each(function(){if(b){var a=j-$(this).height(); $(this).find("li:first").css({margin:a+"px 0 0 0"})}else $(this).find("li:first").css({margin:"0"})})};$H.centerElements=function(){m=$(window).height();i=$(window).width();var b=e.height(),a=e.width();$("body").css({overflow:m<b||i<a?"auto":"hidden"});$("div#SearchBot,div#prefs,div#info").center()};$H.editSites=function(b){b&&b.preventDefault();D(!1);O();typeof $E=="undefined"?(loadCss($H.WWW+"css/start/jquery-ui-1.8.custom.css"),getScript($H.WWW+"js/jquery-ui-1.8.sortableDialog.min.js"),getScript($H.WWW+ "js/jquery.edit.min.js",function(){$E.startEditMode()})):$E.startEditMode();return!1};$H.setDatas=function(b){O();var a="js/sitesDatas.js.php";switch(b){case "code":a="js/sitesDatas-code.js";break;case "twitter":a="js/sitesDatas-twitter.js";break;default:b="home"}getScript($H.WWW+a,function(){$H.buildSites();$H.initSites()});Q(b);E();return!1};$H.buildSites=function(){var a=SITES.length,d=Math.floor(a/2),e="",f="",h="",j;for(j in SITES){var e='<li class="sortLinkCat"><h3>'+SITES[j].title+"</h3></li>", h="",i;for(i in SITES[j].data){var g=SITES[j].data[i];g.href&&g.title&&(h+='<li class="sortLink"><a href="'+g.href+'" rel="'+(g.result||"")+'" title="'+(g.tips||"")+'" class="l" tabindex="'+P++ +'">'+g.title+"</a></li>")}f+=parseInt(j)+1<=d?'<li><ul class="sortUlLink">'+h+e+"</ul></li>":'<li><ul class="sortUlLink">'+e+h+"</ul></li>";parseInt(j)+1==d?($("#D1").html('<ul id="L1" class="sortUlCat">'+f+"</ul>"),f=""):parseInt(j)+1==a&&$("#D2").html('<ul id="L2" class="sortUlCat">'+f+"</ul>")}c=$("a.l")}; $H.initSites=function(){D(!0);$H.setUlColSize(!0);$H.centerElements();c.eq(Math.round(Math.random()*c.length)).addClass("hightlight2");c.bind("click",K).bind("mouseenter",I).bind("mouseleave",J);a.bind("keyup",L).bind("mouseenter",G).bind("focus",F).bind("blur",H);$("select#searcher").bind("change",N);$(document).bind("keypress",M);$("div#SearchBot a.l").keynav()};$(document).ready(function(){i=$(window).width();m=$(window).height();v=$(document).width();w=$(document).height();R(500);a=$("input#q"); c=$("a.l");d=$("div#foxy");e=$("div#SearchBot");$("a.css").styleInit();u(!0);E();$("select#searcher")[0].selectedIndex=0;a.attr({autocomplete:"off"});$("form#f").bind("submit",V);$H.setFormAction(!f);e.fadeIn(300);var b=C();switch(b){case "code":$H.setDatas("code");break;case "twitter":$H.setDatas("twitter");break;default:$H.buildSites(),b=="editmode"?$H.editSites():$H.initSites()}h=$.cookie("foxy")=="no"?!1:!0;$(document).bind("mousemove",U).bind("click",T);$(window).bind("resize",$H.centerElements); setInterval(S,1E3)})});
