
function redirectToportal(url){
  redirectToPortal(url);
}
function redirectToPortal(url){
	     //alert('inside Redirect to portal');
		 var portalHostProtocol = window.location.protocol;
		 var portalHostName = window.location.host;

		 if(url.length>0)
		 {
			 //Break up URL
			 var urlSplit=url.split("/");
		     var arrParams = urlSplit.length;

			 //Need to work out what type of url
			 //1) Check if is a UUID
			 if(url.indexOf('{') != -1)
	   		 {
                //we have a uuid link
	            var redirectString = portalHostProtocol + "//" + portalHostName + "/portal/server.pt?uuID=" + url + "&mode=2";
	            window.location.href = redirectString;
	            return false;
	         } 

			 //2) Check if Portal Url and redirect 	
	        if(urlSplit[2]==window.location.host)
		    {
			    //This is a portal URL 
	            window.location.href = url;
	        }else
	        {
	        	//This is a Non portal URL.  I have put a branch here incase we want to popup the external in a new window
	        	window.location.href = url;
	        	//window.open(url);
		    }
		 }
	}

function executeViaProductSearchEnter(evt){       
 	evt = (evt) ? evt : event;
	//var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
	//if (charCode == 13 || charCode == 3)
	//{
	//    doProductSearch();
	//}
	
	var characterCode; //literal character code will be stored in this variable

	if(evt && evt.which){ //if which property of event object is supported (NN4)
		evt = evt;
		characterCode = evt.which; //character code is contained in NN4's which property
	}
	else{
		evt = event;
		characterCode = evt.keyCode; //character code is contained in IE's keyCode property
	}

	if(characterCode == 13 || characterCode == 3){ //if generated character code is equal to ascii 13 (if enter key)
		doProductSearch();
	}
	else
		return true;
}
function goToHomePage(){
	var searchUrl = document.getElementById('redirectToHomePage').href;
	window.location.href = searchUrl ;
}

function goToGroupePomona(){
	var searchUrl = document.getElementById('redirectToGroupePomona').href;
	window.location.href = searchUrl ;
}
function goToOurBusiness(){
	var searchUrl = document.getElementById('redirectToOurBusiness').href;
	window.location.href = searchUrl ;
}
function goToPPFNews(){
	var searchUrl = document.getElementById('redirectToPPFNews').href;
	window.location.href = searchUrl ;
}
function goToPartenaires(){
	var searchUrl = document.getElementById('redirectToPartenaires').href;
	window.location.href = searchUrl ;
}

function goToProductSearchNoResults(){
	/*var searchUrl = document.getElementById('redirectToSearchProductNoResult').href;
	window.location.href = searchUrl ;
	*/
	setTimeout("goToProductSearchNoResultsAfterWainting()",500);
}
function goToProductSearchNoResultsAfterWainting(){
	var searchUrl = document.getElementById('redirectToSearchProductNoResult').href;
	window.location.href = searchUrl ;
}
function doProductSearch(){
   var searchParam =  document.getElementById('pdtKeyword').value;
   getProductSearchPage(searchParam,1,3);
}
function doNewProductSearch(){ 
	var searchUrl = document.getElementById('redirectToLatestProduct').href;
	window.location.href = searchUrl ;
}
function doSubmitEmail(){
   alert('Do Email Form Submit');
}
function doCatalogSearch(){
   alert('Do Catalog Search');
}
function doTrouvez(){
   alert('Do Trouvez');
}
function doRegisterUser(){
   alert('Do User Registration');
}
function doPortalSearch(){ 
    alert('Do Portal Search');	
}

function goToTrouvezInterlocuteur(){
	var searchUrl = document.getElementById('redirectToTrouvezInterlocuteur').href;
	window.location.href =searchUrl;
}

