// variables globales
var fenetre, fontMover;

window.onload = function ()
{	
	ajoutMenus (0);
	document.getElementById("menusites").style.display = "none";
	document.getElementById("menufaire").style.display = "none";
	initMenus ();
	ajoutDivDemonstration ();
	creationObjets ();
	gestionEvenements ();
	colorerItemMenu ("DEVeld");
	ajoutBordBasDePage (2);
	ajoutEventImpression ();
	document.getElementById("tel").href = "demonstrations/demonstration-objet-element-deplacable.zip";
	document.getElementById("tel").type = "application/zip";
}


function ajoutDivDemonstration ()
{
	var el = document.createElement ('p');
	el.setAttribute ('class', 'demonstration');
	el.setAttribute ('className', 'demonstration');	 // IE
 	document.getElementById('demo').appendChild (el);
	el.innerHTML="<span class='lettrine'>D</span><span style='text-transform: uppercase;'>émonstration</span><br />où l’on <a href='#' id='afficher'>déplacera</a> et fera <a href='#' id='masquer'>disparaître</a> la fenêtre d’un vieux Macintosh .";
 
	el = document.createElement ('p');
	el.setAttribute ('class', 'decoFlorale');
 	el.setAttribute ('className', 'decoFlorale');	// IE
	document.getElementById('demo').appendChild (el);
	el.innerHTML="<img src='images/deco-feuille-lierre-5.gif' alt='image d&eacute;corative' width='69' height='70' />";

	el = document.createElement ('el');
	el.setAttribute ('id', 'fenetre');
	el.style.zIndex = "100";
	el.style.display = "none";
	el.style.margin = 0;
	document.getElementById ('conteneur').appendChild(el);
	el.innerHTML="<img src='images/macintosh-fenetre.png' alt='La fenêtre d’un vieux Macintosh' width='342' height='183' \/><div id='caseFermeture' style='position:absolute; top:0px;left:0px'><img src='images/macintosh-fermeture-fenetre-off.png' alt='' width='27' height='18' onclick='b()' /><\/div>";

	el = document.createElement ('div');
	el.setAttribute ('id', 'fontMover');
	el.style.zIndex = "101";
	el.style.display = "none";
	el.style.margin = 0;
	document.getElementById ('conteneur').appendChild(el);
	el.innerHTML="<img src='images/macintosh-font-mover.png' alt='Un vieux logiciel' width='60' height='50' \/>";

	// rollover sur imprimer et télécharger
	prechargerImages ("../images/puce-telecharger-on.png", "../images/puce-imprimer-on.png");
}

function creationObjets (posVerticaleVache1)
{
	fenetre = new ElementDeplacable ("fenetre", 0, 0, 0, 400, 390);
	//fontMover = new ElementDeplacable ("fontMover", 1, 0, 0, 620, 500);
}

function gestionEvenements ()
{
	document.getElementById('afficher').onclick = a;
	document.getElementById('masquer').onclick = b;
	
	function a ()
	{
		if (!fenetre.on)
		{
			fenetre.afficher();
			fontMover.afficher();
		}

		return false;
	}
}

function b ()
{
	if (fenetre.on)
	{
		fenetre.masquer();
		fontMover.masquer();
	}

	return false;
}


