(function($) {
	$.fn.diapo = function(num) {
		if(!$(this).hasClass("stop")){
		$(".menu").addClass("stop");
		  vu = '#'+$(".vu").attr("id");
		  if ((vu != '#blog'+num) || (vu != '#'+$(".ini").attr("id"))) {
			  $(".chapo").hide();
			  $(".titre-texte").hide();
			  $('#tbis'+num).show(); 
		  	  $("div[class=texte][id!=p"+num+"]").animate({top: "-504px"}, 500, "swing", function(){
			    $('#p'+num).animate({top: "0px"}, 500, "swing", function(){
					$(".menu").removeClass("stop");
				}); 
		      });
			  $(".bouton-vu").hide();
			  $(".bouton").show();
			  $("#"+num+" > .bouton").hide();
			  $("#"+num+" > .bouton-vu").show();
			  $(".chapo").show();
		  	}
		}
	};
})(jQuery);

function init()
{ 
if($(".menu").hasClass(".ini")){
	prec = parseInt($("#num").html());
	if(prec >= 5){prec = 0;}
	next = prec + 1;
	document.getElementById("num").innerHTML = next;	
	$('#'+next).diapo(next);	
	$('#'+next).addClass("ini");
	$('#'+prec).removeClass("ini");	
}
};

$(document).ready(function() {
$(".t").hide();
$(".titre-texte").hide();
$('#tbis'+$(".ini").attr("id")).show();
$('#tbis'+$(".vu").attr("id")).show();

setInterval('init();',8000); 

$(".menu").click(function(){
	$(".ini").removeClass("ini");					  
	$(this).diapo(this.id);
});

$("#animation").click(function(){
	$("body").css("overflow","hidden");						   
	$("#prehome").css("width","100%");	
	$("#prehome").css("height","100%");
	$("#prehome").css("z-index","100");
	/*var chaine = navigator.userAgent;
	var firefox = "Firefox";
	if (chaine.match(firefox)) {
	document.getElementById("film").innerHTML = '<object type="application/x-shockwave-flash" data="images/stories/intro/animdpa.swf" width="860" height="500"><param name="movie" value="images/stories/intro/animdpa.swf" /><param name="wmode" value="transparent"><video tabindex="0" id="video" src="images/stories/intro/mobile_480.mp4video.mp4" controls="controls" preload="auto" autoplay="true" width="480" height="272"></object>';
	}
	else {
	document.getElementById("film").innerHTML = '<object type="application/x-shockwave-flash" data="images/stories/intro/animdpaf4v.swf" width="860" height="500"><param name="movie" value="images/stories/intro/animdpaf4v.swf" /><param name="wmode" value="transparent"><video tabindex="0" id="video" src="images/stories/intro/mobile_480.mp4video.mp4" controls="controls" preload="auto" autoplay="true" width="480" height="272"></object>';	
	}*/
	document.getElementById("film").innerHTML = '<object type="application/x-shockwave-flash" data="images/stories/intro/player_flv_maxi.swf" width="788" height="446"><param name="movie" value="images/stories/intro/player_flv_maxi.swf" /><param name="FlashVars" value="flv=http://www.dpared.com/images/stories/intro/Sequence.flv&amp;width=788&amp;height=446&amp;playercolor=d60006&amp;buttoncolor=d60006&amp;slidercolor=d60006&amp;loadingcolor=0&amp;autoplay=1&amp;buffer=8&amp;showplayer=autohide&amp;showloading=autohide&amp;playeralpha=0&amp;playertimeout=3000&amp;buffershowbg=0&amp;margin=0&amp;showvolume=1&amp;loadingcolor=ffffff&amp;buffermessage=Chargement _n_&amp;slidercolor1=ffffff&amp;slidercolor2=d60006&amp;videobgcolor=d60006" /></object>';
});
$("#skip").click(function(){
	skip();
});

$("#solutions > div").hover(function(){
	$(".ini").removeClass("ini");
});

	$(".menu").hover(function(){
		blogh = '#blog'+this.id;					  
		vuh = '#'+$(".vu").attr("id");
		inih = '#'+$(".ini").attr("id");
		titre = '#t'+this.id;					  
		$("#titre-texte").hide(); 
		$(titre).show(); 
		if ((vuh != blogh) || (vuh != inih)) {$("#"+this.id+" > .bouton").attr("src", "templates/bitoblue/images/bouton"+this.id+".png");}}, function(){
		titre = '#t'+this.id; 
		$(titre).hide(); 
		$("#titre-texte").show();
		if ((vuh != blogh) || (vuh != inih)) {$("#"+this.id+" > .bouton").attr("src", "templates/bitoblue/images/bouton.png");}
	});
	
	$(".menuf").hover(function(){
		$(this).css({'background':'#fff'});
		$(this).css({'color':'#999'});
	},function(){
		$(".menuf").css({'color':'#fff'});					   
		$(".menuf").css({'background':'transparent'});
	});
	
	$(".col").hover(function(){
		excol = '#ex'+this.id;
		$(excol).show();},function(){
		$(excol).hide();
	});
});