function getProductSearchPage(searchParam,indexPage,nbRows){
	var searchUrl = document.getElementById('redirectToProductSearch').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&productCode=' + searchParam +'&indexPage='+indexPage+'&nbRows='+nbRows ;
		}
		else
		{
			window.location.href = searchUrl + '?productCode=' + searchParam +'&indexPage='+indexPage+'&nbRows='+nbRows;
	    }
   }
}
function getProductDetailsPageByProductCode(code){
	var searchUrl = document.getElementById('redirectToProductDetails').href;
	if(code!=null || code!="")
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&productCode=' + code ;
		}
		else
		{
			window.location.href = searchUrl + '?productCode=' + code ;
	    }
   }
}
function getProductsVideos( searchParam,indexPage,nbRows){
	if(searchParam==""){
		searchParam="ALL";
	}
	var searchUrl = document.getElementById('redirectToProductVideo').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
	    }
   }
   
}
function getMiseEnOeuvreVideos( searchParam,indexPage,nbRows){
	if(searchParam==""){
		searchParam="ALL";
	}
	var searchUrl = document.getElementById('redirectToMiseEnOeuvreVideo').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
	    }
   }
   
}
function getRecipesVideos( searchParam,indexPage,nbRows){
	if(searchParam==""){
		searchParam="ALL";
	}
	var searchUrl = document.getElementById('redirectToRecipesVideo').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
	    }
   }
   
}
function getBusinessVideos( searchParam,indexPage,nbRows){
	if(searchParam==""){
		searchParam="ALL";
	}
	var searchUrl = document.getElementById('redirectToBusinessVideo').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
	    }
   }
   
}
function getSectorVideos( searchParam,indexPage,nbRows){
	if(searchParam==""){
		searchParam="ALL";
	}
	var searchUrl = document.getElementById('redirectToSectorVideo').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
	    }
   }
   
}
function getTrendsVideos( searchParam,indexPage,nbRows){
	if(searchParam==""){
		searchParam="ALL";
	}
	var searchUrl = document.getElementById('redirectToTrendsVideo').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?searchParam=' + searchParam +'&indexPage=' + indexPage+'&nbRows='+nbRows;
	    }
   }
   
}
function getAdvancedSearchPage(){
	var searchUrl = document.getElementById('redirectToAdvancedSearch').href;
	window.location.href =searchUrl;
}

function getAdvancedSearchResultsPage(searchParam,restaurationCollective,restaurationCommerciale,indexPage,nbRows){
	var searchUrl = document.getElementById('redirectToAdvancedSearchProductResult').href;
	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&typeSearch=FP&searchStr=' + searchParam +'&restaurationCollective='+restaurationCollective+'&restaurationCommerciale='+restaurationCommerciale+'&indexPage='+indexPage+'&nbRows='+nbRows ; 
		}
		else
		{
			window.location.href = searchUrl + '?typeSearch=FP&searchStr=' + searchParam +'&restaurationCollective='+restaurationCollective+'&restaurationCommerciale='+restaurationCommerciale+'&indexPage='+indexPage+'&nbRows='+nbRows ;
	    }
   }
}
function getNouveauteAdvancedSearchResultsPage(typeSearch,searchParam,restaurationCollective,restaurationCommerciale,indexPage,nbRows){
	var searchUrl = document.getElementById('redirectToNouveauteAdvancedSearchProductResult').href;

	if(searchParam!=null || searchParam!="" || searchParam>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&typeSearch='+typeSearch+'&searchStr=' + searchParam +'&restaurationCollective='+restaurationCollective+'&restaurationCommerciale='+restaurationCommerciale+'&indexPage='+indexPage+'&nbRows='+nbRows ;
		}
		else
		{
			window.location.href = searchUrl + '?typeSearch='+typeSearch+'&searchStr=' + searchParam +'&restaurationCollective='+restaurationCollective+'&restaurationCommerciale='+restaurationCommerciale+'&indexPage='+indexPage+'&nbRows='+nbRows ;
	    }
   }
}
function getRecipeDetailsPageByRecipeCode(code){
	var searchUrl = document.getElementById('redirectToRecipeDetails').href;
	if(code!=null || code!="" || code>0 )
   {
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&recipeCode=' + code ;
		}
		else
		{
			window.location.href = searchUrl + '?recipeCode=' + code ;
	    }
   }
   
}

function goToProductsDernieresSorties(){
     var videoUrl = document.getElementById('redirectToLesDernieresSortiesProducts').href;
	 window.location.href =  videoUrl;
}

