/********************** DEBUT VARIABLES GLOBALES*************************/

var urlActuelle = document.location.href.split("/"); // tableau contenant l'URL actuelle
// var langueActuelle = urlActuelle[urlActuelle.length-3] ; // déclaration de la langue actuelle
var langueCible ;

/*********************FIN VARIABLES GLOBALES***************************/

/****************DEBUT Scripts toujours exécutés**********************/

setDefaultText();				// affiche un texte par défaut dans la barre de statut et de titre
MM_reloadPage(true);			// gère le redimensionnement de la fenêtre sur Netscape
LoadXiti();						// charge le code marqueur xiti
MaximizeWindow();				// adapte la taille de la fenêtre à celle de l'écran


// This scripts sets a default text in the status bar
function setDefaultText()
	{
	var txt ="iXième";
	window.defaultStatus= txt;
	document.title= txt;
	}
// empêche l'affichage des erreurs javascript
/*function stopError()
	{
	return true;
	// window.onerror=stopError();
	}
window.onerror=stopError();		// empêche l'affichage des erreurs javascript
*/
/*This scripts maximize the window to the monitor*/
function MaximizeWindow()
	{
	top.window.moveTo(0,0);
	if (document.all)
		{
		top.window.resizeTo(screen.availWidth,screen.availHeight);
		}
	else if (document.layers||document.getElementById)
		{
		if (top.window.outerHeight < screen.availHeight||top.window.outerWidth < screen.availWidth)
			{
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
			}
		}
	}

// gère le redimensionnement de la fenêtre sur Netscape
function MM_reloadPage(init)
	{
 	if (init==true) with (navigator)
		{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4))
			{
 			document.MM_pgW=innerWidth;
			document.MM_pgH=innerHeight;
			onresize=MM_reloadPage;
			}
		}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
		location.reload();
	}

// affiche le compteur caché de xiti
function LoadXiti()
	{
	doc = document;
	datejour = new Date();
	serveur = '23';
	compte = '123122'
	source = 'http://logv'+serveur+'.xiti.com/hit.xiti?s='+compte;
	source += '&p=&hl=' + datejour.getHours() + 'x' + datejour.getMinutes() + 'x' + datejour.getSeconds();
	Xiti_s = screen;
	source += '&r=' + Xiti_s.width + 'x' + Xiti_s.height + 'x' + Xiti_s.pixelDepth + 'x' + Xiti_s.colorDepth;
	source += '&ref=' + doc.referrer.replace('&', '$');
	logo = new Image ;
	logo.src = source; //préchargement image
	//alert(source);
	}


/****************FIN Scripts toujours exécutés**********************/

function changeLangue()
	{
	if (langueActuelle =="fr")
		langueCible ="en" ;
	else
		langueCible ="fr" ;
	var newURL = new String();
	newURL = document.location.href.split("/"+langueActuelle+"/").join("/"+langueCible+"/");
	document.location = newURL ;
	}

function IsV6()
	{
	/*return true si browser en version 6, false sinon*/
	if (navigator.appName.indexOf("Netscape") >= 0)
		return(parseInt(navigator.appVersion) >= 5);
	else
		return(navigator.appVersion.indexOf("6.") >= 0);	
	}

function afficheMain()
	{
	if (IsV6())
		document.body.style.cursor ="pointer" ;
	}

function cacheMain()
	{
	if (IsV6())
		document.body.style.cursor ="auto" ;
	}

/* Affichage dynamique des switches (navigation)*/

function pathToSwitch(status)
	{
	var chemin ="common/img/carre" + status +".gif";
	
	// alert(urlActuelle.length);
	
	if(urlActuelle.length == 8)
		{
		chemin ="../../../" + chemin ;
		}
	else if (urlActuelle.length == 7)
		{
		chemin ="../../" + chemin ;
		}
	else
		{
		chemin ="../" + chemin ;
		}
	return chemin ;
	}

function selectOn(imageCible)
	{
	imageCible.src = pathToSwitch('on') ;
	}
	
function selectOff(imageCible)
	{
    imageCible.src = pathToSwitch('off') ;
	}

// changement opacité d'image (IE5) -  rend visible une image à 100%
/*function makevisible(cur,which)
	{
	if (which==0)
		{
		cur.filters.alpha.opacity=100 ;
		cur.style.borderColor="#1D94C2";
		}
	else
		{
		cur.filters.alpha.opacity=80 ;
		// cur.style.borderColor="#19338F";
		}
	}
	*/

