$(document).ready(function(){
	//lecteur
	$("#play, #player_video").click(function(){
			$("#player_video").html("<iframe src='http://player.vimeo.com/video/23998096?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1' width='800' height='450' frameborder='0' ></iframe>");
			$("#close").show();
	});
	
	$("#close").click(function(){
		$("#player_video").html("<span id='play'></span>");
		$(this).hide();
		$('html').animate({scrollTop:1024},500);		
	});
	//navigations
	
	$('.home').click(function(){
		$.scrollTo($('#home'), "def", function(){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		});
		return false;
	});
	
	$('.about').click(function(){
		$.scrollTo($('#about'), "def", function(){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		});
		return false;
	});
	
	$('.infos').click(function(){
		$.scrollTo($('#infos'), "def", function(){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		});
		return false;
	});
	
	$('.domaines').click(function(){
		$.scrollTo($('#domaines'), "def", function(){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		});
		return false;
	});
	
	$('.contact').click(function(){
		$.scrollTo($('#contact'), "def", function(){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		});
		return false;
	});
	
	$('.blogg').click(function(){
		$.scrollTo($('#blog'), "def", function(){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		});
		return false;
	});
	
	$(window).scroll(function(){
		var top = $(document).scrollTop();
		if(top >=1024){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		}else{
			$("#bt_share").stop().animate({"top": "+1024px"}, "fast");
		} 
    });
	
	$("#first, #prev, #next, #last").click(function(){
		var top = $(document).scrollTop();
		if(top >=1024){
			$("#bt_share").stop().animate({"top": "+500px"}, "fast");
		}else{
			$("#bt_share").stop().animate({"top": "+1024px"}, "fast");
		}
    });
	// domaines
	$('#go').click( function(){
        var news = $('.news_3');
        if(news.css('top') == "0px"){
            $('#news div').animate({"top": "+=400px"}, 300);
        }else{
            $('#news div').animate({"top": "-=200px"}, 300);
        }         
    });
	
	// over menu
	
	$("#menu a").mouseover(function(){
		var title = $(this).attr("title");
		//alert(attrclass);
		$("span[class^=bulle_]").hide();
		$(".bulle_"+title).show();
	});
	
	$("#menu a").mouseout(function(){
		$("span[class^=bulle_]").hide();
	});

	//verif form
});
	loadFlash("carte", "/swf/Earth ZOom_5_1.swf", 365, 203, false);
	
			function verifForm(){
		var nom = document.getElementById("nom").value;
		var tel = document.getElementById("tel").value;
		var mail = document.getElementById("email").value;
		var message = document.getElementById("message").value;
		var lblnom = document.getElementById("nom");
		var lblmail = document.getElementById("email");
		var lblmessage = document.getElementById("message");
		var erreur = 0;
		if (nom == "" ){
			lblnom.style.color = "#f00";
			erreur++;
		}else{
			lblnom.style.color = "#fff";
		}
		
		if (is_valid_email(mail)){
			lblmail.style.color="#fff";
		}else if (mail == ""){
			lblmail.style.color = "#f00";
			erreur++;
		}else{
			lblmail.style.color = "#f00";
			erreur++;
		}
		if(message == ""){
			lblmessage.style.color = "#f00";
			erreur++;
		}else{
			lblmessage.style.color = "#fff";
		}
		if(erreur==0){
			var str_total = "&nom="+nom+"&mail="+mail+"&message="+message+"&tel="+tel;           
			myAjax("send_form", str_total, result);
		}
	}

    function result(res){
        if(res.res=="OK"){
            document.getElementById("error").innerHTML = "votre message a bien été envoyé"; 
        }else{
            document.getElementById("error").innerHTML = res.error+" Une erreur est survenue lors de l'envoi de votre message";
        }
    }
	
	function is_valid_email(email){
		return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email);
	}
