var page_actuel=1;var page=new Array;var pdiscuss_actuel=1;var pdiscuss=new Array;var $comp=jQuery.noConflict();var cache_disc="";var cache_page="";var pos_disc="txt";var i_d=1;var displayPane;var slideP=false;var slideP_pos=0;var silde_min=0;var splitWidth=0;var error_p=false;var bb_url;var browser=[];function demarp(){if((typeof checkForMathML!="undefined")&&typeof w_isiwig=="undefined"){translate()}i_d=$comp('body').attr("name");bb_url=LireCookie("b_url");SetCookie('b_url',i_d,false);if(pl_hypenate){Hyphenator.hyphenateDocument()}$comp("#RightPane").mouseup(function(e){if((e.which==1)&&(e.ctrlKey)){Y=e.pageY-$comp("#bandeau").height()+$comp(this).scrollTop()-$comp("#pointer").height();$comp("#pointer").animate({top:Y},"normal");$comp("#pointerb").animate({top:Y},"normal")}});jQuery.each(jQuery.browser,function(i,val){browser[i]=val});$comp(window).bind("keypress",function(evt){if((evt.keyCode==38&&evt.ctrlKey)||(evt.keyCode==40&&evt.ctrlKey)){var t=document.getElementById("pointer").offsetTop;if(evt.keyCode==40){$comp("#pointer, #pointerb").css({top:t+7})}else{$comp("#pointer, #pointerb").css({top:t-7})}}});$comp(window).bind("keyup",function(evt){if((document.getElementById("opt_save_var")==undefined)&&((document.getElementById("bt_right"))||(document.getElementById("bt_left")))){if(evt.keyCode==37&&!evt.ctrlKey){var _goto=$comp(".bt_left").find('a').attr('href');if(_goto!=undefined)window.location.href=_goto}else if(evt.keyCode==39&&!evt.ctrlKey){var _goto=$comp(".bt_right").find('a').attr('href');if(_goto!=undefined)window.location.href=_goto}else if((evt.keyCode==39&&evt.ctrlKey)||(evt.keyCode==37&&evt.ctrlKey)){menu_s()}else if((evt.keyCode==38&&evt.shiftKey)||(evt.keyCode==40&&evt.shiftKey)){if(document.getElementById("discut")){if(pos_disc=="disc")bascule_dicut();else show_disc(pdiscuss_actuel);var sel=window.getSelection();sel.removeAllRanges()}}else if(evt.keyCode>=97&&evt.keyCode<=105){if(pos_disc=="disc")show_disc(evt.keyCode-96);else view_page(evt.keyCode-96)}else if(evt.keyCode>=49&&evt.keyCode<=57){if(pos_disc=="disc")show_disc(evt.keyCode-48);else view_page(evt.keyCode-48)}else if(evt.keyCode==48||evt.keyCode==96){window.location.href="index.php?id=4"}}});cutPage();if(typeof array_searc!="undefined"){comp_engi=0;for(var i=0;i<array_searc.length;i++){surlign(document.getElementById("milieucss"),array_searc[i],0,comp_engi);comp_engi++;if(comp_engi==5){comp_engi=0}}}var view="#menugcss,#bandeau,#menugtop,#titre,#partie_head,#chapter_head,#milieucss,#bt_opt";$comp(view).css('visibility','visible');splitWidth=$comp("#split").width();$comp("#split").mousedown(function(e){slideP=true;slideP_pos=e.pageX});$comp("body").mouseup(function(e){if(slideP){slideP=false;SetCookie('menugcss_width',$comp("#LeftPane").width(),false)}}).mousemove(function(e){if(slideP){var x=e.pageX;if(x<=slideP_pos){var s=slideP_pos-x;var LeftPaneWidth=$comp("#LeftPane").width()-s}else{var s=x-slideP_pos;var LeftPaneWidth=$comp("#LeftPane").width()+s}if(LeftPaneWidth>silde_min){_slideP(LeftPaneWidth);slideP_pos=x}}});var menugcss_width=LireCookie("menugcss_width");if(menugcss_width==null){menugcss_width=200}_slideP(menugcss_width*1);if(LireCookie('LeftPane')=='block')menu_s();document.getElementById("RightPane").focus();document.getElementById("RightPane").blur()}function _slideP(w){$comp("#LeftPane").width(w);$comp("#split").css("left",w);$comp("#RightPane").css("left",w+splitWidth)}function ajax_editor(txt,type,ref_id,title){$comp.post("goto.php",{charg:"editorc",editxt:txt,categ:type,ref_id:ref_id,contenu:title,id_wiki:i_d},function(data){if(test_error(data)){tmp_data=data;Reg=/script id=\'java1\' type=\'text\/javascript\'\>([^¶]*)endscript/m;var tab=data.match(Reg);window.eval(tab[1]);chargerCSS(ROOT_URL+a_j['css_poule'],"");chargerCSS(ROOT_URL+a_j['css_outils'],"");chargerCSS(ROOT_URL+a_j['css_file'],"");chargerJS(ROOT_URL+a_j['pile'],"");chargerJS(ROOT_URL+a_j['floatwin'],"");chargerJS(ROOT_URL+"js/editor/lang/lang_"+lang_cour+".js","");chargerJS(ROOT_URL+"js/editor/lang/lang_"+lang_cour+"-m.js","");chargerJS(ROOT_URL+a_j['edit_objet'],"");chargerJS(ROOT_URL+a_j['j_splitter'],"");chargerJS(ROOT_URL+a_j['j_treeview'],"");chargerJS(ROOT_URL+a_j['j_combo_poule'],"");chargerJS(ROOT_URL+a_j['j_accordion'],"");chargerJS(ROOT_URL+a_j['j_selectboxes'],"");chargerJS(ROOT_URL+a_j['latexmathml'],"");chargerJS(ROOT_URL+a_j['file'],"");chargerJS(ROOT_URL+a_j['file'],"");chargerJS(ROOT_URL+a_j['edit_poule'],"");chargerJS(ROOT_URL+a_j['edit_wiki'],"_ajax_editor()")}})}function pl_acces(categ,value,id){if(id=='')id=i_d;$comp.post("goto.php",{charg:"connex",categ:categ,ref_id:id,liste:value},function(data){if(test_error(data)){var txt=$comp.trim(data);var file=txt.substr(0,5);var data=txt.substr(5,txt.length);if(file=='makec'){eval(data)}else{$comp("#baspage").html(data);chargerJS(ROOT_URL+"js/outils/ajax_"+file+".js","onload_"+file+"('"+categ+"','"+value+"','"+id+"');")}}})}function pl_ajoudim(chapter,name){window.location.href="index.php?id="+chapter+"&name="+name+"&lang="+lang_cour}function chargerCSS(file){head=document.getElementsByTagName('head')[0];var css=document.createElement('link');css.setAttribute('rel','stylesheet');css.setAttribute('type','text/css');css.setAttribute('media','screen');css.setAttribute('href',file);head.appendChild(css)}function chargerJS(file,func){head=document.getElementsByTagName('head')[0];var script=document.createElement('script');var not_present=true;$comp('script').each(function(){if($comp(this).attr('src')==file){not_present=false}});if(not_present){script.setAttribute('type','text/javascript');script.setAttribute('src',file);if(typeof(func)!='undefined'){script.onload=function(){eval(func)}}head.appendChild(script)}else{if(typeof(func)!='undefined'){eval(func)}}}function opt(value,module){$comp.post("goto.php",{action:"demarage",charg:"optionsajorx",ref_id:value,module:module,lang:lang_cour},function(data){$comp('#bt_opt').remove();$comp('#milieucss').html(data)})}function opt_save(){chargerJS(ROOT_URL+"js/outils/options.js","save_options();")}function slide(value){var div=$comp('div[@id=ref'+value+']');if(div.css('display')=='none'){div.show("slow")}else{div.hide("slow")}}function surlign(el,find_txt,rep_index,nb_class){regex=new RegExp("("+echap(find_txt)+")",'g');for(var startIndex=0,endIndex=el.childNodes.length;startIndex<endIndex;startIndex++){var item=el.childNodes[startIndex];if(item){if(item.nodeType!=8){if(item.nodeType==3){var text=item.data;var newtext="",match,index=0;regex.lastIndex=0;while(match=regex.exec(text)){repl_text=text.substr(match.index,match[0].length);repl_text_tp=repl_text;if((rep_index&&rep_index==count_search)||(!rep_index)){newtext+=text.substr(index,match.index-index)+'<span class="recherc_xmlatex'+nb_class+'">'+repl_text+"</span>"}else{newtext+=text.substr(index,match.index-index)+repl_text_tp+""}index=match.index+match[0].length}if(newtext){newtext+=text.substring(index);var repl=$comp.merge([],$comp("<span>"+newtext+"</span>")[0].childNodes);endIndex+=repl.length-1;startIndex+=repl.length-1;$comp(item).before(repl).remove()}}else{if(item.nodeType==1){surlign(item,find_txt,rep_index,nb_class)}}}}}}function menu_s(x){var d=$comp("#LeftPane").css('display');if(d!="none"||x=='none'){displayPane=$comp("#LeftPane").width();$comp("#LeftPane, #split").css('display','none');$comp("#RightPane").css("left",0);$comp("#menus_").attr('src','../images/com/msl.png')}else{$comp("#LeftPane, #split").css('display','block');_slideP(displayPane);$comp("#menus_").attr('src','../images/com/msr.png')}if(x==undefined)SetCookie('LeftPane',d,false)}function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr))}function LireCookie(nom){var arg=nom+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break}return null}function SetCookie(name,value,time){var _expire='';if(time){var today=new Date(),expires=new Date();expires.setTime(today.getTime()+(365*24*60*60*1000));var _expire="expires="+expires.toGMTString()}document.cookie=name+"="+value+";"+_expire}function SaveMark(){var link=location.href.split('#');SetCookie('mark_w',window.innerWidth,true);SetCookie('mark_leftw',document.getElementById("menugcss").offsetWidth,true);SetCookie('mark_leftd',document.getElementById("LeftPane").style.display,true);SetCookie('mark_link',link[0],true);SetCookie('mark_top',document.getElementById("pointer").offsetTop,true);SetCookie('mark_scrolltop',document.documentElement.scrollTop,true);SetCookie('mark_page',page_actuel,true)}function GoMark(){var link=LireCookie("mark_link");if(link!=null){var _link=location.href.split('#');if(_link[0]==link){_GoMark()}else{window.location.href=link+'#gomark'}}}function _GoMark(){window.innerWidth=LireCookie("mark_w");_slideP(LireCookie("mark_leftw"));var mark_leftd=LireCookie("mark_leftd");view_page(LireCookie("mark_page"));document.documentElement.scrollTop=LireCookie("mark_scrolltop");var top=LireCookie("mark_top");$comp("#pointer").animate({top:top},"slow");$comp("#pointerb").animate({top:top},"slow");if(LireCookie("mark_leftd")!=$comp("#LeftPane").css('display'))menu_s()}function rest(me,f,d){var x="@";var y="mailto:";me.href=y+d+x+f}function convertMath(node){if(node.nodeType==1){var newnode=document.createElementNS("http://www.w3.org/1998/Math/MathML",node.nodeName.toLowerCase());for(var i=0;i<node.attributes.length;i++)try{newnode.setAttribute(node.attributes[i].nodeName,node.attributes[i].nodeValue)}catch(error){}for(var i=0;i<node.childNodes.length;i++){var st=node.childNodes[i].nodeValue;if(st==null||st.slice(0,1)!=" "&&st.slice(0,1)!="\n")newnode.appendChild(convertMath(node.childNodes[i]))}return newnode}else return node}function convertsvg(node){if(node.nodeType==1){var newnode=document.createElementNS("http://www.w3.org/2000/svg",node.nodeName.toLowerCase());for(var i=0;i<node.attributes.length;i++)newnode.setAttribute(node.attributes[i].nodeName,node.attributes[i].nodeValue);for(var i=0;i<node.childNodes.length;i++){var st=node.childNodes[i].nodeValue;if(st==null||st.slice(0,1)!=" "&&st.slice(0,1)!="\n")newnode.appendChild(convertsvg(node.childNodes[i]))}return newnode}else return node}function convert(){var mmlnode=document.getElementsByTagName("math");for(var i=0;i<mmlnode.length;i++){if(document.createElementNS!=null){mmlnode[i].parentNode.replaceChild(convertMath(mmlnode[i]),mmlnode[i])}}var svgnode=document.getElementsByTagName("svg");for(var i=0;i<svgnode.length;i++){if(document.createElementNS!=null){svgnode[i].parentNode.replaceChild(convertsvg(svgnode[i]),svgnode[i])}}$comp(".p_xmlatex_noident,.p_xmlatex,.right_xmlatex,.left_xmlatex").bind("mouseup",function(e){if((e.which==1)&&(!e.ctrlKey)){var para=$comp(this).find('.num_xmlatex');if(para.css('visibility')=='visible'){para.css('visibility','hidden')}else{para.css('visibility','visible')}}})}function cutPage(){if(document.getElementById("nbpage"))var nbpage=document.getElementById("nbpage").value;else nbpage=1;var infos=location.href.split('#');var lapage_ancre="";var left='';var lapage=1;if(infos[1]){if(infos[1].substr(0,4)=="para")left=' style="left:-15px"';if(infos[1]=="document"){lapage=page_actuel}else{lapage_ancre="page";lapage=$comp("#"+infos[1]).parents('.pagenumber').attr("name");if(lapage==undefined){lapage=$comp("#"+infos[1]).parents('.discusscom').attr("name");if(lapage==undefined){lapage=1}else{lapage_ancre='discuss'}}}}if(document.getElementById("nbpdiscuss")){var nbpdiscuss=$comp("#nbpdiscuss").val();if(document.getElementById("discuss1")){for(i=0;i<nbpdiscuss;i++){var p=$comp("#discuss"+(i+1));pdiscuss[i+1]=p.html();p.remove()}}cache_disc=$comp("#discussions").html();$comp("#discussions").remove()}for(i=0;i<nbpage;i++){var p=$comp("#page"+(i+1));page[i+1]=p.html();p.remove()}cache_page=$comp("#document").html();$comp("#document").html('');var anchor=getQueryVariable('ancre');var pointer='→&#160;';if(anchor==null){anchor=''}else{anchor='#'+anchor;if(bb_url!=null)pointer='↔&#160;'}if(lapage_ancre=="page"){view_page(lapage);window.location.href='#'+infos[1];$comp('#'+infos[1]).prepend('<a class="pointer_ancre"'+left+' href="index.php?id='+bb_url+'&lang='+lang_cour+anchor+'">'+pointer+'</a>');$comp('#'+infos[1]).css('visibility','visible')}else if(lapage_ancre=="discuss"){show_disc(lapage);window.location.href='#'+infos[1];$comp('#'+infos[1]).prepend('<a class="pointer_ancre"'+left+' href="index.php?id='+bb_url+'&lang='+lang_cour+anchor+'">'+pointer+'</a>');$comp('#'+infos[1]).css('visibility','visible')}else{pastPage(1,'page')}}function pastPage(n,type){if(n==undefined)n=1;if(type=="page"){$comp('#document').html(cache_page);$comp("#page").html(page[n])}else{$comp('#document').html(cache_disc);$comp("#discusstt").html('<div id="page">'+pdiscuss[n]+'</div>')}convert()}function getQueryVariable(variable){var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable){return pair[1]}}return null}function view_page(go_p){if(document.getElementById("nbpage")){var nbp=document.getElementById("nbpage").value;if(go_p<=nbp){if(nbp>1){pastPage(go_p,'page');compt_page(go_p);page_actuel=go_p}else{pastPage(1,'page')}window.location.href="#chapter_head"}}}function compt_page(x){$comp('#compt_page_haut > .bt_page_act, #compt_page_bas  > .bt_page_act').attr('class','bt_page');$comp('#bt_page_haut'+x+', #bt_page_bas'+x).attr('class','bt_page_act')}function show_disc(pg){if(document.getElementById("nbpdiscuss")){if(pdiscuss[pg]==undefined)pdiscuss[pg]="";var nbd=document.getElementById("nbpdiscuss").value;if(pg<=nbd){if(pdiscuss[pg]==undefined)pdiscuss[pg]="";pastPage(pg,'discus');if(pos_disc=="txt"){bascule_dicut(false)}compt_disc(pg);pdiscuss_actuel=pg}}else{if(pos_disc=="txt")bascule_dicut(true)}window.location.href="#chapter_head"}function compt_disc(x){$comp('#discussions > .bt_page_act').attr('class','bt_page');$comp('#bt_disc_haut'+x+', #bt_disc_bas'+x).attr('class','bt_page_act')}function bascule_dicut(put){if(pos_disc=="txt"){pos_disc="disc";if(pdiscuss[page_actuel]==undefined)pdiscuss[page_actuel]="";if(put)pastPage(pdiscuss_actuel,'discus');bar_disc=$comp('#discut').html();letexte=$comp('#discut').attr("name");if($comp('#compt_page_bas').html()==null)bas="<input class='bouton' value='"+letexte+"' type='submit' onclick='bascule_dicut(true);'/>";else bas=$comp('#compt_page_bas').html();$comp('#discut').html(bas);$comp('#discut_logo').attr("src","../images/com/txt.png");$comp('#discut_logo').parent().attr("onClick","bascule_dicut(true)")}else{pos_disc="txt";pastPage(page_actuel,'page');$comp('#discut').html(bar_disc);$comp('#discut_logo').attr("src","../images/com/bul.png");$comp('#discut_logo').parent().attr("onClick","show_disc(pdiscuss_actuel)");compt_page(page_actuel)}}function cachewait(){document.getElementById('pleaseWait').style.display='none';document.getElementById('pleaseWait_bt').style.display='none';if(document.getElementById('backmessage'))$comp("#backmessage").remove()}function showwait(txt,temp){if(temp){txt='<img style="vertical-align:middle;" border="0" src="'+ROOT_URL+'images/com/history.gif" />&#160;&#160;'+txt;document.getElementById('pleaseWait_bt').style.display='none'}$comp('#pleaseWait_txt').html(txt);$comp('#pleaseWait').css({visibility:'hidden',display:'block'});if(error_p)$comp('#pleaseWait').css('width','600px');else $comp('#pleaseWait').css('width','300px');LeftPosition=Math.round((window.innerWidth-document.getElementById('pleaseWait').offsetWidth)/2);TopPosition=Math.round((window.innerHeight-document.getElementById('pleaseWait').offsetHeight)/2);$comp("#pleaseWait").css({left:LeftPosition+'px',top:TopPosition+'px',visibility:'visible'})}function test_error(txt){document.getElementById('pleaseWait_bt').style.display='none';error_p=false;txt=$comp.trim(txt);var _in=txt.substr(0,3);switch(_in){case'###':case'<br':if(document.getElementById('pleaseWait').style.display=='block'){cachewait()}error_p=true;$comp("#baspage").after("<div id='backmessage'></div>");$comp("#pleaseWait_bt").css({display:'block'});if(_in=='<br')showwait(txt.substr(6,txt.length),false);else showwait(txt.substr(3,txt.length),false);return false;break;case'§§§':window.location.href=txt.substr(3,txt.length);break;case'£££':window.location.reload();break;case'???':x=window.confirm(txt.substr(3,txt.length));if(x=="1")return 2;else return 3;break;default:return true;break}return false}function showresult_txt(txt){document.getElementById("pleaseWait_txt").innerHTML=txt;setTimeout("cachewait();",1500)}function echap(q){regex=[[/[\/]/ig,'\\/'],[/[\[]/ig,'\\['],[/[\]]/ig,'\\]'],[/[\(]/ig,'\\('],[/[\)]/ig,'\\)']];for(var i=0,l=regex.length;i<l;i++)q=q.replace(regex[i][0],regex[i][1]);return q};
