<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="© Copyright";

///////////////////////////////////
function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")


//Extension des images
var tabLegend = new Array(100);
var tabSubLegend = new Array(100);
var tabSrc = new Array(100);
var tabRef = new Array(100);

function changeImage(numphoto)
{
	if( ! numphoto){
		return;
	}
	this.ID=null;
	interval = 1500;
	this.interval==undefined ? 0 : new Number(interval);

	if(document.getElementById)	o=document.getElementById('imgLoaded');
	else if(document.images) o=document.images.monimage;
	if(o)
	{	
		if(o.filters) o.filters[0].apply();		
		o.src = tabSrc[numphoto];		
		o.width = 1000;
		o.height = 333;
		if(o.filters) 	document.getElementById('imgLoaded').filters[0].play();
	}
	changeTexte(numphoto);
	try{
		sendStats(numphoto);		
	}catch(E){}
}

function changeTexte(numphoto, suffixV)
{
	if(document.getElementById) {
		if(suffixV != 'V')	suffixV = '';
		var oTxt = document.getElementById('imgLegend' + suffixV);
		oTxt.innerHTML = tabLegend[numphoto];

		oTxt = document.getElementById('imgSubLegend' + suffixV);
		if( tabSubLegend[numphoto] ){
			oTxt.innerHTML = tabSubLegend[numphoto];
		}

		var oRef = document.getElementById('imgRef' + suffixV);
		if( tabRef[numphoto] ){
			oRef.innerHTML = 'Ref. ' + tabRef[numphoto];
		}

	}
}

function changeImageV(numphoto)
{
	if( ! numphoto){
		return;
	}
	//ASetInhiber(true);
	
	oImg = document.getElementById('imgLoadedV');
	oImg.src = tabSrc[numphoto];

	var oDiv = document.getElementById('DivImageV');
	oDiv.style.display = 'block';
	oDiv.style.left = (document.body.scrollWidth - oDiv.offsetWidth) / 2;
	oDiv.style.top = (document.body.scrollHeight - oDiv.offsetHeight) / 2;
	oDiv.style.left = document.body.scrollLeft + (document.body.clientWidth - oDiv.offsetWidth) / 2;
	oDiv.style.top = document.body.scrollTop + (document.body.clientHeight - oDiv.offsetHeight) / 2;
	//oDiv.style.top = 0;
	ASetInhiber(true);

	changeTexte(numphoto, 'V');
	try{
		sendStats(numphoto);		
	}catch(E){}
}

function ASetInhiber(flag)
{
    var inhiber = document.getElementById("AInhiber");
    if(flag){
    	inhiber.className="AInhiberShown";
    } else {
			inhiber.className="AInhiberHidden";
    }
}
function closeImageV()
{
	ASetInhiber(false);
	var oDiv = document.getElementById('DivImageV');
	oDiv.style.display = 'none';
}

var httpRequest = null;
var urlStat = null;
var urlStatDoc = null;
function initRequest() {
   if (window.XMLHttpRequest) { // Mozilla, Safari, ...
       httpRequest = new XMLHttpRequest();
       if (httpRequest.overrideMimeType) {
           httpRequest.overrideMimeType('text/xml');
       }
   } else if (window.ActiveXObject) { // IE
       try {
           httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
           try {
               httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
           } catch (e) {}
       }
   }

   if (!httpRequest) {
       //alert('Giving up :( Cannot create an XMLHTTP instance');
       return false;
   }
   httpRequest.onreadystatechange =
     function() { handleResponse(httpRequest); };
		
		urlStat 		= location.protocol + '//' + location.host + '/_php/stats/statsImg.php?type=I&st=';
		urlStatDoc 	= location.protocol + '//' + location.host + '/_php/stats/statsImg.php?type=D&st=';
		//alert("urlStat="+urlStat);
}

function handleResponse(httpRequest) {
   /*if (httpRequest.readyState == 4) {
       if (httpRequest.status == 200) {
           alert('output=' + httpRequest.responseText);           
       } else {
           alert('There was a problem with the request.');
       }
   }*/
}

function sendStats(idImg) {
	if( !httpRequest ){	initRequest(); }
	var oLang = document.getElementById('lang');
	if(oLang) lg = "&lang=" + oLang.value;
	else lg = '';
	httpRequest.open('GET', urlStat + idImg + lg, true);
	httpRequest.send(null);

}

function statsDoc(doc) {
	try {
		if( !httpRequest ){	initRequest(); }
		var oLang = document.getElementById('lang');
		if(oLang) lg = "&lang=" + oLang.value;
		else lg = '';
		httpRequest.open('GET', urlStatDoc + doc + lg, true);
		httpRequest.send(null);
	} catch (e) {}
	return true;
}

/****************************************
 *		PROGRESS BAR preload Images
 ****************************************/

// Progressbar - Version 2.0
// Author: Brian Gosselin of http://scriptasylum.com
// Featured on Dynamic Drive (http://www.dynamicdrive.com)
// PUT THE NAMES OF ALL YOUR IMAGES THAT NEED TO BE "CACHED" IN THE "imagenames" ARRAY.
// DONT FORGET THE COMMA BETWEEN EACH ENTRY, OR THE TICK MARKS AROUND EACH NAME.
// WHEN ALL THE IMAGES ARE DONE LOADING, THE "imagesdone" VARIABLE IS SET TO "TRUE"
var DEBUG_IMG_LOAD_ERROR = 0;	// 0 ou 1
var DEBUG = 0;	// 0 ou 1

