// Fonctions de préload
function load() {
	if (document.images) {
		this.length=load.arguments.length;
		for (var i=0;i<this.length;i++) {
			this[i+1]=new Image();
			this[i+1].src=load.arguments[i];
		}
	}
}

// Cette fonction charge dans le cache toutes les images passées en paramètre
function preload() {
	var temp=new load("images/typo-Techn-multi-gris.jpg",
	                  "images/typo-gravure-gris.jpg",
	                  "images/typo-illustration-gris.jpg",
	                  "images/typo-concept-gris.jpg",
	                  "images/accueil-gris.jpg",
	                  "images/contact-gris.jpg")
}

preload();


// AJAX ------------------------------------- 
var xmlHttp1
var xmlHttp2
var xmlHttp3

function loadArts(str, langue)
{ 
xmlHttp1=GetXmlHttpObject()
xmlHttp2=GetXmlHttpObject()
xmlHttp3=GetXmlHttpObject()
if (xmlHttp1==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="getimage.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp1.onreadystatechange=getImage 
xmlHttp1.open("GET",url,true)
xmlHttp1.send(null)

url="getlegende.php"
url=url+"?q="+str
url=url+"&lang="+langue
//alert(url)
url=url+"&sid="+Math.random()
xmlHttp2.onreadystatechange=getLegende 
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)

url="getthumbs.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp3.onreadystatechange=getThumbs 
xmlHttp3.open("GET",url,true)
xmlHttp3.send(null)
}

function getImage() 
{ 
if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
 { 
 //document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
  x = document.getElementById('test');
  x.src='images/'+xmlHttp1.responseText;
 } 
}

function getLegende() 
{ 
if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
 { 
 document.getElementById("legende").innerHTML=xmlHttp2.responseText;
  //x = document.getElementById('test');
  //x.src='images/'+xmlHttp.responseText;
 } 
}

function getThumbs() 
{ 
if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete")
 { 
 document.getElementById("thumbs").innerHTML=xmlHttp3.responseText;
  //x = document.getElementById('test');
  //x.src='images/'+xmlHttp.responseText;
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
// Fin AJAX ---------------------------------



function showPicture(path) {
  //alert(path);
  x = document.getElementById('test');
  x.src=path;
}