function goToProductsLesPlusRegardees(){
     var videoUrl = document.getElementById('redirectToLesPlusRegardeesProducts').href;
	 window.location.href =  videoUrl;
}
function goToVideo(){
     var searchUrl = document.getElementById('redirectToVideo').href;
	 window.location.href =  searchUrl;
}
function goToVideosDernieresSorties(){
     getVideoDetailsDerniereSorties(1,9);
}
function getVideoDetailsDerniereSorties(indexPage,nbRows){
	var searchUrl = document.getElementById('redirectToLesDernieresSortiesVideos').href;
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;
	    }

}
function getVideoDetailsDerniereSortiesProducts(indexPage,nbRows){
	/*getVideoDetailsDerniereSorties(indexPage,nbRows);
	return;
	*/
	var searchUrl = document.getElementById('redirectToLesDernieresSortiesProductsVideos').href;

	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;
	    }

}
function getVideoDetailsDerniereSortiesMiseEnOeuvre(indexPage,nbRows){
	/*getVideoDetailsDerniereSorties(indexPage,nbRows);
	return;
	*/
	var searchUrl = document.getElementById('redirectToLesDernieresSortiesMiseEnOeuvreVideos').href;

	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;
	    }

}
function getVideoDetailsDerniereSortiesRecipes(indexPage,nbRows){
	/*getVideoDetailsDerniereSorties(indexPage,nbRows);
	return;
	*/
	var searchUrl = document.getElementById('redirectToLesDernieresSortiesRecipesVideos').href;

	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;
	    }

}
function getVideoDetailsDerniereSortiesTrends(indexPage,nbRows){
	var searchUrl = document.getElementById('redirectToLesDernieresSortiesTrendsVideos').href;

	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;

		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;

	    }

}
function goToVideosLesPlusRegardees(){
     getVideoDetailsLesPlusRegardees(1,9);
}
function getVideoDetailsLesPlusRegardees(indexPage,nbRows){
	var searchUrl = document.getElementById('redirectToLesPlusRegardeesVideos').href;
	
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;

		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;

	    }
   
}
function getVideoDetailsLesPlusRegardeesProducts(indexPage,nbRows){
	/*getVideoDetailsLesPlusRegardees(indexPage,nbRows);
	return;
	*/
	var searchUrl = document.getElementById('redirectToLesPlusRegardeesProductsVideos').href;
	
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;

		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;

	    }
   
}
function getVideoDetailsLesPlusRegardeesMiseEnOeuvre(indexPage,nbRows){
	/*getVideoDetailsLesPlusRegardees(indexPage,nbRows);
	return;
	*/
	var searchUrl = document.getElementById('redirectToLesPlusRegardeesMiseEnOeuvreVideos').href;
	
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;

		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;

	    }
   
}
function getVideoDetailsLesPlusRegardeesRecipes(indexPage,nbRows){
	/*getVideoDetailsLesPlusRegardees(indexPage,nbRows);
	return;
	*/

	var searchUrl = document.getElementById('redirectToLesPlusRegardeesRecipesVideos').href;
	
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;

		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;

	    }
   
}
function getVideoDetailsLesPlusRegardeesTrends(indexPage,nbRows){
	/*getVideoDetailsLesPlusRegardees(indexPage,nbRows);
	return;
	*/
	var searchUrl = document.getElementById('redirectToLesPlusRegardeesTrendsVideos').href;
	
	   if (searchUrl.indexOf("?") > -1)
		{
		  	window.location.href = searchUrl += '&indexPage=' + indexPage+'&nbRows='+nbRows;
		}
		else
		{
			window.location.href = searchUrl + '?indexPage=' + indexPage+'&nbRows='+nbRows;

	    }
   
}
function goToCatalog(){
	var catalogUrl = document.getElementById('redirectToCatalog').href;
	 window.location.href =  catalogUrl;
}
function goToFlipBook(URLCatalog){
	var catalogPortalUrl = document.getElementById('redirectToFlipBook').href;
	if(URLCatalog!=null || URLCatalog!="" )
   {
	   if (URLCatalog.indexOf("?") > -1)
		{
		  	window.location.href = catalogPortalUrl += '&URLCatalog=' + URLCatalog  ;
		}
		else
		{
			window.location.href = catalogPortalUrl + '?URLCatalog=' + URLCatalog;
	    }
   }
}
function openFlipBook(url)
{
	var width  = 800;
	var height = 600;
	var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;

	var imgSvr = pathRessources+"/FlipBooks/";
	window.open(imgSvr + url,"_blank","resizable=no , menubar=no, status=no, scrollbars=no, menubar=no , width="+width+" , height="+height+",left="+left+" , top = "+top);
}    
function goToCartesCatalog(){
	var catalogUrl = document.getElementById('redirectToCatalogCartes').href;
	 window.location.href =  catalogUrl;
}
function goToRendezVousCatalog(){
	var catalogUrl = document.getElementById('redirectToCatalogRendezVous').href;
	 window.location.href =  catalogUrl;
}

