var idCurrentItem=0;
var compteurAnim=0;
$(window).resize(function() {
				
				left=$("#central2").offset().left;
				$("#boiteMenu").css('left',left + 'px');
			});
			
			
			$(document).ready(function() {
				
				
				$("#language").change(function()
				{
					
					alert($(this).val);
					switch($(this).value)
					{
						
					}
				});
				
				  $(this).everyTime(5000, function() {
					nbelements = $("#listConcepts li").length;
					idCurrentItem = ++idCurrentItem % nbelements;
					currentItem=$("#listConcepts li").eq(idCurrentItem).html();
					//left: $("#listConcepts").innerWidth() - $("#listConcepts p").innerWidth()
					
					if($("#listConcepts span").length==0) $("#listConcepts").append("<span>&nbsp;</span>");
					
					$("#listConcepts > span").animate({opacity:0},3000,function(){
						$("#listConcepts").append("<span>"+currentItem+"</span>");
						$("#listConcepts > span").css('position','relative');
						$(this).remove();
						switch(compteurAnim % 4)
						{
							case 0:
								$("#listConcepts > span").css('top','0px');
								$("#listConcepts > span").css('left','0px');
								break;
							case 1:
								left=$("#listConcepts").innerWidth() - $("#listConcepts > span").eq(0).innerWidth();
								$("#listConcepts > span").css('left',left + 'px');
								$("#listConcepts > span").css('top','0px');
								break;
							case 2:
								left=$("#listConcepts").innerWidth() - $("#listConcepts > span").eq(0).innerWidth();
								letop=$("#listConcepts").innerHeight() - $("#listConcepts > span").eq(0).innerHeight();
								$("#listConcepts > span").css('left',left + 'px');
								$("#listConcepts > span").css('top',letop + 'px');
								break;
							case 3:
								letop=$("#listConcepts").innerHeight() - $("#listConcepts > span").eq(0).innerHeight();
								$("#listConcepts > span").css('left','0px');
								$("#listConcepts > span").css('top',letop + 'px');
								break;
						}
						compteurAnim++;
					});
					
				});
				
			
				
				 $("h1").appendTo("#bann");
				
				$("#listMenu a").click(function()
				{
					$(window).scrollTo($(this).attr("href"), 1000);
				});
				//alert($("#central2").offset().left);
				left=$("#central2").offset().left;
				$("#boiteMenu").css('left',left + 'px');
				
				$("#monMail").focusin(function() {
					$("#monMail").val('');
				});
				
				$("#monMail").focusout(function() {
					if($("#monMail").val()=="")
					{
						$("#monMail").val('votre adresse email');
					}
				});
				
				$("#subMail").click(function()
				{
					
					
					
					
					
					//$(window).scrollTo('#bann:eq(0)', 1000);
					mail = $("#monMail").attr("value");
					msg = $("#monMessage").attr("value");
			
					$.ajax({
						type: "POST",
						url: "script/mail.php",
						data: "mail="+mail+"&msg="+msg,
						success: function(msg){
							alert('message envoyé ' + msg );
						}
						
					});
					 event.stopPropagation();
					
				});
				
				$("#Mail").click(function()
				{
					
					
					
					//$(window).scrollTo('#bann:eq(0)', 1000);
					mail = $("#monMail").attr("value");
					alert("envoyer un mail a ce bon vieu David " + mail );
					$.ajax({
						type: "POST",
						url: "mail.php",
						data: "mail"+mail,
						success: function(msg){
							//alert( "Data Saved: " + msg );
						}
					});
					 event.stopPropagation();
					
				});
				
				activeScroll = function()
				{
					$(window).unbind('mousewheel');
				};
				
				desactiveScroll = function()
				{
					$(window).mousewheel(function(myevt){return false;});
				};
				
				modal = $(function() {
					$("#dialog").dialog("destroy");
					
					$("#dialog").dialog({ width: 460, modal: true, resizable:false,close: activeScroll,open:desactiveScroll});
					
				});
				
				$("#reIntro").click = modal;
				
				
			});
			

