/************************************/
/*** Initialisation des variables ***/
/************************************/
var isKonqueror			= (navigator.appName=="Konqueror");
var isWanadooNav		= (navigator.appVersion.indexOf("NaviWoo") > -1);
var isInternetExplorer	= (navigator.appName.indexOf( "Microsoft" ) > -1);
var aFlashElement		= new Array();				// la liste des éléments flash

// durée de téléchargement des images
var nDownloadImgTimeout = 50;						// Durée maximale de téléchargement des images (en secondes)

// pour les transitions
var nFaddingIntrvl		= 1;										// Exprimé en seconde
var nFaddingImg			= 25;										// Nombre d'image utilisées pour la transition
var nFaddingTime		= 1000 * nFaddingIntrvl / nFaddingImg;		// Durée totale de la transition
var nFaddingStep		= 100 / nFaddingImg;						// La valeur du pas utilisé dans la transition

var sTrace				= "";
var bStreamViewer		= null;
var nWindowMinWidth		= 880;			// la taille minimale de la fenêtre
var nWindowMaxWidth		= 990;			// la taille maximale de la fenêtre
var nNavWidth			= 150;			// la largeur (barre de navigation)
var nBordureWidth		= 12;			// la largeur de la bordure entre les cellules de la grille
var nCarrePubWidth		= 300;			// la largeur du carré pub

// pour la taille de la manchette
var sManchetteMinWidth	= "280";		// largeur minimale de la manchette (en 880)
var sManchetteMaxWidth	= "349";		// largeur maximale de la manchette (en 1004)
var sManchetteMinHeight	= "199";		// hauteur minimale de la manchette (en 880)
var sManchetteMaxHeight	= "250";		// hauteur maximale de la manchette (en 1004)

// les dépêches
var nInfoSpeed			= 2;			// vitesse de défilement des dépêches
var nInfoMinSpeed		= 2;			// vitesse minimale
var nInfoMaxSpeed		= 14;			// vitesse maximale

var nTimeForNextSequence = 15;			// Délai en seconde entre deux séquence dans la manchette (0 => pas de changement auto)
var bFixedOrder			= false;
var nHeadlineHeight		= 23;			// hauteur du bandeau
var nImgSequenceId		= 0;			// Pour génération automatique de tags HTML
var bInitManchette		= false;		// permet de dire si la manchette est construite ou non

// la grille
var oDisplayGrid = null;				// objet pour gérer la grille

/***********************************************************/
/** Gestions des évènements généraux                     ***/
/***********************************************************/
window.onresize = function() {
	// resize des images de la grille
	try { oDisplayGrid.resize();	} catch(e) {}
	// resize de la manchette
	try	{ manchetteResize();} catch (e) { }
	try {
		var screenPlayer = o_hGetById("ScreenPlayer").component;           // Obligatoire pour la gestion du ScreenPlayer
		screenPlayer.aSequence[screenPlayer.nCurrentSequence].hImg.resize();
	} catch (e) { }
	// resize du flash
	try { flashResize2();         } catch(e) { }
}
 
window.onload = function Window_onLoad() { 
	try{
		window.onresize();
		if (o_hGetById('rech')) o_hGetById('rech').focus();
		if (window.bActivMonitoring) profilerData.postData(); 
		putTime();
	} catch(e) {}      /* Time QOS HP */ 
}

/*
 * fonction utilisée lors du redimensionnement de la manchette 
 */
function manchetteResize(){
	try{
		if (document.body.clientWidth > 993){
			o_hGetById("o_manchette").style.width = sManchetteMaxWidth; 
			o_hGetById("o_manchette").style.height = sManchetteMaxHeight; 
			o_hGetById("o_manchette").parentNode.style.width = o_hGetById("o_manchette").style.width;
			o_hGetById('o_infos').style.height = "200px"; 
			if (document.body.clientWidth > 1004){ 
				o_hGetById('infoDepecheCote').style.width = "179"; 
				o_hGetById('infoDepecheCote').style.pixelwidth = "179"; 
			} else { 
				var nInfoWidth = 991 - nNavWidth - nBordureWidth - nCarrePubWidth - sManchetteMaxWidth; 
				o_hGetById('infoDepecheCote').style.width = nInfoWidth+"px"; 
				o_hGetById('infoDepecheCote').style.pixelwidth = nInfoWidth+"px"; 
			} 
			//o_hGetById('infoVilleCote').style.display = ""; 
			//o_hGetById('infosDepecheBas').style.display = "none"; 
		} else { 
			o_hGetById("o_manchette").style.width = sManchetteMinWidth; 
			o_hGetById("o_manchette").style.height = sManchetteMinHeight; 
			o_hGetById("o_manchette").parentNode.style.width = o_hGetById("o_manchette").style.width;
			o_hGetById('o_infos').style.height = "200px"; 
			if (document.body.clientWidth < 880){ 
				o_hGetById('infoDepecheCote').style.width = "138px"; 
				o_hGetById('infoDepecheCote').style.pixelwidth = "138px"; 
			} else { 
				var nInfoWidth = document.body.clientWidth - nNavWidth - nBordureWidth - nCarrePubWidth - sManchetteMinWidth;
				o_hGetById('infoDepecheCote').style.width = nInfoWidth+"px"; 
				o_hGetById('infoDepecheCote').style.pixelwidth = nInfoWidth+"px"; 
			} 
			//o_hGetById('infoVilleCote').style.display = "none"; 
			//o_hGetById('infosDepecheBas').style.display = ""; 
		}
		o_hGetById('infoDepecheCote').style.visibility = "";
	} catch(e) {alert(e);}
}


/***********************************************************
 * Jacques Thieck : 05/05/2005 
 * 
 * Fonction destinée a permettre le resizing des flash 
 * Rendue générique pour pouvoir redimensionner plusieurs 
 * flashs dans une page 
 * 
 * pour rendre un flash redimensionnable, apres son appel  
 * lui donner un ID puis inserer le code suivant :  
 * <script language="javascript"> 
 * flashArray = flashArray.concat ([["id_flash",2,0.514]]); 
 * </script> 
 * ou id_flash est l'id du flash
 * 2 le nobre de colonne [1-3]
 * 0.514 le ratio du flash.
 *
 **********************************************************/

/**
 * methode utilisée pour le redimensionnement du flash
 * quelle est la méthode utilisée en fait (flashResize ou flashResize2) ?
 */
function flashResize2(){
	try{
		for (var i = 0; i < aFlashElement.length; i++){
			var iFlash				= aFlashElement[i][0];	// id de l'élément flash à redimensionner
			var nNbCol				= aFlashElement[i][1];	// nombre de colonne occupé par l'élément flash
			var nRatioWidthHeight	= aFlashElement[i][2];	// rapport hauteur - largeur de l'élément flash

			if ( o_hGetById(iFlash) ){
				var nGridWidth = (document.body.clientWidth - nNavWidth ) * nNbCol / oDisplayGrid.nCellsPerLine;
				nGridWidth = Math.max( nGridWidth , (nWindowMinWidth - nNavWidth) * nNbCol / oDisplayGrid.nCellsPerLine);
				nGridWidth = Math.min( nGridWidth , (nWindowMaxWidth - nNavWidth ) * nNbCol / oDisplayGrid.nCellsPerLine);
				nGridWidth -= 12;
				if ( ! document.all ){
					var hEmbedNode = o_hGetById(iFlash).getElementsByTagName("embed")[0];
					hEmbedNode.width = nGridWidth;
					hEmbedNode.height = nGridWidth * nRatioWidthHeight;
				} else {
					o_hGetById(iFlash).width = nGridWidth;
					o_hGetById(iFlash).height = nGridWidth * nRatioWidthHeight;
				}
			}
		}
	} catch (e) {}
}

function changeAllLinks() {
	try {
		var grilleStart = 0;
		var rStartNode = window.document;
		scanTreeForChangeUrls( rStartNode, null );                     
		for( var i=0; i<oScreenPlayer.aSequence.length; i++ ) {   
			var sequenceNode = oScreenPlayer.aSequence[i].hDiv;
			scanTreeForChangeUrls( sequenceNode, null );
		}
	} 
	catch( exception ) { }
}
/*
	Parcourt la page et trouve les balises <span addRef=''>.
*/
function scanTreeForChangeUrls( o_rNode, hasAddRef ) {
	try{
		if (o_rNode == null || typeof(o_rNode) != "object") return;                                               
		try {
			if (o_rNode.addRef) hasAddRef = o_rNode.addRef;              
			else if (o_rNode.attributes && o_rNode.attributes["addRef"]) hasAddRef = o_rNode.attributes["addRef"].value;   
		} catch( e ) { }
		if ( o_rNode.childNodes ) {  
			for(var i=0; i<o_rNode.childNodes.length; i++) 
			{ scanTreeForChangeUrls( o_rNode.childNodes[i], hasAddRef ); }
		}
		var goodUrlReferrer = (hasAddRef==null ? sUrlReferrer : sUrlReferrer + "_" + hasAddRef);              
		if (o_rNode.tagName == null) return;
		if (window.bActivMonitoring == true) {
			if (o_rNode.tagName.toUpperCase() == "A" && o_rNode.href) {                                               
				if (! o_rNode.attributes["notChanged"]) o_rNode.href = changeOneUrl( o_rNode.href, goodUrlReferrer );
				profilerData.addLnk( o_rNode );
			} else if (o_rNode.tagName.toUpperCase() == "FORM" && o_rNode.action) {                                   
				if (! o_rNode.attributes["notChanged"]) o_rNode.action = changeOneUrl( o_rNode.action, goodUrlReferrer );
			} else if (o_rNode.tagName.toUpperCase() == "IMG") {
				profilerData.addImg( o_rNode );
			} else if (o_rNode.tagName.toUpperCase() == "SCRIPT") {
				profilerData.addScript( o_rNode );
			} else if (o_rNode.tagName.toUpperCase() == "LINK") {
				profilerData.addStyle( o_rNode );
			} else if (o_rNode.tagName.toUpperCase() == "EMBED") {
				profilerData.addEmbed( o_rNode );
			}        
		} else {
			if (o_rNode.tagName.toUpperCase() == "A" && o_rNode.href) {                                               
				if (! o_rNode.attributes["notChanged"]) o_rNode.href = changeOneUrl( o_rNode.href, goodUrlReferrer );
			} else if (o_rNode.tagName.toUpperCase() == "FORM" && o_rNode.action) {                                   
				if (! o_rNode.attributes["notChanged"]) o_rNode.action = changeOneUrl( o_rNode.action, goodUrlReferrer );
			}
		}
	} catch (e) {}
}

