/* Auteur : Chanh T.Do [ThoranSoft - 2006.05.01] */

/* Modifié par Chanh T.Do [ThoranSoft - 2006.10.14] 
   Ajout de la fonction LoadCSSFile pour pouvoir choisir la bonne feuille de style selon le
   browser. Les browser n'interprète pas de la même façon les pixels pour le positionnement
   des images. 
*/
                  //Variables Globale
var topImg;       //Variables pour calculer les pixels de l'axe des x (top) et l'axe des y (left)
var leftImg;      //du logo du site (point de référence pour placer les autres images ou animations).

var agt = navigator.userAgent.toLowerCase();
var isMac = (agt.indexOf('mac') != -1);
var isOpera = (agt.indexOf('opera') != -1);
var IEver = parseInt(agt.substring(agt.indexOf('msie ') + 5));
var isIE = ((agt.indexOf('msie')!=-1 && !isOpera && (agt.indexOf('webtv')==-1)) && !isMac);
var isIE5win = (isIE && IEver >= 5);
var isIE5mac = ((agt.indexOf('msie') != -1) && isMac);
var isSafari = (agt.indexOf('safari') != -1);



/* Fonction pour différencier la famille NETSCAPE ou IE */
function CheckBrowser()
{if (navigator.appName=="Microsoft Internet Explorer")
     {
      DisableFlashBug();
     }
}


function DisableFlashBug()
{
 objects = document.getElementsByTagName("object");
 for (var i = 0; i < objects.length; i++)
     {
      objects[i].outerHTML = objects[i].outerHTML;
     }
}


/* Cette fonction permet aux animation flash d'ouvrir des POPUPS windows pour afficher les images */
function PopMe(TitleName,Content)
{
 var WindowSpecs="width=600,height=500,scrollbars=no";

 switch(Content)
       {
        case 'BonneSante300.png':               WindowSpecs="width=850,height=400,scrollbars=no"; break;
        case 'Clocks300.png':                   WindowSpecs="width=850,height=430,scrollbars=no"; break;
        case 'Coupons1_300.png':                WindowSpecs="width=760,height=530,scrollbars=no"; break;
        case 'Coupons2_300.png':                WindowSpecs="width=750,height=520,scrollbars=no"; break;
        case 'Coupons3_300.png':                WindowSpecs="width=750,height=520,scrollbars=no"; break;
        case 'Coupons4_300.png':                WindowSpecs="width=760,height=530,scrollbars=no"; break;
        case 'XploranceP1_300.png':             WindowSpecs="width=510,height=680,scrollbars=no"; break;
        case 'XploranceP2_300.png':             WindowSpecs="width=510,height=680,scrollbars=no"; break;
        case 'XploranceP3_300.JPG':             WindowSpecs="width=520,height=680,scrollbars=no"; break;
        case 'XploranceP4_300.png':             WindowSpecs="width=520,height=680,scrollbars=no"; break;
        case 'XploranceP5_300.png':             WindowSpecs="width=520,height=680,scrollbars=no"; break;
        case 'XploranceP6_300.png':             WindowSpecs="width=520,height=680,scrollbars=no"; break;
        case 'NakisaCD.png':                    WindowSpecs="width=570,height=570,scrollbars=no"; break;
        case 'NDP_300.png':                     WindowSpecs="width=850,height=650,scrollbars=no"; break;
        case 'Nickels_300.png':                 WindowSpecs="width=500,height=650,scrollbars=no"; break;
       }

 consoleRef=window.open('',TitleName,WindowSpecs)
 //consoleRef.document.write('<img src="../images/'+Content+'">');

 consoleRef.document.writeln(
   '<html><head><title>'
   +TitleName
   +'</title></head>'
   +'<body bgcolor=white onLoad="self.focus()">'
   +'<img src="../images/'
   +Content
   +'">'
   +'</body></html>'
 )
 consoleRef.document.close();

}

/* Cette fonction permet de cacher le PRIVACY POLICY */

function Cacher(strIDName)
{
 if (document.getElementById(strIDName))
     document.getElementById(strIDName).style.visibility="hidden";
}

/* Cette fonction permet de montrer le PRIVACY POLICY */
function Montrer(strIDName)
{
 if (document.getElementById(strIDName))
     document.getElementById(strIDName).style.visibility="visible";
}

/* Fonction pour insérer les Headings flash dans la page HTML */
function embedFlashHeadings(strFlash, strWidth, strHeight)
{
 document.write('<p class=\"headings\" id=\"SWFObject\">' +
 '      <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"' +
 '        codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"' +
 '        width=\"' + strWidth + 'px\" height=\"' + strHeight + 'px\">' +
 '        <param name=\"movie\" value=\"' + strFlash + '\">' +
 '        <param name=\"quality\" value=\"high\">' +
 '' +
 '        <embed src=\"' + strFlash + '\"' +
 '          quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"' +
 '          type=\"application/x-shockwave-flash\" width=\"' + strWidth + 'px\" height=\"' + strHeight + 'px\">' +
 '        </embed>' +
 '      </object>' +
 '    </p>');
}



/* Function pour calculer la largeur et la hauteur de l'écran du client. */
function Positionner(posTop, posLeft, imgID, RefID)
{
 /* Pour différencier la famille NETSCAPE ou IE */
 if (navigator.appName=="Microsoft Internet Explorer")
    {topImg=findPosY(RefID);
     leftImg=findPosX(RefID);}
 else
    {imgRef=document.getElementById(RefID);
     topImg=imgRef.offsetTop;
     leftImg=imgRef.offsetLeft;
    }

 /* On positionne l'image ou l'animation */
 document.getElementById(imgID).style.top = parseInt(topImg) + parseInt(posTop);
 document.getElementById(imgID).style.left = parseInt(leftImg) + parseInt(posLeft);
}


//Ajouté par Chanh T.Do [2005.11.19]
//Sert à trouver la position de l'axe des X d'une image
function findPosY(imageTofind)
         {var img = document.getElementById(imageTofind);
          var thisTop = (document.all)? img.offsetTop :
          document.defaultView.getComputedStyle(img, "").getPropertyValue("top");
          return(thisTop);
         }

//Ajouté par Chanh T.Do [2005.11.19]
//Sert à trouver la position de l'axe des Y d'une image
function findPosX(imageTofind)
         {var img = document.getElementById(imageTofind);
          var thisLeft = (document.all)? img.offsetLeft :
          document.defaultView.getComputedStyle(img, "").getPropertyValue("left");
          return(thisLeft);
         }


function LoadPrivacy(strFlash, strFlaID, strWidth, strHeight, strFlashVersion, strBGColor, strTagID)
{
 Montrer(strTagID);
 loadFlash(strFlash, strFlaID, strWidth, strHeight, strFlashVersion, strBGColor, strTagID);
}

function UnloadPrivacy(strFlash, strFlaID, strWidth, strHeight, strFlashVersion, strBGColor, strTagID)
{
 Cacher(strTagID);
 loadFlash(strFlash, strFlaID, strWidth, strHeight, strFlashVersion, strBGColor, strTagID);
 
}

/* Fonction pour Menu en image */
function imgOn(myImgName) 
  {//we need to name the image in the BODY
   //so we can use its name here
   document[myImgName].src=eval(myImgName+ 'H' ).src;
  }

function imgOut(myImgName) 
{document[myImgName].src=eval(myImgName+ 'N' ).src;}
