// JavaScript Document

function align() {

	var lmt = document.getElementById('centrage');
	var container = document.documentElement;

	if(lmt && container) {
	    var containerHeight;
	    if (container.innerWidth) {
            containerHeight = container.innerHeight;
		} else {
            containerHeight = container.clientHeight;
		}
		
	    var lmtHeight;
	    if (lmt.innerWidth) {
            lmtHeight = lmt.innerHeight;
		} else {
            lmtHeight = lmt.offsetHeight;
		}
		
		var y = Math.ceil((containerHeight - lmtHeight) / 2) - 90;
		if(y < 0) {
			y = 0;
		}
		lmt.style.position = "relative";
		lmt.style.top = y + "px";
	}
	if (document.getElementById) {
		document.body.style.visibility = 'visible';
	}

}

function addevent(obj,evt,fn,capt){
	if(obj.addEventListener)
	{
		obj.addEventListener(evt, fn, capt);
		return true;
	}
	else if(obj.attachEvent)
	{
		obj.attachEvent('on'+evt, fn);
		return true;
	}
	else return false;
}

if (document.getElementById && document.getElementsByTagName) {
	addevent(window, 'load', align, false);
	addevent(window, 'resize', align, false);
}

/*********************************************************************
* FONCTION QUI CHANGE UNE IMAGE LORSQUE LA SOURIS PASSE DESSUS
*********************************************************************/
function ChangeImage (unBouton, uneImage) {
	document[unBouton].src = uneImage;
}

var message="Copyright 2008, petrolympic.com. All rights reserved."; // Message for the alert box

isIE = document.all;
isNN =! document.all&&document.getElementById;
isN4 = document.layers;

/*
if (isIE||isNN) {
	document.oncontextmenu = block;
} else {
	document.captureEvents (Event.MOUSEDOWN || Event.MOUSEUP);
	document.onmousedown = block;
}

function block(e) {
	if (isN4) {
		if (e.which==2||e.which==3) {
			alert(message);
		return false;
		}
	} else {
		alert(message);
		return false;
	}
}
*/

function blockError() {
	return true;
}

window.onerror = blockError;

var hcolor = 255;
function Fade(direction) {
	obj = document.getElementById("head1");
   	hcolor += direction;
   	if (hcolor >= 0 && hcolor < 256) {
    	hex=hcolor.toString(16);
      	if (hex.length==1) hex="0" + hex;
      	obj.style.color="#" + hex + hex + hex;
      	window.setTimeout("Fade(" + direction + ");",1);
	}
}