/*
	19/04/2006 : zzpetit@echo.fr (les liens en wanadoo.fr passent en orange.fr et les rl deviennent r)
*/
function changeOneUrl(sUrl,sUrlRef){
	try { 
		var sOldUrl = sUrl, sRef = "";
		var sFrameCgiUrl = "http://www.orange.fr/bin/frame.cgi?url="; 
		if ( (sUrl.substring(0,sFrameCgiUrl.length) != sFrameCgiUrl) && (sUrl.indexOf("http://r.orange.fr") == -1) && (sUrl.indexOf(".orange.fr") > 0 || sUrl.indexOf(".wanadoo.fr") > 0) && (sUrl.indexOf("http://externe") ==-1) && (sUrl.indexOf("http://www.orange.fr") ==-1) && (sUrl.indexOf(".orange.fr") ==-1) && (sUrl.indexOf(".dev.orange.fr") ==-1)){ 
			/* si l'appel au frame.cgi manque alors qu'il devrait être la, on l'ajoute */
			sUrl = sFrameCgiUrl + escape(sUrl);
		}
		// on récupère l'éventuel paramètre addRef qu'on peut trouver dans l'url
		var sAddRef = o_sExtractVar('addRef',sUrl);
		if (sAddRef != null){
			sUrlRef = sUrlReferrer + "_" + sAddRef;
			nAddRefPos = sUrl.indexOf('addRef');
			sUrl = sUrl.substring(0,nAddRefPos-1); // -1, car le paramètre addRef est forcément en dernier (donc juste avant, il y a '&' ou '?')
		}

		if (sUrl.substring(0, 20) == "http://r.orange.fr/r") { 
			/* traitement spécial des adresses r.orange.fr */
			if (sUrl.indexOf('ref=') == -1){
				/* on ajoute le sUrlReferrer comme addRef dans l'adresse demandee (pour la comptabilisation des clics) */
				var nPosInterrogation = sUrl.indexOf("?");
				if (nPosInterrogation > -1)	sUrl = sUrl.substring(0, nPosInterrogation+1) + "ref=" + sUrlRef + "&" + sUrl.substring(nPosInterrogation+1, sUrl.length);
				else sUrl += "?ref=" + sUrlRef;
			}
		} else if (sUrl.indexOf('wanadooregie') != -1) {
			/* on ne fait rien */
		} else if (sUrl.indexOf('externe.shopping.orange.fr') != -1  || sUrl.indexOf('ads-click') != -1 || sUrl.indexOf('doubleclick') != -1 ||  sUrl.indexOf('fluxlc') != -1 ||  sUrl.indexOf('fluxlr') != -1 ||  sUrl.indexOf('mediaplex') != -1) {
			/* cas shopping on utilise rl.wanadoo.fr (rl est utilise pour les url de plus de 128 lettres) */
			var nPosRef = sUrl.indexOf("?ref=");
			if (nPosRef > -1) {
				var sRef = escape(sUrl.substring(nPosRef+1, sUrl.length));
				sUrl = escape(sUrl.substring(0, nPosRef));
				sUrl = "http://r.orange.fr/r?" + sRef + "&url=" + sUrl;
			} else {
				var sOldUrl = escape( sUrl );
				sUrl = "http://r.orange.fr/r?ref=" + sUrlRef + "&url=" + sOldUrl;
            }
		} else {
			var nPosRef = sUrl.indexOf("?ref=");
			if (nPosRef > -1) {
				var sRef = escape(sUrl.substring(nPosRef+1, sUrl.length));
				sUrl = escape(sUrl.substring(0, nPosRef));
			} else {
				//alert(sUrl);
				var sOldUrl = escape(sUrl);
				if ((sUrl.indexOf("javascript") ==-1)) sUrl = "http://r.orange.fr/r?ref=" + sUrlRef + "&url=" + sOldUrl;
			}
		}
		return sUrl; 
	} catch(e) { return sOldUrl; }	// on renvoie l'adresse initiale au cas où l'url provoquerai une erreur
}

/************************************************************/ 
/*** Dominique LIARD : 25/01/2005                         ***/ 
/***                                                      ***/ 
/*** Prise en charge des timeout sur le téléchargement des***/ 
/*** images. Pour affecter un timeout à un image, ajoutez ***/ 
/*** l'attribut timeout au tag <IMG> : cet attribut attend***/ 
/*** un nombre de secondes comme valeur. La constante     ***/ 
/*** nDownloadImgTimeout fixe le timeout global			  ***/ 
/*** pour la page : il prévaut sur celui d'une image.     ***/ 
/*** Si le download est coupé : soit la valeur du paramètre**/ 
/*** lowsrc est pris en compte, soit une image z.gif      ***/ 
/*** (transparente) sera utilisée. La methode             ***/ 
/*** startDownloadTimers doit être invoquée en fin de page***/ 
/*** mais pas sur un onload, bien entendu !!!             ***/ 
/***                                                      ***/ 
/*** Enfin : pour fonctionner, le tag d'image doit 	      ***/ 
/*** impérativement avoir un ID pour supporter timeout !!!***/ 
/***                                                      ***/ 
/************************************************************/ 

/**
 * Fonction déclenchée à la fin du timeout des images
 * On lance la fonction stopDownloadTimer pour les images qui n'ont pas pu être chargées
 */
function globalTimeoutExpired() {
	try{	
		var aDocImage = window.document.images;	// récupération de la liste des images de la page HTML
		for( var i = 0; i<aDocImage.length; i++ ) {
			var hImg = aDocImage[i];
			if ( /*hImg.attributes["timeout"] &&*/ hImg.complete == false ) {
				stopDownloadTimer(hImg);		// si l'image n'est pas chargée, on lance la fonction stopDownloadTimer
			}
		}
	} catch (e){}
}

/**
 * Fonction permettant de modifier la source des images
 * dans le cas où les images ne peuvent pas être téléchargées
 * hImg est l'image dont la source doit être modifiée
 */
function stopDownloadTimer(hImg) {
	try{
		if ( hImg.complete == false ){
			// si l'image a une source moins lourde, on charge cette source, sinon on charge z.gif (image transparente de 1 pixel)
			if (hImg.lowsrc) hImg.src = hImg.lowsrc;
			else hImg.src = "http://img.servihoo.com/orangebeta/I/z.gif";
		}
		// on relance le chargement de l'image
		if (hImg.clockId) clearTimeout(hImg.clockId);
		hImg.clockId = null;
	} catch (e) {}
}

/**
 * Fonction permettant d'initialiser le déclenchement des fonctions globalTimeoutExpired et stopDownloadTimer pour toutes les images de la page
 */
function startDownloadTimers() {
	try{
		var aDocImg = window.document.images;
		for( var i=0; i<aDocImg.length; i++ ) {
			var hImg = aDocImg[i];
			if ( hImg.id && hImg.attributes["timeout"] && hImg.complete == false ) {
				var nTimeout = hImg.attributes["timeout"].value * 1; // temps au bout duquel l'image doit être modifiée si elle n'est pas chargé (pour une image spécifique)
				hImg.clockId = setTimeout( "stopDownloadTimer( o_hGetById('" + hImg.id + "') );", nTimeout * 1000 );
			}
		}
		setTimeout( "globalTimeoutExpired();", nDownloadImgTimeout * 1000 ); // au bout de nDownloadImgTimeout secondes, on modifie toutes les images non chargées
	} catch (e){}
}
 
/******************************************************************************/ 
/*** Dominique LIARD : 30/03/2005											***/ 
/***																		***/ 
/*** Ces deux fonctions permettent de controler, sur IE						***/ 
/*** uniquement, un temps maximal de download des fichiers					***/ 
/*** Javascript. En fait les choses sont plus compliquées					***/ 
/*** que pour les images, car temps qu'un script n'est						***/ 
/*** pas arrivé, le traitement de la page HTML est							***/ 
/*** intérrompu. Il faut donc, obligatoirement déclancher					***/ 
/*** un timeout avant d'inclure le script ! C'est							***/ 
/*** l'objectif de la fonction startJavascriptDownloadTimer					***/ 
/*** Elle prend deux paramètre, l'ID du tag et un timeout					***/ 
/*** en secondes.															***/ 
/***																		***/ 
/*** La fonction stopJavascriptDownload doit être invoquée					***/ 
/*** soit explicitement (avec un unique paramètre) si le					***/ 
/*** transfert c'est fait correctement, soit elle est						***/ 
/*** invoquée implicitement via le script.									***/ 
/***																		***/ 
/*** L'exemple présenté ci-dessous montre comment utiliser					***/ 
/*** ces deux fonctions.													***/ 
/***																		***/ 
/*** <SCRIPT>startJavascriptDownloadTimer( "script1", 5 );</SCRIPT>			***/
/*** <SCRIPT id="script1" src="http://localhost/Javascript.asp"></SCRIPT>	***/
/*** <SCRIPT>stopJavascriptDownload( "script1" );</SCRIPT>					***/
/******************************************************************************/ 

/**
 * Fonction permettant d'initialiser le déclenchement de la fonction stopJavascriptDownload pour les scripts
 * iScript est l'identifiant du script
 * nTimeout est le temps au bout duquel le script ne sera plus chargé s'il n'a pas pu être chargé avant
 */
function startJsDownloadTimer(iScript,nTimeout){
	try{
		window.scriptClockId = window.setTimeout( "stopJavascriptDownload( '" + iScript + "', true );", nTimeout*1000 );
	} catch (e) {}
}
 
/**
 * Fonction permettant d'arrêter le chargement d'un javascript spécifique
 * iScript est l'identifiant du script
 * bAutoClose, boolean valant true si le chargement du javascript doit s'arrêter et null si le javascript a réussi à se charger
 */
function stopJsDownload(iScript,bAutoClose ) {
	try{
		if ( bAutoClose == null ) { 
			if ( window.scriptClockId != null ) window.clearTimeout( window.scriptClockId ); 
		} else { 
			var hScript = o_hGetById(iScript); 
			hScript.src = "/Js/Nothing.js"; 
		} 
		window.scriptClockId = null; 
	} catch(e){}
} 
 

