/***********************************************************************
 *   Fichier : Script.js                                               *
 *   Page de script de MagicHome                                       *
 ***********************************************************************/

/***********************************************************************
 * Sélection d'un onglet                                               *
 ***********************************************************************/

function gdSelect(pPartie)
{
wString = "index.php";
document.location.replace(wString);
var wString;
if (pPartie != 0)
  {
  wString = "index.php?Partie=" + pPartie;
  document.location.replace(wString);
  }
}
/*****************************************************************************
 * Fonction Pixar                                                            *
 *****************************************************************************/

function gdSelectFilm()
{
window.open('http://www.narnia.com','_blank','toolbar=1, location=1, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width=900, height=700, left=10, top=10');
}

/***********************************************************************
 * Change l'image du menu                                              *
 ***********************************************************************/

function PictureMenu(pPicture, pNom, pNum)
{
var wImage, wName;

wImage = "Pages/Images/Onglet/" + pNom + pPicture + ".gif";
wName = "Pic" + pNum;
document.images[wName].src = wImage;
}

/***********************************************************************
 * Change l'image du bouton accueil                                    *
 ***********************************************************************/

function Picture(pPicture)
{
var wImage;

wImage = "Pages/Images/Accueil" + pPicture + ".gif";
document.images['Pic'].src = wImage;
}

/***********************************************************************
 * Ouverture de la page d'accueil                                      *
 ***********************************************************************/

function Index()
{
wString = "index.php";
window.top.document.location.replace(wString);
}

/***********************************************************************
 * Change l'image des bouton lien                                      *
 ***********************************************************************/

function Picture_lien(pPicture, pNum)
{
var wImage, wName;

wImage = "Pages/Images/liens" + pNum + pPicture + ".jpg";
wName = "Pic" + pNum;
document.images[wName].src = wImage;
}

/***********************************************************************
 * Ouverture de la page du lien                                        *
 ***********************************************************************/

function Lien(pLien)
{
wString = "index.php?Partie=5&lien=" + pLien;
document.location.replace(wString);
}

/***********************************************************************
 * Bouton retour                                                       *
 ***********************************************************************/

