// variable globale
var caillou = null;

window.onload = function ()
{
	ajoutDivDemonstration();
	creationObjets ();
	gestionEvenements ();
	prechargerImages("images/fleche-blanche-haut-on.gif");
	ajoutMenus (0);
	document.getElementById("menusites").style.display = "none";
	document.getElementById("menufaire").style.display = "none";
	initMenus ();
	colorerItemMenu ("DEVree");
	ajoutBordBasDePage (2);
	ajoutEventImpression ();
	document.getElementById("tel").href = "demonstrations/demonstration-objet-rebond-element.zip";
	document.getElementById("tel").type = "application/zip";
	prechargerImages ("../images/puce-telecharger-on.png", "../images/puce-imprimer-on.png");
}


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 verra <a href='#' id='rebondir'>rebondir</a> et <a href='#' id='remonter'>s’envoler</a> un caillou, ce qui est chose bien remarquable.";
 
	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-2.gif' alt='image d&eacute;corative' width='69' height='70' />";
	
	el = document.createElement ('div');
	el.setAttribute ('id', 'caillou');
	el.style.marginLeft = '350px';
	el.style.zIndex = '10';
	document.getElementById ('conteneur').appendChild(el);
	el.innerHTML="<img src='images/galet-breton.jpg' alt='Un galet breton' width='300' height='210' style='border: 1px dashed #555;'><div id='fermeture_rebond' onclick='caillou.remonter()' title='Remonter'><\/div>";
}

function creationObjets ()
{
	var ie = navigator.appVersion.indexOf("MSIE") > -1;
	
	if (ie)
	{
		var hauteurRebond = 390;
	}
	else
	{
		var hauteurRebond = 405;
	}
	
	caillou = new RebondElement ("caillou", hauteurRebond, 0, 212, 20, 20);
}

function gestionEvenements ()
{
	document.getElementById("rebondir").onclick = function () { if(!caillou.enMvt)caillou.rebondir();return false; }
	document.getElementById("remonter").onclick = function () { if(!caillou.enMvt)caillou.remonter();return false; }
}

