/*function ajax(page,lg)
{
        var xhr=null;
         xhr=createxhr();
         xhr.onreadystatechange = function()
		{ 
			document.getElementById("main").innerHTML = "Wait server...";
			if(xhr.readyState == 4)
			{
				if(xhr.status == 200)
				{
					document.getElementById("main").innerHTML  = xhr.responseText;
				}	
				else
				{
					document.getElementById("main").innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
				}	
			}
		}; 
		xhr.open("POST","runpage.php", true);
            xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
            xhr.send("page="+page+"&lg="+lg);

} */
/*function ajaximg(k,g)
{
  var xhr=null;
  xhr=createxhr();

  xhr.onreadystatechange = function()
  {
    document.getElementById("news").innerHTML = "Wait server...";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById("news").innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById("news").innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","image.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("image="+k+"&g="+g);
} */
/*function ajaximgg(k,g)
{
  var xhr=null;
  xhr=createxhr();
  
  xhr.onreadystatechange = function()
  {
    document.getElementById("HQ").innerHTML = "<div id=test>Wait server...</div>";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById("HQ").innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById("HQ").innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","gg.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("image="+k+"&g="+g);
} */
function ajaxid(id,visible,style,dir)
{

  var xhr=null;
  xhr = createxhr();

  
  xhr.onreadystatechange = function()
  {

    document.getElementById(id).innerHTML = "wait<br />";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById(id).innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById(id).innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","modules2.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("id="+id+"&visible="+visible+"&style="+style+"&dir="+dir);
}
/*function ajaxmenu(id,visible,titre)
{
  var xhr=null;
  xhr=createxhr();
  
  xhr.onreadystatechange = function()
  {
    document.getElementById(id).innerHTML = "wait<br />";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById(id).innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById(id).innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","modulesmenu.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("id="+id+"&visible="+visible+"&titre="+titre);
} */

function openimage(img) {
  img = 'images/'+img;
  Image1= new Image();
  Image1.src=(img);
  Control(img);
}
function Control(img){
  if((Image1.width!=0)&&(Image1.height!=0)){
    VoirImage(img);
  }
  else{
    fonction="Control('"+img+"')";
    intervalle=setTimeout(fonction,20);
  }
}
function VoirImage(img){
  largeur=Image1.width+20;
  hauteur=Image1.height+40;
  proprietes="width="+ largeur +",height="+ hauteur;
  win=window.open('openimage.php?img='+img,"",proprietes);
}
/*function edit(id,dir) {
  alert(id);
  window.open('edit.php?id='+id+'&dir='+dir,"",'');

}
function edit_submit(id,t1,t2) {
  var xhr=null;
  xhr=createxhr();

  xhr.onreadystatechange = function()
  {
    document.getElementById('rep').innerHTML = "wait<br />";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById('rep').innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById('rep').innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","edit_submit.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("id="+id+"&t1="+t1+"&t2="+t2);
}*/

/*function load()
{
  var xhr=null;
  xhr=createxhr();
  
  xhr.onreadystatechange = function()
  {
    document.getElementById('body').innerHTML = "wait<br />";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById('body').innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById('body').innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","index_.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send('null');
} */
/*function changelang(lg)
{
  var xhr=null;
  xhr=createxhr();
  
  xhr.onreadystatechange = function()
  {
    document.getElementById('body').innerHTML = "wait<br />";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById('body').innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById('body').innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","index_.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send('lg='+lg);
}*/
function createxhr() {
  if (window.XMLHttpRequest)
  {
    xhr = new XMLHttpRequest();
    if (xhr.overrideMimeType)
    {
      xhr.overrideMimeType('text/xml');
    }
  }
  else if (window.ActiveXObject)
  {
    try {
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e)
    {
      try {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  return xhr;
}
function defilefr(l) {
  msg = "Bienvenue sur notre nouveau site internet - <a href=\"index.php?main=a3&amp;lg=fr&amp;g4=1\">News : voir les derni&egrave;res photos</a>";
  if (!l) { l = 800; }
  if (l<-500) { l = 800; }
  l=l-1;

  document.getElementById("test").style.left = l+"px";
  document.getElementById("test").innerHTML = msg;
  hfr = window.setTimeout("defilefr("+l+")",20);
}
function afffr() {
  window.clearTimeout(hfr);
}
function recomfr() {
  lpx = document.getElementById("test").style.left
  if (lpx.length==5) { setTimeout("defilefr("+lpx.charAt(0)+lpx.charAt(1)+lpx.charAt(2)+")",10); }
  if (lpx.length==4) { setTimeout("defilefr("+lpx.charAt(0)+lpx.charAt(1)+")",10); }
  if (lpx.length==3) { setTimeout("defilefr("+lpx.charAt(0)+")",10); }
}
function defileen(l) {
  msg = "Welcome to our new website - <a href=\"index.php?main=a3&amp;lg=fr&amp;g4=1\">News : Check the latest photos</a>";
  if (!l) { l = 800; }
  if (l<-500) { l = 800; }
  l=l-1;

  document.getElementById("test").style.left = l+"px";
  document.getElementById("test").innerHTML = msg;
  hen = window.setTimeout("defileen("+l+")",20);
}
function affen() {
  window.clearTimeout(hen);
}
function recomen() {
  lpx = document.getElementById("test").style.left
  if (lpx.length==5) { setTimeout("defileen("+lpx.charAt(0)+lpx.charAt(1)+lpx.charAt(2)+")",10); }
  if (lpx.length==4) { setTimeout("defileen("+lpx.charAt(0)+lpx.charAt(1)+")",10); }
  if (lpx.length==3) { setTimeout("defileen("+lpx.charAt(0)+")",10); }
}


/*function galerie(id,visible,style,dir)
{
  var xhr=null;
  xhr = createxhr();


  xhr.onreadystatechange = function()
  {
    document.getElementById(id).innerHTML = "wait<br />";
    if(xhr.readyState == 4)
    {
      if(xhr.status == 200)
      {
        document.getElementById(id).innerHTML  = xhr.responseText;
      }
      else
      {
        document.getElementById(id).innerHTML="Error: returned status code " + xhr.status + " " + xhr.statusText;
      }
    }
  };
  xhr.open("POST","galerie.php", true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("id="+id+"&visible="+visible+"&style="+style+"&dir="+dir);
}*/