var yposition=200;                      // POSITION OF LOAD BAR FROM TOP OF WINDOW, IN PIXELS
var loadedcolor='gray' ;                // PROGRESS BAR COLOR
var unloadedcolor='white';              // BGCOLOR OF UNLOADED AREA
var barheight=15;                       // HEIGHT OF PROGRESS BAR IN PIXELS (MIN 25)
var barwidth=350;                       // WIDTH OF THE BAR IN PIXELS  
var bordercolor='black';                // COLOR OF THE BORDER

//DO NOT EDIT BEYOND THIS POINT 
var imagenames;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var imagesdone=false;
var blocksize=barwidth;
barheight=Math.max(barheight,25);
var loaded=0, perouter, perdone, images=new Array();

function MM_preloadImages(){
	imagenames = MM_preloadImages.arguments;
	blocksize=barwidth/(imagenames.length);

	var txt='<table cellpadding="0" cellspacing="1" border="0"><tr><td width="'+barwidth+'" height="'+barheight+'" valign="center">';
	txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'" bgcolor="'+unloadedcolor+'"><center><font color="'+loadedcolor+'" size="1" face="sans-serif">Preloading Images...</font></center></td></tr></table>';
	txt+='<div id="perdone" style="position:absolute; top:1px; left:1px; width:'+barwidth+'px; height:'+barheight+'px; background-color:'+loadedcolor+'; z-index:100">';
	txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'" bgcolor="'+loadedcolor+'"><center><font color="'+unloadedcolor+'" size="1" face="sans-serif">Preloading Images...</font></center></td></tr></table>';
	txt+='</div>';
	txt+='</td></tr></table>';
	
	txt='<div id="perouter" style="position:absolute; visibility:hidden; background-color:'+bordercolor+'">' + txt + '</div>';
	document.write(txt);

	/*var oDiv = document.createElement("div");
	oDiv.setAttribute("id", "perouter");
	oDiv.setAttribute("style", "position:absolute; visibility:hidden; background-color:"+bordercolor);
  oDiv.innerHTML=txt;
  document.body.appendChild(oDiv);*/
	
	loadimages();
}

function loadimages(){
	if(NS6){
		perouter=document.getElementById('perouter');
		perdone=document.getElementById('perdone');
	}
	if(IE4){
		perouter=document.all.perouter;
		perdone=document.all.perdone;
	}
	cliplayer(perdone,0,0,barheight,0);
	window.onresize=setouterpos;
	setouterpos();
	for(n=0;n<imagenames.length;n++){
		images[n]=new Image();
		images[n].onerror=imgLoadError;
		images[n].src=imagenames[n];
		//images[n].onload=function() {
		//  log('image loaded' + this.src)
		//};
	}
	setTimeout('checkload()' ,100);

}
var nbImgLoadError = 0;
function imgLoadError(evt){
	nbImgLoadError++;
  //log("imgLoadError: nbImgLoadError = " + nbImgLoadError);
	//alert("imgLoadError nbImgLoadError=" + nbImgLoadError + " evt=" + (evt?evt.target:"undef") );
}
function setouterpos(){
	var ww=(IE4)? document.body.clientWidth : window.innerWidth;
	var x=(ww-barwidth)/2;
	if(IE4||NS6){
		perouter.style.left=x+'px';
		perouter.style.top=yposition+'px';
		if(!imagesdone)	perouter.style.visibility="visible";
		//perdone.style.left=(x+1)+'px';
		//perdone.style.top=(yposition+1)+'px';
	}
}
function dispbars(){
	cliplayer(perdone, 0, blocksize*loaded, barheight, 0);
	//if(loaded>=imagenames.length)	setTimeout('hideperouter()', 800);
	if(loaded>=imagenames.length)	hideperouter();
}

function checkload(){
	var ok=1;
	loaded=0;

	for(n=0;n<images.length;n++){
    if (!(images[n].complete)) {
    	ok=0;
    	//log("loading: " + images[n].src);
    }
  	else{
  		loaded++;
    	//log("loaded : " + images[n].src);
  	}
	}
  //if (!ok)	setTimeout("checkload()",100);
  loaded+=nbImgLoadError;
  if (loaded != images.length)	setTimeout("checkload()",100);
  dispbars();
}

function hideperouter(){
	perouter.style.visibility="hidden";
	imagesdone=true;
	alertImgLoadError();
}

function cliplayer(layer, ct, cr, cb, cl){
	if(IE4||NS6)layer.style.clip='rect('+ct+' '+cr+' '+cb+' '+cl+')';
}

function alertImgLoadError(){
	var st = "";
	/*if(DEBUG){
		log("END nb = " + images.length);
		for(n=0;n<images.length;n++){
    	st += n + " : " + images[n].complete + " = " + images[n].src + getLogCRLF();
		}
		log(st);
	}*/
	if(nbImgLoadError==0 || !DEBUG_IMG_LOAD_ERROR) return;
	st = "";
	for(n=0;n<images.length;n++){
    if (!(images[n].complete)){
    	st += images[n].src + "\n";
    }
	}
	if(st.length > 0){
		log(st);
		alert("imgLoadError nbImgLoadError =" + nbImgLoadError + " \n" + st);
	}		
}

function log(st){
	if(!DEBUG) return;
	var oDiv=document.getElementById('divLog');
	oDiv.innerHTML += st + getLogCRLF();
}
function getLogCRLF(){
	return "<br>";
}

function initDivlog(){
	if(!DEBUG) return;
	/*var oDiv = document.createElement("div");
	oDiv.setAttribute("id", "divLog");
	oDiv.setAttribute("style", "width=600px;height=200px;overflow:auto;color:white;position:absolute;top:0;left:0;");
  oDiv.innerHTML="LOG<br>";
  document.body.appendChild(oDiv);*/
  document.write('<div id=divLog style="width=600px;height=200px;overflow:auto;color:white;position:absolute;top:0;left:0;">LOG DEBUG<br></div>');
}
initDivlog();



//-->
