/*
	FONCTIONS permettant de ce passer du footer sur la homepage
*/

// chargement des traductions pour l'audio et le footer
var scriptNode = document.createElement('script');
document.getElementsByTagName("head")[0].appendChild(scriptNode);
scriptNode.language='javascript';
scriptNode.src='/js/nofooterlang.js'; 

// chargement de la dernière conf (fonction disp_HighlightConf)
var scriptNode = document.createElement('script');
document.getElementsByTagName("head")[0].appendChild(scriptNode);
scriptNode.language='javascript';
scriptNode.src='/js/highlights_Lastconf1.js'; 

// chargement des 10 dernière new (fonction disp_HighlightNews)
var scriptNode = document.createElement('script');
document.getElementsByTagName("head")[0].appendChild(scriptNode);
scriptNode.language='javascript';
scriptNode.src='/js/highlights_LastNews10.js'; 

/* tempo les 2 formats vont être dans le même fichier
// chargement des 10 dernière new (fonction disp_HighlightNews)
var scriptNode = document.createElement('script');
document.getElementsByTagName("head")[0].appendChild(scriptNode);
scriptNode.language='javascript';
scriptNode.src='/js/highlights_LastNews10.js'; 
*/

/****************************************************************************************************************/
// FONCTIONS RELATIVES A LA VOIX HON
// -------
// permet de recuperer le cookie
function getCookieVal(offset)
{
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr)); 
	}
// retourne la valeur du cookie à partir de son nom
function LireCookie(nom)
{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)
	{	
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;	
	}
	return null; 
}

// -------
// affiche bouton ON/OFF
function disp_OnOff_button (HTMLpage, audioOK,lg){
  // ------
  // test la langue
  if (lg == 'fr')  		lg = 1;
  else if (lg == 'sp')	lg = 2;
  //else if (lg == 'cn')	lg = 3; // todo_cn??
  else					lg = 0;
	
  //document.write("so: " + aa[lg]['mr_info_HTML']);
  // lien pour plus d'infos
  var mr_info_lk = 
  "<a target=\"_blank\" " +
  " href=\"/Global/" + aa[lg]['mr_info_HTML'] +  "\" " + 
  " onmouseover=\"mysound.TGotoAndPlay('/more','start'); return false\" " +
  " onmouseout =\"mysound.TGotoAndPlay('/more','stop'); return false\"   " +
  " class=\"txtpetit\" " + 
  " title=\" " + aa[lg]['mr_info'] + "\" " +
  ">" + 
  aa[lg]['mr_info'] + 
  "</a>";

  // ------
  // teste l'état du cookie
  if (audioOK >= 1) {	
	var boutonOnOff = 
	 aa[lg]['on'] +" / <a  class=menuG style=\"font-size: 11px;\" " +
  	 " onmouseover=\"mysound.TGotoAndPlay('/off','start'); return false\" " +
  	 " onmouseout=\"mysound.TGotoAndPlay('/off','stop'); return false\"   " +
	 " title=\"" + 
	 aa[lg]['offTitle'] + 
	 "\" href=\"/cgi-bin/cookie/create_cookies_hh.pl?0\+/"+ HTMLpage + "\">"+ aa[lg]['off'] +"</a> ";	
  }
  else {
	var boutonOnOff = 
	"<a class=menuG style=\"font-size: 11px;\"" +
	 " href=\"/cgi-bin/cookie/create_cookies_hh.pl?1\+/"+ HTMLpage +"\"" +
	 " title=\"" + aa[lg]['onTitle'] + "\"" +
	 ">"+ aa[lg]['on'] +"</a> / "+ aa[lg]['off'] +" " +
	 "" ;
  }

  
  // ------
  // ecrit le bouton
  document.write(aa[lg]['sectName']);
  document.write(boutonOnOff);
  document.write(mr_info_lk);
}

