  var Images = new Array();
  Images[0] = 'caramel.jpg';
  Images[1] = 'spiderman.jpg';
  Images[2] = 'bleue.jpg';
  Images[3] = 'caramel.jpg';
  Images[4] = 'spiderman.jpg';
  Images[5] = 'bleue.jpg';
  Images[6] = 'caramel.jpg';
  Images[7] = 'spiderman.jpg';
  Images[8] = 'bleue.jpg';
  var indiceDebutAffiche=0;

function traceBandeau()	{
	var result ="<table height='100%'>";
	result+="<tr><td><center><FONT face='Comic Sans MS' color='#000066'><FONT SIZE=+2>Cinema Le Foyer</FONT></FONT></center></td></tr>";
	result+="<tr><td><img border='0' src='cine_nuit.jpg' height='125'></td></tr>";
	result+="<tr height='10%'><TD ><DIV ID='Programme' style='cursor:pointer;' onclick='loadProgramme()'><CENTER><FONT face='Comic Sans MS' size=+2 color='#8080E0'>Programme</FONT></CENTER></DIV></TD></tr>";
	result+="<tr height='10%'><TD><DIV ID='Salles' style='cursor:pointer;' onclick='Milieu.innerHTML=traceSalles()'><CENTER><FONT face='Comic Sans MS' size=+2 color='#c080c0'>Salles</FONT></CENTER></DIV></TD></tr>";
	result+="<tr height='10%'><TD><DIV ID='Acces' style='cursor:pointer;' onclick='Milieu.innerHTML=traceAcces()'><CENTER><FONT face='Comic Sans MS' size=+2 color='#008080'>Accès</FONT></CENTER></DIV></TD></tr>";
	result+="<tr height='10%'><TD><DIV ID='Telecharger' style='cursor:pointer;' onclick='Milieu.innerHTML=traceTelecharger()'><CENTER><FONT face='Comic Sans MS' size=+2 color='#8080E0'>Telecharger</FONT></CENTER></DIV></TD></tr>";
	result+="<tr height='15%'><TD></TD></tr>";
	result+=traceInfos();
	result+=traceTarifs();
	result+="</table>";
	return result;
}

function traceTelecharger() {
	dateFin = null;
	dateDebut = null;
	dateDepartSelected = 0;
	returnValue = "<TABLE height='20%' width='100%'>";
	returnValue+="<TR><TD><center><FONT face='Comic Sans MS' size=+2 color='#8080E0'>Construction de votre programme</font></center></TD></TR>";
	returnValue+="</TABLE>";
	returnValue+= "<center><TABLE height='30%' width='80%'>";
	returnValue+="<TR height='20%'>";
	returnValue+= "<TD width='30%'><FONT SIZE=+1><font color='#008080'>Date de début du programme</font></font></TD>";
	returnValue+= "<TD width='30%'><input type='text' name='date1' id='sel1' size='30'><input type='reset' value=' ... ' onclick='showCalendarSel1();'></TD>";
	returnValue+= "<TD width='30%'>Cliquez pour modifier la date...</TD>";
	returnValue+= "</TR>";
	returnValue+="<TR height='20%'>";
	returnValue+= "<TD width='30%'><FONT SIZE=+1><font color='#008080'>Date de fin du programme</font></font></TD>";
	returnValue+= "<TD width='40%'><input type='text' name='date2' id='sel2' size='30'><input type='reset' value=' ... ' onclick='showCalendarSel2();'></TD>";
	returnValue+= "<TD width='30%'>Cliquez pour modifier la date...</TD>";
	returnValue+= "</TR>";
	returnValue+="</TABLE></center>";
	return returnValue;
}

function traceMilieu() {
	var result ="<table height='100%' width='100%'>";
	result+="<tr><td><center><img border='0' src='cine_nuit.jpg'><p><FONT face='Comic Sans MS' color='#8080E0'><FONT SIZE=+2>Cinema Le Foyer</FONT></FONT></center></td></tr>";
	result+="</table>";
	return result;
}

function moinsIndiceDebutAffiche()	{
	if (indiceDebutAffiche>0)	{
		indiceDebutAffiche = indiceDebutAffiche - 1;
		document.getElementById("Menu").innerHTML=traceListeAffiche();
	}
}

function plusIndiceDebutAffiche()	{
   if (indiceDebutAffiche+8<Images.length)	{
		indiceDebutAffiche = indiceDebutAffiche + 1;
		document.getElementById("Menu").innerHTML=traceListeAffiche();
	}
}