function goToTarifsCatalog(){
	var catalogUrl = document.getElementById('redirectToCatalogTarifs').href;
	 window.location.href =  catalogUrl;
}
function goToHorsSerieCatalog(){
	var catalogUrl = document.getElementById('redirectToCatalogHorsSerie').href;
	 window.location.href =  catalogUrl;
}
function goToFamilleProduitCatalog(){
	var catalogUrl = document.getElementById('redirectToCatalogFamilleProduit').href;
	 window.location.href =  catalogUrl;
}


function goToRecipeHome( ){
	var recipeUrl = document.getElementById('redirectToRecipeHome').href;
	   window.location.href = recipeUrl ; 	
}
function goToRecetteIdeesMenu( ){
	var recipeUrl = document.getElementById('redirectToRecetteIdeesMenu').href;
	   window.location.href = recipeUrl ; 	
}
function goToRecettePlatsDuJour( ){
	var recipeUrl = document.getElementById('redirectToRecettePlatsDuJour').href;
	   window.location.href = recipeUrl ; 	
}
function goToRecetteFichePlatDuJour(idPlat,listeIdPlat ){
	var recipeUrl = document.getElementById('redirectToRecetteFichePlatDuJour').href;
	if (recipeUrl.indexOf("?") > -1)
		{
		  	window.location.href = recipeUrl += '&idPlat=' + idPlat +"&listeIdPlat="+listeIdPlat ;
		}
		else
		{
			window.location.href = recipeUrl + '?idPlat=' + idPlat+"&listeIdPlat="+listeIdPlat;
	    }
}
function goToRecetteIdeeMenuBudget(budget ){
	var recipeUrl = document.getElementById('redirectToRecetteIdeeBudget').href;
	if (recipeUrl.indexOf("?") > -1)
		{
		  	window.location.href = recipeUrl += '&budget=' + budget ;
		}
		else
		{
			window.location.href = recipeUrl + '?budget=' + budget;
	    }
	   
}
function goToRecetteDetailsIdeeMenuBudget(budget,idMenu ,listeIdMenu){
	var recipeUrl = document.getElementById('redirectToRecetteDetailIdeeBudget').href;
	if (recipeUrl.indexOf("?") > -1)
		{
		  	window.location.href = recipeUrl += '&budget=' + budget+"&idMenu="+idMenu+"&listeIdMenu="+listeIdMenu ;
		}
		else
		{
			window.location.href = recipeUrl + '?budget=' + budget+"&idMenu="+idMenu+"&listeIdMenu="+listeIdMenu;
	    }
	   
}
function goToRecetteMenuCollectivite(client, mois, semaine){
	
	var recipeUrl = document.getElementById('redirectToRecetteMenuCollectivite').href;
	if (recipeUrl.indexOf("?") > -1)
	{
		window.location.href = recipeUrl += '&client=' + client + "&mois="+mois+"&semaine="+semaine ;
	}
	else
	{
			window.location.href = recipeUrl + '?client=' + client+ "&mois="+mois+"&semaine="+semaine ;
    }
	   
}

function goToRecetteDetailMenuCollectivite(client, mois, semaine,idMenu ,listeIdMenu ){
	
	var recipeUrl = document.getElementById('redirectToRecetteDetailMenuCollectivite').href;
	if (recipeUrl.indexOf("?") > -1)
	{
		window.location.href = recipeUrl += '&client=' + client + "&mois="+mois+"&semaine="+semaine +"&idMenu="+idMenu+"&listeIdMenu="+listeIdMenu;
	}
	else
	{
			window.location.href = recipeUrl + '?client=' + client+ "&mois="+mois+"&semaine="+semaine+"&idMenu="+idMenu+"&listeIdMenu="+listeIdMenu ;
    }
	   
}
function goToRecetteMenuPersonnesAgees(client, mois, semaine ){
	
	var recipeUrl = document.getElementById('redirectToRecetteMenuPersonnesAgees').href;
	if (recipeUrl.indexOf("?") > -1)
	{
		window.location.href = recipeUrl += '&client=' + client + "&mois="+mois+"&semaine="+semaine ;
	}
	else
	{
			window.location.href = recipeUrl + '?client=' + client+ "&mois="+mois+"&semaine="+semaine ;
    }
	   
}
function goToRecetteDetailMenuPersonnesAgees(client, mois, semaine,idMenu ,listeIdMenu ){
	
	var recipeUrl = document.getElementById('redirectToRecetteDetailMenuPersonnesAgees').href;
	if (recipeUrl.indexOf("?") > -1)
	{
		window.location.href = recipeUrl += '&client=' + client + "&mois="+mois+"&semaine="+semaine +"&idMenu="+idMenu+"&listeIdMenu="+listeIdMenu;
	}
	else
	{
			window.location.href = recipeUrl + '?client=' + client+ "&mois="+mois+"&semaine="+semaine+"&idMenu="+idMenu+"&listeIdMenu="+listeIdMenu ;
    }
	   
}
	