// ------
// appel de script(flashSound) ou pas
//    flasSound: pour lancer des sons à partir d'un swf contenant des mp3
function disp_SwfCallScript (audioOK){
	// imprime le script (flashSound), appel au constructeur
	var onmode_callscript = 
		"<script src='js/flashsound.js' type='text/javascript' language='JavaScript1.1'></script> " +
		"<script type='text/javascript' language='JavaScript1.1'>var mysound = new FlashSound();</script>";	
	// imprime une fonction vide
    var offmode_callscript = 
		"<script src='js/flashsoundblank.js' type='text/javascript' language='JavaScript1.1'><\/"+"script> ";
   
   // selon le cookie
   if (audioOK >= 1) document.write(onmode_callscript);
   else 			 document.write(onmode_callscript);   
}

// ------
// embed le swf ou pas
function disp_AudioSwf (audioOK,lg) {
   // selon la langue
   if (lg == 'fr')  		lg = 1;
   else if (lg == 'sp')		lg = 2;
   //else if (lg == 'cn')	lg = 3; // todo_cn??
   else						lg = 0;
    
   // selon le cookie
   if (audioOK >= 1) document.write("<script>mysound.embedSWF('" + aa[lg]['onmode_swfembed'] + "');<\/"+"script>");
   else   	  		 document.write("");
}

/****************************************************************************************************************/
// AFFICHER LE bas_de_page
function disp_basDePage (HTMLpage,lg){
	
   // selon la langue
   if      (lg == 'fr')  	lg = 1;
   else if (lg == 'sp')		lg = 2;
   else if (lg == 'cn')		lg = 3;
   else if (lg == 'de')		lg = 4;
   else						lg = 0;
	
   bas_de_page_en = 
		"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"640\">" +
		"<tbody><tr><td align=\"left\" valign=\"middle\" class=\"txtpetit\">" +
		//"http://www.hon.ch/"+ 
		"/"+ 
		HTMLpage +
		"</td><td align=\"center\" class=\"txtpetit\" width=\"100%\">" +
		aa[lg]['lastmodif'] +
     		"</td><td align=\"right\">" +
    		"<a href='http://www.hon.ch/Global/" + 
		aa[lg]['copyrightPage'] +
		"' class='txtpetit' target='_parent' title='HON Copyright'>" +	
		"©&nbsp;HON&nbsp;2009</a></div></td></tr></tbody></table>";
			
	document.write(bas_de_page_en);
	
}

// AFFICHER LE bas_de_page
function disp_basDePage2 (HTMLpage,lg){
	
   // selon la langue
   if      (lg == 'fr')  	lg = 1;
   else if (lg == 'sp')		lg = 2;
   else if (lg == 'cn')		lg = 3;
   else						lg = 0;
	
   bas_de_page_en = 
		"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"640\">" +
		"<tbody><tr><td align=\"justify\" valign=\"middle\" width=\"100%\" class=\"txtpetit\">" +
		"<div align='justify'>" + 
		"http://www.hon.ch/program.html" +
		"	&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  " +
		"Jan 07 2008" +
     	"	&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  " +
    	"	<a href='http://www.hon.ch/Global/" + 
		"© copyright HON 2007" +
		"' class='txtpetit' target='_parent' title='HON Copyright'>		 " +	
		"	©&nbsp;copyright&nbsp;HON&nbsp;2009</a></div></td></tr></tbody></table>" +
		"<p>" +
		"";
			
	document.write(bas_de_page_en);
	
}

/****************************************************************************************************************/
// LES CONF  ET NEWS MIS EN AVANT

