var tabLettre=["0-9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

var plansiteCol="moins";
function viewPlanduSite(imgPlusMoins_plansite){
	if(plansiteCol=="moins"){
		document.getElementById('plandusite').style.display='block';
		document.getElementById(imgPlusMoins_plansite).src=urlbaseImg+'btn_moins_orange.gif';
		plansiteCol="plus";
	}else{
		document.getElementById('plandusite').style.display='none';
		document.getElementById(imgPlusMoins_plansite).src=urlbaseImg+'btn_plus_orange.gif';
		plansiteCol="moins";
	}
}
// for the header???
function viewPlanduSite(idSel){
	if(plansiteCol=="moins"){
		document.getElementById('plandusite').style.display='block';
		plansiteCol="plus";
		document.getElementById(idSel).src="/img/btn_moins_orange.gif";
	}else{
		document.getElementById('plandusite').style.display='none';
		plansiteCol="moins";
	}
}

function popEnlarge(photo,w,h,allTrue){ 	
	var toolbarsValue=0; var menubarValue=0; var statusValue=0; var locationValue=0; var scrollbarsValue=0; var resizeValue = 0;
	if(allTrue == "yes"){ 	toolbarsValue=1; menubarValue=1; statusValue=1; locationValue=1; scrollbarsValue=1; resizeValue=1;}		
	
	var toolbars=toolbarsValue;	
	var menubar=menubarValue; 
	var status=statusValue; 
	var location=locationValue; 
	var scrollbars=scrollbarsValue;
	var resize=resizeValue;
	var spec=",toolbar="+toolbars+",menubar="+menubar+",status="+status+",location="+location+",scrollbars="+scrollbars+",resizable="+resize;
	
	var winEnlarge=window.open(photo,"Enlarge","width="+w+",height="+h+spec); winEnlarge.focus();
}

function popUpWindow(uri,w,h,title,type) {
	if (uri == ''){ return;}
	else	{
		if(w=="" || w==null ){w='500'} if(h=="" || h==null ){h='500'}	
		var iMyWidth; var iMyHeight;
		iMyWidth = (window.screen.width - w)/2; iMyHeight = (window.screen.height-h)/2;					
		var winVideo = window.open(uri,"NaitreetGrandir","width="+w+",height="+h+",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
		winVideo.focus();
	}
}

function popUpVideo(uri,wv,hv,title,type,w,h,sectionVideo) {
	/*
	uri=Path du vidéo,
	wv=largueur du vidéo,
	hv=Hauteur du vidéo,
	title=Titre du vidéo,
	type=Type de popup --> nomenu,
	w=largeur du Window,
	h=hauteur du Window	
	*/
	//var baseURLPsn="http://www.passeportsante.net";
	var baseURLPsn="";
	
		if (title == "" || title == null){title="PasseportSant&eacute;.net";}
		var iMyWidth; var iMyHeight;
		
		//> Dimension de la fenêtre
		if(w=="" || w==null){w='800'} if(h=="" || h==null){h='500'}		
		iMyWidth = (window.screen.width - w)/2; iMyHeight = (window.screen.height-h)/2;
		
		//> Dimension du vidéo
		if(wv=="" || wv==null){wv='240'} if(hv=="" || hv==null){hv='245'}
				
		if (sectionVideo == null || (sectionVideo != 0 && sectionVideo !=1)){sectionVideo=1}
		
		//URL du template de vidéo
		if(type=="nomenu"){startURL=baseURLPsn+"/DocumentsProteus/popupHtml/video_pop_non_menu.asp?uri="+uri+"&w="+wv+"&h="+hv+"&title="+title}
		else if (type=="" || type==null ){
		    if (sectionVideo == 1)
		    {
		        if(uri == "" || uri == null){
				    startURL=baseURLPsn+"/DocumentsProteus/popupHtml/tv/player.html";
			    }else{
				    startURL=baseURLPsn+"/DocumentsProteus/popupHtml/tv/player.html?choix="+uri;
			    }
		    }
		    else
		    {
		        if (uri != "" && uri != null)
		        {
		            startURL="/DocumentsProteus/PopupHTML/" + uri;
		        }
		    }

			
		}
		
		//> Génération du popup avec paramètre
		if (startURL != '' || startURL != null)
		{
		   var winVideo = window.open(startURL,"PasseportSante","width="+w+",height="+h+",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
		   winVideo.focus();	
		}

}

//> Fonction pour la barre de menu Partager pour social bookmarking
var imgOverPartager=new Image(); imgOverPartager.src='/img/reseausociaux/btn_Partager.gif';
        var imgOutPartager=new Image(); imgOutPartager.src='/img/reseausociaux/btn_Partager.gif';     
        
        function btnPartagerEvent(step){
            if(step=="on"){                
                document.getElementById('btnPartager').src=imgOverPartager.src;
               document.getElementById('BoxReseauSociauxHeader').style.display='inline';  
                document.getElementById('GlobalBoxReseauSociauxHeader').style.display='inline'; 
            }
            
        }
      function PartagerEvent(){              
            document.getElementById('BoxReseauSociauxHeader').style.display='none'; 
            document.getElementById('GlobalBoxReseauSociauxHeader').style.display='none';
            document.getElementById('btnPartager').src=imgOutPartager.src;            
      }
      
//> Fonction pour bouton SUITE et RETOUR dans boîte vidéo et Blogue      
 function mouseOverBtnBox(id,eventStep){
    if(eventStep=="over") {
        id.style.border='1px solid #afb897';
        id.style.cursor='hand';
        id.style.cursor='pointer';
    }
    else if(eventStep=="out") {
        id.style.border='1px solid #e5e8db';
    }
}      

// JavaScript Document

function locateObject(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showTooltip(object,e, tipContent)
{
	if (document.all)
		{ 
			
			locateObject(object).innerHTML= unescape(tipContent)
		   
		   if(object==null || object=="dHTMLToolTip"){
		       document.getElementById("dHTMLToolTip").style.top=document.documentElement.scrollTop+event.clientY+20+"px";    
		       contener="dHTMLToolTip";
		    }else if (object=="popViteUneReponseIn"){
		        var height = document.getElementById("popViteUneReponseContent").clientHeight;
		        var top = (document.documentElement.scrollTop + event.clientY - height - 20);
		       document.getElementById("popViteUneReponseContent").style.top= top +"px";
		       contener="popViteUneReponseContent";
		    }		    		    
		    
			if ((e.x + locateObject(contener).clientWidth) > (document.body.clientWidth + document.body.scrollLeft))
				{	 
					locateObject(contener).style.left = (document.body.clientWidth + document.body.scrollLeft) - locateObject(contener).clientWidth-10;
				}
			else
			{
		    	locateObject(contener).style.left=document.body.scrollLeft+event.clientX-70;
			}
		
		locateObject(contener).style.visibility="visible";		
		
		return true;
		}
	if (document.getElementById)
		{
					locateObject(object).innerHTML = '';
					locateObject(object).innerHTML = unescape(tipContent);
					var posx = 0;
					var posy = 0;
					var contener="";
					if (!e) var e = window.event;
					if (e.pageX || e.pageY)
					{
						posx = e.pageX ;
						posy = e.pageY ;
						
		                if(object=="dHTMLToolTip"){
		                    contener="dHTMLToolTip";
		                    locateObject(contener).style.left = (posx - 200 )+"px";
						    posyFin=posy + 20;
						}else if(object=="popViteUneReponseIn"){
						    contener="popViteUneReponseContent";
						    locateObject(contener).style.left = (posx - 200 )+"px";
						    posyFin=posy - locateObject(contener).offsetHeight - 20 ;						   
						}						
						
						locateObject(contener).style.top = posyFin+"px";
						
					}
					else if (e.clientX || e.clientY)
					{
					    if(object=="dHTMLToolTip")
					    {
					        contener="dHTMLToolTip";
						    posx = e.clientX  - 200 + ( document.documentElement.scrollLeft || document.body.scrollLeft);
						    posy = e.clientY  - 100 + ( document.documentElement.scrollTop || document.body.scrollTop);
						    locateObject(contener).style.left = "280px";
						    posyFin=posy + 20;
						    locateObject(contener).style.top = posyFin+"px";					        
					    }
					    else if(object=="popViteUneReponseIn")
					    {   
					        contener="popViteUneReponseContent";
						    posx = e.clientX  - 200 + ( document.documentElement.scrollLeft || document.body.scrollLeft);
						    posy = e.clientY  - 100 + ( document.documentElement.scrollTop || document.body.scrollTop);
						    locateObject(contener).style.left = posx ;
						    posyFin=posy - locateObject(contener).offsetHeight - 20 ;
						    locateObject(contener).style.top = posyFin+"px";
					    }
					}

						locateObject(contener).style.visibility="visible"
						return true;
	}
	else if (document.layers)
		{
		locateObject(object).document.write(unescape(tipContent))
		locateObject(object).document.close();
		var contener="";
		if(object=="dHTMLToolTip"){contener="dHTMLToolTip";}
		else if(object=="popViteUneReponse"){contener="popViteUneReponseContent";}
		
		locateObject(contener).top=e.y+20

		if ((e.x + locateObject(contener).clip.width) > (window.pageXOffset + window.innerWidth))
			{
				locateObject(contener).left = window.innerWidth - locateObject(contener).clip.width-10;
			}
		else
			{
			locateObject(contener).left=e.x;
			}
		locateObject(contener).visibility="show"
		return true;
	}
	else
	{
		return true;
	}
	
	
	
}

function hideTooltip(object)
{
//!!! bp 2007-02-16
//return;
if (document.all)
{
	locateObject(object).style.visibility="hidden"
	locateObject(object).style.left = 1;
	locateObject(object).style.top = 1;
return false
}
else if (document.getElementById)
{
	locateObject(object).style.visibility="hidden"
	locateObject(object).style.left = 1;
	locateObject(object).style.top = 1;
	return false
}
else if (document.layers)
{
	locateObject(object).visibility="hide"
	locateObject(object).left = 1;
	locateObject(object).top = 1;
	return false
}
else
	return true
}

//> Fonction pour le SlideShow du big Teaser
function SlideShow(imageId, textId, titleId, linkId, interval,imageLink,linkPlus){
	this.imageId = imageId;
	this.textId = textId;
	this.titleId = titleId;
	this.linkId = linkId;
	this.imageLinkId=imageLink;
	this.LinkPlusId=linkPlus;
	this.aSlideShow = [];
	this.intervalId = null;
	this.index = 0;
	if(interval)
		this.interval = interval;
	else
		this.interval = 1000;
	
	this.nextSlide = function(){	  
		for(i=1;i<=3;i++){
		    document.getElementById('BtnTop'+i).src="/img/layout/accueil/btnTeaserTop"+i+"_off.gif";
		}
		
		if(++this.index > this.aSlideShow.length - 1)
			this.index = 0;		
		
	    document.getElementById('BtnTop'+(this.index+1)).src="/img/layout/accueil/btnTeaserTop"+(this.index+1)+"_on.gif";
	    
		this.populateSlide();
	}
	this.prevSlide = function(){
		if(--this.index < 0)
			this.index = this.aSlideShow.length - 1;
		this.populateSlide();
	}
	
	this.numSlide = function(num){
	    document.getElementById('BtnTop'+(this.index+1)).src="/img/layout/accueil/btnTeaserTop"+(this.index+1)+"_off.gif";
	    this.index = num-1;
	    document.getElementById('BtnTop'+num).src="/img/layout/accueil/btnTeaserTop"+num+"_on.gif";
		this.populateSlide();
	}
	
	this.populateSlide = function(){
		if(!this.aSlideShow[this.index])
			return;
		var image = document.getElementById(this.imageId);
		image.src = this.aSlideShow[this.index][0];
		var text = document.getElementById(this.textId);
		text.innerHTML = this.aSlideShow[this.index][1];
		var title = document.getElementById(this.titleId);
		title.innerHTML = this.aSlideShow[this.index][2];
		
		var linkE = document.getElementById(this.linkId);
		linkE.href = this.aSlideShow[this.index][3];
		
		var linkI = document.getElementById(this.imageLinkId);		
		linkI.href = this.aSlideShow[this.index][3];
		
		var linkP = document.getElementById(this.LinkPlusId);		
		linkP.href = this.aSlideShow[this.index][3];
	}
	this.stopSlideShow = function(){
		window.clearInterval(this.intervalId);
		this.intervalId = null;
	}
	this.startSlideShow = function(){
		if(this.intervalId == null){
			var me = this;
			this.intervalId = setInterval(function(){me.nextSlide()}, this.interval);
		}
	}
	this.loadSlideShow = function(){
		var me = this;
		this.intervalId = setInterval(function(){me.nextSlide()}, this.interval);
	}
	this.addSlide = function(image, text, title, docLink){
		var tmpArray = [image, text, title, docLink];
		this.aSlideShow[this.aSlideShow.length] = tmpArray;
	}
	
	this.loadSlideShow();
}

var sourcePetiteFelcheBleu= new Image;
sourcePetiteFelcheBleu.src="/img/flecheBasSubMenuBleu.gif";

var sourcePetiteFelcheGris= new Image;
sourcePetiteFelcheGris.src="/img/flecheBasSubMenuGris.gif";

function cellLeftLink(num,IfSubMenu){
   document.getElementById('cellLinkLeft'+num).style.backgroundColor='#0171bd';    
   
   if(IfSubMenu !=null) {
        document.getElementById('petiteFlecheLink'+IfSubMenu).src=sourcePetiteFelcheBleu.src;        
   }
}

function cellLeftLinkOut(num,IfSubMenu){
    document.getElementById('cellLinkLeft'+num).style.backgroundColor='#e3e7e8';
   if(IfSubMenu != null) {
        document.getElementById('petiteFlecheLink'+IfSubMenu).src=sourcePetiteFelcheGris.src;        
   } 
}

function popupWindowLienInterne(url, WindowName, width, height) 
{
    var valExterne="externe-";
    var valPopHTML="popupHTML-";
	var valSectionVideo="sectionvideo-";
	var valSosCuisine = "http://www.soscuisine.com"
	
	var checkSectionVideo=url.indexOf(valSectionVideo);
	var checkPopUpHtml=url.indexOf(valPopHTML);
	var checkLienExterne=url.indexOf(valExterne);
	var checkLienSOS=url.indexOf(valSosCuisine);
	
	if (checkSectionVideo!= -1){	
		valVideoToPlay=url.substring((checkSectionVideo+valSectionVideo.length), url.length);
		var Win = window.open(valVideoToPlay, WindowName, 'width=' + '700' + ',height=' + '600' + ',resizable=yes,scrollbars=yes,menubar=yes,status=yes,toolbar=yes,location=yes' );
		Win.focus();
		
	}else if (checkPopUpHtml!= -1){
		urlPopUpHtml="../../../DocumentsProteus/PopupHTML/"+url.substring((checkPopUpHtml+valPopHTML.length), url.length);			
		var Win = window.open(urlPopUpHtml, WindowName, 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubar=no,status=no,toolbar=no,location=no' );
		Win.focus();
	}else if (checkLienExterne!= -1){
		urlLienExterne=url.substring((checkLienExterne+valExterne.length), url.length);			
		var Win = window.open(urlLienExterne, WindowName, 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubar=yes,status=yes,toolbar=yes,location=yes' );
		Win.focus();
	}	
	else if (checkLienSOS!= -1){
		urlLienSOS=url.substring(checkLienSOS, url.length);			
		var Win = window.open(urlLienSOS, WindowName, 'width=700,height=600,resizable=yes,scrollbars=yes,menubar=yes,status=yes,toolbar=yes,location=yes' );
		Win.focus();
	}	
	else{	
	
	    var valImageLoupe="Loupe/Fiche.aspx?doc=";	    
	    var checkImageLoupe=url.indexOf(valImageLoupe);
	   
	    if(checkImageLoupe!=-1){
	        selectImageName=url.substring(checkImageLoupe+valImageLoupe.length,url.length);
	    
	    
	        
	        var LoupeImg= new Image();	        
	        LoupeImg.src="http://www.passeportsante.net/DocumentsProteus/ImagesLoupe/"+selectImageName;	        
	        
	            myWidth=returnWidthImgLoupe(LoupeImg);	            
	            if(myWidth == 0){myWidth=returnWidthImgLoupe(LoupeImg);}	           
	            if(myWidth != 0){ 	 	                            
	                width=myWidth+60;	    
	                height=LoupeImg.height+60;	           
	            }	            
	           var ifImgRecette = selectImageName.indexOf("recette")
	           
	           if(ifImgRecette != -1){
	            width="860"; height="600";
	           }
	    
	    }
	    
	    var Win = window.open(url, WindowName, 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubar=no,status=no,toolbar=no,location=no' );
		Win.focus();
	
	    }           
		
	

	//return false;
}

//Fonctions pour envoyer à un amis
function AfficherFenetreEnvoyerAmi()
{
    var div = document.getElementById('EnvoyerAmi');
    var contenant = document.getElementById('divCacheContenu');
    
    div.style.display = 'block';
    contenant.style.display = 'block';
    
}
function FermerFenetreEnvoyerAmi()
{
    var div = document.getElementById('EnvoyerAmi');
    var contenant = document.getElementById('divCacheContenu');
    
    div.style.display = 'none';
    contenant.style.display = 'none';
}

