var Action = "";
var Param1 = "";
var Param2 = "";
var Param3 = "";
var Param4 = "";

Action = getVar('C');
Param1 = getVar('P1');
Param2 = getVar('P2');
Param3 = getVar('P3');
Param4 = getVar('P4');

/* Titre : Appel aux pages d'affichage */
function Appel(Ind,Haut,Type,Eff)
 {
	// alert('Param');
	// alert(Param1 );alert(Param2);alert(Param3);alert(Param4);
	DiaporamaA() ;
	switch (Action)
	{
		case 'C':
			Ind = Param1 * 1;
			Haut = Param2 * 1;
			Type = Param3 * 1;
			Eff = Param4 ;
			
			EffPAram();
			break;
		case 'G':
			 ContenueGen(Param1,Param2);
			 
			 EffPAram();
			 return;
			break;
		case 'D':
			ContenueDiap(Param1 * 1 , Param2 * 1,Param3);
			
			EffPAram();
			return;
			break;
		case 'J':
			Ind = Param1 * 1;
			Haut = Param2 * 1;
			Type = Param3 * 1;
			Eff = Param4 ;
			
			EffPAram();
			AppelA(Ind,Haut,Type,Eff);
			return;
			break;
	}
	if( Eff=='Y' )
	{
		document.getElementById('contenueG').innerHTML = "";
		document.getElementById('contenueC').innerHTML = "";
		document.getElementById('contenueP').innerHTML = "";
	}
	// alert('eeee');
	// alert(Ind );alert(Haut);alert(Type);alert(Eff);

	switch (Type)
	{
		case 1://Contenue P
			Contenue('P',Haut,Ind);
			break;
		case 2://Contenue C
			Contenue('C',Haut,Ind);
			break;
		case 4://Contenue G
			Contenue('G',Haut,Ind);		
			break;
		case 3://Contenue P & C
			Contenue('P',Haut,Ind);
			Contenue('C',Haut,Ind);			
			break;
		case 5://Contenue P & G
			Contenue('G',Haut,Ind);					
			Contenue('P',Haut,Ind);
			break;
		case 6://Contenue C & G
			Contenue('C',Haut,Ind);
			Contenue('G',Haut,Ind);			
			break;
		case 7://Contenue P & C & G
			Contenue('P',Haut,Ind);
			Contenue('C',Haut,Ind);
			Contenue('G',Haut,Ind);			
			break;
		default:
			break;
	}
 }
function AppelA(Ind,Haut,Type,Eff)
 {
	// alert('Param');
	// alert(Param1 );alert(Param2);alert(Param3);alert(Param4);
	DiaporamaA() ;
	switch (Action)
	{
		case 'C':
			Ind = Param1 * 1;
			Haut = Param2 * 1;
			Type = Param3 * 1;
			Eff = Param4 ;
			
			EffPAram();
			Appel(Ind,Haut,Type,Eff);
			return;
			break;
		case 'G':
			ContenueGen(Param1,Param2);
			EffPAram();
			return;
			break;
		case 'D':
			ContenueDiap(Param1 * 1, Param2 * 1,Param3);
			EffPAram();
			return;
			break;
		case 'J':
			Ind = Param1 * 1;
			Haut = Param2 * 1;
			Type = Param3 * 1;
			Eff = Param4 ;
			
			EffPAram();
			break;

	}
	// alert('eeee');
	// alert(Ind );alert(Haut);alert(Type);alert(Eff);
	if( Eff=='Y' )
	{
		document.getElementById('contenueG').innerHTML = "";
		document.getElementById('contenueC').innerHTML = "";
		document.getElementById('contenueP').innerHTML = "";
	}
	switch (Type)
	{
		case 1://Contenue P
			Contenue('P',Haut,Ind);
			break;
		case 2://Contenue C
			Contenue('C',Haut,Ind);
			break;
		case 4://Contenue G
			Contenue('G',Haut,Ind);		
			break;
		case 3://Contenue P & C
			Contenue('P',Haut,Ind);
			Contenue('C',Haut,Ind);			
			break;
		case 5://Contenue P & G
			Contenue('G',Haut,Ind);					
			Contenue('P',Haut,Ind);
			break;
		case 6://Contenue C & G
			Contenue('C',Haut,Ind);
			Contenue('G',Haut,Ind);			
			break;
		case 7://Contenue P & C & G
			Contenue('P',Haut,Ind);
			Contenue('C',Haut,Ind);
			Contenue('G',Haut,Ind);			
			break;
		default:
			break;
	}
	 LectContenue (Ind);
 }
 
 function EffPAram()
 {
 			Action = '';
			Param1 = '';
			Param2 = '';
			Param3 = '';
			Param4 = '';
 }
