var ie = /MSIE/.test(navigator.userAgent);
var ie7 = (navigator.appVersion.indexOf("MSIE 7") > -1);
var ie8 = (navigator.appVersion.indexOf("MSIE 8") > -1);

// script permettant d'inserer un flash dans une page web et eviter le clic pour activer le flash
function insertFlash( strSrc, intWidth, intHeight, strAlt, flashvars )
{
    var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
    strFlash += 'width="' + intWidth + '" height="' + intHeight + '" title="' + strAlt + '">';
    strFlash += '<param name="movie" value="' + strSrc + '" />';
    strFlash += '<param name="wmode" value="transparent" />';
    strFlash += '<param name="quality" value="high" />';
    strFlash += '<embed flashVars="' + flashvars + '" + " src="' + strSrc + '" width="' + intWidth + '" height="' + intHeight + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>';
    strFlash += '</object>';
    document.write( strFlash );
    document.close( ); 
}

function insertFlashDynamic( strSrc, intWidth, intHeight, strAlt, flashvars,div )
{
    var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
    strFlash += 'width="' + intWidth + '" height="' + intHeight + '" title="' + strAlt + '">';
    strFlash += '<param name="movie" value="' + strSrc + '" />';
    strFlash += '<param name="wmode" value="transparent" />';
    strFlash += '<param name="quality" value="high" />';
    strFlash += '<embed flashVars="' + flashvars + '" + " src="' + strSrc + '" width="' + intWidth + '" height="' + intHeight + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>';
    strFlash += '</object>';
    document.getElementById(div).innerHTML =  strFlash;
}

/*function hover(obj){
 if(ie && !ie7 && !ie8){
    UL = obj.getElementsByTagName('ul');
    if(UL.length > 0){
      sousMenu = UL[0].style;
      if(sousMenu.display == 'none' || sousMenu.display == ''){
        sousMenu.display = 'block';
		obj.style.marginBottom = '-13px';
      }else{
        sousMenu.display = 'none';
		obj.style.marginBottom = '0px';
      }
    }
  }
}*/

function hover(obj){
  if(ie && !ie7 && !ie8){
    UL = obj.getElementsByTagName('ul');
    if(UL.length > 0){
      sousMenu = UL[0].style;
      sousMenu.display = 'block';
		  //obj.style.marginBottom = '-13px';
    }
  }
}

function out(obj){
  if(ie && !ie7 && !ie8){
    UL = obj.getElementsByTagName('ul');
    if(UL.length > 0){
      sousMenu = UL[0].style;
      sousMenu.display = 'none';
		  //obj.style.marginBottom = '0px';
    }
  }
}

function setHover(){
  if(ie && !ie7 && !ie8){
  LI = document.getElementById('menu').getElementsByTagName('li');
  for(i=0; i < LI.length; i++){
    LI[i].onmouseover = function(){hover(this);};
    LI[i].onmouseout = function(){out(this);};
    }
  }
}

window.onload = function()
{
setHover();
}

/*
function GetId(id)
{
    return document.getElementById(id);
}

var visbulle=false; // La variable i nous dit si la bulle est visible ou non
 
function move(e) {
  if(visbulle) {  // Si la bulle est visible, on calcul en temps reel sa position ideale
        if (navigator.appName!="Microsoft Internet Explorer") { // Si on est pas sous IE
            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) {
//alert('test = ' + text + visbulle);
  if(visbulle==false && text.length>0) {
      GetId("curseur").style.visibility="visible"; // Si il est cacher (la verif n'est qu'une securité) on le rend visible.
      GetId("curseur").innerHTML = text; // Cette fonction est a améliorer, il parait qu'elle n'est pas valide (mais elle marche)
      visbulle=true;
  }
}
function cache() {
    if(visbulle==true) {
        GetId("curseur").style.visibility="hidden"; // Si la bulle etais visible on la cache
        visbulle=false;
    }
}
document.onmousemove=move; // des que la souris bouge, on appelle la fonction move pour mettre a jour la position de la bulle.
*/

function GetId(id)
{
return document.getElementById(id);
}
var ii=false; // La variable i nous dit si la bulle est visible ou non
 
function move(e) {
  if(ii) {  // Si la bulle est visible, on calcul en temps reel sa position ideale
    if (navigator.appName!="Microsoft Internet Explorer") { // Si on est pas sous IE
    GetId("curseur").style.left=e.pageX + 10+"px";
    GetId("curseur").style.top=e.pageY + 5+"px";
    }
    else { // 
    if(document.documentElement.clientWidth>0) {
	GetId("curseur").style.left=10+event.x+"px";
	GetId("curseur").style.top=30+event.y+"px";
    } else {
	GetId("curseur").style.left=10+event.x+"px";
	GetId("curseur").style.top=30+event.y+"px";
	     }
    }
  }
}
 
function montre(text) {

  if(ii==false && text !="") {
  GetId("curseur").style.visibility="visible"; // Si il est cacher (la verif n'est qu'une securitÃ©) on le rend visible.
  GetId("curseur").innerHTML = text; // Cette fonction est a amÃ©liorer, il parait qu'elle n'est pas valide (mais elle marche)
  ii=true;
  }
}
function cache() {
if(ii==true) {
GetId("curseur").style.visibility="hidden"; // Si la bulle etais visible on la cache
ii=false;
}
}
document.onmousemove=move; // des que la souris bouge, on appelle la fonction move pour mettre a jour la position de la bulle.
    function reloadPhoto(url,copy)
    {
        var urlTemp=document.getElementById("grandePhoto").getAttribute("src");
        document.getElementById("grandePhoto").setAttribute("src",url);
        document.getElementById(url).setAttribute("src",urlTemp);
        document.getElementById(url).setAttribute("onClick","javascript:reloadPhoto('"+urlTemp+"','"+copy+"');");
        document.getElementById(url).onclick=function(){reloadPhoto(urlTemp,copy);};
        document.getElementById(url).setAttribute("id",urlTemp);

        if(copy.length != 0 && document.getElementById("photos_info")!=null)
        {
            document.getElementById("photos_info").setAttribute("style","display:");
            document.getElementById("photos_info").innerHTML='&copy; '+copy;
        }
        else
        {
           if (document.getElementById("photos_info")!=null)
            document.getElementById("photos_info").setAttribute("style","display:none");
        }
        
       if(document.getElementById("popPhoto").style.display == "block")
       {
         document.getElementById("photoPop").src = url.replace("maxheight=300&maxWidth=300","maxheight=400&maxWidth=400");
       }
    }
    
    function openPhoto()
    {
        document.getElementById("popPhoto").setAttribute("style","display:block;z-index:100;position:absolute");
        document.getElementById("popPhoto").style.display = "block";
        //document.getElementById("photoPop").setAttribute("src",document.getElementById("grandePhoto").getAttribute("src"));
        document.getElementById("photoPop").src = document.getElementById("grandePhoto").src.replace("maxheight=300&maxWidth=300","maxheight=500&maxWidth=500");
    }
