function initialize() {
    var latlng = new google.maps.LatLng(49.22946, 6.99207);
    var myOptions = {
		zoom: 16,
		center: latlng,
		panControl: false,
		zoomControl: true,
		mapTypeControl: false,
		scaleControl: false,
		streetViewControl: true,
		overviewMapControl: false,
		mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
	 var marker = new google.maps.Marker({
      position: latlng,
      title:"Eurodistrict - SaarMoselle"
  });

  // To add the marker to the map, call setMap();
  marker.setMap(map); 
 }
$(document).ready(function(){
	$("#content_header, #content_menu, #content_in, #content_footer, img, #revue_presse, .presse_arrowr, .presse_arrowl").pngfix({sizingMethod: "scale"});
	var IE7 = false;
	var IE6 = false;
	var strChUserAgent = navigator.userAgent;
	var intSplitStart = strChUserAgent.indexOf("(",0);
	var intSplitEnd = strChUserAgent.indexOf(")",0);
	var strChStart = strChUserAgent.substring(0,intSplitStart);
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
	var strChEnd = strChUserAgent.substring(strChEnd);
	if(strChMid.indexOf("MSIE 7") != -1){
		$("#menu .img0").css("display","none");
	}else if(strChMid.indexOf("MSIE 6") != -1){
		$("#menu .img0").css("display","none");
	}else{
		$("#menu .img4").css("display","none");
	}
	function compare(x, y){
		return y-x;	
	}
	$('#menu li.menu_in').each(function () {
		var time = 200;
		var hideDelay = 200;
		var hideDelayTimer = null;
		var beingShown = false;
		var shown = false;
		var trigger = $(this);
		var info= $("li.sous_menu", this);
		$(trigger).mouseover(function () {
			tab = Array();
			i=0;
			$("li.sous_menu", this).each(function(){
				maxi = $(this).css("width").length;
				tab[i]=($(this).css("width").substr(0,maxi-2));
				i++;
			});
			tab.sort(compare);
			if(tab[0]>$(this).width()){
				wid = tab[0]+"px";
			}else{
				wid = $(this).width()+"px"	
			}
			$("li.sous_menu", this).css("width",wid);
			$(".menu_ul", this).css("margin-left",wid);
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				// don't trigger the animation again
				return;
			} else {
				// reset position of info box
				beingShown = true;
				$(info).each(function(k){
					$(this).css("display","none");
					$(this).css("margin-top","0");
				});
				$(info).each(function(k){
					$(this).css("display","block");
					$(this).animate({
						opacity: 1,
						filter:''
					},200);
					decal = 30*k;
					delay = 200+k*150;
					$(this).animate({
						marginTop: '+='+decal+"px"
					},delay, function() {
						beingShown = false;
						shown = true;
					});
				});
			}
			return false;
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				$(info).each(function(k){
					decal = 30*k;
					$(this).animate({
						marginTop: '-='+decal+"px",
						opacity: 0,
						filter:''
					},200, function () {
						shown = false;
						$(this).css('display', 'none');
					});
				});
			}, hideDelay);
			return false;
		});
	});
	/*if(strChMid.indexOf("MSIE 7") != -1 || strChMid.indexOf("MSIE 6") != -1 ){
		$("#pos_background").css("width",$(window).width());
		$("#img_header").css("width",$(window).width());
		$("#img_background").css("width",$(window).width());
	}*/
	/* Initialisation de la position et taille des différents éléments */
	$("#pos_background").css("height",$(document).height());
	newR = ($(window).width()-$("#img_background").width())/2;
	$("#img_background").css("right",newR);
	w0= $("#li_0").width()+$("#li_1").width()+$("#li_2").width()+$("#li_3").width()+$("#li_4").width();
	w = Math.floor((831-w0)/10-0.4);
	w1 = Math.floor((831-w0)/10-0.4-3);
	$("#menu ul li.menu_in a").css("padding-left",w);
	$("#menu ul li.menu_in a").css("padding-right",w);
	$("#menu ul li.menu_in ul li a").css("padding-left",w);
	$("#menu ul li.menu_in ul li a").css("padding-right",w1);
	/**/

	 if(strChMid.indexOf("MSIE 6") != -1){
		$("#menu ul li ul li a").mouseover(function () {
			$(this).parent().parent().parent().css("background","#037EBB");
			$(this).parent().css("background","#009EE3"); 
		});
		$("#menu ul li ul li a").mouseout(function () {
			$(this).parent().parent().parent().css("background","none");
			$(this).parent().css("background","#037EBB"); 
		});
	}
	$(window).resize( function(){
   		/* Position et taille des différents éléments au redimansionnement de la page */
		newR = ($(window).width()-$("#img_background").width())/2;
		$("#img_background").css("right",newR);
	});
	/**/
	$('#menu li ul li').each(function () {
		$(this).mouseover(function(){
			$(this).children(".menu_ul").css("display","block");
		});
		$(this).mouseout(function(){
			$(this).children(".menu_ul").css("display","none");
		});
	});
	$('#content_menu li').each(function () {
		var time = 500;
		var hideDelay = 10;
		var hideDelayTimer = null;
		var beingShown = false;
		var shown = false;
		var trigger = $(this);
		var info= $(".mov", this);
		var infol= $(".left", this);
		$(trigger).mouseover(function () {
			$(info).css("margin-left","0");
			$(infol).css("margin-left","0");
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
				$(info).css("margin-left","0");
				$(infol).css("margin-left","0");
			if (beingShown || shown) {
				// don't trigger the animation again
				return;
			} else {
				// reset position of info box
				beingShown = true;
				$(info).animate({
					marginLeft: '-=159px'
				},500
				);
				$(infol).animate({
					marginLeft: '+=129px'
				},500, function() {
						beingShown = false;
						shown = true;
				});
			}
			return false;
		}).mouseout(function () {
			$(info).css("margin-left","-159px");
			$(infol).css("margin-left","129px");
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				$(info).animate({
					marginLeft: '+=159px'
				},500
				)
				$(infol).animate({
					marginLeft: '-=129px'
				},500, function () {
						$(info).css("margin-left","0");
						$(infol).css("margin-left","0");
						shown = false;
				});
			}, hideDelay);
			return false;
		});
	});
	/**/
	$("#print, #printf").click(function(){
		window.print();	
		return false;
	});
	if(strChMid.indexOf("MSIE 6") != -1){
		wP = $("#revue_presse ul li").size()*250;
		decalP = 250;
	}else{
		wP = $("#revue_presse ul li").size()*240;
		decalP = 240;
	}
	
	$("#revue_presse ul").css("width",wP+"px");
	// Déplacement des promotions
	$("#revue_presse .presse_arrowr").click(function(){
		leng = $("#revue_presse ul").css("margin-left").length;
		minL = $("#revue_presse ul").css("margin-left").substr(0,leng-2);
		if(minL > -wP+decalP){
			$("#revue_presse ul").animate({
				marginLeft:	'-='+decalP+"px"
			});
		}
		return false;
	});
	$("#revue_presse .presse_arrowl").click(function(){
		leng = $("#revue_presse ul").css("margin-left").length;
		minL = $("#revue_presse ul").css("margin-left").substr(0,leng-2);
		if(minL < 0){
			$("#revue_presse ul").animate({
				marginLeft:	'+='+decalP+"px"
			});
		}	
		return false;
	});
});
$(function(){
			$('#slides').slides({
				preload: true,
				preloadImage: 'design/images/loading.gif',
				play: 5000,
				pause: 2500,
				hoverPause: true,
				animationStart: function(){
					$('.caption').animate({
						bottom:-35
					},100);
				},
				animationComplete: function(current){
					$('.caption').animate({
						bottom:0
					},200);
					if (window.console && console.log) {
						// example return of current slide number
						console.log(current);
					};
				}
			});
		});