///////////////////////////////////////////////////////////////////
// pour les confs
function disp_HighlightConf(){
	tconf = new Array();
	
	//Les conférences mises en avant
/*
	tconf[0] = " <a href=\"http://debussy.hon.ch/cgi-bin/confevent?aff2+CONF04470\" target=\"_blank\" class=\"menu\"> <IMG BORDER=0 SRC=\"/images/LogosConf/OESOconf.jpg\" WIDTH=130 HEIGHT=50> <br> <span class=\"txtpetitbleu\"> Gastro-enterology<BR> Avignon&nbsp;(France)&nbsp;-&nbsp;Sep&nbsp;03-06,&nbsp;2006</span> </a> ";
*/
/*
	tconf[0] = " <a href=\"http://www.mednetcongress.com/\" target=\"_blank\" class=\"menu\"> <IMG BORDER=0 SRC=\"/images/mednet2006_menugauche.gif\" WIDTH=98 HEIGHT=69> </a> ";
/*
/*	
	tconf[1] = " <CENTER><a href=\"http://www.hon.ch/Global/WorldHealthDay2006.html\" target=\"_blank\" class=\"menu\"> <IMG TITLE=\"7 April 2006 - World Health Day: Working together for health\" BORDER=0 SRC=\"http://www.hon.ch/images/LogosConf/Starmap_petit.gif\" WIDTH=100 HEIGHT=100> </a></CENTER> ";	
*/
	tconf[0] = lastconf();
	
	// tire un nbr aléatoire
	var nb  = 1; // limit
	var nba = Math.floor(Math.random() * nb);
	
	//imprime le highlight
	document.write(tconf[nba]);
}

/////////////////////////////////////////////////////////////////// OLD
// pour les news
function disp_HighlightNews(){
	tnews = new Array();
	
    if (lg == 'fr')  		lgG = 1;
    else if (lg == 'sp')	lgG = 2;
	else if (lg == 'cn')	lgG = 3;
    else					lgG = 0;
	
	//Les conférences mises en avant
	/*tnews[0] = " <CENTER><a href=\"http://www.hon.ch/Global/WorldHealthDay2006.html\" target=\"_blank\" class=\"menu\"> <IMG TITLE=\"7 April 2006 - World Health Day: Working together for health\" BORDER=0 SRC=\"http://www.hon.ch/images/LogosConf/Starmap_petit.gif\" WIDTH=100 HEIGHT=100> </a></CENTER> ";	*/

	tnews[0] = tnews[1] = tnews[2] = " <table width=100% cellpadding=0 cellspacing=0 border=0> <tr> <TD ALIGN=CENTER> <a href=\"http://www.hon.ch/Survey/analysis.html\" target=\"_blank\" class=\"menu\"> <em class=\"txtbleu\"><strong>Analysis of 9th HON Survey</strong></em> <br> <span class=\"txtpetit\"><b>By HON Team</b><br /></span> </a> </TD> <TD VALIGN=BOTTOM><a href=\"http://www.hon.ch/Survey/analysis.html\" target=\"_blank\" class=\"menu\"> <IMG TITLE=\"Analysis of 9th HON Survey\" WIDTH=25 HEIGHT=33 SRC=\"/images/Chart1.gif\" BORDER=0></A></TD> </TR></TABLE> "; 
	
	tnews[3] = lastnews1();
	tnews[4] = lastnews2();
	tnews[5] = lastnews3();
	tnews[6] = lastnews4();
	tnews[7] = lastnews5();
	tnews[8] = lastnews6();
	tnews[9] = lastnews7();
	tnews[10] = lastnews8();
	tnews[11] = lastnews9();
	tnews[12] = lastnews10();

	// tire un nbr aléatoire
	var nb  = 13; // limit
	var nba = Math.floor(Math.random() * nb);
	//var nba = 0;
	
	//imprime le highlight
	document.write(tnews[nba]);
}

/////////////////////////////////////////////////////////////////// OLD
// pour la main HomePage
function disp_HighlightMainHmPage(){
	tab = new Array();
	
    if (lg == 'fr')  		lgG = 1;
    else if (lg == 'sp')	lgG = 2;
	else if (lg == 'cn')	lgG = 3;
    else					lgG = 0;
	
	//Les conférences mises en avant
//tab[0] = "<A HREF=\"/Project/regio_ruig.html\"><IMG TITLE=\"A Study Focusing on Francophone Africa\" SRC=\"/images/news_10years2.gif\" WIDTH=\"160\" HEIGHT=\"40\" BORDER=\"0\"></A>";	
tab[0] = "<A HREF=\"/SR/C18.452.394.750_en.html\" class=\"menu\"><br>14 November 2007<br><br>World Diabetes Day</A><br><br>";	

/*tab[1]  = "<A HREF=\"/Global/WorldOfHealthIT.html\"><IMG TITLE=\"10-13 October 2006 - The World of Health IT Conferences \& Exhibition\" SRC=\"/images/whit.gif\" WIDTH=\"115\" HEIGHT=\"115\" BORDER=\"0\"></A>";*/ 	

	// tire un nbr aléatoire
	var nb  = 1; // limit (nbr d'item ds le tableau)
	var nba = Math.floor(Math.random() * nb);
	
	//imprime le highlight
	document.write(tab[nba]);
}