function Retour()
{
wString = "index.php?Partie=4";
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture de la page du cinéma                                      *
 ***********************************************************************/

function Cinema(pOk, pFilm)
{
wString = "index.php?Partie=1&cinema=" + pOk + "&film=" + pFilm;
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture de la page du cinéma des archives                         *
 ***********************************************************************/

function Cinema(pOk, pFilm)
{
wString = "index.php?Partie=1&cinema=" + pOk + "&film=" + pFilm + "&pcour=1";
document.location.replace(wString);
}

/***********************************************************************
 * Change l'image du bouton téléchargement                             *
 ***********************************************************************/

function Picture_download(pPicture, pNum)
{
var wImage, wName;

wImage = "../Images/cameratourne" + pPicture + ".gif";
wName = "Pico" + pNum;
document.images[wName].src = wImage;
}

/***********************************************************************
 * Ouverture de la page du cinéma                                      *
 ***********************************************************************/

function OpenPop(pNum)
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/popup.php?num=" + pNum;
wWidth = 390;
wHeight = 170;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=no, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Change l'image1 de l'étoile n°1                                     *
 ***********************************************************************/

function Picture1(pPicture, pNum)
{
var wImage1, wName;

wImage1 = "Pages/Images/star" + pPicture + ".gif";
wName = "PicStar" + pNum;
document.images[wName].src = wImage1;
}

/***********************************************************************
 * Change l'image2 de l'étoile n°2                                     *
 ***********************************************************************/

function Picture2(pPicture, pNum)
{
var wImage1, wImage2, wName1, wName2;

wImage1 = "Pages/Images/star" + pPicture + ".gif";
wName1 = "PicStar" + pNum;
document.images[wName1].src = wImage1;
wImage2 = "Pages/Images/star" + pPicture + ".gif";
wName2 = "PicSstar" + pNum;
document.images[wName2].src = wImage2;
}

/***********************************************************************
 * Change l'image3 de l'étoile n°3                                     *
 ***********************************************************************/

function Picture3(pPicture, pNum)
{
var wImage, wImage2, wImage3, wName1, wName2, wName3;

wImage1 = "Pages/Images/star" + pPicture + ".gif";
wName1 = "PicStar" + pNum;
document.images[wName1].src = wImage1;
wImage2 = "Pages/Images/star" + pPicture + ".gif";
wName2 = "PicSstar" + pNum;
document.images[wName2].src = wImage2;
wImage3 = "Pages/Images/star" + pPicture + ".gif";
wName3 = "PicSsstar" + pNum;
document.images[wName3].src = wImage3;
}

/***********************************************************************
 * Change l'image4 de l'étoile n°4                                     *
 ***********************************************************************/

function Picture4(pPicture, pNum)
{
var wImage1, wImage2, wImage3, wImage4, wName1, wName2, wName3, wName4;

wImage1 = "Pages/Images/star" + pPicture + ".gif";
wName1 = "PicStar" + pNum;
document.images[wName1].src = wImage1;
wImage2 = "Pages/Images/star" + pPicture + ".gif";
wName2 = "PicSstar" + pNum;
document.images[wName2].src = wImage2;
wImage3 = "Pages/Images/star" + pPicture + ".gif";
wName3 = "PicSsstar" + pNum;
document.images[wName3].src = wImage3;
wImage4 = "Pages/Images/star" + pPicture + ".gif";
wName4 = "PicSssstar" + pNum;
document.images[wName4].src = wImage4;
}

/***********************************************************************
 * Ouverture de la page de la confirmation du vote                     *
 ***********************************************************************/

function Vote(pStar, pNum)
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/Vote.php?star=" + pStar + "&num=" + pNum;
wWidth = 390;
wHeight = 170;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=yes, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture des pages de cinéma professionnel via la page accueil     *
 ***********************************************************************/

function Photo(pPhoto)
{
var wString;

wString = "index.php?Partie=1&cinema=6&film=" + pPhoto + "&ssmenu=2";
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture des pages de cinéma professionnel via la page accueil     *
 ***********************************************************************/

function Fiche(pFilm)
{
var wString;

wString = "index.php?Partie=1&cinema=6&film=" + pFilm + "&ssmenu=1";
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture des pages de cinéma amateur via la page accueil           *
 ***********************************************************************/

function Amateur(pNum)
{
var wString;

wString = "index.php?Partie=2&sspartie=4&video=" + pNum + "&pcour=1";
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture de la page des courts métrages                            *
 ***********************************************************************/

function Courtmetrage(pNum)
{
var wString;

wString = "index.php?Partie=3&num=" + pNum;
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture des fiches des séries                                     *
 ***********************************************************************/

function Ficheserie(pNum)
{
var wString;

wString = "http://www.magichome2.com/index.php?Partie=2&sspartie=5&serie=" + pNum;
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture de la page du sondage                                     *
 ***********************************************************************/

function Voter()
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/Sondage.php";
wWidth = 300;
wHeight = 220;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=no, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture de la page du puzzle                                      *
 ***********************************************************************/

function Jeux()
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/puzzle.htm";
wWidth = 600;
wHeight = 720;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=no, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture de la page du sondage                                     *
 ***********************************************************************/

function Newsletter()
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/Newsletter.php";
wWidth = 300;
wHeight = 220;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=no, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture de la page coup de cœur via la page accueil               *
 ***********************************************************************/

function Adore()
{
var wString;

wString = "index.php?Partie=1&cinema=8";
document.location.replace(wString);
}

/***********************************************************************
 * Change l'image des icônes de cinéma                                 *
 ***********************************************************************/

function PictureCine(pPicture, pNum)
{
var wImage, wName;

wImage = "Pages/Images/icone" + pNum + pPicture + ".gif";
wName = "sPic" + pNum;
document.images[wName].src = wImage;
}

/***********************************************************************
 * Ouverture de la page de l'agrandissement des photos                 *
 ***********************************************************************/

function Agrandir(pPic)
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/Pic.php?pic=" + pPic;
wWidth = 650;
wHeight = 680;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=no, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture de la page de l'agrandissement des photos n°2             *
 ***********************************************************************/

function Agrandir2(pPic, pNum)
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/Pic2.php?pic=" + pPic + "&num=" + pNum;
wWidth = 580;
wHeight = 460;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=no, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture de la page de l'envoi du mail                             *
 ***********************************************************************/

function OpenPopMail(pNum)
{
var wCells, wString, wState, wWidth, wLeft, wTop, wHeight;
var gView = null

wString = "Pages/popupmail.php?num=" + pNum;
wWidth = 400;
wHeight = 300;
wLeft = (screen.width - wWidth) / 2;
wTop = (screen.height - wHeight) / 2;
wState  = "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, ";
wState += "resizable=yes, copyhistory=no, width=" + wWidth;
wState += ", height=" + wHeight + ", left=" + wLeft + ", top=" + wTop;
gView = window.open(wString, "Popup", wState);
}

/***********************************************************************
 * Ouverture de la page du lien                                        *
 ***********************************************************************/

function Lien2()
{
wString = "index.php?Partie=2&sspartie=4";
document.location.replace(wString);
}

/***********************************************************************
 * Change l'image du mini menu                                         *
 ***********************************************************************/

function MiniMenu(pPicture, pNum)
{
var wImage, wName;

wImage = "Pages/Parties/Images/Case" + pPicture + ".gif";
wName = "Onglet" + pNum;
document.images[wName].src = wImage;
}

/***********************************************************************
 * Ouverture de la page du lien                                        *
 ***********************************************************************/

function MiniMenuSelect(pSerie, pNum)
{
wString = "index.php?Partie=2&sspartie=5&serie=" + pSerie + "&ssmenu=" + pNum;
document.location.replace(wString);
}

/***********************************************************************
 * Ouverture de la page du lien                                        *
 ***********************************************************************/

function MiniMenuSelectFilms(pFilm, pNum, pCinema)
{
wString = "index.php?Partie=1&cinema=" + pCinema + "&film=" + pFilm + "&ssmenu=" + pNum;
document.location.replace(wString);
}

/***********************************************************************
 * Obtenir le numéro de l'épisode                                      *
 ***********************************************************************/
 
function getElement(num)
{
if (!document.getElementById) { return; }

if (document.all) 
{
return eval("document.all." + num)
} 
else 
{
return document.getElementById(num)
}
}

/***********************************************************************
 * Développer le contenu de l'épisode                                  *
 ***********************************************************************/
 
 function ShowEpisode(num) 
 {
 getElement('epi'+num).style.display = (getElement('epi'+num).style.display == "none" ? "inline" : "none");
 }

/***********************************************************************
 * Fonction ouverture de lien                                          *
 ***********************************************************************/
function OpenLien(url)
{
document.location.href = url;
return true;
}

/***********************************************************************
 * Affiche les onglets correspondants                                  *
 ***********************************************************************/
 
 function ShowOnglets(Num, i) 
 {
 getElement('ong' + i + '1').style.display = "none";
 getElement('ong' + i + '2').style.display = "none";
 getElement('ong' + i + '3').style.display = "none";
 getElement('ong' + i + '4').style.display = "none";
 
 getElement('menu' + i + '1').style.display = "none";
 getElement('menu' + i + '2').style.display = "none";
 getElement('menu' + i + '3').style.display = "none";
 getElement('menu' + i + '4').style.display = "none";

 
 if (Num == 1)
   {
   getElement('ong' + i + '1').style.display = (getElement('ong' + i + '1').style.display == "none" ? "inline" : "none");
   getElement('ong' + i + '2').style.display = "none";
   getElement('ong' + i + '3').style.display = "none";
   getElement('ong' + i + '4').style.display = "none";
   getElement('menu' + i + '1').style.display = (getElement('menu' + i + '1').style.display == "none" ? "inline" : "none");
   getElement('menu' + i + '2').style.display = "none";
   getElement('menu' + i + '3').style.display = "none";
   getElement('menu' + i + '4').style.display = "none";
   }
  if (Num == 2)
   {
   getElement('ong' + i + '1').style.display = "none";
   getElement('ong' + i + '2').style.display = (getElement('ong' + i + '2').style.display == "none" ? "inline" : "none");
   getElement('ong' + i + '3').style.display = "none";
   getElement('ong' + i + '4').style.display = "none";
   getElement('menu' + i + '1').style.display = "none";
   getElement('menu' + i + '2').style.display = (getElement('menu' + i + '2').style.display == "none" ? "inline" : "none");
   getElement('menu' + i + '3').style.display = "none";
   getElement('menu' + i + '4').style.display = "none";
   }
  if (Num == 3)
   {
   getElement('ong' + i + '1').style.display = "none";
   getElement('ong' + i + '2').style.display = "none";
   getElement('ong' + i + '3').style.display = (getElement('ong' + i + '3').style.display == "none" ? "inline" : "none");
   getElement('ong' + i + '4').style.display = "none";
   getElement('menu' + i + '1').style.display = "none";
   getElement('menu' + i + '2').style.display = "none";
   getElement('menu' + i + '3').style.display = (getElement('menu' + i + '3').style.display == "none" ? "inline" : "none");
   getElement('menu' + i + '4').style.display = "none";

   }
  if (Num == 4)
   {
   getElement('ong' + i + '1').style.display = "none";
   getElement('ong' + i + '2').style.display = "none";
   getElement('ong' + i + '3').style.display = "none";
   getElement('ong' + i + '4').style.display = (getElement('ong' + i + '4').style.display == "none" ? "inline" : "none");
   getElement('menu' + i + '1').style.display = "none";
   getElement('menu' + i + '2').style.display = "none";
   getElement('menu' + i + '3').style.display = "none";
   getElement('menu' + i + '4').style.display = (getElement('menu' + i + '4').style.display == "none" ? "inline" : "none");
   }
 }
/***********************************************************************
 * Affiche les onglets correspondants                                  *
 ***********************************************************************/
 
 function ShowPhotos(Num, i) 
 {
 
 getElement('photo' + i + '1').style.display = "none";
 getElement('photo' + i + '2').style.display = "none";
 getElement('photo' + i + '3').style.display = "none";
 getElement('photo' + i + '4').style.display = "none";

  
 if (Num == 1)
   {
   getElement('photo' + i + '1').style.display = (getElement('photo' + i + '1').style.display == "none" ? "inline" : "none");
   getElement('photo' + i + '2').style.display = "none";
   getElement('photo' + i + '3').style.display = "none";
   getElement('photo' + i + '4').style.display = "none";
   }
 if (Num == 2)
   {
   getElement('photo' + i + '1').style.display = "none";
   getElement('photo' + i + '2').style.display = (getElement('photo' + i + '1').style.display == "none" ? "inline" : "none");
   getElement('photo' + i + '3').style.display = "none";
   getElement('photo' + i + '4').style.display = "none";
   }
 if (Num == 3)
   {
   getElement('photo' + i + '1').style.display = "none";
   getElement('photo' + i + '2').style.display = "none";
   getElement('photo' + i + '3').style.display = (getElement('photo' + i + '1').style.display == "none" ? "inline" : "none");
   getElement('photo' + i + '4').style.display = "none";
   }
 if (Num == 4)
   {
   getElement('photo' + i + '1').style.display = "none";
   getElement('photo' + i + '2').style.display = "none";
   getElement('photo' + i + '3').style.display = "none";
   getElement('photo' + i + '4').style.display = (getElement('photo' + i + '1').style.display == "none" ? "inline" : "none");

   }
 }

