<html>
<head>
<!--
Créé par milyon
Basé sur le template de Willspo
-->
<style>
   body {
      background: #ADBBFF;
      color: black;
      font-family: Tahoma, Arial, Verdana;
   }
   
   h1 {         /* Title */
      font-size: 18px;
   }
   
   p {
      font-size: 13px;
      line-height: 125%;
   }
   
   td {
      font-size: 14px;
   }
   
   #picture {
       width: 240px;
       height: 320px;
       overflow: hidden;
       border: 2px solid #666666;
   }
   
   .button {      /* Next / Prev and category buttons */
       height: 15px;
      padding-left: 18px;
      padding-right: 18px;
      border: 2px solid #666666;
      font-weight: bold;
      cursor: hand;
   }
   
   #exit {
         color: #FF6666;
   }
   
   #play {
      color: #99FF00;
   }
   
   #counter {      /* Movie number between next and prev */
         width: 100px;
         height: 15px;
         font-weight: bold;
         text-align: center;
   }

   #contentDiv {   /* The area that contains the movies */
       height: 500px;
       overflow: hidden;
       margin-top: 5px;
       margin-bottom: 5px;
     }
   
   #playDialog {
      position: absolute;
      visibility: hidden;
      background: black;
      padding: 10px;
      border: 2px solid #666666;
   }
</style>
<script language="javaScript">

var message="Zone de recherche"
var neonbasecolor="gray"
var neontextcolor="yellow"
var flashspeed=100  //in milliseconds
var n=0
if (document.all){
document.write('<font color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight">'+message.charAt(m)+'</span>')
document.write('</font>')
var tempref=document.all.neonlight
}
else
document.write(message)

function neon(){

if (n==0){
for (m=0;m<message.length;m++)
tempref[m].style.color=neonbasecolor
}

//cycle through and change individual letters to neon color
tempref[n].style.color=neontextcolor

if (n<tempref.length-1)
n++
else{
n=0
clearInterval(flashing)
setTimeout("beginneon()",1500)
return
}
}

function beginneon(){
if (document.all)
flashing=setInterval("neon()",flashspeed)
}
beginneon()


   /* User variables */
   var playerPath = "C:\\Progra~1\\Window~1\\mplayer2.exe /fullscreen";
   var playerPath2 = "C:\\Player\\player.exe";
   var cdDriveLetter = "e";
   
   /* System variables */
