// manipulateur d'images flottantes sur fond fluide
// Grégoire Ganne - juin 2009
// http://greboca.com
// licence : CC-By-SA
// toute utilisation de ce script doit respecter la licence CC-By-SA : partage dans les mêmes conditions, mention de l'auteur.

var data = new Array;
var coef,larg,haut,lrgfond;
// l'image de fond doit avoir comme id : fondimage
// Remplissage à la déclaration.
// nom de l'identifiant image, position x, position y.
var lrgfond = 2800;
data[0]= new Array("mick","855", "697"); 
data[1]= new Array("ohm","1071","287");
//data[2]= new Array("zik","58","570"); 
data[2]= new Array("prog","1408","436");
data[3]= new Array("info","1423","691");
data[4]= new Array("adress","1748","808");


// on y va
function initdata(){
	

		for (var j in data) 	{	
	//	alert(document.getElementById(data[0][0]).width);
		data[j][3] = document.getElementById(data[j][0]).width;	
	//	alert(data[j][3]);
	}
	calculdata();
}

// on charge les donnée:
function calculdata(){

	
	if (document.body)
	{
	var larg = (document.body.clientWidth);
	var haut = (document.body.clientHeight);
	}
	else
	{
	var larg = (window.innerWidth);
	var haut = (window.innerHeight);
	};
	var coef = larg/lrgfond;
	for (var i in data) 	{
	move(coef,data[i][0], data[i][1],data[i][2],data[i][3]);
	}

}

function move(coef,id, x,y,xx){
	// alert(coef + " " + id + " x: " + x + " y: " + y);
	//alert(xx);
	document.getElementById(id).style.left = coef*x+"px";
	document.getElementById(id).style.top = coef*y+"px";
	document.getElementById(id).style.width = coef*xx+"px";
	// document.getElementById(id+'_b').style.left = coef*x+"px";
	// document.getElementById(id+'_b').style.top = coef*y+"px";
	// document.getElementById(id+'_b').style.width = coef*xx+"px";
	// document.getElementById(id).style.display = "visible";
}



