// JavaScript Document
var flag1 = 0;

//****** LIB ***********************************************************************************************************
function EcrireCookie(nom, valeur) {
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;

	var date=new Date;
	date.setMonth(date.getFullYear()+5);

	var expires=date;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}
function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(nom) {
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}
//*****************************************************************************************************************
function pub() {
		new Effect.Appear('bleu');
}

function test1() {
	/*if (!(document.all)) {
	$('effet1').show();
	$('effet1').fade({duration: 3});
	var secondes = 3 + aleatoire(6);
	test1.delay(secondes);
	}*/
}
function test2() {
	/*if (!(document.all)) {
	$('effet2').show();
	$('effet2').fade({duration: 3});
	var secondes = 3 + aleatoire(6);
	test2.delay(secondes);
	}*/
}
function test3() {
	/*if (!(document.all)) {
	$('effet3').show();
	$('effet3').fade({duration: 3});
	var secondes = 3 + aleatoire(6);
	test3.delay(secondes);
	}*/
}
function test4() {
	/*if (!(document.all)) {
	$('effet4').show();
	$('effet4').fade({duration: 3});
	var secondes = 3 + aleatoire(6);
	test4.delay(secondes);
	}*/
}
function test5() {
	if (!(document.all)) {
	$('effet5').show();
	$('effet5').fade({duration: 3});
	var secondes = 3 + aleatoire(6);
	test5.delay(secondes);
	}
}
function test6() {
	/*if (!(document.all)) {
	$('effet6').show();
	$('effet6').fade({duration: 3});
	var secondes = 3 + aleatoire(6);
	test6.delay(secondes);
	}*/
}

function attendre() {
	/*var secondes = 1 + aleatoire(6);
	test1.delay(secondes);
	
	secondes = 1 + aleatoire(6);
	test2.delay(secondes);
	
	secondes = 1 + aleatoire(6);
	test3.delay(secondes);
	
	secondes = 1 + aleatoire(6);
	test4.delay(secondes);
	
	secondes = 1 + aleatoire(6);
	test5.delay(secondes);
	
	secondes = 1 + aleatoire(6);
	test6.delay(secondes);	*/
}

function aleatoire(nombre) {
	var retour = Math.random() * nombre;
	retour = Math.round(retour);
	
	return retour;
}
function devis_on() {
	if (flag1 == 0) {
		$('devis').appear();
	}
}
function devis_off() {
	$('devis').fade();
	flag1 = 0;
}

// ********** PARALLAX **********
var x = 1;
var y = 1;
var z = 1;

function parallaxMouseMove(f)
{
	//$('f').update(Event.pointerX(f) + 'x' + Event.pointerY(f));
	var x = (Event.pointerX(f) * 1.2)+"px 0px";
	var y = (Event.pointerX(f) * 0.7)+"px 0px";
	var z = (Event.pointerX(f) * 0.2)+"px 0px";
	
	myStyle("grand", "background-position", x);
	myStyle("moyen", "background-position", y);
	myStyle("petit", "background-position", z);
}

function myStyle(element, stylez, attri) {
    element = document.getElementById(element);
    element.style[stylez.camelize()] = attri;
}

//$('petit').observe('mousemove', parallaxMouseMove);

function parallax() {
	//var x = (Event.pointerX(f) * 1.2)+"px 0px";
	//var y = (Event.pointerX(f) * 0.7)+"px 0px";
	//var z = (Event.pointerX(f) * 0.2)+"px 0px";

	/*x = x - 5;
	y = y - 3;
	z = z - 1;
	
	myStyle("grand", "background-position", x+"px 0px");
	myStyle("moyen", "background-position", y+"px 0px");
	myStyle("petit", "background-position", z+"px 0px");	
	
	parallax.delay(0.07);*/
}