/**
 * Fonction permettant d'initialiser urlReferrer
 * urlReferrer permet de gérer les redirections pour le calcul des statistiques
 */ 
 function initUrlReferrer(){
	try{
		if (! window.sUrlReferrer ) sUrlReferrer ="W3ACC";	// Si pas d'urlReferrer défini dans la page HTML => valeur par défaut. 
		var nHour = (new Date()).getHours();				// l'heure actuelle
		var sPeriod = '0003';
		if		( nHour <= 3 )	sPeriod = '0003'; 
		else if ( nHour <= 6 )	sPeriod = '0306'; 
		else if ( nHour <= 9 )	sPeriod = '0609'; 
		else if ( nHour <= 12)	sPeriod = '0912'; 
		else if ( nHour <= 15)	sPeriod = '1215'; 
		else if ( nHour <= 18)	sPeriod = '1518'; 
		else if ( nHour <= 21)	sPeriod = '1821'; 
		else 					sPeriod = '2124'; 
		sUrlReferrer = sUrlReferrer +'_'+ sPeriod ;
	} catch (e){}
}
 
/************************************************************/ 
/*** Calcul du numéro de version d'Internet Explorer      ***/ 
/************************************************************/ 
/** !!!!!!!!!! FONCTION QUI VA PASSER DANS COMMON.JS !!!!!!!!!!!!!!!!!**/
function getIEAppVersionNumber() { 
	var appVersion = navigator.appVersion; 
	var msiePos = appVersion.indexOf("MSIE") + 5; 
	var appVersionNumber = appVersion.substring(msiePos, msiePos+3) * 1; 
	return appVersionNumber; 
} 
 
/**
 * Fonction permettant de descendre les infos contenues dans le bloc des infos en continu
 * iInfo est l'identifiant du div des dépêches 
 */
function infoMoveDown(){
	try{
		var crossobj = o_hGetById('content');
		var contentheight=crossobj.offsetHeight;
		if (parseInt(crossobj.style.top)>=(contentheight*(-1)+100))	crossobj.style.top=parseInt(crossobj.style.top)-nInfoSpeed;
		hInfoMoveDown = setTimeout("infoMoveDown()",100);
	} catch(e) {}
}

/**
 * Fonction permettant de monter les infos contenues dans le bloc des infos en continu
 * iInfo est l'identifiant du div des dépêches 
 */
function infoMoveUp(){
	try{
		var crossobj = o_hGetById('content');
		var contentheight=crossobj.offsetHeight;
		if (parseInt(crossobj.style.top)<=0) crossobj.style.top=parseInt(crossobj.style.top)+nInfoSpeed;
		hInfoMoveUp = setTimeout("infoMoveUp()",100);
	} catch(e) {}
}


