﻿window.isHomePage="true";


var imagesHome=[];
	imagesHome[0]=["assortiment_de_carres.jpg","Des produits","redirectHomeAnimation","ADVANCED_SEARCH","PAYSAGE","","true","assortiment_de_carres"];
	imagesHome[1]=["boule-poire-sur-lit-de-chocolat.jpg","Recettes","redirectHomeAnimation","HOME_RECIPES","PAYSAGE","","true","boule-poire-sur-lit-de-chocolat"];
	imagesHome[2]=["camion.jpg","Nos métiers","redirectHomeAnimation","METIERS","PAYSAGE","","true","camion"];
	imagesHome[3]=["pintade home page.jpg","Des catalogues","redirectHomeAnimation","HOME_CATALOGS","PORTRAIT","","true","Les rendez-vous du mois"];
	imagesHome[4]=["cocktail-de-crevettes.jpg","Recettes","redirectHomeAnimation","HOME_RECIPES","PORTRAIT","","true","cocktail-de-crevettes"];
	imagesHome[5]=["plsandwich.jpg","Recettes","redirectHomeAnimation","HOME_RECIPES","PORTRAIT","","true","plsandwich"];
	imagesHome[6]=["couverture-garniture.jpg","Des catalogues","redirectHomeAnimation","HOME_CATALOGS","PORTRAIT","","true","couverture-garniture"];
	imagesHome[7]=["crumble-de-poireaux.jpg","Des produits","redirectHomeAnimation","HOME_ADVANCED_SEARCH","PAYSAGE","","true","crumble-de-poireaux"];
	imagesHome[8]=["dorade-sebaste.jpg","Des produits","redirectHomeAnimation","ADVANCED_SEARCH","PAYSAGE","","true","dorade-sebaste"];
	imagesHome[9]=["fille_glace.jpg","Nouveautés","redirectHomeAnimation","PRODUCT_NEWS","PORTRAIT","","true","fille_glace"];
	imagesHome[10]=["haricot-verts.jpg","Idées menus","redirectHomeAnimation","IDEES_MENU","PORTRAIT","","true","haricot-verts"];
	imagesHome[11]=["27339-pintade Home page vignette video.jpg","Des vidéos","redirectHomeAnimation","HOME_VIDEOS","PAYSAGE","435.flv","true","Suprême de Pintade"];
	imagesHome[12]=["dessert_glace_pistache.jpg","Ma très bonne glace","redirectHomeAnimation","CATALOGS_MARQUES_CONCEPT","PAYSAGE","","true","Ma_très_bonne_glace"];
	imagesHome[13]=["glace-fruits-de-la-passion.jpg","Des vidéos","redirectHomeAnimation","HOME_VIDEOS","PAYSAGE","413.mov","true","recette-glace-fruits-de-la-passion"];
	imagesHome[14]=["ppf-nantes.jpg","Notre actualité","redirectHomeAnimation","NEWS","PAYSAGE","","true","ppf-nantes"];
	imagesHome[15]=["mtbg.jpg","Des vidéos","redirectHomeAnimation","HOME_VIDEOS","PAYSAGE","419.flv","true","ma-tres-bonne-glace"];
	imagesHome[16]=["riz-dans-bol.jpg","Idées menus","redirectHomeAnimation","IDEES_MENU","PAYSAGE","","true","riz-dans-bol"];
	imagesHome[17]=["Saute_de_bison.jpg","Des produits","redirectHomeAnimation","ADVANCED_SEARCH","PAYSAGE","","true","Saute_de_bison"];
	imagesHome[18]=["tomates-farcies.jpg","Idées menus","redirectHomeAnimation","IDEES_MENU","PAYSAGE","","true","tomates-farcies"];
	imagesHome[19]=["Toque.png","Idées menus","redirectHomeAnimation","IDEES_MENU","PORTRAIT","","false","Toque"];
	
var skipIntro;

if(PTPortlet.getSessionPref("skipIntro")==null || PTPortlet.getSessionPref("skipIntro")==undefined){
	skipIntro="false";
}
else{
	skipIntro=PTPortlet.getSessionPref("skipIntro");
	//PTPortlet.setSessionPref("skipIntro","false");
}
// on vérifie la version du flash player
var playerVersionRequired = 9;
var playerVersionObj = swfobject.getFlashPlayerVersion();
var playerVersion=playerVersionObj.major+(playerVersionObj.minor/10)+(playerVersionObj.release/1000);
var playerIsOK = false;
var activeDomainChecker=false;

	/*var output = "You have Flash player " +
	playerVersion.major + "." + playerVersion.minor + "." +
	playerVersion.release + " installed";
	output+="<br>You need 9.00";
	document.getElementById("flashInfos").innerHTML=output;
	*/