/* Titre : Affichage du Contenu */
function Contenue(NoContenu,Haut,Gauche)
 {
     // alert('Contenu');
	 // alert(NoContenu);
	 // alert(Haut);
	 // alert(Gauche); 
	 new Ajax.Updater("contenue" + NoContenu , "cont/C_" + Haut + "_" + Gauche + "_" + NoContenu + ".cont", { method: 'get' });
	 if (NoContenu == 'P') GoogleAnalytics("/Cont_" + Haut + "_" + Gauche + ".htm");      
 }
 /* Titre : Affichage du Contenu Générique*/
function ContenueGen(Contenu,Fichier)
 {
     new Ajax.Updater(Contenu , "cont/C_" + Fichier + ".cont", { method: 'get' });
 }
 
function LectContenue (Conten) {
     switch (Conten) {
         case 0:
             strFichier = "cont/accueil.cont";
             break;
		case 99: // Gestion Carte de Noel
			strFichier = "cont/C_Carte3hvtt.cont"
         default:
             strFichier = "PAS/PAS.cont";
             break;
     }
	 //alert (strFichier);
     new Ajax.Request(strFichier, { method: 'get',
         onSuccess: function(transport, json) { EvalContenue(transport.responseText); },
         onFailure: function() {
         alert("Une erreur est survenue lors de l'appel AJAX.\nRecharger la page devrait résoudre le problème. -- " + strFichier)
         } 
     });
 }
 
/* Ouverture d'une Page */
function OpenLien(URL, Target)
{
    GoogleAnalytics(URL) 
    window.open (URL,Target,'','');
}

