// JavaScript Document
/* Menu */
$(".language a:first").attr("href", getURLFR());
$(".language a:last").attr("href", getURLEN());
initMenu();
function initMenu() {
	$(".subMenu").show();
	$(".subMenu").hide();
	$(".bouton").hover(function () {showMenu($(this));}, function () {hideMenu($(this));} );
}
function showMenu(myElement) {
	myElement.children("a:first").fadeTo("normal", 0.3);
	myElement.children(".subMenu").stop(true, true).slideDown();


}
function hideMenu(myElement) {
	myElement.children("a:first").fadeTo("fast", 1);
	myElement.children(".subMenu").fadeOut();
}
function getURLFR() {
	var url = window.location.pathname;
	
	return "http://www.dmailer.fr" + url;
}
function getURLEN() {
	var url = window.location.pathname;
	return "http://www.dmailer.com" + url;
}

/* ********************************* anim for dmailer backup *****************************/
var statePicture = 1;
templateFade(1500);
function templateFade(temps) {
window.setTimeout(function() {
						   var temps2 = 3000;
						   if (statePicture == 1) {
							   $("#banner img:last").fadeOut(1500);
						   		statePicture = 2;
								temps2 = 1500;
						   }else  if (statePicture == 2) {
							   $("#banner img:last").prev("img").fadeOut(1500);
							   statePicture = 3;
							   temps2 = 1500;
						   }else  if (statePicture == 3) {
							   $("#banner img:last").prev("img").prev("img").fadeOut(1500);
							   statePicture = 4;
						   }else  if (statePicture == 4) {
							   $("#banner img:last").prev("img").prev("img").prev("img").fadeOut(1500);
							   statePicture = 5;
						   }else {
							   $("#banner img:last").fadeIn(1500, function(){$("#banner img").prev("img").show();});							   
							   statePicture = 1;
						   }
						   templateFade(temps2);
						   }, temps);
}