function goToRecipeCocktails( typeSearch, valeurSearch,indexPage,nbRows){
	
	PTPortlet.setSessionPref('pageRecette', "cocktails");
	PTPortlet.setSessionPref('typeAttribut', typeSearch);
	PTPortlet.setSessionPref('valeurAttribut', valeurSearch);
	if(indexPage==null || indexPage==""){
		indexPage="1";
	}
	PTPortlet.setSessionPref('indexPage', indexPage);
	if(nbRows==null || nbRows==""){
		nbRows="12";
	}
	PTPortlet.setSessionPref('nbRows', nbRows);
	var recipeUrl = document.getElementById('redirectToRecetteCocktail').href;
	
	window.location.href = recipeUrl;
}
function goToRecipeFromageDessert(typeSearch, valeurSearch,indexPage,nbRows){
	
	PTPortlet.setSessionPref('pageRecette', "fromages");
	PTPortlet.setSessionPref('typeAttribut', typeSearch);
	PTPortlet.setSessionPref('valeurAttribut', valeurSearch);
	if(indexPage==null || indexPage==""){
		indexPage="1";
	}
	PTPortlet.setSessionPref('indexPage', indexPage);
	if(nbRows==null || nbRows==""){
		nbRows="12";
	}
	PTPortlet.setSessionPref('nbRows', nbRows);
	var recipeUrl = document.getElementById('redirectToRecetteFromageEtDessert').href;
	
	window.location.href = recipeUrl;
	
}
function goToRecipePlats(typeSearch, valeurSearch,indexPage,nbRows){
	
	PTPortlet.setSessionPref('pageRecette', "plats");
	PTPortlet.setSessionPref('typeAttribut', typeSearch);
	PTPortlet.setSessionPref('valeurAttribut', valeurSearch);
	if(indexPage==null || indexPage==""){
		indexPage="1";
	}
	PTPortlet.setSessionPref('indexPage', indexPage);
	if(nbRows==null || nbRows==""){
		nbRows="12";
	}
	PTPortlet.setSessionPref('nbRows', nbRows);
	var recipeUrl = document.getElementById('redirectToRecettePlat').href;
	
	window.location.href = recipeUrl;
	
}
function goToRecipeEntrees(typeSearch, valeurSearch,indexPage,nbRows){
	PTPortlet.setSessionPref('pageRecette', "entrees");
	PTPortlet.setSessionPref('typeAttribut', typeSearch);
	PTPortlet.setSessionPref('valeurAttribut', valeurSearch);
	if(indexPage==null || indexPage==""){
		indexPage="1";
	}
	PTPortlet.setSessionPref('indexPage', indexPage);
	if(nbRows==null || nbRows==""){
		nbRows="12";
	}
	PTPortlet.setSessionPref('nbRows', nbRows);
	var recipeUrl = document.getElementById('redirectToRecetteEntree').href;
	
	window.location.href = recipeUrl;
}

	
function goToKitAnimation(typeSearch, valeurSearch){
	var kitAnimationUrl = document.getElementById('redirectToKitAnimation').href;
	window.location.href = kitAnimationUrl;
}
function goToKitPages(typePage){
	if(typePage != null || typePage != "" ){
		var kitPage = null;
		if(typePage == 0) {
			kitPage = document.getElementById('redirectToKitRegions').href;
		}
		else if (typePage == 1) {
			kitPage = document.getElementById('redirectToKitPonctuel').href;
		}
		else if (typePage == 2) {
			kitPage = document.getElementById('redirectToKitMonde').href;
		}
		else {
			kitPage = document.getElementById('redirectToKitProduits').href;
		}
	
		if (kitPage != null)
			window.location.href =  kitPage;
	}	
}
function goToStylisme(){
	var stylismeUrl = document.getElementById('redirectToStylisme').href;
	window.location.href = stylismeUrl;
}
function goToMetiers(){

          window.location.href = document.getElementById('redirectToMetier').href;
	
}         
function goToFicheMetier(IndexFiche){
	var ficheMetierUrl = document.getElementById('redirectToFicheMetier').href;
	if(IndexFiche!=null || IndexFiche!="" ){
	    var sc = '';
           
           if (IndexFiche.indexOf("?") > -1){
                sc = ficheMetierUrl += '&metierId=' + IndexFiche;
		}
		else{
                sc = ficheMetierUrl + '?metierId=' + IndexFiche;
	    }
          PTPortlet.setSessionPref('METIERID', IndexFiche);
          PTPortlet.setSessionPref('RETURNURL', sc);
          window.location.href = sc ;
	}
}
function goToEvenementiel(){
	var evenementielUrl = document.getElementById('redirectToEvenementiel').href;
	window.location.href = evenementielUrl;
}

