
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}
func();}}}
function mouseArticle(){if(document.getElementById){var art=document.getElementById('art');if(art){var imgs=art.getElementsByTagName('div');for(var i=0;i<imgs.length;i++){imgs[i].onmouseover=function(){this.style.background='#FFFFCC';var im=this.getElementsByTagName('img');im[0].className='img_muzz';}
imgs[i].onmouseout=function(){this.style.background='#EEEEEE url(/fond_degrad.jpg) repeat scroll left bottom';var im=this.getElementsByTagName('img');im[0].className='img_muzz2';}}}}else{alert('marche pas');}}
addLoadEvent(mouseArticle);function onglet(num){var xhr=getXhr();xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){leselect=xhr.responseText;document.getElementById('contenu_onglet').innerHTML=leselect;}}
xhr.open("GET","/page_onglet.php?page_onglet="+num,true);xhr.send(null);}
function switch_onglet(nom_onglet){var tab_onglet=new Array('onglet_media_photo','onglet_media_audio','onglet_media_video','onglet_media_radio');for(i=0;i<4;i++){if(tab_onglet[i]==nom_onglet){document.getElementById(tab_onglet[i]+'_img').src=tab_onglet[i]+'_a.jpg';onglet(nom_onglet);}else{document.getElementById(tab_onglet[i]+'_img').src=tab_onglet[i]+'.jpg';}}}
function load_onglet(cat){document.getElementById('contenu_onglet').innerHTML=loading_img;var tab_onglet=new Array('muzzariens','blog','audio','photo');for(i=0;i<4;i++){if(cat==tab_onglet[i]){document.getElementById(tab_onglet[i]).className='current';document.getElementById(tab_onglet[i]).blur();}else{document.getElementById(tab_onglet[i]).className='';}}
var xhr=getXhr();xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){var ret=xhr.responseText;document.getElementById('contenu_onglet').innerHTML=ret;}}
var categorie="cat="+cat;xhr.open("POST","/load_onglet.php",true);xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr.setRequestHeader("Connection","close");xhr.send(categorie);}
function detail_article(id_article){document.getElementById('detail_article').innerHTML=loading_img;var xhr=getXhr();xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){leselect=xhr.responseText;document.getElementById('detail_article').innerHTML=leselect;}}
xhr.open("GET","/affiche_detail_article.php?id_article="+id_article,true);xhr.send(null);}

function GetId(id){return document.getElementById(id);}
var k=false;
function move(e){if(k){if(navigator.appName!="Microsoft Internet Explorer"){GetId("curseur").style.left=e.pageX+5+"px";GetId("curseur").style.top=e.pageY+10+"px";}
else{if(document.documentElement.clientWidth>0){GetId("curseur").style.left=20+event.x+document.documentElement.scrollLeft+"px";GetId("curseur").style.top=10+event.y+document.documentElement.scrollTop+"px";}else{GetId("curseur").style.left=20+event.x+document.body.scrollLeft+"px";GetId("curseur").style.top=10+event.y+document.body.scrollTop+"px";}}}}
//function montre(text){if(i==false){GetId("curseur").style.visibility="visible";GetId("curseur").innerHTML=text;i=true;}}
//function cache(){if(i==true){GetId("curseur").style.visibility="hidden";i=false;}}
document.onmousemove=move;
function infobul() {
if (document.getElementById) {
    var ph = document.getElementById('ph');
    if (ph) {
      var imgs = ph.getElementsByTagName('img');
     // alert(imgs.length);
      for (var j=0;j<imgs.length;j++) {

        imgs[j].onmouseover = function() {
            //      alert("toto"+this.id);
    //      var id_img = this.getElementById()
          
          montre2(this.id);
          
 //         this.style.background='#FFFFCC';     
 //         var im = this.getElementsByTagName('img');
 //         im[0].className='img_muzz';
        
         }
         imgs[j].onmouseout = function () {
      //   alert("cash "+k);
//         if(k==true) {
GetId("curseur").style.visibility="hidden"; // Si la bulle etais visible on la cache
k=false;
//}
         
//          this.style.background='#EEEEEE url(/fond_degrad.jpg) repeat scroll left bottom';
//          var im = this.getElementsByTagName('img');
//          im[0].className='img_muzz2';
          
        }
       }
     }
   } else {
  // alert('marche pas');
   }

}
addLoadEvent(infobul);

  var k=false;
function cache() {
GetId("curseur").style.visibility="hidden";
}
function montre2(id) {

  var xhr = getXhr();
  // On d?fini ce qu'on va faire quand on aura la r?ponse
  xhr.onreadystatechange = function() {
  // On ne fait quelque chose que si on a tout re?u et que le serveur est ok
    if(xhr.readyState == 4 && xhr.status == 200) {
      leselect = xhr.responseText;
//   alert(leselect);
 // alert("post1"+k);  
  if(k==false) {
  GetId("curseur").style.visibility="visible"; // Si il est cacher (la verif n'est qu'une securitÃ©) on le rend visible.
  GetId("curseur").innerHTML = leselect; // Cette fonction est a amÃ©liorer, il parait qu'elle n'est pas valide (mais elle marche)
  k=true;
       }
       setTimeout("cache()",10000);
   //   alert("post2"+k);   
  //    document.getElementById('contenu_agenda'+id_agenda).innerHTML = leselect;
      
    }
  }
  xhr.open("GET","/contenu_infobulle.php?id="+id,true);
  xhr.send(null);

}