function plusIndiceDebutJour() {
    indiceJourCourant++;
    loadProgramme();
}

function moinsIndiceDebutJour() {
    indiceJourCourant--;
    loadProgramme();
}

function put(indDiv,num){
	visuFilm(num);
}

function traceListeAffiche()	{
	var ind=0;
	var result = "<CENTER><TABLE cellspacing=0 cellpadding=0 width='100%' height='100%'><TR>";
	if (Images.length<9)	{
		for(ind=0; ind<Images.length; ind++)	{
			result +="<TD><CENTER><img style='cursor:pointer;' src="+Images[ind]+" onmouseover='put(1,"+ind+")' border='0' height='120' alt='pas d'image'></CENTER></TD>";
		}
	}
	else {
		if(indiceDebutAffiche>0)	{
			result +="<TD><CENTER><img style='cursor:pointer;' src='moins.bmp' onclick='moinsIndiceDebutAffiche()' border='0' height='120' alt='pas d'image'></CENTER></TD>";
		}
		else {
			result +="<TD><CENTER><img style='cursor:pointer;' src='vide.bmp' border='0' height='120' alt='pas d'image'></CENTER></TD>";
		}
		for(ind=indiceDebutAffiche; ind<indiceDebutAffiche+8; ind++)	{
			result +="<TD><CENTER><img style='cursor:pointer;' src="+Images[ind]+" onmouseover='put(1,"+ind+")' border='0' height='120' alt='pas d'image'></CENTER></TD>";
		}
		if (indiceDebutAffiche+8<Images.length)	{
			result +="<TD><CENTER><img style='cursor:pointer;' src='plus.bmp' onclick='plusIndiceDebutAffiche()' border='0' height='120' alt='pas d'image'></CENTER></TD>";
		}
		else {
			result +="<TD><CENTER><img style='cursor:pointer;' src='vide.bmp' border='0' height='120' alt='pas d'image'></CENTER></TD>";
		}
	}
	result+="</TR></TABLE></CENTER>";
	return result;
}

function traceInfos()	{
	var result ="";
	result+="<tr><td><center>";
	result+="<FONT><font color='#008080'>Répondeur : </font>";
	result+="<font color='#8080c0'>02.99.62.27.73<br></font>";
    result+="<FONT><font color='#008080'>Contact : </font>";
	result+="<font color='#8080c0'><a href='mailto:cinema.acigne@wanadoo.fr'>cinema.acigne@wanadoo.fr</a><br></font>";
	result+="<p></center></td></tr>";
	return result;
}


function traceAcces()	{
	var result="<TABLE width='100%' height='100%'><TR>";
	result+="<TD style='vertical-align: middle;'><center>";
	result+="<img border='1' src='plan.gif'>";
	result+="</center></TD>";
	result+="</TR></TABLE>";
	return result;
}

function traceSalles()	{
	var result="";
	result+="<TABLE width='100%' height='100%'><TR><TD>"; 
	result+="<TABLE width='100%' height='100%'>";
	result+="<TR height='40%'><TD><CENTER><H2><font color='#008080' >Salle Coline Serreau</font></H2><font color='#000066'>Contenant 205 places dont 10 avec accès handicapés,<BR> cette salle est équipée des sons numériques<br>Dolby SRD, Dolby SRDex et DTS</font></CENTER></TD></TR>";
	result+="<TR><TD><CENTER><img border='1' src='salle1.jpg'></CENTER></TD></TR>";
	result+="</TABLE>";
	result+="</TD>";
	result+="<TD>";
	result+="<TABLE width='100%' height='100%'>";
	result+="<TR><TD><CENTER><img border='1' src='salle2.jpg'></CENTER></TD></TR>";
	result+="<TR height='40%'><TD><CENTER><H2><font color='#008080' >Salle Art et essai</font></H2><font color='#000066'>Contenant 65 places dont 6 avec accès handicapés.<BR>Dédiée à l'Art et Essai, elle offre un cadre intime pour la projection des films.</font></CENTER></TD></TR>";
	result+="</TABLE>";
	result+="</TD></TR></TABLE>";
	return result;
}

