var tab_email={};
var cpt_email=0;
$(document).ready(function() {
	$("#contenu .cartouche").delay(1000).animate({
		backgroundPosition: '0px 0px'
	});
	$(".mail_crypte").each(function() {
		var mail = $(this).html();
		mail=mail.replace("{#}", "@");
		mail=mail.replace("{{#}}", ".");
		tab_email[cpt_email]=mail;
		$("<a href=\"#\" rel=\"nofollow\" class=\"lien_mail\" id=\"mail"+cpt_email+"\">Nous envoyer un mail</a>").insertAfter(this);
		cpt_email++;
		$(this).remove();
	});
	$(".lien_mail").click(function() {
		var ref = $(this).attr("id");
		ref=ref.replace("mail", "");
		$(location).attr("href","mailto:"+tab_email[ref]);
		return false;
	});
	$(".membre_equipe").hover(function() {
		/*$("#fleche").css({top: $(this).css("top").replace("px", "")-20, left: parseInt($(this).css("left").replace("px", ""))+($(this).width()/2)-45});
		$("#fleche").show();*/
		$("#bulle_"+$(this).attr("id")).stop().animate({
			top : "520px",
			opacity:1
		});
	}, function() {
		$("#fleche").hide();
		$(".bulle_info").stop().animate({
			top : "540px",
			opacity:0
		});
	});
	if ($("#zone_photo").length>0) {
		$(window).scrollTop(1000);
	}
	if ($(window).height()>1100) {
		setInterval(changevisage, 300);
	}
	 $("a[rel^='prettyPhoto']").prettyPhoto({
		 overlay_gallery: false,
		 social_tools:"",
		 allow_resize: false
	 });
	 $("#noflash_bandeau").click(function() {
		if (!$("#general").hasClass("couleur_accueil")) {
			window.open('http://get.adobe.com/fr/flashplayer/');
		}
		else {
			location.href='agence.html';
		}
	 });
});
$(window).scroll(function() {
	if ($(document).scrollTop()>200) {
		setInterval(changevisage, 300);
	}
})
var element=0;
function changevisage() {
	var obj = $(".membre_equipe").eq(element);
	if (!obj.hasClass("pos2") && !obj.hasClass("pos3")) {
		obj.addClass("pos2");
	}
	else if (obj.hasClass("pos2")) {
		obj.removeClass("pos2");
		obj.addClass("pos3");
	}
	else if (obj.hasClass("pos3")) {
		element++;
	}
}

// Fonction pour l'animation de l'accueil
function lien_site(txt) {
	switch(txt) {
		case "carre_web" :location.href="internet.html";break;
		case "carre_conseil" :location.href="marketing.html";break;
		case "carre_print" :location.href="print.html";break;
		case "carre_stand" :location.href="stand-plv.html";break;
		case "info_web" :location.href="internet.html";break;
		case "info_conseil" :location.href="marketing.html";break;
		case "info_print" :location.href="print.html";break;
		case "info_stand" :location.href="stand-plv.html";break;
	}
}

// Fonction pour l'animation du menu
function action_btn(txt) {
	switch(txt) {
		case "lagence" :location.href="agence.html";break;
		case "marketing" :location.href="marketing.html";break;
		case "print" :location.href="print.html";break;
		case "stand" :location.href="stand-plv.html";break;
		case "internet" :location.href="internet.html";break;
		case "multimedia" :location.href="multimedia.html";break;
		case "contact" :location.href="contact.html";break;
	}
}
function trim(string) {
	return string.replace(/(^\s*)|(\s*$)/g,'');
} 

function vision(id) {
	//var url_site = "http://192.168.1.70/planete/";
	var url_site = "http://www.planete-communication.fr/";
	api_images = [
		url_site+'video-1-720-400.html?iframe=true&width=720&height=400',
		url_site+'video-2-704-528.html?iframe=true&width=704&height=528',
		url_site+'video-3-976-544.html?iframe=true&width=976&height=544',
		url_site+'video-4-704-400.html?iframe=true&width=704&height=400',
		'http://www.pepinieres-valderdre.fr/visite_virtuelle/visite_virtuelle.html?iframe=true&width=915&height=620',
		url_site+'bandeau-1.html?iframe=true&width=915&height=620',
		url_site+'bandeau-2.html?iframe=true&width=800&height=360',
		url_site+'bandeau-3.html?iframe=true&width=800&height=360',
		url_site+'bandeau-4.html?iframe=true&width=800&height=620',
		url_site+'audio-1.html?iframe=true&width=400&height=250',
		url_site+'bandeau-5.html?iframe=true&width=800&height=500',
		url_site+'bandeau-6.html?iframe=true&width=800&height=500'
	];
	api_titles = [
		'',
		'',
		'',
		'',
		'',
		'',
		'',
		'',
		'',
		''
	];
	api_descriptions = [
		'Clément & lise',
		'Soreel',
		'Tandem',
		'ADB Formation',
		'Pépinière Val d\'erdre',
		'Campagne JEEP - La fête des Pères et des fils',
		'Campagne BOPY',
		'Campagne Méduse',
		'Campagne Kavany',
		'Bande son - Domaine du lotus',
		'Ecran chargeur SGTE',
		'CD-ROM France Joint'
	];
	$.prettyPhoto.open(api_images,api_titles,api_descriptions);
	switch (id) {
		case 218:
			$.prettyPhoto.changePage(0);
			break;
		case 219:
			$.prettyPhoto.changePage(1);
			break;
		case 220:
			$.prettyPhoto.changePage(2);
			break;
		case 221:
			$.prettyPhoto.changePage(3);
			break;
		case 222:
			$.prettyPhoto.changePage(4);
			break;
		case 232:
			$.prettyPhoto.changePage(5);
			break;
		case 233:
			$.prettyPhoto.changePage(7);
			break;
		case 234:
			$.prettyPhoto.changePage(8);
			break;
		case 235:
			$.prettyPhoto.changePage(6);
			break;
		case 224:
			$.prettyPhoto.changePage(9);
			break;
		case 228:
			$.prettyPhoto.changePage(10);
			break;
		case 223:
			$.prettyPhoto.changePage(11);
			break;
	}
}