// lance la boîte de dialogue ajouter aux favoris avec >=IE4
function AddToFavorite()
	{
	var url ="http://www.lotusfilms.com";
	var who ="Les Films du Lotus";
	var ver = navigator.appName;
	var num = parseInt(navigator.appVersion);
	if ((ver =="Microsoft Internet Explorer")&&(num >= 4))
		{
		window.external.AddFavorite(url,who);
		}
	}

// lance la boîte de dialogue impression IE et NS
function custom_print() {
    if (document.all) {
        if (navigator.appVersion.indexOf("5.0") == -1) {
            var OLECMDID_PRINT = 6;
            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
            var OLECMDEXECOPT_PROMPTUSER = 1;
            var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
            document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
            WebBrowser1.ExecWB(6, 2);
            WebBrowser1.outerHTML = "";
        } else {
            self.print();
        }
    } else {
        self.print();
    }
}

// lance une popup adaptée à la taille d'une image
function PopupPic(sPicURL)
	{ 
    window.open("popup.html?"+sPicURL,"auto","resizable=1,HEIGHT=200,WIDTH=200"); 
	} 


function launchThisPopup(URL)
	{
	centerPopup(URL,'',500,300,'');
	}	

// lance une popup centrée sur l'écran
// s'appelle comme suit : <a href="JavaScript:newWindow('centered.htm','popup',300,200,'')">click to open the popup window</a>
// paramètres : URL, titre, largeur, hauteur, options
// fonction technique, on ne l'appelle pas dans la page html" , on utilise les fonctions intermédiaire pour diminuer le nombre de paramètre !

function centerPopup(URL,myname,w,h,features)
	{
	if(screen.width) { var winl = (screen.width-w)/2; var wint = (screen.height-h)/2;}
	else { winl = 0; wint = 0; } if(winl < 0) winl = 0;	if(wint < 0) wint = 0;
	
	var settings = 'height=' + h + ','; //hauteur
		settings += 'width=' + w + ','; //largeur
		settings += 'top=' + wint + ','; //position verticale
		settings += 'left=' + winl + ',';//position horizontale
		settings += features; // autres
		
	laPopup = window.open(URL,myname,settings) ;
	laPopup.window.focus();
	}
	
// Fonction back to top
/*
var btts=50, bttx=120, btty=50, bttc='<img src="../../../common/img/back2top.gif">';
function winWid(){ return (ns4||ns6)?window.innerWidth:document.body.clientWidth; }
function winHei(){ return (ns4||ns6)?window.innerHeight:document.body.clientHeight; }
function winOfy(){ return (ns4||ns6)?window.pageYOffset:document.body.scrollTop; }
function mtoplink(){ with(eval(bttll)){ left=(winOfy()>0)?winWid()-bttx:-500; top=(winOfy()>0)?winHei()-btty+winOfy():-500; } setTimeout('mtoplink()',btts); }
function toplink(){ rt=(!ns4)?'<div id="bttl" style="position:absolute;">':'<layer name="bttl">'; rt+=(!ns4)?'<a style="cursor: '+hand+'" onclick':'<a href"'; rt+='="JavaScript:scrollTo(0,0)">'; rt+=bttc; rt+=(!ns4)?'</a></div>':'</a></layer>'; document.write(rt); mtoplink(); }
var ns4=(document.layers)?1:0;
var ie4=(document.all)?1:0;
var ns6=(document.getElementById&&!document.all)?1:0;
var hand=(ie4)?'hand':'pointer';
if(ie4)	bttll="document.all['bttl'].style";
if(ns4) bttll="document.layers['bttl']";
if(ns6) bttll="document.getElementById('bttl').style";
toplink();
*/

	function PopUp(url, name, width,height,center,resize,scroll,posleft,postop) {
	
		if (posleft != 0) { var X = posleft }
		if (postop  != 0) { var Y = postop  }
	
		if (!scroll || scroll == 0) { scroll = 'no' }
		if (!resize || resize == 0) { resize = 'no' }
	
		if ((parseInt (navigator.appVersion) >= 4 ) && (center)) {
		  var X = (screen.width  - width ) / 2;
		  var Y = (screen.height - height) / 2;
		}
		if (scroll != 0) { scroll = 1 }
	
		var Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable='+resize+',scrollbars='+scroll+',location=0,directories=0,status=none,menuBar=0,toolbar=0,copyhistory=0');
		
		if( Win ) {
			Win.focus();
		}
		else {
			alert("Desactivate your anti-popup system !");
			return;
		}
	}