// l'utilisateur possède le plugin flash et la version est > 9
if(playerVersion>=playerVersionRequired){
	// on paramètre l'animation
	playerIsOK=true;

	var imgSvrPath = pathRessources;
	// path du fond musical
	var pathMusic=imgSvrPath + "/flash/home/asset/music/";
	// path des images
	var pathImg=imgSvrPath +"/flash/home/asset/img/";

	var skipIntro=skipIntro;
	// valeur en ms du temps maximum d'attente pour le chargement de l'animation
	// mettre 0 pour un temps infini
	// valeur conseillée : 10000 soit 10 s
	var timeOut=10000;
	
	// sub path des videos DONt'T TOUCH this value
	var pathVideo="/content-management/video-management/integrated/video/";
	// path du domain checker
	var domainCheckerConfigURL=imgSvrPath +"/flash/domain_checking/";
	// active : activation du domain checker
	//var imgSvrPath = portalHostProtocol + "//" + portalHostName + "/imageserver/plumtree/portal/custom/pomona/branding"; 
	
	// recupère le protocol [http:]
	//var portalHostProtocol = window.location.protocol;
	// recupère le hostName [pomonapassionfroid.fr]
	var portalHostName = window.location.host;

	if(portalHostName.indexOf("www.")<0 && portalHostName.indexOf(".fr")<0){
		// on est sur le réseau pomona donc en mode intranet
		activeDomainChecker=true;
	}
	
	var str="<images><domainChecker active='"+activeDomainChecker+"' configURL='"+domainCheckerConfigURL+"'/>";
	str+="<skipIntro value='"+skipIntro+"'/>";
	str+="<timeOut value='"+timeOut+"'/>";
	str+="<music url='"+pathMusic+"sweetTravel.mp3'/>";
	// on dessine un contour blanc autour des images (pas sur les images avec une vidéo attachée)
	str+="<borders active='true'/>";
	
	// pour info : 	les images 16/9 doivent être aux dimensions : 367 x 206 ou 206 x 367
	// 				pour les vidéos 16/9 il faut renseigner urlVideo=pathVideo+[nom de la vidéo].flv
	
	for(var i=0;i<imagesHome.length;i++){
		var item=imagesHome[i];
		
		var homeFileName=imagesHome[i][0];
		var homeFileLabel=imagesHome[i][1];
		var homeJSFunctionRedirect=imagesHome[i][2];
		var homeParamRedirect=imagesHome[i][3];
		var homeImgMode=imagesHome[i][4];
		var homeURLVideo=imagesHome[i][5];
		var homeDisplayStatic=imagesHome[i][6];
		var homeLinkXitiLog=imagesHome[i][7];
		
		if(homeURLVideo!=""){
			str+="<image url='"+pathImg+homeFileName+"' label='"+homeFileLabel+"' xitiLog='"+homeLinkXitiLog+"' link='"+homeJSFunctionRedirect+"' parameter='"+homeParamRedirect+"' urlVideo='"+pathVideo+homeURLVideo+"'/>";
		}
		else{
			str+="<image url='"+pathImg+homeFileName+"' label='"+homeFileLabel+"' xitiLog='"+homeLinkXitiLog+"' link='"+homeJSFunctionRedirect+"' parameter='"+homeParamRedirect+"' />";
		}
		
	}
	str+="</images>";

	
	// on lance l'animation
	var flashvars = {};
	flashvars.configData=str;
	var params = {};
	params.menu = "false";
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = "menu3D_container";
	var swf = imgSvrPath + "/flash/home/swf/homeDSIPomona.swf?t="+Math.random();
	var swfInstall = imgSvrPath +"/flash/swf/expressInstall.swf";

	// pour info : anciennes dimensions de l'animation 725 x 470
	// pour info : nouvelles dimensions de l'animation 796 x 528
	swfobject.embedSWF(swf, "menu3D_container", "748", "530", "9.0.0", swfInstall, flashvars, params, attributes);

}
else{
	// on passe l'animation car l'utilisateur n'a pas flash d'installé
	//redirectToNextPage();
}
// function de navigations ************************************************
function redirectHomeAnimation(param){
	PTPortlet.setSessionPref("skipIntro","true");
	if(param=="PRODUCT_NEWS"){
		doNewProductSearch();	
	}
	if(param=="ADVANCED_SEARCH"){
		getAdvancedSearchPage();	
	}
	if(param=="HOME_CATALOGS"){
		goToCatalog();
	}
	if(param=="CATALOGS_MARQUES_CONCEPT"){
		goToHorsSerieCatalog();
	}
	if(param=="HOME_VIDEOS"){
		goToVideo();
	}
	if(param=="IDEES_MENU"){
		goToRecetteIdeesMenu();
	}
	if(param=="METIERS"){
		goToOurBusiness();
	}
	if(param=="HOME_RECIPES"){
		goToRecipeHome();
	}
	if(param=="NEWS"){
		goToPPFNews();
	}
	if(param=="PARTENAIRES"){
		goToPartenaires();
	}
	
}	
function redirectWithDetailsHomeAnimation(param){
	PTPortlet.setSessionPref("skipIntro","true");
	var homeRedirectParams=param.split("|");
	if(homeRedirectParams[0]=="PRODUCT"){
		var code=homeRedirectParams[1];
		getProductDetailsPageByProductCode(code);	
	}
}
// function de navigations / flash ************************************************
function onSkipAnimation(){
	// l'animation informe que l'on skip l'animation
	PTPortlet.setSessionPref("skipIntro","true");
	redirectToNextPage();
}
function redirectToNextPage(){
	redirectHomeAnimation("PRODUCT_NEWS");
}
// functions statistiques ***********************************************************
function onDomainChecked(domain){
	// après recherche du domain d'execution des vidéos
	//alert("onDomainChecked "+domain);
}
function logAnimationSuccessFull(param){
	// l'animation est chargée avec succès
	PTPortlet.setSessionPref("skipIntro","true");
	xt_med('F','',xtpage+"::chargee");
	
}
function logAnimationFailed(param){
	// l'animation est chargée avec une erreur
	xt_med('F','',xtpage+"::erreur::"+param);
	if(activeDomainChecker){
		if(param.indexOf("timeout")>=0){
			// s'il s'agit d'un timeout
			redirectToNextPage();
		}
		else{
			// s'il s'agit d'une erreur
			displayStaticHome(param);
		}
	}
	else{
		displayStaticHome(param);
	}
}
function logFirstClickLeaf(param){
	// on click pour zoomer une image
	xt_med('F','',xtpage+"::zoom::"+param);
}
function logSecondClickLeaf(param){
	// on click pour visualiser le lien proposer sur l'image
	xt_med('F','',xtpage+"::"+param);
}