function html_size_width(){if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth-20;
 }
}return winW;}function html_size_height(){if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winH = window.innerHeight-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winH = document.documentElement.offsetHeight-20;
 }
}return winH;}	
/* Biblioth&egrave;que DHTML */

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if(document.layers && !OP) {
   DHTML = 1;
   NS = 1;
 }
}

function getElem(p1,p2,p3) {
 var Elem;
 if(DOM) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.getElementsByTagName(p2) == "object" ||
        (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
   if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
}

function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
     if(getElem(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElem(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElem(p1,p2,p3)) {
     Cont = getElem(p1,p2,p3).innerText;
     return(Cont);
   }
   else return void(0);
}

function getAttr(p1,p2,p3,p4) {
   var Attr;
   if((DOM || MS) && getElem(p1,p2,p3)) {
     Attr = getElem(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElem(p1,p2)) {
       if (typeof getElem(p1,p2)[p3] == "object")
        Attr=getElem(p1,p2)[p3][p4]
       else
        Attr=getElem(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

function setCont(p1,p2,p3,p4) {
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
     getElem(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElem(p1,p2,p3))
     getElem(p1,p2,p3).innerText = p4;
   else if(NS && getElem(p1,p2,p3)) {
     getElem(p1,p2,p3).document.open();
     getElem(p1,p2,p3).document.write(p4);
     getElem(p1,p2,p3).document.close();
   }
}

DHTML_init();
	var selected_chess = -1;
function chess_menu(){
  var div = document.getElementById("tp_chessboard_menu");
  div.replaceChild(chess_construct(), div.firstChild);
}

function chess_construct(){
  var table = document.createElement("table");
  table.style.borderWidth = "0px";
    table.style.margin = "0";
    table.style.margin = "0";
    table.cellPadding= "0";
    table.cellSpacing= "0";
  var tbody = document.createElement("tbody");
  var tr = document.createElement("tr");
  var pair = 0;
  var nb_nodes = document.getElementById("tp_chessboard_menu_ul").childNodes.length;
  for (var i=0;i<nb_nodes; i++){
    if (i<8){
      if (i==4) 
         pair = 1;
      var n = document.getElementById("tp_chessboard_menu_ul").childNodes[i];
      var link = document.createElement("a");

      link.href = n.firstChild.href;
      link.target = n.firstChild.target;
      link.innerHTML = n.firstChild.innerHTML;
      link.style.fontSize = "11px";
        if (selected_chess==i) link.style.color= "#962f34";

      var td = document.createElement("td");
      td.style.height = "57px";
      td.style.overflow = "hidden";
      td.style.textAlign = "center";
      if (pair == 0){
        td.style.background = "#c0c0c0";
        pair = 1;
      }
      else{
        td.style.background = "#CFCFCF";
        pair = 0;
      }

      var div = document.createElement("div");
      div.id = "tp_chessboard_menu_"+i;
      div.style.width = "100px";
      div.style.overflow = "hidden";
      div.appendChild(link);
      td.appendChild(div);
      if (i==4){
         tbody.appendChild(tr);
         var tr = document.createElement("tr");
      }
      tr.appendChild(td);
    }
  }
  tbody.appendChild(tr);
  table.appendChild(tbody);
  return table;
}

function display_contact(type){ var peremption = 1000*60*60*24*365;if (type=='open') {document.getElementById('contact_info').style.display = 'block';fixer_valeur('contactdip', '1', peremption);}if (type=='close') {document.getElementById('contact_info').style.display = 'none';fixer_valeur('contactdip', '0', peremption);}}

function fixer_valeur(indicateur, valeur, expire) {
 var maintenant = new Date();
 var temps = new Date(maintenant.getTime() + expire);
 document.cookie = indicateur+"="+valeur+"; expires="+temps.toGMTString()+";";
}

function cherche_valeur(indicateur) {
 var valeur = 1;
 if(document.cookie) {
  var valeur_depart = document.cookie.indexOf(indicateur+"=");
  if (valeur_depart != -1){
    valeur_depart +=  indicateur.length + 1;
    var sub = document.cookie.substring(valeur_depart);
    var valeur_fin = sub.indexOf(";");
    if (valeur_fin == -1)
     valeur_fin = sub.length;
    valeur = sub.substring(0,valeur_fin);

  }
 }
 return valeur;
}

function init_contactdisp(){
  if (cherche_valeur('contactdip') == 0) document.getElementById('contact_info').style.display = 'none';
  else document.getElementById('contact_info').style.display = 'block';

}
var tab_pr = new Array();tab_pr[0]=0;tab_pr[1]=15;tab_pr[2]=30;tab_pr[3]=45;tab_pr[4]=60;tab_pr[5]=75;tab_pr[6]=90;tab_pr[7]=105;var pr_win_height = 30;var pr_item_scroll_height = 2;var pr_total_item_height = 120;var pr_scroll_speed = 150;var pr_scroll_id = "";var pr_display_id = -1;
   function pr_init(){
     for(i=0;i<tab_pr.length;i++){
       document.getElementById("pr_allcontent_"+i).style.display = "none";
     }
    pr_scroll_id = window.setInterval("pr_scroll()",pr_scroll_speed);
   }
   function pr_scroll(){
     for(i=0;i<tab_pr.length;i++){
       pos = tab_pr[i]-pr_item_scroll_height;
       if (pos < -15)
         pos = pr_total_item_height;
       tab_pr[i] = pos;
       document.getElementById("pr_"+i).style.top = pos+"px";
     }
   }

   function pr_stop_scroll(i){
     if (i>-1){
       document.getElementById("pr_"+i).style.color = "#962f34";
     }
     window.clearInterval(pr_scroll_id);
   }

   function pr_restart_scroll(i){
     if (i>-1){
       document.getElementById("pr_"+i).style.color = "#00386e";
     }
     pr_scroll_id = window.setInterval("pr_scroll()",pr_scroll_speed);
   }

   function pr_display(p){
     pr_hidde(pr_display_id);
     pr_display_id = p;
     document.getElementById("pr_allcontent").style.display = "block";
     document.getElementById("pr_allcontent_"+pr_display_id).style.display = "block";
     document.getElementById("pr_info").style.display = "none";
   }

   function pr_hidde(p){
     if(p!=-1){
       document.getElementById("pr_allcontent").style.display = "none";
       document.getElementById("pr_allcontent_"+p).style.display = "none";
       document.getElementById("pr_info").style.display = "block";
     }
     pr_display_id = -1;
   }

   function pr_display_first(){
     document.getElementById("pr_allcontent").style.display = "block";
     document.getElementById("pr_allcontent_0").style.display = "block";
      pr_display_id = 0;
   }
 
