function Tab(o,m){var h=-1;var f=o;var i=document.getElementById(f+"_content");var q=0;var g=this;var n=new Array();var a=0;var t=document.createElement("div");var u=document.createElement("div");var l="";if(!document.getElementById(f).getElementsByTagName("ul").length){l=document.createElement("ul");l.id=f+"_ul"}else{l=document.getElementById(f+"_ul")}t.id=f+"_crop";u.id=f+"_slide";this.tabWidth=146;this.sideOffset=20;this.maxVisibleTags=5;this.onchangetab=function(){};this.allTabsDeleted=function(){};if(!ie4){t.setAttribute("class","tab_ul_crop");u.setAttribute("class","tab_ul_slide")}else{t.setAttribute("className","tab_ul_crop");u.setAttribute("className","tab_ul_slide")}t.appendChild(u);u.appendChild(l);document.getElementById(o+"_tabs").appendChild(t);if(m){var d=document.createElement("div");var r=document.createElement("div");if(!ie4){d.setAttribute("class","dashboard_move_tab_sx");r.setAttribute("class","dashboard_move_tab_dx")}else{d.setAttribute("className","dashboard_move_tab_sx");r.setAttribute("className","dashboard_move_tab_dx")}d.setAttribute("title","Visualiser l'onglet pr\351c\351dent");r.setAttribute("title","Visualiser l'onglet suivant");document.getElementById(f+"_tabs").style.backgroundPosition=this.sideOffset+"px 0px";d.onclick=b;r.onclick=e;t.parentNode.insertBefore(d,t);document.getElementById(o+"_tabs").appendChild(r)}var k=l.getElementsByTagName("li");this.getNumTabs=function(){return n.length};this.getAvailableId=function(){return h};this.getSelectedTabId=function(){for(var w=0;w<k.length;w++){if(k[w].className=="selected"){var y=new RegExp("[0-9]+$");var v=y.exec(n[w]);var x="";for(w=0;w<v.length;w++){x=x-v[w]}return x}}return""};this.getTabsId=function(){var w=new Array();for(var x=0;x<k.length;x++){var z=new RegExp("[0-9]+$");var v=z.exec(n[x]);var y="";for(j=0;j<v.length;j++){y=y+v[j]}w[x]=y}return w};function p(v){for(var w=0;w<k.length;w++){k[w].className="";if(n[w]){document.getElementById(n[w]).style.display="none"}}v.parentNode.parentNode.className="selected";document.getElementById(v.getAttribute("rel")).style.display="block";q=v.parentNode.id}function s(v){n[n.length]=v}function c(v){var w=l.removeChild(document.getElementById(v));l.appendChild(w)}this.Init=function(){var w=0;if(arguments.length==1){w=parseInt(arguments[0])}n.length=0;for(var x=0;x<k.length;x++){var v=k[x].getElementsByTagName("a")[0];if(v.getAttribute("rel")){s(v.getAttribute("rel"));v.onclick=function(){p(this);g.onchangetab();return false}}}if(k.length>0){p(k[k.length-1].getElementsByTagName("a")[0]);a=((k.length-this.maxVisibleTags)>0)?(k.length-this.maxVisibleTags):0;this.shift(a,Tab.LEFT)}};this.addTab=function(C,B,E,D){var x=document.createElement("div");var y=document.createElement("li");var A=document.createElement("a");var w=document.createElement("div");var v=document.createElement("div");var z=h++;A.href="#";A.title=C;A.rel=f+"_content_"+z;y.id=f+"_tab_"+z;if(ie4){y.onClick=E}else{y.onclick=E}if(D){if(!ie4){w.setAttribute("class","close_tab");A.setAttribute("style","vertical-align:middle; cursor:pointer; float:left;")}else{w.setAttribute("className","close_tab");A.setAttribute("cssText","vertical-align:middle; cursor:pointer; float:left;")}w.setAttribute("title","Fermer l'onglet "+C);w.onclick=D;A.innerHTML=((C.length>15)?(C.substr(0,12)+"..."):C)+"&nbsp;&nbsp;";v.appendChild(A);v.appendChild(w)}else{A.innerHTML=((C.length>21)?(C.substr(0,19)+"..."):C)+"&nbsp;&nbsp;";v.appendChild(A)}y.appendChild(v);l.appendChild(y);x.id=A.rel;x.setAttribute("class","tabcontent");x.innerHTML=B;i.appendChild(x);this.Init()};this.includeTab=function(C,B,E,D){var x=document.createElement("div");var y=document.createElement("li");var A=document.createElement("a");var w=document.createElement("div");var v=document.createElement("div");var z=h++;A.href="#";A.title=C;A.rel=B;y.id=f+"_tab_"+z;if(ie4){y.onClick=E}else{y.onclick=E}if(D){if(!ie4){w.setAttribute("class","close_tab");A.setAttribute("style","vertical-align:middle; cursor:pointer; float:left;")}else{w.setAttribute("className","close_tab");A.setAttribute("cssText","vertical-align:middle; cursor:pointer; float:left;")}w.setAttribute("title","Chiudi "+C);w.onclick=D;A.innerHTML=((C.length>15)?(C.substr(0,12)+"..."):C)+"&nbsp;&nbsp;";v.appendChild(A);v.appendChild(w)}else{A.innerHTML=((C.length>21)?(C.substr(0,19)+"..."):C)+"&nbsp;&nbsp;";v.appendChild(A)}y.appendChild(v);l.appendChild(y);this.Init()};this.removeTab=function(v){if(v=="all"){while(l.childNodes.length>=1){l.removeChild(l.firstChild)}while(i.childNodes.length>=1){i.removeChild(i.firstChild)}}else{l.removeChild(document.getElementById(f+"_tab_"+v));i.removeChild(document.getElementById(f+"_content_"+v));n[v]=null;k=l.getElementsByTagName("li")}this.Init()};this.shift=function(v,w){if(w==Tab.LEFT){u.style.marginLeft="-"+(v*this.tabWidth)+"px"}else{if(w==Tab.RIGHT){u.style.marginLeft=(v*this.tabWidth)+"px"}}};function b(){g.shift(((k.length>5)?++a:0),Tab.LEFT)}function e(){g.shift(((k.length>5)?--a:0),Tab.LEFT)}this.getTabContents=function(){return n};this.getTabTitles=function(){var z=new Array();var y=t.getElementsByTagName("div");var v=y.length;for(var x=0;x<v;x++){var w=y[x];add=false;if(!ie4){if(w.getAttribute("class")=="close_tab"){add=true}}else{if(w.getAttribute("className")=="close_tab"){add=true}}if(add){z.push(w.getAttribute("title").replace("Fermer l'onglet ",""))}}return z}}Tab.LEFT=-1;Tab.RIGHT=1;
