//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Preloaded images
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var MAX_IMAGES = 22;
var MAX_TIME = 2400;
var MIN_TIME = 0;
var STEP_TIME = 200;
var aImages = new Array;
var arrHrefAlt = new Array;

if (document.images) 
{
	arrHrefAlt[0] = new oHrefAlt('serviceConstruction.aspx?Pg=AdminGenerale&Mn=servicesoffert','');
	arrHrefAlt[1] = new oHrefAlt('serviceConstruction.aspx?Pg=Pharmacie&Mn=servicesoffert','');
	arrHrefAlt[2] = new oHrefAlt('serviceConstruction.aspx?Pg=RH&Mn=servicesoffert','');
	arrHrefAlt[3] = new oHrefAlt('serviceConstruction.aspx?Pg=CentreDeJour&Mn=servicesoffert','');
	arrHrefAlt[4] = new oHrefAlt('serviceConstruction.aspx?Pg=NutritionClinique&Mn=servicesoffert','');
	arrHrefAlt[5] = new oHrefAlt('serviceConstruction.aspx?Pg=Comptabilite&Mn=servicesoffert','');
	arrHrefAlt[6] = new oHrefAlt('serviceConstruction.aspx?Pg=ServicesMilieuVie&Mn=servicesoffert','');
	arrHrefAlt[7] = new oHrefAlt('serviceConstruction.aspx?Pg=SoinsAssistance&Mn=servicesoffert','');
	arrHrefAlt[8] = new oHrefAlt('serviceConstruction.aspx?Pg=ServiceAlimentaire&Mn=servicesoffert','');
	arrHrefAlt[9] = new oHrefAlt('serviceConstruction.aspx?Pg=Pastorale&Mn=servicesoffert','');
	arrHrefAlt[10] = new oHrefAlt('serviceConstruction.aspx?Pg=Approvisionnement&Mn=servicesoffert','');
	arrHrefAlt[11] = new oHrefAlt('serviceConstruction.aspx?Pg=DeveloppementClinique&Mn=servicesoffert','');
	arrHrefAlt[12] = new oHrefAlt('serviceConstruction.aspx?Pg=Remuneration&Mn=servicesoffert','');
	arrHrefAlt[13] = new oHrefAlt('serviceConstruction.aspx?Pg=ServicesTechniques&Mn=servicesoffert','');
	arrHrefAlt[14] = new oHrefAlt('serviceConstruction.aspx?Pg=Secretariat&Mn=servicesoffert','');
	arrHrefAlt[15] = new oHrefAlt('serviceConstruction.aspx?Pg=ServicesMedicaux&Mn=servicesoffert','');
	arrHrefAlt[16] = new oHrefAlt('serviceConstruction.aspx?Pg=Readaptation&Mn=servicesoffert','');
	arrHrefAlt[17] = new oHrefAlt('serviceConstruction.aspx?Pg=AnimationLoisirs&Mn=servicesoffert','');
	arrHrefAlt[18] = new oHrefAlt('serviceConstruction.aspx?Pg=Informatique&Mn=servicesoffert','');
	arrHrefAlt[19] = new oHrefAlt('serviceConstruction.aspx?Pg=EntretienSanitaire&Mn=servicesoffert','');
	arrHrefAlt[20] = new oHrefAlt('serviceConstruction.aspx?Pg=Benevolat&Mn=servicesoffert','');
	arrHrefAlt[21] = new oHrefAlt('serviceConstruction.aspx?Pg=SoinsInfirmiers&Mn=servicesoffert','');

	for (var i=0; i< 10; i++){
		aImages[i] = new Image();
		aImages[i].src = "images/soleil0" + i + ".gif";
	}
	
	for (var i=10; i< MAX_IMAGES; i++){
		aImages[i] = new Image();
		aImages[i].src = "images/soleil" + i + ".gif";
	}	
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Reusable timer
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function oHrefAlt(sHref, sAlt){
	this.sHref = sHref;
	this.sAlt = sAlt;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Reusable timer
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Vigi_TimeImgs(numb) 
{
	var sTime = document.Form1.vRotation.value;
	thetimer = setTimeout("Vigi_ImgTurn('" + numb + "')", parseInt(sTime));
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Vigi_SetTimerUp() 
{
	var iTime = parseInt(document.Form1.vRotation.value);
	if (iTime > MIN_TIME)
		document.Form1.vRotation.value = iTime - STEP_TIME;
	else
		alert('Vitesse de rotation maximale');
	
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Vigi_SetTimerDn() 
{
	var iTime = parseInt(document.Form1.vRotation.value);
	if (iTime < MAX_TIME)
		document.Form1.vRotation.value = iTime + STEP_TIME;
	else
		alert('Vitesse de rotation minimale');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Reusable image turner
// This will loop the image
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Vigi_ImgTurn(numb) 
{
	if (document.images) 
	{
		var iMax = MAX_IMAGES - 1;
		if (numb == iMax) {
			document["imgSoleilId"].src = eval("aImages[" + iMax + "].src");
			Vigi_HrefAlt(numb);
			Vigi_TimeImgs('0');
		}
		else {
			document["imgSoleilId"].src = eval("aImages[" + numb + "].src");
			var vImgObj = Vigi_getElById('mapAreaId');
			Vigi_HrefAlt(numb);
			Vigi_TimeImgs(numb = ++numb);
		}
	}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Vigi_HrefAlt(index) 
{
	var vImgObj = Vigi_getElById('mapAreaId');
	if (vImgObj != null)
	{
		vImgObj.href = arrHrefAlt[index].sHref;
		vImgObj.alt = arrHrefAlt[index].sAlt;
	}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Vigi_getElById(idVal)
{
	if (document.getElementById != null){
		return document.getElementById(idVal);
	}else{
		if (document.all != null)
			return document.all[idVal];
		else
			return null;
	}
}