/////////////////////////////////////////////////////////////////// OLD depuis 15/05/07 medinfo
// pour la main HomePage
function disp_HighlightMainHmPage2(){
	tab = new Array();
	
    if (lg == 'fr')  		lgG = 1;
    else if (lg == 'sp')	lgG = 2;
    else if (lg == 'cn')	lgG = 3;
    else			lgG = 0;
	
	//Les conférences mises en avant
//tab[0] = "<A HREF=\"/medinf07.html\"><IMG TITLE=\"MEDinfo 2007 - Workshop\" SRC=\"/images/medinfo2007call3.gif\" WIDTH=\"160\" HEIGHT=\"49\" BORDER=\"0\"></A>";	

/*
// celui ci-dessous a retirer le 3-4 dec 07
tab[0] = 
	"<A " +
	"	class=\"menu\"  " +
	"	HREF=\"http://www.hon.ch/Conf/WHCC/HL07080-HON-8-14-07.htm\" " +
	"	><img src=\"/images/wgDec.gif\" border=\"0\"/></A>";	
	
// celui ci-dessous a retirer le 10-12 Mar 2008
tab[1] = "<A   " +
		 "	class=\"menu\"  " +
		 "	HREF=\"http://www.hon.ch/Conf/WHCC/HR08015-HON-8-14-07.htm\" " +
		 "	><img src=\"/images/wgMar.gif\" border=\"0\"/></A>";

// celui ci-dessous a retirer le Apr 6-9, 2008
tab[2] = "<span class=\"txt\"><A class=\"menu\" HREF=\"http://www.oeso.org/\"> 9th World Congress - The Gastro-Esophageal Reflux Disease</A><br/>Monaco (Apr 6-9, 2008)</span>";	

// celui ci-dessous a retirer le 21-23 Apr 2008
tab[3] = "<A   " +
		 "	class=\"menu\"  " +
		 "	HREF=\"http://www.worldcongress.com/events/HR08000/\" " +
		 "	target=\"_blank\" " +
		 "	><img src=\"/images/wgApr.gif\" border=\"0\"/></A>";
// celui ci-dessous a retirer le 1dec07
tab[4] = "<A HREF=\"/SR/C18.452.394.750_en.html\" class=\"menu\"><br>November 14, 2007<br><br>World Diabetes Day</A><br><br>";	
*/


/*tab[0] = "<span class=txt><br><A HREF=\"/HONcode/HAS/collaboration_press.html\" class=menu>HON: the official accrediting body for all French health websites</a><br><br></span>";	
*/

tab[0] = "<span class=txt><A HREF=\"/HONcode/HAS/rapport_activite.html\" class=menu><img src=\"/images/HasHonAnim_en.gif\" width=160 height=68 border=0></a></span>";	

/*
// AID 
tab[1] = "<br/><A   " +
		 "	class=\"menu\"  " +
		 "	HREF=\"http://www.hon.ch/SR/C02.782.815.616.400.040_en.html\" " +
		 "	>World AIDS Day</A><br /><span class=\"txtpetit\">1st December 2007<span/><br/><br/>";
*/
	// tire un nbr aléatoire
	var nb  = 1; // limit (nbr d'item ds le tableau)
	var nba = Math.floor(Math.random() * nb);
	
	//imprime le highlight
	document.write(tab[nba]);
}