var movies = new Array();
   var category  = "";         // Current category
   var movie = null;         // Current movie
   var categoryButton = null;   // Active category button
   var index = 0;            // Current movie number in this category
   var isReady = true;         // Is ready for input from user
   
   /*
    * Gets called by body onload.
    * Organizes all div elements with the attribute category in different arrays
    * depending on category.
    */
   function init() {
      var elements = document.body.getElementsByTagName("div");   
      var catArray = null;
      movies["Liste"] = new Array();
      createCategory("Liste");
      for (var i = 0; i < elements.length; i++) {
         category = elements[i].category;
         if (category != null && category != "") {
            catArray = movies[category];
            if (catArray == null) {
               catArray = new Array();
               movies[category] = catArray;
               catArray[0] = elements[i];
               createCategory(category);
            } else {
               catArray[catArray.length] = elements[i];
            }
            movies["Liste"][movies["Liste"].length] = elements[i];
         }
      }
      category = "Liste";
      showMovie(0);
   }
   
   /*
    * Called by init()
    * Writes the html code for a category button with given name
    */
   function createCategory(name) {
      html = "<span class='button' onclick='setCategory(\"" + name + "\")'>" + name + "</span>";
      document.all.categoryDiv.innerHTML += html;
   }
   
   /*
    * Called when the user presses a category button.
    * Sets the category to the given value.
    */
   function setCategory(name) {
      if (!isReady) return;
      category = name;
      index = 0;
      showMovie(index);
     
      // Changes apperance of the pressed category button
      if (categoryButton != null) {
        categoryButton.style.borderColor = "#666666";
        categoryButton.style.color = "white";
      }
      categoryButton = window.event.srcElement;
      categoryButton.style.borderColor = "99FF00";
      categoryButton.style.color = "99FF00";
   }
   
   /*
    * Gets called when user presses next button
    * Switches to the next movie in this category
    */
   function next() {
      if (!isReady) return;
      index++;
         if (index >= movies[category].length)
             index = 0;
         showMovie(index);
   }
   
   /*
    * Gets called when user presses prev button
    * Switches to the previous movie in this category
    */
   function prev() {
      if (!isReady) return;
         index--;
         if (index < 0)
           index = movies[category].length - 1;
         showMovie(index);
   }

   /*
    * Called by functions next and prev.
    * Shows the movie with specified number in this category.
    * Also responsible for loading and displaying the picture for this movie
    */
   function showMovie(i) {
      if (movie != null) {
          movie.style.display = "none";
         }
         movie = movies[category][i];
        movie.style.display = "inline";
      document.all.picture.src = movie.img;
        document.all.counter.innerHTML = (i + 1) + "/" + movies[category].length;
   }

   /*
    * Gets called when the user presses the exit button.
    * Closes the program.
    */
   function exit() {
      window.close();
   }

   /*
    * Gets called when the user presses the play button.
    * Initializes the play dialog: "Inserer CD_ROM avec le film #... label"
    */
   function play() {
      if (movie != null) {
         var playDialog = document.all.playDialog;
         var type = (movie.media == "") ? "CD-ROM" : movie.media;
         isReady = false;
         html = "<table cellpadding='10' cellspacing='0' border='0'><tr><td align='center'>";
         html += "Inserer " + type + " avec le film #" + movie.nr + " " + movie.media;
         html += "</td></tr><tr><td align='center'>";
         html += "<span id='ok' class='button' onclick='ok()'>Ok</span>";
         html += "<span id='cancel' class='button' onclick='cancel()'>Annuler</span>";
         html += "</td></tr></table>";
         playDialog.innerHTML = html;

         // Center th eplay dialog on screen
         var posX = screen.availWidth / 2 - playDialog.offsetWidth / 2;
         var posY = screen.availHeight / 2 - playDialog.offsetHeight / 2;
         playDialog.style.posTop = posY;
         playDialog.style.posLeft = posX;
         playDialog.style.visibility = "visible";
      }
   }
    /*
    * Gets called when the user presses the play2 button.
    * Initializes the play dialog: "Inserer CD_ROM avec le film #... label"
    */
   function play2() {
      if (movie != null) {
         var playDialog = document.all.playDialog;
         var type = (movie.media == "") ? "CD-ROM" : movie.media;
         isReady = false;
         html = "<table cellpadding='10' cellspacing='0' border='0'><tr><td align='center'>";
         html += "Inserer " + type + " avec le film #" + movie.nr + " " + movie.media;
         html += "</td></tr><tr><td align='center'>";
         html += "<span id='ok' class='button' onclick='ok2()'>Ok</span>";
         html += "<span id='cancel' class='button' onclick='cancel()'>Annuler</span>";
         html += "</td></tr></table>";
         playDialog.innerHTML = html;

         // Center th eplay dialog on screen
         var posX = screen.availWidth / 2 - playDialog.offsetWidth / 2;
         var posY = screen.availHeight / 2 - playDialog.offsetHeight / 2;
         playDialog.style.posTop = posY;
         playDialog.style.posLeft = posX;
         playDialog.style.visibility = "visible";
      }
   }
   
   /* Gets called when the user presses the ok button in the play dialog
    * Searches the specified cd drive for the first avi file.
    * Launches the specified player with the avi file as argument.
    * Hopefully the player will start the movie.
    */
   function ok() {
      document.all.playDialog.style.visibility = "hidden";
      var wScript = new ActiveXObject("Wscript.Shell");
      var fso = new ActiveXObject("Scripting.FileSystemObject");
        var folder = fso.GetFolder(cdDriveLetter + ":");
        var fc = new Enumerator(folder.files);
      var file = null;
        for (; !fc.atEnd(); fc.moveNext()){
         if ( fc.item().Name.indexOf(".avi") != -1 ) {
            file = fc.item().ShortPath;
            break;
         }
      }
      if (file != null) {
         wScript.run(playerPath + " " + file);
      } else {
         alert("Pas de Film sur  " + cdDriveLetter + "!");
      }
      isReady = true;
   }
   function ok2() {
      document.all.playDialog.style.visibility = "hidden";
      var wScript = new ActiveXObject("Wscript.Shell");
      var fso = new ActiveXObject("Scripting.FileSystemObject");
        var folder = fso.GetFolder(cdDriveLetter + ":");
        var fc = new Enumerator(folder.files);
      var file = null;
        for (; !fc.atEnd(); fc.moveNext()){
         if ( fc.item().Name.indexOf(".avi") != -1 ) {
            file = fc.item().ShortPath;
            break;
         }
      }
      if (file != null) {
         wScript.run(playerPath2 + " " + file);
      } else {
         alert("Pas de Film sur  " + cdDriveLetter + "!");
      }
      isReady = true;
   }
   /* Gets called when the user presses the cancel button in the play dialog */
   function cancel() {
      document.all.playDialog.style.visibility = "hidden";
      isReady = true;
   }
function NomObjets(formname,selname,textname,str)
{
this.formname = formname;
this.selname = selname;
this.textname = textname;
this.select_str = str || '';
this.selectArr = new Array();
this.initialize = initialize;
this.bldInitial = bldInitial;
this.maj = maj;
}

function initialize()
{
if (this.select_str =='')
{
for(var i=0;i<document.forms[this.formname][this.selname].options.length;i++)
  {
  this.selectArr[i] = document.forms[this.formname][this.selname].options[i];
  this.select_str += document.forms[this.formname][this.selname].options[i].value+":"+document.forms[this.formname][this.selname].options[i].text+",";
   }
}
else
{
var tempArr = this.select_str.split(',');
for(var i=0;i<tempArr.length;i++)
  {
  var prop = tempArr[i].split(':');
  this.selectArr[i] = new Option(prop[1],prop[0]);
  }
}
return;
}