/* Fontion pour le Diaporama */
 var Fichier 	= new Array;
 var Texte 		= new Array;
 var FichierA 	= new Array;
 var Comm		= new Array;
 var indexPhoto = 0;
 var photoMini 	= 1;
 var photoMaxi 	= 1;
 var photo 		= photoMini - 1;
 var photoDuree = 8000;
 var diapoTemps ;
 var photoHeight = 400;
 var photoWidth = 600 ;

 function ContenueDiap(Ind, Conten,Titre) {
     if (Ind == 1) {
        strFichier1 = "cont/C_Diaporama_1.cont";
		photoHeight = '45px';
		photoWidth = '60px' ;

        new Ajax.Updater(Titre, strFichier1, { method: 'get' });
        LectContenueDiap(Conten);
		document.getElementById('divCADRE').style.height = photoHeight;
		document.getElementById('divCADRE').style.width = photoWidth;
     }
     if (Ind == 2) {
        strFichier1 = "cont/C_Diaporama_2.cont";
		photoHeight = '45px';
		photoWidth = '60px' ;

        new Ajax.Updater(Titre, strFichier1, { method: 'get' });
        LectContenueDiap(Conten);
		
     }
     if (Ind == 3) {
        strFichier1 = "cont/C_Diaporama_1.cont";
		photoHeight = '450px';
		photoWidth = '600px' ;

        new Ajax.Updater(Titre, strFichier1, { method: 'get' });
        LectContenueDiap(Conten);
     }	 
     if (Ind == 4) {
        strFichier1 = "cont/C_Diaporama_3.cont";
		photoHeight = '110px';
		photoWidth = '150px' ;		
		photoDuree = 4000;
        new Ajax.Updater(Titre, strFichier1, { method: 'get' });
        LectContenueDiap(Conten);
     }	 
     if (Ind == 5) {
        strFichier1 = "cont/C_Diaporama_4.cont";
		photoHeight = '450px';
		photoWidth = '600px' ;		
		photoDuree = 4000;
        new Ajax.Updater(Titre, strFichier1, { method: 'get' });
        LectContenueDiap(Conten);
     }
     GoogleAnalytics("/" + Ind + "/" + Conten + "/ajaxDiap.htm");  
 }
 function LectContenueDiap(Conten) {
     //GoogleAnalytics("/2/" + Conten + "/ajaxDiap.htm");
     var indexPhoto = 1;
     var photoMini = 1;
     var photoMaxi = 1;
     var photo = photoMini - 1;
     window.clearTimeout(diapoTemps);

     switch (Conten) {
        case 1:
             strFichier = "diaporama/Drapeau.cont";
             break;
        case 2:
             strFichier = "diaporama/elcimai.cont";
             break;         
        case 3:
             strFichier = "diaporama/2009.cont";
             break;
        case 4:
             strFichier = "diaporama/2005.cont";
             break;
        case 5:
             strFichier = "diaporama/2004.cont";
             break;
        case 6:
             strFichier = "diaporama/2003.cont";
             break;
        case 7:
             strFichier = "diaporama/2002.cont";
             break;			 
        case 8:
             strFichier = "diaporama/2001.cont";
             break;			 
        case 9:
             strFichier = "diaporama/quelquesphotos.cont";
             break;			
        case 10:
             strFichier = "diaporama/3hvtt.cont";
             break;			
        case 11:
             strFichier = "diaporama/partenaire.cont";
             break;			 
        case 12:
             strFichier = "diaporama/TDF2010-Etape1.cont";
             break;			 
        case 13:
             strFichier = "diaporama/TDF2010-Etape2.cont";
             break;	
        case 14:
             strFichier = "diaporama/TDF2010-Etape3.cont";
             break;	
        case 15:
             strFichier = "diaporama/TDF2010-Etape4.cont";
             break;
        case 16:
             strFichier = "diaporama/TDF2010-Etape5.cont";
             break;
        case 17:
             strFichier = "diaporama/TDF2010-Etape6.cont";
             break;
        case 18:
             strFichier = "diaporama/TDF2010-Etape7.cont";
             break;			 
			 default:
             strFichier = "PAS/PAS.cont";
             break;
     }
	 //alert(strFichier);
     new Ajax.Request(strFichier, { method: 'get',
         onSuccess: function(transport, json) { EvalContenue(transport.responseText); },
         onFailure: function() {
         alert("Une erreur est survenue lors de l'appel AJAX.\nRecharger la page devrait résoudre le problème. -- " + strFichier)
         } 
     });
 }
 function EvalContenue(strCont) {
     
	 //alert ('Js');
	 //alert (strCont);
     eval(strCont);
 }
 function Diaporama() {
     window.clearTimeout(diapoTemps);
     photo = photo + 1;
     if (photo > photoMaxi) {
         photo = photoMini;
     }
     var PAGE = photo / photoMaxi;
     document.getElementById('divPage').innerHTML = photo + "/" + photoMaxi;
	 document.getElementById('divCOMMENT').innerHTML = Comm[photo];
	 if (	FichierA[photo] == "" )
	 {
		document.getElementById('divIMAGE').innerHTML = "<img src='" + Fichier[photo] + "' height='" + photoHeight  +"' Border='0' >";
	 }
	 else
	 {
		document.getElementById('divIMAGE').innerHTML = "<a href='" + FichierA[photo] + "' Target='Photo'><img src='" + Fichier[photo] + "' height='" + photoHeight   +"' Border='0' ></a>";
	 }
     document.getElementById('divImageTexte').innerHTML = Texte[photo];
     diapoTemps = window.setTimeout("Diaporama()", photoDuree);
 }
 function DiaporamaP() {
     photo = photo - 1;
     if (photo < photoMini) {
         photo = photoMaxi;
     }
     var PAGE = photo / photoMaxi;
     document.getElementById('divPage').innerHTML = photo + "/" + photoMaxi;
	 document.getElementById('divCOMMENT').innerHTML = Comm[photo];
	 if (	FichierA[photo] == "" )
	 {
		document.getElementById('divIMAGE').innerHTML = "<img src='" + Fichier[photo] + "' height='" + photoHeight +"' Border='0' >";
	 }
	 else
	 {
		document.getElementById('divIMAGE').innerHTML = "<a href='" + FichierA[photo] + "' Target='Photo'><img src='" + Fichier[photo] + "' height='" + photoHeight  +"' Border='0' ></a>";
	 }
	 document.getElementById('divImageTexte').innerHTML = Texte[photo];
 }
 function DiaporamaS() {
     photo = photo + 1;
     if (photo > photoMaxi) {
         photo = photoMini;
     }
     var PAGE = photo / photoMaxi;
     document.getElementById('divPage').innerHTML = photo + "/" + photoMaxi;
	 document.getElementById('divCOMMENT').innerHTML = Comm[photo];
	 if (	FichierA[photo] == "" )
	 {
		document.getElementById('divIMAGE').innerHTML = "<img src='" + Fichier[photo] + "' height='" + photoHeight  +"' Border='0' >";
	 }
	 else
	 {
		document.getElementById('divIMAGE').innerHTML = "<a href='" + FichierA[photo] + "' Target='Photo'><img src='" + Fichier[photo] + "' height='" + photoHeight  +"' Border='0' ></a>";
	 }
	 document.getElementById('divImageTexte').innerHTML = Texte[photo];
 }
 function DiaporamaA() {
     window.clearTimeout(diapoTemps);
 }
 /* Fin de la Fonction diaporama */
	
	
	function Marquage(PageM,Groupe,typ)
	{
		//GoogleA(PageM) ;
		//estat(PageM, Groupe);
		xiti(PageM, typ);
	}
	
 /* Titre: Google analytics */
 function GoogleAnalytics(NomFichier) 
 {
     Marquage(NomFichier,"Groupe",1);
	try {
    var pageTracker = _gat._getTracker("UA-120822-7"); // Prod
	//var pageTracker = _gat._getTracker("UA-120822-6"); // Test
    pageTracker._initData();
    pageTracker._trackPageview(NomFichier);
    } catch (e) {
        //throw e;
    }

 }

	