/////////////////////////////////////////////////////////////////// OLD depuis 15/05/07 ruig
// pour la main HomePage
function disp_HighlightMainHmPageFR(){
	tab = new Array();
	
    if (lg == 'fr')  		lgG = 1;
    else if (lg == 'sp')	lgG = 2;
	else if (lg == 'cn')	lgG = 3;
    else					lgG = 0;
	
	//Les conférences mises en avant
	// les 3 liens ci-dessous avant pub has
//tab[0] = "<A HREF=\"/Project/regio_ruig_f.html\"><IMG TITLE=\"Etude des spécificités en Afrique francophone\" SRC=\"/images/news_10yearsFr.gif\" WIDTH=\"160\" HEIGHT=\"40\" BORDER=\"0\"></A>";	
//tab[1] = "<A HREF=\"http://raft.hcuge.ch/\" target=\"_blank\"><IMG TITLE=\"RAFT, un réseau de télé-enseignement et de télémédecine en Afrique francophone\" SRC=\"/images/raft5.gif\" WIDTH=\"160\" HEIGHT=\"69\" BORDER=\"0\"></A>";	
//tab[2] = "<span class=txt><A HREF=\"http://www.healthonnet.org/Projet_Afrique_FR/\" class=menu><IMG TITLE=\"Des informations médicales en ligne, dignes de confiance, Etude en Afrique francophone (Sep 2007)\" SRC=\"/images/an_afrique.gif\" WIDTH=\"160\" HEIGHT=\"83\" BORDER=\"0\"></span>";	

tab[0] = "<span class=txt><A HREF=\"/HONcode/HAS/rapport_activite_f.html\" class=menu><img src=\"/images/HasHonAnim.gif\" width=160 height=68 border=0></a></span>";	

//tab[2] = "<span class=txt><A HREF=\"http://www.unige.ch/iued/new/information/conferences/pdf/conf_07_Suissafrique.pdf\" target=\"_blank\" class=\"menu\">La SuissAfrique : Partenariats scientifique et acad&eacute;mique</A><br/> 13-15 Sep 2007 (Gen&egrave;ve)</span>";	
/*tab[1]  = "<A HREF=\"/Global/WorldOfHealthIT.html\"><IMG TITLE=\"10-13 October 2006 - The World of Health IT Conferences \& Exhibition\" SRC=\"/images/whit.gif\" WIDTH=\"115\" HEIGHT=\"115\" BORDER=\"0\"></A>";*/ 	

	// tire un nbr aléatoire
	var nb  = 1; // limit (nbr d'item ds le tableau)
	var nba = Math.floor(Math.random() * nb);
	
	//imprime le highlight
	document.write(tab[nba]);
}

/////////////////////////////////////////////////////////////////// WHO palais
// pour la main HomePage
function disp_HighlightMainHmPage_who(lg){
	tab = new Array();
	
    if (lg == 'fr')  		lgG = 1;
    else if (lg == 'sp')	lgG = 2;
	else if (lg == 'cn')	lgG = 3;
    else					lgG = 0;
	
	if (lgG==1){
//La news
tab[0] = "<A HREF=\"/Project/RUIG/ruigConference_f.html\"><IMG TITLE=\"Invitation à participer à une réunion d’information organisée dans le cadre de l’Assemblée Mondiale de la Santé\" SRC=\"/images/news_omsHonFr.gif\" WIDTH=\"160\" HEIGHT=\"40\" BORDER=\"0\"></A>";
	}
	else{
//La news
tab[0] = "<A HREF=\"/Project/RUIG/ruigConference.html\"><IMG TITLE=\"Invitation to participate to a briefing session and a discussion organized in the context of the World Health Assembly\" SRC=\"/images/news_omsHonEn.gif\" WIDTH=\"160\" HEIGHT=\"40\" BORDER=\"0\"></A>";
		
	}
	// tire un nbr aléatoire
	var nb  = 1; // limit (nbr d'item ds le tableau)
	var nba = Math.floor(Math.random() * nb);
	
	//imprime le highlight
	document.write(tab[nba]);
}