function bldInitial()
{
this.initialize();
for(var i=0;i<this.selectArr.length;i++)
document.forms[this.formname][this.selname].options[i] = this.selectArr[i];
document.forms[this.formname][this.selname].options.length = this.selectArr.length;
return;
}

function maj()
{
var str = document.forms[this.formname][this.textname].value;
if(str == '') { this.bldInitial();return; }
this.initialize();
var j = 0;
pattern1 = new RegExp("^"+str,"i");
for(var i=0;i<this.selectArr.length;i++)
if(pattern1.test(this.selectArr[i].text))
document.forms[this.formname][this.selname].options[j++] = this.selectArr[i];
document.forms[this.formname][this.selname].options.length = j;
if(j==1)
{
document.forms[this.formname][this.selname].options[0].selected = true;
}
}

function initialisation()
{
lettre = new NomObjets('formulaire','liste','entree');
lettre.bldInitial();
}

function Go2(liste)
{
      var page = liste.options[liste.selectedIndex].value;
      liste.selectedIndex = 0;
      window.open(page, 'nomFenetre', 'directories=no, location=no, menubar=no, fullscreen=yes, resizable=no, scrollbars=yes, status=no, titlebar=no, resizable=yes, toolbar=no, width=800, height=600, left=200, top=100, screenX=200, screenY=100');
}


</script>
</head>
</body>
<body onLoad="init();initialisation()" topmargin="5" leftmargin="5">

<form name="formulaire" action="#" method="get">
<input type="text" name="entree" size="20" onKeyUp="javascript:lettre.maj();">
</p>
<select name="liste" size="3" OnClick="if (this.options[this.selectedIndex].value)
;Go2(this);">
$$ITEM_BEGIN
<option value="$$ITEM_FILEINDIV ">$$ITEM_FORMATTEDTITLE2</option>
$$ITEM_END
</select>
</form>     <hr>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
   <tr>
      <td align="center">
         <table width="780" height="600" cellspacing="0" cellpadding="0" border="0">
            <tr>
               <td valign="top" align="center">
                  <div id="categoryDiv">
                  </div>
                  <div id="contentDiv">
                     <table class="$$ITEM_CATEGORY" cellspacing="0" cellpadding="0" border="0" width="100%"  >
                        <tr>
                           <td width="350" valign="top">
                              <img src="" id="picture">
                           </td>
                           <td valign="top">
                              $$ITEM_BEGIN

                              <div category="$$ITEM_CATEGORY" style="display: none" nr="$$ITEM_NUMBER" type="$$ITEM_TYPE" media="$$ITEM_MEDIA" img="$$ITEM_PICTUREFILENAME">
                              <h1>$$ITEM_FORMATTEDTITLE2</h1>
                                 <table cellspacing="0" cellpadding="0">
                                    <tr>
                                       <td><b>Categorie:&nbsp;&nbsp;</b>
                                       </td>
                                       <td>$$ITEM_CATEGORY
                                       </td>
                                    </tr>
                                    <tr>
                                       <td><b>Année:</b>
                                       </td>
                                       <td>$$ITEM_YEAR
                                       </td>
                                    </tr>
                                    <tr>
                                       <td><b>Réalisateur:</b>
                                       </td>
                                       <td>$$ITEM_DIRECTOR
                                       </td>
                                    </tr>
                                    <tr>
                                       <td><b>Durée:</b>
                                       </td>
                                       <td>$$ITEM_LENGTH mns
                                       </td>
                                    </tr>
                                    </tr>
                                    <tr>
                                       <td><b>Pret à:</b>
                                       </td>
                                       <td>$$ITEM_BORROWER
                                       </td>
                                    </tr>
                                 </table>
                                 <br>
                                 <p>
                                    <b>Description:</b>
                                    <br>
                                    $$ITEM_DESCRIPTION
                                 </p>
                              </div>
                              $$ITEM_END
                           </td>
                        </tr>
                     </table>
                  </div>
                  <table cellspacing="0" cellpadding="0" border="0" width="100%">
                     <tr>
                        <td width="200">&nbsp;
                        </td>
                        <td align="center">
                           <span id="prev" class="button" onClick="prev()">
                              Prec.
                           </span>
                           <span id="counter">
                           </span>
                           <span id="next" class="button" onClick="next()">
                              Suiv.
                           </span>
                        </td>
                        <td width="200" align="right">
                           <span id="play" class="button" onClick="play()">
                             Windows Player 6
                           </span>
                           <span id="play" class="button" onClick="play2()">
                             DivX Player Alpha
                           </span>
                           <span id="exit" class="button" onClick="window.close()">
                              Quitter
                           </span>
                        </td>
                     </tr>
                  </table>
               </td>
            </tr>
         </table>
      </td>
   </tr>
</table>
<div id="playDialog">
</div>
</body>
</html>