/* Marquage e-Stat	*/
/* 	var _UJS=0;
	var wr_detail = '';
	var cmkturl = "http://astatic.weborama.fr/js/adperf_network.js";
	var wr_site      = 26;
	var wr_page      = 265;
	var wr_board     = 289;
	var wr_boardsize = "1x1";
	var wr_floating  = 1;
	var wr_thema     = 0;	
	function estat(PageM, GroupaPage)
	{	
		var _s = '258058177149';
		var _p = PageM;
		var _c = GroupaPage;
		var _S="http://perso.estat.com/m/00/";
		var _M=_s+"?";_M+="n="+Math.round(Math.random()*1000000000);
		_M+="&c="+escape(_c);_M+="&p="+escape(_p);
		var _R;
		if(navigator.appName=='Netscape')_R=escape(document.referrer);
		else (top!=null && top.location!=null && typeof(top.location.href)=="string")?_R=escape(top.document.referrer):_R=escape(document.referrer);
		if (_R=="undefined"||_R=="")_R="_bm_";_M+="&r="+_R;
		if(typeof(screen)=="object")
		{
			_M+="&scw="+screen.width;
			_M+="&sch="+screen.height;
			_M+="&scp="+screen.colorDepth
		};
		
		document.getElementById("eStat").innerHTML = '<a href="http://persos.estat.com/statistiques/audience/'+_s+'" target="_blank"><img'+' border="0" src="'+_S+_M+'"></a>';
		wr_detail = _s.substring(6);
	}	 */

/* Marquage XITI */	
	function xiti(PageM, typ)
	{
		// Prod
		if (typ == 0 )
		{ 	
			Xt_param = 's=436387&p=';
		}		
		else
		{
			Xt_param = 's=436387&p=' + PageM ;
		}
		
		// Test	
/*		
		if (typ == 0 )
		{ 	
			Xt_param = 's=436386&p=';
		}		
		else
		{
			Xt_param = 's=436386&p=' + PageM ;
		}		
*/				
		try 
		{
			Xt_r = top.document.referrer;
		}
		catch(e) 
		{
			Xt_r = document.referrer; 
		}

		Xt_h = new Date();
		Xt_i = '<img width="80" height="15" border="0" alt="" ';
		Xt_i += 'src="http://logv10.xiti.com/orcr.xiti?'+Xt_param;
		Xt_i += '&hl='+Xt_h.getHours()+'x'+Xt_h.getMinutes()+'x'+Xt_h.getSeconds();
		if(parseFloat(navigator.appVersion)>=4)
		{
			Xt_s=screen;
			Xt_i+='&r='+Xt_s.width+'x'+Xt_s.height+'x'+Xt_s.pixelDepth+'x'+Xt_s.colorDepth;
		}
		Xt_i += '&ref='+Xt_r.replace(/[<>"]/g, '').replace(/&/g, '$')+'" title="Internet Audience">';
		document.getElementById("XiTi").innerHTML = Xt_i;
		//document.write(Xt_i);
		 
	}
	