function traceTarifs()	{
	var result="";
	result+="<tr><TD style='vertical-align: middle;'><center>";
	result+="<FONT SIZE=+1><font color='#008080'>Tarif Plein : </font>";
	result+="<font color='#8080c0'>4,8€<br></font>";
	result+="<font color='#008080'>Tarif Réduit : </font>";
	result+="<font color='#8080c0'>3,8€<br></font></font>";
	result+="<FONT>";
	result+="<font color='#000066'>-10 ans et le mercredi soir<br></font></font>";
	result+="<FONT SIZE=+1>";
	result+="<font color='#008080'>Carnet de 10 places : </font>";
	result+="<font color='#8080c0'>38€<p></font></font>";
	result+="</CENTER></TD></tr>";
	return result;
}

function traceAccueil()	{
	var result ="";
	result+="<table width='100%' height='100%'><tr>";
	result+="<td style='vertical-align: middle;'><p><CENTER><FONT face='Comic Sans MS' color='#8080E0'>Programme pdf du cinéma: <br>";
	result+="<a href='Programme/programme_27_08_08.pdf'>programme du 27 Août au 7 Septembre 2008</a><br>";
	result+="</FONT></center></td>";
	return result;
}

function LoadFilm(Id) {
    var xmlhttp2 = getHTTPObject(); 
    xmlhttp2.open("GET", 'Php/loadFilmById.php?Id='+Id); 
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
        if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
            document.getElementById("Milieu").innerHTML=xmlhttp2.responseText;
       }
    }
    xmlhttp2.send(null);
}

function ListeAffiche() {
    var Id = 2;
    var xmlhttp2 = getHTTPObject(); 
    xmlhttp2.open("GET", 'Php/listeAffiche.php'); 
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
        if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
            document.getElementById("Site").innerHTML=xmlhttp2.responseText;
       }
    }
    xmlhttp2.send(null);
}



function SaveFilmToXml() {
    var Id = 2;
    var xmlhttp2 = getHTTPObject(); 
    xmlhttp2.open("GET", 'Php/SaveFilmToXml.php?Id='+Id); 
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
        if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
            document.getElementById("Milieu").innerHTML="fichier sauvegardé";
       }
    }
    xmlhttp2.send(null);
}

function FilmXmlToHtml() {
    var xmlhttp2 = getHTTPObject(); 
    xmlhttp2.open("GET", 'Php/FilmXmlToHtml.php'); 
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
        if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
            document.getElementById("Milieu").innerHTML=xmlhttp2.responseText;

       }
    }
    xmlhttp2.send(null);
}

function updateSeance(numCase,jour,mois,annee){
    var xmlhttp2 = getHTTPObject();
    xmlhttp2.open("GET", 'Php/loadSeanceByDate.php?Jour='+jour+'&Mois='+mois+'&Annee='+annee);
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
       if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
          if (xmlhttp2.responseText.length>0) {
            document.getElementById(numCase).style.backgroundColor='#ddddff';
            document.getElementById(numCase).innerHTML=xmlhttp2.responseText;
          } else {
            document.getElementById(numCase).style.backgroundColor='#ccccff';
            document.getElementById(numCase).innerHTML="<center><FONT face='Comic Sans MS' color='#AA0000'>Programmation<p/>à venir</font></center>";
          }
       }
    }
    xmlhttp2.send(null);   
}

function loadProgramme(){
    var xmlhttp2 = getHTTPObject();
    xmlhttp2.open("GET", 'Php/loadProgramme.php?IndiceJourCourant='+indiceJourCourant);
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
        document.getElementById('Milieu').innerHTML=xmlhttp2.responseText;
    }
    xmlhttp2.send(null);   
}

function constructProgramme(){
    var xmlhttp2 = getHTTPObject();
    xmlhttp2.open("GET", 'Php/constructProgramme.php?DateDebut='+dateDebut+'&DateFin='+dateFin);
    vider_cache(xmlhttp2);
    xmlhttp2.onreadystatechange = function() {
	texte= "<TABLE height='20%' width='100%'>";
	texte+="<TR><TD><center><FONT face='Comic Sans MS' size=+2 color='#8080E0'>Construction de votre programme réalisée</font></center></TD></TR>";
	texte+="</TABLE>";
	texte+= "<center><TABLE height='30%' width='80%'>";
	texte+= "<TR height='30%'><TD><center><Input type='reset' value='Telecharger' onclick='self.location.href=\"Php/uploadProgramme.php\"'/><center>";
	texte+= "</TD></TR></TABLE></center>";
      document.getElementById('Milieu').innerHTML=texte;
    }
    xmlhttp2.send(null);   
}


	