function setLoginError(){
	var lgError = PTPortlet.getSessionPref("LOGINERROR");
	if(lgError=='errLogin')
	{
	   var spanError = document.getElementById("showloginError");
	   spanError.innerText="Erreur. Veuillez vous reconnecter.";
	   PTPortlet.setSessionPref("LOGINERROR",'');
	}
}
	
function setMenuSection(section){
     PTPortlet.setSessionPref("SECTION",section);
     //alert(PTPortlet.getSessionPref("SECTION")); 	
}
function doExpandMenu(){
	
	return;
      //alert('about to expand menu');	
      var section = PTPortlet.getSessionPref("SECTION");
      //alert("get:" + section);
      var obj = null;
      //check if RH Menus is active
      //TODO::
      
      if(section=="des_hommes")
      {
        //alert("inside des hommes");
		var obj = document.getElementById("aHommes");
        obj.click();
      }
      
      if(section=="des_services")
      {
        //alert("inside des services");
		obj = document.getElementById("aServices");
        obj.click();
      }
      
      if(section=="produits")
      {
		//alert("inside des produits");
        obj = document.getElementById("aProduits");
        obj.click();
      }
      
      if(section=="des_catalogues")
      {
        //alert("inside catalogs");
		obj = document.getElementById("aCatalogues");
        obj.click();
      }
      
      if(section=="des_video")
      {
        //alert("inside des video");
        obj = document.getElementById("aVideos");
        obj.click();
      }
}

var showDetails = function(){
   $("#pdtDeatils dd").css("visibility", "visible");
   $("#pdtDeatils dd").hide();
   $("#pdtDeatils dt a").click( function () {
      $(this).blur();
      var theParent = $(this).parent();
      // Si le contenu etait deja ouvert, on le referme :      
      if ($(theParent).next("dd:visible").length != 0) {
          $(theParent).next("dd").slideUp("normal", function () { $(theParent).removeClass("ddOpened") } );
      }
      // Si le contenu etait cache, on ferme les autres et on l'affiche :
      else {
          $("#pdtDeatils dd").slideUp("normal", function () { $(theParent).removeClass("ddOpened") } );
          $(theParent).next("dd").slideDown("normal", function () { $(theParent).addClass("ddOpened") } );
          //On eteint tous les boutons allumes
          $("#pdtDeatils dt").each( function (){
             $(this).removeClass("ddOpened");
          });
      }
      return false;
  });
  $("#pdtDeatils").children("dd")[0].style.display = "block";
  $("#pdtDeatils").children("dt")[0].className = "ddOpened";
}

function IE_CorrectAlpha_PNG(){
        
        if(navigator.userAgent.indexOf('MSIE') != -1) 
	{
		for(i=0; i<document.images.length; i++){
		        
			img    = document.images[i];
			imgExt  = img.src.substring(img.src.length-3, img.src.length);
			imgExt  = imgExt.toUpperCase();
			if (imgExt == "PNG"){
			        //alert('png found');
				imgID    = (img.id) ? "id='" + img.id + "' " : "";
				imgClass= (img.className) ? "class='" + img.className + "' " : "";
				imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				imgStyle= "display:inline-block;" + img.style.cssText;
				if (img.align == "left") { imgStyle = "float:left;"  + imgStyle; } else if (img.align == "right"){ imgStyle = "float:right;" + imgStyle; }
				if (img.parentElement.href)   { imgStyle = "cursor:hand;" + imgStyle; }       
				strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\');"></span>';
				img.outerHTML = strNewHTML;
				i = i-1;
			}
		}
	}
}
