// Copyright Hippocampe 2001
browserVer = parseInt(navigator.appVersion);
browserName = navigator.appName;
browser = 0;
url = "" + document.location;
var printAll=false;
// Netscape ou IE
if ((browserName == 'Netscape') && (browserVer >= 2) && (browserVer != 5))
	browser = 1;
else
	browser = 2;

function addHeader(){
	var buffer =null;
	buffer = "<html>\r\n";
	buffer += "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'\r\n";
	buffer += "'http://www.w3.org/TR/html4/strict.dtd'>\r\n";
	buffer += "		<head>\r\n";
    buffer += "			<title>Impression</title>\r\n";
    buffer += "			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>\r\n";
    buffer += "			<meta name='robots' content='index,follow'>\r\n";
    buffer += "			<meta http-equiv='Expires' content='0'>\r\n";
    buffer += "		 	<meta http-equiv='Pragma' content='no-cache'>\r\n";
    buffer += "			<meta http-equiv='Cache-Control' content='no-cache'>\r\n";
    buffer += "			<link rel=stylesheet type='text/css' href='../configuration/css/ie_site.css' title='Feuille de style du site'>\r\n";
    buffer += "		</head>\r\n";
	buffer += "		<body bgcolor='#ffffff' style='background-color: white;'>\r\n";
	return buffer;
}

function addFooter(){
	var buffer = null;
	buffer = "		</body>\r\n";
	buffer += "</html>\r\n";
	return buffer;
}

function imprime(){
	var bufferHtml = null;
	
	//if (browser==1)
	//	window.print();
	//else {
    	bufferHtml = addHeader();
		if (printAll)
			bufferHtml += document.myForm.hiddenContenu.value+"\r\n";
		else
	    	bufferHtml += document.getElementById('content').innerHTML+"\r\n";
    	bufferHtml += addFooter();
    	var win = open('', 'plateform_preview')
    	if (win) {
            win.document.open();
            win.moveTo(-1000, -1000);
            win.resizeTo(600, 400);
            
            win.document.write(bufferHtml);
            win.document.close();
            
            win.focus();
            win.print();
            win.close();
        }
	//}
}


/**
 * Ouvre la popup url
 *
 * @param url de la page
 */
// si x==-1 et y==-1 alors centrage par rapport à l'écran
var wPopWindow 				= null; // Popup
function windowOpen(urlPage,x,y,w,h) {
	if (wPopWindow && !wPopWindow.closed) {
		wPopWindow.close();
		wPopWindow = null;
	}
   	if (x==-1) x = (screen.width / 2) - (w / 2);
   	if (y==-1) y = (screen.height / 2) - (h / 2);
   	wPopWindow = window.open(urlPage,'wPopWindow','width=' + w + ',height=' + h + ',left=' + x + ',top=' + y + ',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=NO');
   	wPopWindow.focus();
   	return false;
}
/**
 * Ouvre la popup url
 *
 * @param url de la page
 */
// si x==-1 et y==-1 alors centrage par rapport à l'écran
function windowOpenFixed(urlPage,x,y,w,h) {
	if (wPopWindow && !wPopWindow.closed) {
		wPopWindow.close();
		wPopWindow = null;
	}
   	if (x==-1) x = (screen.width / 2) - (w / 2);
   	if (y==-1) y = (screen.height / 2) - (h / 2);
   	wPopWindow = window.open(urlPage,'wPopWindow','width=' + w + ',height=' + h + ',left=' + x + ',top=' + y + ',resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no');
   	wPopWindow.focus();
   	return false;
}

// va a la page via la navigation interne (suiv-precedent ou combo)
function goToPage(iOrdrePage, sCmdPage){
	if (iOrdrePage && sCmdPage) {
		document.formPage.cmd_page.value	= sCmdPage;
		document.formPage.ordre_page.value = iOrdrePage;
		document.formPage.submit();
		return true;
	}
	return false;
}


	
/**
 * Set une valeur dans le champ caché specialCmd et envoit le formulaire
 *
 * @param <form>
 * @param sCmd
 */
function setValueInSpecialCmd(form, sCmd)
{
	form.specialCmd.value = sCmd;
	form.submit();
}



function moveDiv() {
	if (browser==1){
		x = document.getElementById('placeImg').offsetLeft;
		document.getElementById('MENUFOND').style.left = x;
		document.getElementById('MENU').style.left = x;
		if (document.getElementById('ENGRENAGE'))
			document.getElementById('ENGRENAGE').style.left = x;
		if (document.getElementById('ENGRENAGEFILLE'))
			document.getElementById('ENGRENAGEFILLE').style.left = x;
		if (document.getElementById('CONTENER'))
			document.getElementById('CONTENER').style.left = x;
		if (document.getElementById('CONTENERFILLE'))
			document.getElementById('CONTENERFILLE').style.left = x;
	}
}

function toggleOnOffP(idParagraph){
	if (idParagraph.length){
		var currentId = document.getElementById(idParagraph);
		if (currentId.style.display=='none')
			currentId.style.display = 'block';
		else
			currentId.style.display = 'none';
	}
	
	var nodes = document.getElementById('content').childNodes;
	for(var iCount = 0; iCount < nodes.length; iCount++) {
		if (browser==2) {
			if (nodes(iCount).nodeName == "P"){
				if (nodes(iCount).id.indexOf('paragraph_', 0)>-1 && nodes(iCount).id != idParagraph)
					nodes(iCount).style.display = 'none';
			}
		} else {
			if (nodes[iCount].nodeName == "P"){
				if (nodes[iCount].id.indexOf('paragraph_', 0)>-1 && nodes[iCount].id != idParagraph)
					nodes[iCount].style.display = 'none';
			}
			//alert(nodes[iCount].nodeName);
		}
	}
}

/* function de scrolling */
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()

lstart=100
loop=true 
speed=60
pr_step=1

function makeObj(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.newsScroll=newsScroll;
	this.moveIt=b_moveIt;
	this.x;
	this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}
function b_moveIt(x,y){
	this.x=x;
	this.y=y;
	this.css.left=this.x;
	this.css.top=this.y;
}
function newsScroll(speed){
	if(this.y>-this.scrollHeight){
		this.moveIt(0,this.y-pr_step)
		setTimeout(this.obj+".newsScroll("+speed+")",speed)
	} else if(loop) {
		this.moveIt(0,lstart)
		eval(this.obj+".newsScroll("+speed+")")
	}
}
function newsScrollInit(){
	oNewsCont=new makeObj('divNewsCont')
	oNewsScroll=new makeObj('divNewsText','divNewsCont')
	oNewsScroll.moveIt(0,lstart)
	oNewsCont.css.visibility='visible'
	oNewsScroll.newsScroll(speed)
}

function stopScroll(){
	pr_step=0;
}
function resumeScroll(){
	pr_step=1;
}
function forwardScroll(){
	pr_step=4;
}
function backyardScroll(){
	pr_step=-4;
}