/*** 
* MM - 29/07/2004 
* Code necessaire pour faire marcher les blocs "Partenaires" shopping
* hLabelNode est ...
* sUnivers est ...
* sService est ...
* sPathDistinct est ...
* sPage est ...
* sZone est ...
***/ 
function selectOneLabel( hLabelNode, sUnivers, sService, sPathDistinct, sPage, sZone ) {
	try{
		// modification de sPage et sZone en passant par les expressions régulières ...
		var sEtComm = /&/g,    sAmp = /amp;/g;
		sPage = sPage.replace(sEtComm, "__");
		sZone = sZone.replace(sEtComm, "__");
	 
		var aLabel		= hLabelNode.getElementsByTagName("div");	// liste des éléments div dans l'élément hLabelNode
		var nNbLabel	= aLabel.length;							// nombre de div
		var sCookieName = 'newRotation' + sService + sPathDistinct;	// nom du cookie
		var nRndId		= 0;										// nombre aléatoire
		var sOldLblId	= o_sGetCookie(sCookieName);		// ancien ID provenant du cookie

		if (nNbLabel > 1) {
			do { nRndId = Math.floor(Math.random()*nNbLabel); } while( nRndId == sOldLblId );
		}

		var hDataNode = o_hGetById( '_' + sUnivers + '_' + sService + '_' + sPathDistinct + '_' + nRndId );
		o_hGetById( "title_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML	= hDataNode.attributes["titre"].value;
		o_hGetById( "link1_" + sUnivers + "_" + sService + '_' + sPathDistinct ).href		= hDataNode.attributes["href"].value;
		o_hGetById( "link2_" + sUnivers + "_" + sService + '_' + sPathDistinct ).href		= hDataNode.attributes["href"].value;
		for ( var i=0; i<hDataNode.childNodes.length; i++ ) {
			var hChildNode = hDataNode.childNodes[i];
			if ( hChildNode.tagName && hChildNode.tagName == "SPAN") {
				switch( hChildNode.attributes["pos"].value * 1 ) {	// String * 1 => integer
					case 0:		// Affectation de l'image
						o_hGetById( "image_" + sUnivers + "_" + sService + '_' + sPathDistinct ).src				= hChildNode.innerHTML;
						break;
					case 1:		// Affectation du titre de la vignette
						o_hGetById( "titre_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML			= hChildNode.innerHTML;
						break;
					case 2:		// Affectation du contenu textuel de la vignette
						o_hGetById( "description_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML	= hChildNode.innerHTML;
						break;
					case 3:		// Gestion des stats
						var sVignette = hChildNode.innerHTML;
						sVignette = sVignette.replace(sEtComm, "__");
						sVignette = sVignette.replace(sAmp, "");
						var sSrcImgStat	= 'http://i4.woopic.com/Shopping/z.gif?param=' + sPage + '||' + sZone + '||' + sVignette;
						var sImgNode	= '<img notResize="true" onload="window.tps_shopping = new Date ();" src="' + sSrcImgStat + '" width="1" height="1" border="0">';
						o_hGetById( "forZImage_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML = sImgNode;
				}
			}
		}
		o_bSetCookie(sCookieName,nRndId);
	} catch(e) {}
}

/**
 *
 * COMMENT CA PEUT FONCTIONNER SI les variables ne sont pas initialisées (exemple tag_id, tag_page, etc ...)
 */
function displayTagShopping (numero) {
	try{
		sInnerHTML = o_hGetById(tag_id+numero).innerHTML;
		sInnerHTML = sInnerHTML.replace(sEtComm, "__");
		sInnerHTML = sInnerHTML.replace(sAmp, "");
		o_hGetById(tag_main_id).innerHTML  = 
			'<img notResize="true" onload="window.tps_shopping = new Date ();" src="' + tag_racine + '?param=' + tag_page + '||' + tag_zone + '||' + sInnerHTML + '" width="1" height="1" border="0">';
		try {o_hGetById(tag_main_id).innerHTML += '<img notResize="true" onload="window.tps_shopping = new Date ();" src="' + tag_racine2 + '?param=' + tag_page + '||' + tag_zone + '||' + sInnerHTML + '" width="1" height="1" border="0">';} catch( e ) { /* NOTHING */ }
		img_vignette = o_hGetById(tag_id+'img_'+numero);
		if (img_vignette && img_vignette.innerHTML.indexOf("<img") == -1) {
			img_vignette.innerHTML  = '<img src="' + img_vignette.innerHTML + '" alt="" half="true" align="left" class="half" border="0" notResize="true">';
			img_vignette.style.display = 'inline';
		}
	} catch(e) {}
}

function GoStart() { 
	try{
		var verif_id = o_sGetCookie(cookieName);
		var random_div = 0; 
		if (nbr_div > 1) { 
			do { random_div = Math.floor(Math.random()*nbr_div); } while(random_div == verif_id); 
		} 
		for(var index=0; index<nbr_div; index++) { 
			o_hGetById(div_id + index).style.display = (random_div==index) ? 'block' : 'none'; 
		} 
		displayTagShopping (random_div); 
		o_bSetCookie(sCookieName,random_div);
	} catch(e) {}
} 

/**
 * Fonction permettant de modifier la transparence d'un élément
 * hNode est le noeud dont on doit modifier la transparence
 * nOpacity est la transparence souhaitée (comprise entre 0 et 100)
 */
function changeOpacity(hNode,nOpacity ){
	try{
		hNode.style.filter			= "alpha(opacity=" + nOpacity + ")"; 	// pour IE				 
		hNode.style.MozOpacity		= nOpacity / 100;						// pour Netscape 
		hNode.style.KHTMLOpacity	= nOpacity / 100;						// pour Safari < 1.2, Konqueror 
		hNode.style.opacity			= nOpacity / 100;						// pour Safari >= 1.2, firefox (new) et CSS3  
	} catch(e){}
}

/**
 * Objet permettant de gérer le fondu entre deux images (utilisée dans la manchette)
 * hBGNode est le noeud correspondant à l'image qui doit apparaître
 * hFGNode est le noeud correspondant à l'image qui doit disparaître
 * hCallBackFct est la fonction exécutée lorsque le fondu est terminé 
 */
function Fadding( hBGNode, hFGNode, hCallBackFct) {
	try { window.clearInterval( window.currentFadding.faddingClock ); } catch( e ) { } 
	window.currentFadding = this;
	this.hcallbackFunction	= hCallBackFct;		// fonction exécutée à la fin du fondu
	this.hBackgroundNode	= hBGNode;			// image d'arrière plan
	this.hForegroundNode	= hFGNode; 			// image de premier plan
	this.nOpacityRate		= 0;				// transparence de l'image d'arrière plan
 
	changeOpacity(this.hBackgroundNode, 0);
	changeOpacity(this.hForegroundNode, 100);
	this.hFaddingTimeout = window.setInterval( "window.currentFadding.nextStep()", nFaddingTime );

	/**
	 * méthode permettant d'avancer le fondu entre les deux images
	 */
	this.nextStep = function Fadding_nextStep() {
		try{
			this.nOpacityRate += nFaddingStep;
			if ( this.nOpacityRate > 100 ) this.nOpacityRate = 100;

			var nBackGroundOpacity = Math.floor( this.nOpacityRate );
			var nForeGroundOpacity = Math.floor( 100 - this.nOpacityRate );
			changeOpacity( this.hBackgroundNode, nBackGroundOpacity );
			changeOpacity( this.hForegroundNode, nForeGroundOpacity );

			// partie du code s'exécutant à la fin du fondu
			if ( this.nOpacityRate == 100 ) {
				window.clearInterval( window.currentFadding.hFaddingTimeout ); // on supprime l'évènement
				if ( this.hcallbackFunction != null ) this.hcallbackFunction();
			}
		} catch( e ) { } 
	}
}
 
/**
 * Fonction permettant d'afficher les informations relative à une erreur javascript
 * oError est l'erreur dont on affiche quelques informations supplémentaires
 */
function displayErr(oError) {
	try{
		alert ( "erreur js : "+ oError.description +
			"\n message : " + oError.message +
			"\n nom : " + oError.name +
			"\n # : " + oError.number);
	} catch( e ) { } 
}

/////////////////////////////
// POUR GERER LA MANCHETTE //
/////////////////////////////

/**
 * Fonction permettant de redimensionner les images des séquences
 */
function sequenceResize() {
	try{
		if (this.parentNode == null) return;                            // Le player n'est pas encore chargé
		this.style.display = "block";
		if (isKonqueror) {                   
			var hImgNode			= document.createElement("IMG");          // Konqueror et Safari perdent l'image de la manchette à un moment donné.
			hImgNode.src			= this.src;
			hImgNode.resize			= this.resize;
			hImgNode.sequence		= this.sequence;
			hImgNode.sequence.hImg	= hImgNode;
			hImgNode.noBorder = hImgNode.attributes["noBorder"] = true;
			this.parentNode.appendChild( hImgNode );
			this.parentNode.removeChild( this );
			this.sequence.hDiv.style.top	= 99; //113;
			this.sequence.hDiv.style.width	= this.width;
			this.sequence.hDiv.style.height = this.height;
			return;
		}

		if (this.width>290) this.height = "227";
		else this.height = "176";

        var hMainStyle			= this.previousSibling.style;
        var hAlphaParam			= this.sequence.oAlphaParam;
        var hAlphaLayerStyle	= this.sequence.hAlphaLayer.style;
        var hLeftBtnStyle		= this.sequence.hLeftBtn.style;
        var hRightBtnStyle		= this.sequence.hRightBtn.style;

        if ( document.all ) {
            hMainStyle.pixelTop		= this.offsetTop - nHeadlineHeight;	// position du texte sous IE
            hMainStyle.pixelLeft	= this.offsetLeft;

            if (getIEAppVersionNumber() <= 5) {	// problématique de positionnement de IE 5.0
                if (hMainStyle.pixelLeft*1 == 0) {
                    hMainStyle.pixelLeft = -1000;
                    window.setTimeout("window.onresize();", 10);
                }
            }
			
			// Positionnement de la couche transparente sous IE
            hAlphaLayerStyle.pixelLeft		= 0;
            //hAlphaLayerStyle.pixelTop	= this.height + nHeadlineHeight - 93;
			hAlphaLayerStyle.pixelBottom	= 0;
            
            if (this.sequence.screenPlayer.aSequence.length > 1) {	// Positionnement des boutons sous IE
                hLeftBtnStyle.pixelTop		= nHeadlineHeight + 5;
                hRightBtnStyle.pixelTop		= nHeadlineHeight + 5;
                hLeftBtnStyle.pixelLeft		= this.width - 45;
                hRightBtnStyle.pixelLeft	= this.width - 24;
            } else {	
                hLeftBtnStyle.display	= "none";
                hRightBtnStyle.display	= "none";
            }
        } else {
            hMainStyle.top	= this.y - nHeadlineHeight;	// Positionnement du texte sous Netscape
            hMainStyle.left = this.x;    

			// Positionnement de la couche transparente sous Netscape
            hAlphaLayerStyle.left	= 0;
			hAlphaLayerStyle.bottom	= 0;

            if (this.sequence.screenPlayer.aSequence.length > 1) {	// Positionnement des boutons sous Netscape
                hLeftBtnStyle.top	= nHeadlineHeight + 5;
                hRightBtnStyle.top	= nHeadlineHeight + 5;
                hLeftBtnStyle.left	= this.width - 45;
                hRightBtnStyle.left = this.width - 24;
            } else {
                hLeftBtnStyle.display	= "none";
                hRightBtnStyle.display	= "none";
            }
        }
    
		hMainStyle.height	= this.height + nHeadlineHeight;	// Retaillage du texte
		hMainStyle.width	= this.width;
		hMainStyle.display	= 'block';							// Pour éviter un effet désagréable au démarrage

        if (! document.all && this.height>this.width*0.69) {	// Patch petit bug Netscape qui arrive de temps en temps
            hMainStyle.height = this.width * 0.68 + nHeadlineHeight;
            setTimeout("window.onresize();", 1);
        }
		
		// Retaillage du calque transparent
        hAlphaLayerStyle.width	= 280;
		//hAlphaLayerStyle.display = "block";
        
        var faddingNode = this.sequence.screenPlayer.hFaddingImg;
		faddingNode.style.top				= nHeadlineHeight + 1*(document.all ? hMainStyle.pixelTop : sSubPx(hMainStyle.top));
		faddingNode.style.left				= document.all ? hMainStyle.pixelLeft : sSubPx(hMainStyle.left);
		faddingNode.style.width				= document.all ? hMainStyle.pixelWidth : sSubPx(hMainStyle.width);
		faddingNode.firstChild.style.width	= document.all ? hMainStyle.pixelWidth : sSubPx(hMainStyle.width);
		faddingNode.style.height			= (document.all ? hMainStyle.pixelHeight : sSubPx(hMainStyle.height)) - nHeadlineHeight;
    } catch(e) { /* Si l'écran est trop petit */ }
}

/**
 * Fonction pour retirer la chaine px dans une autre chaine ...
 */
function sSubPx(sWithPx){
	try{
		var sPx = "px";
		var iPosPx = sWithPx.lastIndexOf(sPx);
		if (iPosPx > -1) return sWithPx.substr(0,iPosPx);
		else return sWithPx;
	} catch( e ) { } 
}

/**
 * Objet contenant les paramètres de la couche transparente
 */
function AlphaParam(sAlphaParam) {
	try{
		var aAlphaParam		= sAlphaParam.split("-");
		this.bckgColor		= aAlphaParam[0];
	} catch( e ) { } 
}

/*************************************************************************
*** Permet de contenir les informations utiles pour une séquence. Et   ***
*** principalement : une image d'arrière plan, un noeud de code HTML,  ***
*** une couche de transparence et les informations qui y sont          ***
*** relatives                                                          ***
*************************************************************************/

function Sequence(imageSrc, iSequence, iAlphaLayer, sAlphaParam) {
	try{
		this.imageSrc		= imageSrc;
		this.iSequence		= iSequence;
		this.oAlphaParam	= new AlphaParam(sAlphaParam);
		this.hAlphaLayer	= o_hGetById(iAlphaLayer);

		// BEGIN Génération du tableau de text
		this.hDiv = o_hGetById(this.iSequence);	// Le texte d'une séquence est chargé via une <!-- #include
		this.hDiv.parentNode.removeChild( this.hDiv );			// On le décroche donc du DOM
		this.hDiv.style.position = "absolute";
		this.hDiv.style.overflow = "hidden";
		this.hDiv.sequence = this;								// et on le stocke dans la séquence
		// END Génération du panneau de text

		/* Génération du bandeau supérieur */
		this.hTopLnk = document.createElement("DIV");
		this.hTopLnk.style.cssText = "font-size: 2";
		this.hTopLnk.style.height = nHeadlineHeight;
		/* /Génération du bandeau supérieur */
					
		/* Génération de l'image */
		if (navigator.appName.indexOf("Microsoft") > -1){
			var idName = "Image" + (nImgSequenceId++);            // Attention : ne pas changer la technique de création de noeud sous peine de mauvais retaillage de l'image. Why ? Je ne sais pas !!!!
			document.write("<IMG class='backGroundImg' noBorder='true' hspace='0' border='0' id='" + idName + "' style='display: none' />");
			this.hImg = o_hGetById(idName);                             // On créer un tag d'image
			this.hImg.parentNode.removeChild(this.hImg);
			this.hImg.style.width = "100%";
		} else {                    // Konqueror, Safari, Netscape, ...
			this.hImg = document.createElement("IMG");
			this.hImg.className = "backGroundImg";
			this.hImg.attributes["noBorder"] = true;
			this.hImg.border = 0;
			this.hImg.style.width = "100%";
		}
		this.hImg.ssrc = this.imageSrc;
		this.hImg.resize = sequenceResize;                 // On définit un gestionnaire d'évènements pour le resize => repositionnement des layers
		this.hImg.sequence = this;                                                 // On stocke l'image dans la séquence
		/* /Génération de l'image */

		/* Génération du calque transparent */
		//this.hAlphaLayer					= document.createElement("DIV");                            // On créé un noeud pour la couche transparente
		//this.hAlphaLayer.style.zIndex		= -1;                                          // Qui se présentera derrière le texte de la séquence
		this.hAlphaLayer.style.position		= "absolute";
		this.hAlphaLayer.style.background	= this.oAlphaParam.bckgColor;              // On force la couleur de transparence
		changeOpacity( this.hAlphaLayer, 75 );										// On force l'opacité en fonction du navigateur

		this.hDiv.appendChild( this.hAlphaLayer );                                // On accroche le layer transparent de le noeud de texte => positionnement relatif
		this.hAlphaLayer.sequence = this;
		/* /Génération du calque transparent */
		
		/* Génération des boutons de navigation */
		if (navigator.appName.indexOf("Microsoft") > -1){
			document.write("<img src='http://img.servihoo.com/orangebeta/I/manchetteArrowLeft.gif' notResize='true' id='btnLeft' style='position:absolute;' />");
			this.hLeftBtn = o_hGetById('btnLeft');
			this.hLeftBtn.parentNode.removeChild(this.hLeftBtn);

			document.write("<img src='http://img.servihoo.com/orangebeta/I/manchetteArrowRight.gif' notResize='true' id='btnRight' style='position:absolute;' />");
			this.hRightBtn = o_hGetById('btnRight');
			this.hRightBtn.parentNode.removeChild(this.hRightBtn);

		} else {
			this.hLeftBtn					= document.createElement("IMG");
			this.hLeftBtn.src				= "http://img.servihoo.com/orangebeta/I/manchetteArrowLeft.gif";
			this.hLeftBtn.notResize			= true;
			this.hLeftBtn.style.position	= "absolute";

			this.hRightBtn					= document.createElement("IMG");
			this.hRightBtn.src				= "http://img.servihoo.com/orangebeta/I/manchetteArrowRight.gif";
			this.hRightBtn.notResize		= true;
			this.hRightBtn.style.position	= "absolute";
		}
		this.hDiv.appendChild(this.hLeftBtn);
		this.hDiv.appendChild(this.hRightBtn);

		this.hLeftBtn.onclick  = function () { oScreenPlayer.prevSequence(); }      
		this.hRightBtn.onclick = function () { oScreenPlayer.nextSequence(); }      
		/* /Génération des boutons de navigation */
	} catch( e ) { } 
}




/*************************************************************************
*** Fonction de construction de l'objet de lecture de séquences. Deux  ***
*** méthodes sont disponibles afin de passer aux séquences précédentes ***
*** ou suivantes. La dernière séquence visionnée est stockée dans les  ***
*** cookies de l'utilisateur                                           ***
*************************************************************************/

/**
 * Objet de lecture et de gestion des séquences
 */
function ScreenPlayer() {
    this.aSequence = new Array();								// la liste des séquences de la manchette
    this.nCurrentSequence = 0;									// la séquence courante affichée
    this.iScreenPlayer = o_hGetById("ScreenPlayer");
    this.iScreenPlayer.component	= this;
    this.iScreenPlayer.position		= "relative";
    this.iScreenPlayer.overflow		= "hidden";

	this.hFaddingImg				= document.createElement( "DIV" );
	this.hFaddingImg.innerHTML		= "<img width='100%' height='100%' src='http://img.servihoo.com/orangebeta/I/z.gif' />";
	this.hFaddingImg.style.cssText	= "position: absolute;";
	this.iScreenPlayer.parentNode.appendChild( this.hFaddingImg );
	changeOpacity( this.hFaddingImg, 0 );

	/**
	 * Fonction permettant de déclencher le changement de séquence ...
	 */
	this.launchTimer = function ScreenPlayer_launchTimer() {
		try{
			if (nTimeForNextSequence > 0) {								// lancement du timer pour le changement automatique de séquence
				if (this.clockId) window.clearInterval(this.clockId);	// suppression de l'ancien timer
				this.clockId = window.setInterval("oScreenPlayer.nextSequence()", nTimeForNextSequence * 1000);	// passage à la séquence suivante toutes les nTimeForNextSequence secondes
			}
		} catch( e ) { } 
	}
    
	/**
	 * Fonction permettant d'ajouter une séquence à la liste des séquences 
	 */
	this.addSequence = function ScreenPlayer_addSequence( sequence ) {
		try{
			this.aSequence[this.aSequence.length] = sequence;
			sequence.screenPlayer = this;
		} catch( e ) { } 
	}

	/**
	 * Fonction permettant de passer à la séquence précédente
	 */
	this.prevSequence = function ScreenPlayer_getPreviousSequence() {
		try{
			if ((--this.nCurrentSequence) == -1) this.nCurrentSequence = this.aSequence.length-1;
			this.generateHTML();
		} catch( e ) { } 
	}

	/**
	 * Fonction permettant de passer à la séquence suivante
	 */
	this.nextSequence = function ScreenPlayer_getNextSequence() {
		try{
			if ((++this.nCurrentSequence) == this.aSequence.length) this.nCurrentSequence = 0;
			this.generateHTML();
		} catch( e ) { } 
	}

	/**
	 * Fonction permettant l'affichage de la séquence 
	 */
	this.generateHTML = function ScreenPlayer_generateHTML() {
		try{
			if (this.aSequence.length == 0) {
				alert("You must add sequences to the ScreenPlayer");
				throw true;
			}

			var sequence		= this.aSequence[this.nCurrentSequence];
			sequence.hImg.src	= sequence.hImg.ssrc;

			try {
				this.iScreenPlayer.removeChild( this.iScreenPlayer.firstChild );
				this.iScreenPlayer.removeChild( this.iScreenPlayer.firstChild );
				if ( this.aSequence.length > 1 ) {
					changeOpacity( this.hFaddingImg, 100 );
				}
				this.iScreenPlayer.removeChild( this.iScreenPlayer.firstChild );
			} catch( e ) { }
			if ( this.aSequence.length > 1 ) {
				changeOpacity( sequence.hImg, 0 );
			} else {
				this.hFaddingImg.style.display = "none";
			}

			this.iScreenPlayer.appendChild( sequence.hTopLnk );
			this.iScreenPlayer.appendChild( sequence.hDiv );                                   // Réaffecte la nouvelle séquence
			this.iScreenPlayer.appendChild( sequence.hImg );

			o_bSetCookie("lastSequence", this.nCurrentSequence);                   // Mémorise dans les cookies la dernière séquence visionnée
			this.launchTimer();

			window.onresize();
			if ( this.aSequence.length > 1 ) {
				new Fadding(sequence.hImg,this.hFaddingImg,faddingFinished);
			}
		} catch( e ) { } 
	}
    
	/**
	 * Fonction permettant de démarrer le défilement des séquences
	 */
    this.start = function ScreenPlayer_start() {
		try{
			this.nCurrentSequence = o_sGetCookie("lastSequence"); // recherche de la dernière séquence vue
			// Si aucune séquence trouvée dans les cookies ou séquence unique ou on force à la première séquence => première séquence
			if (this.nCurrentSequence == null || this.nCurrentSequence>=this.aSequence.length || bFixedOrder == true)
				this.nCurrentSequence = -1;
			this.nextSequence();
		} catch( e ) { } 
	}
}

/**
 * Fonction lancée à la fin d'un fondu entre deux images successives du screenplayer 
 */
function faddingFinished() {
	try{
		oScreenPlayer.hFaddingImg.firstChild.src = oScreenPlayer.aSequence[oScreenPlayer.nCurrentSequence].hImg.src;
	} catch( e ) { } 
}

/////////////////////////////
// POUR AFFICHER LA GRILLE //
/////////////////////////////

/*************************************************************************
*** Utilisé pour connaître l'état de la table HTML à construire !      ***
*************************************************************************/

/**
 * Objet permettant de gérer l'état de la grille
 */
function GridManager(nCellsPerLine){
	this.aCells			= new Array();		// Tableau de booleans pour localiser les TD restant à gérer (true si le td est occupé, false sinon)
	this.nCellsPerLine	= nCellsPerLine;	// nombre de colonne par ligne
	this.nCurrentX		= 0;				// position en X du prochain TD à remplir dans la grille
	this.nCurrentY		= 0;				// position en Y du prohain TD à remplir dans la grille
	this.nInsertLineNb	= 0;				// nombre de lignes devant être ajoutées

	/**
	 * Fonction d'ajouter une nouvelle ligne dans l'objet de gestion de la grille
	 */
	this.insertLine = function GridManager_insertLine() {
		try{
			var newLine = new Array();
			for(var i=0; i<this.nCellsPerLine; i++) newLine[i] = false;
			this.aCells[this.aCells.length] = newLine;
		} catch( e ) { } 
	}

	/**
	 * Fonction permettante de marquer une seule cellule
	 * nPosX est le numéro de la colonne dans laquelle se trouve la cellule à marquer
	 * nPosY est le numéro de la ligne dans laquelle se trouve la cellule à marquer
	 */
	this.markCell = function GridManager_markCell(nPosX, nPosY) {
		try{
			if (this.aCells.length <= nPosY) {
				for (var i=this.aCells.length; i <= nPosY; i++) this.insertLine();
			}
			if (nPosX >= this.nCellsPerLine) {
				throw "Bad index for CellMatrix";
			}
			this.aCells[nPosY][nPosX] = true;
		} catch( e ) { } 
	}

	/**
	 * Fonction permettant de marquer un groupe de cellule 
	 */
	this.markCells = function GridManager_markCells(nColspan, nRowspan) {
		try{
			for (var nX = 0; nX < nColspan; nX++) {
				for (var nY=0; nY < nRowspan; nY++) {
					this.markCell(this.nCurrentX, this.nCurrentY + nY);
				}
				this.nCurrentX++;
			}

			// ajout d'une ligne et mise à jour des positions X et Y courantes si nécessaire
			if (this.nCurrentX == this.nCellsPerLine) {
				this.nInsertLineNb ++;
				this.nCurrentX = 0;
				this.nCurrentY++;
				if (this.aCells.length<=this.nCurrentY) this.insertLine();
			}

			// mise à jour des positions X et Y courantes
			while(this.aCells[this.nCurrentY][this.nCurrentX] == true) {
				this.nCurrentX++;
				if (this.nCurrentX == this.nCellsPerLine) {
					this.nInsertLineNb ++;
					this.nCurrentX=0;
					this.nCurrentY++;
					if (this.aCells.length<=this.nCurrentY) this.insertLine();
				}
			}
		} catch( e ) { } 
	}

	/**
	 * Fonction permettant d'afficher l'état de la grille
	 * Utilisée pour le debogage
	 */
	this.displayMatrix = function GridManager_displayMatrix() {
		try{
			var theString = "";
			for(var line=0; line<this.aCells.length; line++) {
				for(var column=0; column<this.nCellsPerLine; column++) {
					theString += (this.aCells[line][column] ? "true " : "false") + " - ";
				}
				theString += "\n";
			}
			alert(theString);
		} catch( e ) { } 
	}

	return this;
}

/*************************************************************************
*** Génération de la grille de vignettes                               ***
*************************************************************************/

function DisplayGrid(nCellsPerLine) {
    this.nCellsPerLine	= nCellsPerLine;		// nombre de colonne dans la grille
    this.currentPos		= 1;
    this.oGridManager	= new GridManager(this.nCellsPerLine);
    oDisplayGrid = this;
    document.writeln("<TABLE class='grid' cellspacing='0' cellpadding='0' border='0' id='grid'><TR></TR></TABLE>");
    this.hGrid = o_hGetById("grid");
	this.hCurrentLine = this.hGrid.firstChild.lastChild;

	/**
	 * Fonction permettant d'ajouter une cellule dans la grille
	 */
    this.addCell = function DisplayGrid_addCell(iCell, nColspan, nRowspan) {
		try{
			// si on doit insérer une nouvelle ligne
			while (this.oGridManager.nInsertLineNb > 0) {
				this.hCurrentLine = document.createElement("TR");
				this.hGrid.firstChild.appendChild(this.hCurrentLine);	// ajout d'un TR dans le TABLE
				this.oGridManager.nInsertLineNb --;
			}
			var hTd = document.createElement("TD");	// création de la cellule
			hTd.gridMarker = true;					// on marque le TD principal (pour le retrouver facilement dans la fonction resize)
			// Affection des points de la cellule
			hTd.colSpan = nColspan;
			hTd.rowSpan	= nRowspan;

			// On décroche le bloc de la DOM
			var hCell = o_hGetById(iCell);
			hCell.parentNode.removeChild(hCell);
			hTd.appendChild(hCell);	// ajout du bloc dans le TD
			hCell.style.height = "100%";

			hTd.className = "gridCell";
			this.hCurrentLine.appendChild(hTd);	// ajout du TD dans le TR de la grille
			
			this.currentPos += nColspan;
			this.oGridManager.markCells(nColspan, nRowspan);	// on ajoute le container dans l'objet permettant de gérer la grille

			if (bStreamViewer == true) {                                              // Pour la pages d'affichage des flux dynamiques
				var titleNode = hTd.getElementsByTagName("H5");                    // Ce fut une demande de Laurent Faribault.
				titleNode[0].innerHTML += "<BR><SPAN style='text-transform: lowercase;'>( " + iCell + " )</SPAN>";
			}
		} catch( e ) { }
	}

	/**
	 * Fonction permettant de redimensionner les images de la grille
	 */
    this.resize = function DisplayGrid_resize(){
		var aGridImg = this.hGrid.getElementsByTagName("IMG");
		for(var i = 0; i < aGridImg.length; i++) {
			try {
				var hImg = aGridImg[i];
				if (hImg.attributes["notResize"] || hImg.notResize) continue;	// on ne retaille pas ces images, donc on passe à l'image suivante
				// on récupère le td dans la grille qui contient l'image que l'on veut retailler
				var hTd = hImg.parentNode;
				while(hTd.gridMarker != true) hTd = hTd.parentNode; 

				var nColSpan	= hTd.colSpan;		// colspan de la cellule
				var nBordWidth	= (nColSpan-1);	// nombre de pixel à soustraire (prise en compte de la largeur de la bordure entre les cellules)

				// on détermine la largeur de l'image en fonction de la résolution
				var nGridWidth = document.body.clientWidth;
				if (nGridWidth < nWindowMinWidth){
					nGridWidth = nWindowMinWidth;
				} else if (nGridWidth > nWindowMaxWidth) {
					nGridWidth = nWindowMaxWidth;
					o_hGetById("SubBody").style.width = nWindowMaxWidth;
				} else {
					o_hGetById("SubBody").style.width = "100%";
				}
				var nImgWidth	= ((nGridWidth - nNavWidth) / this.nCellsPerLine) * nColSpan - nBordWidth;
				var nTdWidth	= nImgWidth;
				if (hImg.attributes["half"] || hImg.half) nImgWidth /= 2;	// demie largeur (pour les blocs shopping par exemple)
				if (hImg.attributes["shopping"] || hImg.shopping) nImgWidth /= 2.28 ;   // format des blocs shopping
				if (!(hImg.attributes["noBorder"] || hImg.noBorder) && !(hImg.attributes["boxService"] || hImg.boxService) && hImg.className != 'backGroundImg'){
					nImgWidth -= 12;	// prise en compte des marges (pour l'instant 12px à gauche)
				}

				hTd.style.width				= Math.ceil(nImgWidth-0.5);
				if (document.all){
					// ca pose probleme sous Mozilla, mais indispensable pour IE (pas de resize auto a voir sous IE)
					hImg.style.width		= Math.ceil(nImgWidth-0.5);
				} 
			} catch(e) { }
		}
	}
	return this;
}


/*******************************************************
 ********* LES FONCTIONS POUR GERER LE FORMULAIRE VOL
 ******************************************************/


/*****************************************
 * FONCTION COMMUNE AUX FORMULAIRES 
 *****************************************/
// retourne un pointeur à partir d'un identifiant HTML
function i2h(id) {
	try{
		handler = (document.getElementById(id))?document.getElementById(id):false;
		return handler;
	} catch( e ) { } 
}


function addSelectOption( Hselect, index, title, value) {
	try{
		Hselect.options[index] = new Option( title, value);
	} catch( e ) { } 
}



/*****************************************
 * FONCTION SPECIFIQUE AU FORMULAIRE VOL
 *****************************************/

function ShowCalendar(dt,iDivCalendar) {
	try{
		var tDate = new Date( yearToday, monthToday-1, dayToday);
		var calDate = new Date(dt);
		calDate.setDate(1);
		calDate.setHours(23);
		calDate.setMinutes(59);
		calDate.setSeconds(59);
		var uDate = new Date(tDate);
		uDate.setDate(uDate.getDate()+lastDate);
		tDate.setDate(tDate.getDate()+firstDate);

		var cyear = calDate.getFullYear();
		var isLeapYear = (((cyear % 4 == 0) && (cyear % 100 != 0)) || (cyear % 400 == 0));
		mDays[1] = (isLeapYear)?29:28;
	 
		var calStr = '<div class="calend" align="center"><table border="0" cellspacing="0" cellpadding="0" class="c-crmonthcell">';
		calStr += '<tr>';

		calDate.setMonth(calDate.getMonth()-1);
		tDate.setMonth(tDate.getMonth()-1);

		calStr +='<td align=center class="c-titledaycell" width="100%">';
		if (calDate>tDate){
			calStr +='<a href="javascript:ShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><image src="http://img.servihoo.com/orangebeta/I/Voyages/prev.gif" border="0" width=13 notResize="true"></a>&nbsp;';
		}
		tDate.setMonth(tDate.getMonth()+1);
		calDate.setMonth(calDate.getMonth()+1);

		calStr += '<span style="width:90px">'+mNames[calDate.getMonth()]+' '+calDate.getFullYear()+'</span>';
		calDate.setMonth(calDate.getMonth()+1);

		if (calDate<uDate){
			calStr +='&nbsp;<a href="javascript:ShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><image src="http://img.servihoo.com/orangebeta/I/Voyages/next.gif" notResize="true" border="0" width=13>';
		}
		calStr += '</td>';
		calStr += '<td align="right" class="c-titledaycell"><a href="#" onclick="cl.style.display=\'none\'; selectState( false);return false;" class="close"><img src="http://img.servihoo.com/orangebeta/I/Voyages/close.gif" style="vertical-align:middle" notResize="true" border="0" width=13/>&nbsp;'+calClose+'</a></td>';

		calStr += '</tr>';
		calStr += '<tr><td colspan="2">';
		calStr += '<table width="100%" border="0" cellspacing="1" cellpadding="0" class="c-alldaycell">';

		calDate.setMonth(calDate.getMonth()-1);
		for(var x=0;x<dNames.length;x++) {
			calStr += (x==0)
				?'<tr><td align=center class="c-titledaycell">'+dNames[x]+'</td>'
				:'<td align=center class="c-titledaycell">'+dNames[x]+'</td>';
		}
		calStr+='</tr>';
		calStr+= '<tr>';

		var cnt = 0,clDate = (calDate.getDay()==0)?6:calDate.getDay()-1;
		for(var x=0;x<clDate;x++) {
			calStr += '<td class="c-prevdaycell">&nbsp;</td>';
			cnt++;
		}  
		for(var x=0;x<mDays[calDate.getMonth()];x++) {
			calDate.setDate(x+1);
			if(calDate >= tDate && calDate <= uDate) {
				if(cnt > 4) {
					calStr+=(cnt==0)
						?'<tr><td width="14" align="center" class="c-crdaycell">'
						:'<td width="14" align="center" class="c-crdaycell">';
				} else {
					calStr+=(cnt==0)
						?'<tr><td width="14" align="center" class="c-crdaycell">'
						:'<td width="14" align="center" class="c-crdaycell">';
				}
				calStr +='<a href="javascript:setDay(\''+(((calDate.getMonth()+1)<10)?0+''+(calDate.getMonth()+1):(calDate.getMonth()+1))+'-'+calDate.getFullYear()+'\',\''+(((x+1)<10)?0+''+(x+1):(x+1))+'\');	selectState(false);" class="c-jourclic">'+(x+1)+'</a></td>';
			} else {
				calStr +=(cnt==0)
					?'<tr><td width="14" align="center" class="c-prevdaycell">'
					:'<td width="14" align="center" class="c-prevdaycell">';
				calStr+=(x+1)+"&nbsp;</td>"
			}
			cnt++;

			if(cnt == 7) {
				calStr +='</tr>';
				cnt=0;
			}
		}
		if(cnt<7) {
			for( j=1; j<=7-cnt; j++) {
				calStr+='<td class="c-prevdaycell">&nbsp;</td>';
				if( j==7-cnt) {
					calStr+='</tr>';
				}
			}
		}
		calStr+='</table></div>';
		calStr+='</div>';
		cl = document.getElementById(iDivCalendar);
		cl.style.display='';
		cl.innerHTML=calStr;
	} catch( e ) { } 
}

function Calendar( Day, Month, dateFld,iDivCalendar) {
	try{
		cMonthYearField=Month;
		cMonthYearFieldVal = document.getElementById(Month).options[document.getElementById(Month).selectedIndex].value;
		cDateField=Day;
		cDayFieldVal = document.getElementById(Day).options[document.getElementById(Day).selectedIndex].value;
		cDayField = dateFld;
		newDate = new Date(cMonthYearFieldVal.substr(3,4)+"/"+cMonthYearFieldVal.substr(0,2)+"/"+cDayFieldVal);
		selectState(true);
		ShowCalendar(newDate,iDivCalendar);
	} catch( e ) { } 
}

function setDay(MYnm,Dnm) {
	try{
		element1 = i2h(cMonthYearField);
		element2 = i2h(cDateField);
		cl.style.display='none';
		setDDValue( element1, MYnm);
		setDDValue( element2, Dnm);
		if (cDayField) {
			calcDay( cDateField, cMonthYearField, cDayField);
		}
		upDate();
	} catch( e ) { } 
}

function calcDay(nm,nm2,day) {
	try{
		dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
		monthVal = i2h(nm2).options[i2h(nm2).selectedIndex].value;
		var isLeapYear = (((monthVal.substr(3,4) % 4 == 0) && (monthVal.substr(3,4) % 100 != 0)) || (monthVal.substr(3,4) % 400 == 0));
		mDays[1] = (isLeapYear)?29:28;
		if(dateVal > mDays[monthVal.substr(0,2)-1]) {
			setDDValue(i2h(nm),mDays[monthVal.substr(0,2)-1]);
			dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
		}

		newDate = new Date(monthVal.substr(3,4)+"/"+monthVal.substr(0,2)+"/"+dateVal);
		i2h(day).innerHTML = days[newDate.getDay()];
	} catch( e ) { } 
}


function rSetCal(day,month,year) {
	try{
		dateCal = day+'-'+month+'-'+year;
		dayCal = (day.length < 2)?'0'+day:day;
		monthCal = month;
		yearCal = year;
	} catch( e ) { } 
}

function today_date(plusdays) { //renvoie la date du jour plus plusday
	try{
		if ((typeof plusdays == 'undefined') || (plusdays == '')) {
			plusdays=0;
		}
		var date = new Date(yearToday,monthToday*1-1, dayToday);
		date.setDate(date.getDate() + plusdays);
		var d  = date.getDate();
		var day = (d < 10) ? '0' + d : d;
		var m = (date.getMonth()*1)+1;
		var month = (m < 10) ? '0' + m : m;
		var yy = date.getYear();
		var year = (yy < 1000) ? yy + 1900 : yy;
		rSetCal(day, month, year);
		return(day + "-" + month + "-" + year);
	} catch( e ) { } 
}

/* une seconde fonction a faire */
function initFormVol() {
	try{
		i2h("sArrivalDate").value = today_date(9);
		i2h("sDepartDate").value = today_date(8);
	} catch( e ) { } 
}

/* une seconde fonction a faire */
function init2FormVol() {
	try{
		var dateD = i2h("sDepartDate").value;
		var dateA = i2h("sArrivalDate").value;
		setDDValue(i2h("sArrivalDate2"), dateA.substr(3,7));
		setDDValue(i2h("sArrivalDate1"), dateA.substr(0,2));
		calcDay('sArrivalDate1','sArrivalDate2','DDayOfWeek');
		setDDValue(i2h("sDepartDate2"), dateD.substr(3,7));
		setDDValue(i2h("sDepartDate1"), dateD.substr(0,2));
		calcDay('sDepartDate1','sDepartDate2','DepartDayOfWeek');
	} catch( e ) { } 
}


/* une seconde fonction a faire */
function upDate() {
	try{
		dateD = new Date(i2h("sDepartDate2").value.substr(3,4),i2h("sDepartDate2").value.substr(0,2),i2h("sDepartDate1").value);
		dateA = new Date(i2h("sArrivalDate2").value.substr(3,4),i2h("sArrivalDate2").value.substr(0,2),i2h("sArrivalDate1").value);
		if (dateA < dateD) {
			var dateG = dateD;
			dateG.setDate(dateG.getDate() + 0); //ex : J+1
			var d  = dateG.getDate();
			var day = (d < 10) ? '0' + d : d;
			var m = dateG.getMonth();
			var month = (m < 10) ? '0' + m : m;
			var yy = dateG.getYear();
			var year = (yy < 1000) ? yy + 1900 : yy;

			var good_monthyear = month + '-' + year;
			var good_day = day;
			setDDValue(i2h("sArrivalDate2"), good_monthyear);
			setDDValue(i2h("sArrivalDate1"), good_day);
			calcDay('sArrivalDate1','sArrivalDate2','DDayOfWeek');
		}
		i2h("sDepartDate").value = i2h("sDepartDate1").value + '-' + i2h("sDepartDate2").value;
		i2h("sArrivalDate").value = i2h("sArrivalDate1").value + '-' + i2h("sArrivalDate2").value;
	} catch( e ) { } 
}

/* une seconde fonction a faire NP */
function validFormVol() {
	try{
		var strAlert = '';
		if(i2h('psAdults').value=='0' && i2h('psChildren').value=='0')
		strAlert += "Le nombre de passagers ne peut être nul.\n";
		if(i2h('sDepartLocation').value=="")
		strAlert += "La ville de départ doit être spécifiée.\n";
		if(i2h('sArrivalLocation').value=="")	strAlert += "La ville d'arrivée doit être spécifiée.\n";

		currentDate = new Date();
		v_departDate = new Date(i2h('sDepartDate').value.substr(6,4),i2h('sDepartDate').value.substr(3,2)-1,i2h('sDepartDate').value.substr(0,2));
		if(currentDate.getTime()>v_departDate.getTime()) strAlert += "La date de départ doit être postérieure à la date courante.\n";
		if (document.form_vol.psFareType) var psFareType = (document.form_vol.psFareType.checked)?"S":"R";
		else var psFareType = "R";

		if (strAlert.length > 0) {
			alert(strAlert);
		} else {
			var url = "http://r.orange.fr/r?ref=W3ACC_hp_rechercher_vol&url=http://lr.voyages.orange.fr/FLIGHT/pages/invokeServlet.php?sTazzooFor=Orange";
				url+= "&sDepartDate=" + document.form_vol.sDepartDate.value;
				url+= "&sArrivalDate=" + document.form_vol.sArrivalDate.value;
				url+= "&sDepartLocation=" + document.form_vol.sDepartLocation.value;
				url+= "&sArrivalLocation=" + document.form_vol.sArrivalLocation.value;
				url+= "&psAdults=" + document.form_vol.psAdults.value;
				url+= "&psChildren=" + document.form_vol.psChildren.value;
				url+= "&psBabies=0";
				url+= "&psFareType=" + psFareType;
				document.location.href = url;
		}
		return false;
	} catch( e ) { } 
}

/* une seconde fonction a faire */
function selectState(hidden) {
	try{
		var state = (hidden)?'hidden':'visible';
		i2h("psAdults").style.visibility = state;
		i2h("psChildren").style.visibility = state;
		i2h("voyages_rechercher").style.visibility = state;
		i2h("formulaire_recherche").style.visibility = state;
	} catch( e ) { } 
}

function addSelectDate( champsJour, champsMois) {
	try{
		for( i=1; i<=31; i++) {
			addSelectOption( champsJour, i-1, i, (i<10)?"0"+i:i);
		}
		champsJour.options[dayCal-1].selected = true;
		for(i=0; i<13; i++) {
			mois = monthCal*1 + i - 1;
			mois = (mois<=0)?12+mois:mois;
			annee = (mois>12)?yearCal+1:yearCal;
			mois = (mois>12)?mois-12:mois;
			if (typeof noYear != "undefined" && noYear){
				addSelectOption( champsMois, i, mNamesShort[mois-1], ((mois<10)?"0"+mois:mois)+"-"+annee);
			} else {
				addSelectOption( champsMois, i, mNamesShort[mois-1]+" "+annee, ((mois<10)?"0"+mois:mois)+"-"+annee);
			}
		}
		champsMois.options[1].selected = true;
	} catch( e ) { } 
}

function setDDValue(oDropDown, sValue) {
	try{
		for(var iIndex=0; iIndex<oDropDown.options.length; ++iIndex) {
			if(oDropDown.options[iIndex].value == sValue) {
				oDropDown.selectedIndex = iIndex;
				break;
			}
		}
	} catch( e ) { } 
}

/************************************
 * FONCTION SPECIFIQUE A FORM SEJOUR
 ************************************/

function sejShowCalendar(dt,iDivCalendar) {
	try{
		var tDate = new Date( sejYearToday, sejMonthToday-1, sejDayToday);
		var calDate = new Date(dt);
		calDate.setDate(1);
		calDate.setHours(23);
		calDate.setMinutes(59);
		calDate.setSeconds(59);
		var uDate = new Date(tDate);
		uDate.setDate(uDate.getDate()+sejLastDate);
		tDate.setDate(tDate.getDate()+sejFirstDate);

		var cyear = calDate.getFullYear();
		var isLeapYear = (((cyear % 4 == 0) && (cyear % 100 != 0)) || (cyear % 400 == 0));
		sejMDays[1] = (isLeapYear)?29:28;
	 
		var calStr = '<div class="calend" align="center"><table border="0" cellspacing="0" cellpadding="0" class="c-crmonthcell">';
		calStr += '<tr>';

		calDate.setMonth(calDate.getMonth()-1);
		tDate.setMonth(tDate.getMonth()-1);

		calStr +='<td align=center class="c-titledaycell" width="100%">';
		if (calDate>tDate){
			calStr +='<a href="javascript:sejShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><image src="http://img.servihoo.com/orangebeta/I/Voyages/prev.gif" border="0" width=13 notResize="true"></a>&nbsp;';
		}
		tDate.setMonth(tDate.getMonth()+1);
		calDate.setMonth(calDate.getMonth()+1);

		calStr += '<span style="width:90px">'+sejMNames[calDate.getMonth()]+' '+calDate.getFullYear()+'</span>';
		calDate.setMonth(calDate.getMonth()+1);

		if (calDate<uDate){
			calStr +='&nbsp;<a href="javascript:sejShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><image src="http://img.servihoo.com/orangebeta/I/Voyages/next.gif" notResize="true" border="0" width=13>';
		}
		calStr += '</td>';
		calStr += '<td align="right" class="c-titledaycell"><a href="#" onclick="sejCl.style.display=\'none\'; sejSelectState( false);return false;" class="close"><img src="http://img.servihoo.com/orangebeta/I/Voyages/close.gif" style="vertical-align:middle" notResize="true" border="0" width=13/>&nbsp;'+sejCalClose+'</a></td>';

		calStr += '</tr>';
		calStr += '<tr><td colspan=2>';
		calStr += '<table width="100%" border="0" cellspacing="1" cellpadding="0" class="c-alldaycell">';

		calDate.setMonth(calDate.getMonth()-1);
		for(var x=0;x<dNames.length;x++) {
			calStr += (x==0)
				?'<tr><td align=center class="c-titledaycell">'+dNames[x]+'</td>'
				:'<td align=center class="c-titledaycell">'+dNames[x]+'</td>';
		}
		calStr+='</tr>';
		calStr+= '<tr>';

		var cnt = 0,clDate = (calDate.getDay()==0)?6:calDate.getDay()-1;
		for(var x=0;x<clDate;x++) {
			calStr += '<td class="c-prevdaycell">&nbsp;</td>';
			cnt++;
		}  
		for(var x=0;x<sejMDays[calDate.getMonth()];x++) {
			calDate.setDate(x+1);
			if(calDate >= tDate && calDate <= uDate) {
				if(cnt > 4) {
					calStr+=(cnt==0)
						?'<tr><td width="14" align="center" class="c-crdaycell">'
						:'<td width="14" align="center" class="c-crdaycell">';
				} else {
					calStr+=(cnt==0)
						?'<tr><td width="14" align="center" class="c-crdaycell">'
						:'<td width="14" align="center" class="c-crdaycell">';
				}
				calStr +='<a href="javascript:sejSetDay(\''+(((calDate.getMonth()+1)<10)?0+''+(calDate.getMonth()+1):(calDate.getMonth()+1))+'-'+calDate.getFullYear()+'\',\''+(((x+1)<10)?0+''+(x+1):(x+1))+'\');	sejSelectState(false);" class="c-jourclic">'+(x+1)+'</a></td>';
			} else {
				calStr +=(cnt==0)
					?'<tr><td width="14" align="center" class="c-prevdaycell">'
					:'<td width="14" align="center" class="c-prevdaycell">';
				calStr+=(x+1)+"&nbsp;</td>"
			}
			cnt++;

			if(cnt == 7) {
				calStr +='</tr>';
				cnt=0;
			}
		}
		if(cnt<7) {
			for( j=1; j<=7-cnt; j++) {
				calStr+='<td class="c-prevdaycell">&nbsp;</td>';
				if( j==7-cnt) {
					calStr+='</tr>';
				}
			}
		}
		calStr+='</table></div>';
		sejCl = document.getElementById(iDivCalendar);
		sejCl.style.display='';
		sejCl.innerHTML=calStr;
	} catch( e ) { } 
}

function sejCalendar( Day, Month, dateFld,iDivCalendar) {//Calendar( Day, Month, dateFld,iDivCalendar) {
	try{
		sejCMonthYearField=Month;
		cMonthYearFieldVal = document.getElementById(Month).options[document.getElementById(Month).selectedIndex].value;
		sejCDateField=Day;
		cDayFieldVal = document.getElementById(Day).options[document.getElementById(Day).selectedIndex].value;
		sejCDayField = dateFld;
		newDate = new Date(cMonthYearFieldVal.substr(3,4)+"/"+cMonthYearFieldVal.substr(0,2)+"/"+cDayFieldVal);
		sejSelectState(true);
		sejShowCalendar(newDate,iDivCalendar);
	} catch( e ) { } 
}

function sejSetDay(MYnm,Dnm) {//setDay(MYnm,Dnm) {
	try{
		element1 = i2h(sejCMonthYearField);
		element2 = i2h(sejCDateField);
		sejCl.style.display='none';
		sejSetDDValue( element1, MYnm);
		sejSetDDValue( element2, Dnm);
		if (sejCDayField) {
			sejCalcDay( sejCDateField, sejCMonthYearField, sejCDayField);
		}
	} catch( e ) { } 
}

function sejCalcDay(nm,nm2,day) {//calcDay(nm,nm2,day) {
	try{
		dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
		monthVal = i2h(nm2).options[i2h(nm2).selectedIndex].value;
		var isLeapYear = (((monthVal.substr(3,4) % 4 == 0) && (monthVal.substr(3,4) % 100 != 0)) || (monthVal.substr(3,4) % 400 == 0));
		sejMDays[1] = (isLeapYear)?29:28;
		if(dateVal > sejMDays[monthVal.substr(0,2)-1]) {
			sejSetDDValue(i2h(nm),sejMDays[monthVal.substr(0,2)-1]);
			dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
		}
		newDate = new Date(monthVal.substr(3,4)+"/"+monthVal.substr(0,2)+"/"+dateVal);
		i2h(day).value = sejDays[newDate.getDay()];
		i2h(day).title = sejDays2[newDate.getDay()];
	} catch( e ) { } 
}

function sejRSetCal(day,month,year) { //rSetCal(day,month,year) {
	try{
		dateCal = day+'-'+month+'-'+year;
		dayCal = (day.length < 2)?'0'+day:day;
		monthCal = month;
		yearCal = year;
	} catch( e ) { } 
}

function sejToday_date(plusdays) {//today_date(plusdays) { //renvoie la date du jour plus plusday
	try{
		if ((typeof plusdays == 'undefined') || (plusdays == '')) {
			plusdays=0;
		}
		var date = new Date(sejYearToday,sejMonthToday*1-1, sejDayToday);
		date.setDate(date.getDate() + plusdays);
		var d  = date.getDate();
		var day = (d < 10) ? '0' + d : d;
		var m = (date.getMonth()*1)+1;
		var month = (m < 10) ? '0' + m : m;
		var yy = date.getYear();
		var year = (yy < 1000) ? yy + 1900 : yy;
		sejRSetCal(day, month, year);
		return(day + "-" + month + "-" + year);
	} catch( e ) { } 
}

function sejInitForm() {//initFormSejour() {
	try{
		i2h("sejDepartDate").value = sejToday_date(8);
	} catch( e ) { } 
}

function sejInit2Form() {//init2FormSejour() {
	try{
		var dateD = i2h("sejDepartDate").value;
		sejSetDDValue(i2h("sejDepartDate2"), dateD.substr(3,7));
		sejSetDDValue(i2h("sejDepartDate1"), dateD.substr(0,2));
		sejCalcDay('sejDepartDate1','sejDepartDate2','sejDepartDayOfWeek');
	} catch( e ) { } 
}

function sejValidForm() {//validFormSejour() {
	try{
		// pour comparaison entre date demandée et date du jour :
		var url; var where;
		var batch_id; var sDepartLocation; var sDepartDate; var iDateSpread; var iDuration; var iPrice; var sMinPrice; var sMaxPrice; var sDestinationCountry;
		currentDate = new Date();
		sDepartDate = i2h('sejDepartDate').value;
		if (sDepartDate == 'Indifférent') {
			sDepartDate = '';
			wantedDate = '';
		} else {
			wantedDate = new Date(sDepartDate.substr(6,4),sDepartDate.substr(3,2)-1,sDepartDate.substr(0,2));
		}
		url = 'http://rl.orange.fr/r?ref=wvoyages_rechercher_sejours&url=http://lr.voyages.orange.fr/VACATION/pages/results.php?sTazzooFor=Orange';

		// recuperation des valeurs au bon format :
		sDepartLocation = i2h('sejDepartLocation').value;
		batch_id = i2h('sDestinationCountry').value;
		iDuration = i2h('iDuration').value;
		/*if (iPrice != '') {
			WorkArray = iPrice.split('-');
			sMinPrice = WorkArray[0];
			sMaxPrice = WorkArray[1];
		} else {
			sMinPrice = '';
			sMaxPrice = '';
		}*/

		strAlert = "";
		if(sDestinationCountry == '')
			strAlert += "Le pays d'arrivée doit être spécifié.\n";
		if((sDepartDate == ''))
			strAlert += "La date de départ doit être précisée.\n";
		if((sDepartDate != '') && (currentDate.getTime()>wantedDate.getTime()))
			strAlert += "La date de départ doit être postérieure à la date courante.\n";
		if(strAlert) {
			alert(strAlert);
		} else {
			// construction de l'url
			url = url + "&iDuration=" + iDuration + "&batch_id=" + batch_id + "&sDepartDate=" + sDepartDate;
			location.href = url;
		}
		return false;
	} catch( e ) { } 
}

function sejSelectState(hidden) {
	try{
		var state = (hidden)?'hidden':'visible';
		i2h("validFormSejour").style.visibility = state;
		i2h("formulaireSejour").style.visibility = state;
	} catch( e ) { } 
}

function sejAddSelectDate( champsJour, champsMois) {
	try{
		for( i=1; i<=31; i++) {
			addSelectOption( champsJour, i-1, i, (i<10)?"0"+i:i);
		}
		champsJour.options[dayCal-1].selected = true;
		for(i=0; i<13; i++) {
			mois = monthCal*1 + i - 1;
			mois = (mois<=0)?12+mois:mois;
			annee = (mois>12)?yearCal+1:yearCal;
			mois = (mois>12)?mois-12:mois;
			addSelectOption( champsMois, i, sejMNamesShort[mois-1]+" "+annee, ((mois<10)?"0"+mois:mois)+"-"+annee);
		}
		champsMois.options[1].selected = true;
	} catch( e ) { } 
}

function sejSetDDValue(oDropDown, sValue) {
	try{
		for(var iIndex=0; iIndex<oDropDown.options.length; ++iIndex) {
			if(oDropDown.options[iIndex].value == sValue) {
				oDropDown.selectedIndex = iIndex;
				break;
			}
		}
	} catch( e ) { } 
}

function franceBresil(){
	try{
		var nTemps = (new Date(2006,6,9,20,0,0).getTime() - new Date().getTime())/1000;
		var nDay = Math.floor(nTemps/86400);
		var nHeure = Math.floor(nTemps/3600);
		var nMinute = Math.floor((nTemps - nHeure*3600)/60);
		var text = 'France-Italie ';
		if (nDay >= 1 ) text += 'j-'+ nDay;
		else if (nHeure >= 1 ) text += 'dans '+ nHeure +'h';
		else if (nHeure >= 0 ) text += 'dans '+ nMinute +'m';
		else if(nHeure > -2) {}
		else text = "Coupe du Monde";

		return text;
	} catch( e ) { } 
}

function Pop(theURL){
      var w_width = 490;
      var w_height = 350;
      var screen_width = screen.width;
      var screen_height = screen.height;
      var w_top = (screen_height/2) - (w_height/2);
      var w_left = (screen_width/2) - (w_width/2);
      window.open(theURL,'','scrollbars=yes,width='+w_width+',height='+w_height+', top='+w_top+',left='+w_left+'');
   }
