//change le contenu &agrave; l'int&eacute;rieur d'une balise div
//param balise : id de la balise
//param html : texte en format html


// Début - fonctions de la section En Vedette
var intEnVedetteNoActif;  // Variable contenant le numéro de l'article En Vedette actif
var hndRotationEnVedette;   // Pointeur vers la fonction de rotation de l'article En Vedette
var blnRotationEnVedette;

function getNextEnVedetteNumber()
{
  var intDummy;
  (intEnVedetteNoActif == intNbEnVedette) ? intDummy = 1 : intDummy = intEnVedetteNoActif + 1 ;
  return intDummy;
}

function setTimeoutOnNextEnVedette()
{
  hndRotationEnVedette = eval("window.setTimeout(\"afficheEnVedette(" + getNextEnVedetteNumber() + ")\", 10000)");
}

function userSelectsEnVedette(intDummy)
{
  if (hndRotationEnVedette != undefined)
  {
    window.clearTimeout(hndRotationEnVedette);
  }
  blnRotationEnVedette = false;
  document.getElementById("selecteurEnVedette").getElementsByTagName("a")[0].style.display = "inline";
  afficheEnVedette(intDummy);
}

function userResetsRotationEnVedette()
{
  blnRotationEnVedette = true;
  document.getElementById("selecteurEnVedette").getElementsByTagName("a")[0].style.display = "none";
  afficheEnVedette(getNextEnVedetteNumber());
}

function afficheEnVedette(intDummy)
{
  var elem;
    
  if (intDummy != intEnVedetteNoActif)
  {
    document.getElementById("selecteurEnVedette").getElementsByTagName("img")[intEnVedetteNoActif].src = "/fileadmin/Image/medias/btn_chiffre_inactif.png";
    elem = document.getElementById("selecteurEnVedette").getElementsByTagName("a")[intEnVedetteNoActif]; 
    elem.alt = strAfficherEnVedette; 
    elem.title = strAfficherEnVedette;
    document.getElementById("selecteurEnVedette").getElementsByTagName("span")[intEnVedetteNoActif - 1].style.color = "white";
    document.getElementById("enVedette" + intEnVedetteNoActif).style.display = "none";
    intEnVedetteNoActif = intDummy;
  }
  document.getElementById("enVedette" + intEnVedetteNoActif).style.display = "block";
  document.getElementById("selecteurEnVedette").getElementsByTagName("img")[intEnVedetteNoActif].src = "/fileadmin/Image/medias/btn_chiffre_actif.png";
  elem = document.getElementById("selecteurEnVedette").getElementsByTagName("a")[intEnVedetteNoActif];
  elem.alt = ""; 
  elem.title = "";
  document.getElementById("selecteurEnVedette").getElementsByTagName("span")[intEnVedetteNoActif - 1].style.color = "black";
  if (blnRotationEnVedette && (intNbEnVedette > 1))
  {
    setTimeoutOnNextEnVedette();
  } 
}

function initialiseEnVedette()
{
  intEnVedetteNoActif = 1;
  blnRotationEnVedette = true;
  document.getElementById("selecteurEnVedette").getElementsByTagName("a")[0].style.display = "none";
  afficheEnVedette(intEnVedetteNoActif);
}

// Fin - fonctions de la section En Vedette

function MM_swapHTML(balise,html) {
  document.getElementById(balise).innerHTML=html
}

//change le style d'un menu
//param divSelec : id de la balise du menu
//param nom_commun : nom par lequel tous les menus du meme type commence... ex.: dans menu_haut_acceuil, menu_haut est le nom commun
//important : ce param est egalement le nom du style. Lorsque le menu est selectionne, le nom du style choisi est identique mais comprend '_select' &agrave; la fin
//param bool_submit : refresh de la page ? true ou false
function MM_swap_menu(divSelec,nom_commun,bool_submit) {
	//alert('MM_swap_menu debut')
	monObj = document.getElementsByTagName("div")
	for (i = 0 ; i < monObj.length ; i++)
		if(monObj[i].id.indexOf(nom_commun) != -1)												//si le mot commun est pr&eacute;sent
			monObj[i].className = nom_commun																//je change la classe de tous les menus a "d&eacute;selectionn&eacute;" ou normal
	document.getElementById(divSelec).className=nom_commun+'_select'		//je change la classe du menu appropri&eacute; &agrave; "s&eacute;lectionn&eacute;"		
	
	if(bool_submit)													//if(true)	refresh
		document.change_param.submit()
}


//change la langue et refresh
//param nouvlangue : langue ... 2 lettres   ce suffixe est le meme que celui a la fin des fichiers textes. ex.: qcbref_fr.html
function MM_change_Langue(nouvlangue)
{
	document.change_param.langue.value=nouvlangue
	document.change_param.submit()
}

function MM_change_page(page)
{
	document.change_param.action='/medias/'+page+'/index.php'
	document.change_param.submit()
}

function MM_change_selection(nouv_categorie,nouv_cle_idee)
{
	document.change_select.categorie.value=nouv_categorie
	document.change_select.cle_idee.value=nouv_cle_idee
	document.change_select.submit()
}

function MM_mouse_over_menu(menu,categorie)
{
	
	if(menu.className!=categorie+"_select")
	{
		menu.className=categorie+"_survol"
	}
}

function MM_mouse_out_menu(menu,categorie)
{
	if(menu.className!=categorie+"_select")
		menu.className=categorie
}

//dans la section joindre	fonction utilis&eacute;e pour afficher le repr&eacute;sentant d'une r&eacute;gion des US 
//param choix : balise select
function medias_changeUS(region,balise,langue)
{
	//var region = choix.options[choix.selectedIndex].value
	balise_texte = document.getElementById(balise)
	texte="<table><tr><td>"
	document.menus.menu_bas_courant.value="US"+region
	if(langue=="en")
	{
		if(region=="SUD")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>South</b>"+
			"<br/><b>Yves Gentil</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>33 West 19th Street, 4th Floor"+
			"<br/>New York, NY 10011"+
			"<br/>Telephone :&nbsp;&nbsp;(646) 619-1234"+
			"<br/>Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(212) 400-7201"+
			"<br/><a href='mailto:yves@destinationquebec.us'>E-mail</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/gentil.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="OUEST" || region=="NOUVELLE_ANGLETERRE")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>West and New England</b>"+
			"<br/><b>Bard Nordby</b>"+
			"<br/>Tourisme Qu&eacute;bec"+
			"<br/>1255, rue Peel, bureau 400"+
			"<br/>Montr&eacute;al (Qu&eacute;bec)"+
			"<br/>H3B 4V4"+
			"<br/>Telephone :&nbsp;&nbsp;(514) 873-7977 ext. 4342"+
			"<br/>Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(514) 864-3188"+
			"<br/><a href='mailto:nordby.bard@tourisme.gouv.qc.ca'>E-mail</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/nordby.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="CENTRE_OUEST")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Midwest and Moutain States</b>"+
			"<br/><b>Annemarie Heidbuechel</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>333 W. North Avenue, PMB 218"+
			"<br/>Chicago, IL 60610-1293"+
			"<br/>Telephone :&nbsp;&nbsp;(312) 573-1849"+
			"<br/>Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(312) 573-9620"+
			"<br/><a href='mailto:qcah@aol.com'>E-mail</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/heidbuechel.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="ATLANTIQUE_CENTRE")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Mid-Atlantic</b>"+
			"<br/><b>Yves Gentil</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>33 West 19th Street, 4th Floor"+
			"<br/>New York, NY 10011"+
			"<br/>Telephone :&nbsp;&nbsp;(646) 619-1234"+
			"<br/>Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(212) 400-7201"+
			"<br/><a href='mailto:yves@destinationquebec.us'>E-mail</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/gentil.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
	}
	else if(langue=="fr") 		//francais
	{
		if(region=="SUD")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Sud</b>"+
			"<br/><b>Yves Gentil</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>33 West 19th Street, 4th Floor"+
			"<br/>New York, NY 10011"+
			"<br/>T&eacute;l&eacute;phone :   (646) 619-1234"+
			"<br/>T&eacute;l&eacute;copieur : (212) 400-7201"+
			"<br/><a href='mailto:yves@destinationquebec.us'>Courriel</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/gentil.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="OUEST" || region=="NOUVELLE_ANGLETERRE")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Ouest et Nouvelle-Angleterre</b>"+
			"<br/><b>Bard Nordby</b>"+
			"<br/>Tourisme Qu&eacute;bec"+
			"<br/>1255, rue Peel, bureau 400"+
			"<br/>Montr&eacute;al (Qu&eacute;bec)"+
			"<br/>H3B 4V4"+
			"<br/>T&eacute;l&eacute;phone :    (514) 873-7977 poste 4342"+
			"<br/>T&eacute;l&eacute;copieur :  (514) 864-3188"+
			"<br/><a href='mailto:nordby.bard@tourisme.gouv.qc.ca'>Courriel</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/nordby.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="CENTRE_OUEST")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Centre Ouest et des Montagnes</b>"+
			"<br/><b>Annemarie Heidbuechel</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>333 W. North Avenue, PMB 218"+
			"<br/>Chicago, IL 60610-1293"+
			"<br/>T&eacute;l&eacute;phone :   (312) 573-1849"+
			"<br/>T&eacute;l&eacute;copieur : (312) 573-9620"+
			"<br/><a href='mailto:qcah@aol.com'>Courriel</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/heidbuechel.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="ATLANTIQUE_CENTRE")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Atlantique Centre</b>"+
			"<br/><b>Yves Gentil</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>33 West 19th Street, 4th Floor"+
			"<br/>New York, NY 10011"+
			"<br/>T&eacute;l&eacute;phone :   (646) 619-1234"+
			"<br/>T&eacute;l&eacute;copieur : (212) 400-7201"+
			"<br/><a href='mailto:yves@destinationquebec.us'>Courriel</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/gentil.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
	}
  else if(langue=="es") 		//espagnol
	{
		if(region=="SUD")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Sud</b>"+
			"<br/><b>Yves Gentil</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>33 West 19th Street, 4th Floor"+
			"<br/>New York, NY 10011"+
			"<br/>Teléfono :   (646) 619-1234"+
			"<br/>Fax : (212) 400-7201"+
			"<br/><a href='mailto:yves@destinationquebec.us'>Dirección electrónica</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/gentil.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="OUEST" || region=="NOUVELLE_ANGLETERRE")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Ouest et Nouvelle-Angleterre</b>"+
			"<br/><b>Bard Nordby</b>"+
			"<br/>Tourisme Qu&eacute;bec"+
			"<br/>1255, rue Peel, bureau 400"+
			"<br/>Montr&eacute;al (Qu&eacute;bec)"+
			"<br/>H3B 4V4"+
			"<br/>Teléfono :    (514) 873-7977 ext. 4342"+
			"<br/>Fax :  (514) 864-3188"+
			"<br/><a href='mailto:nordby.bard@tourisme.gouv.qc.ca'>Dirección electrónica</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/nordby.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="CENTRE_OUEST")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Centre Ouest et des Montagnes</b>"+
			"<br/><b>Annemarie Heidbuechel</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>333 W. North Avenue, PMB 218"+
			"<br/>Chicago, IL 60610-1293"+
			"<br/>Teléfono :   (312) 573-1849"+
			"<br/>Fax : (312) 573-9620"+
			"<br/><a href='mailto:qcah@aol.com'>Dirección electrónica</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/heidbuechel.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
		else if(region=="ATLANTIQUE_CENTRE")
		{
			texte+="<table border='0' cellpadding='0' cellspacing='0' width='550'><tr><td valign='top'><div class='texte'><b>Atlantique Centre</b>"+
			"<br/><b>Yves Gentil</b>"+
			"<br/>Destination Qu&eacute;bec"+
			"<br/>33 West 19th Street, 4th Floor"+
			"<br/>New York, NY 10011"+
			"<br/>Teléfono :   (646) 619-1234"+
			"<br/>Fax : (212) 400-7201"+
			"<br/><a href='mailto:yves@destinationquebec.us'>Dirección electrónica</a></div>"+
			"</td>"
			/* endroit reserve pour l'image */
			+"<td width='13%'></td>"+
			"<td align='center'>"+
			"<img src='/medias/include/joindre/images/gentil.jpg' width='126' height='181'>"+
			"</td>"
			/* fin endroit reserve pour l'image */
		}
	}
	texte+="</tr></table>" 
	balise_texte.innerHTML=texte
}

function medias_change_pays(balise,regions,index)
{
	MM_swapHTML(balise,regions[index])
	document.menus.menu_bas_courant.value=index
}

function trouve_index(balise,valeur)
{

	for(i=0; i<balise.length; i++)
	{
		if(balise.options[i].value==valeur)
			return i;
	}
	return 0;
}

function get_param_php()
{
	tab_avec_perluette=document.location.href.split('php?');
	if(tab_avec_perluette.length>1)
	{
		tab=tab_avec_perluette[1].split('&');
		texte=""
		for(i=0;i<tab.length;i++)
		{
			if(i==tab.length-1)
				texte+=tab[i]
			else
				texte+=tab[i]+'***'
		}
		return texte
	}
}

function imprimer(menu_haut)
{
	commande='/medias/commun/scripts/print_v2.php?xpath=' + document.location.href+'&param='+get_param_php()
	if(document.menus.menu_haut_courant.value=="quebecbref" || document.menus.menu_haut_courant.value=="joindre")
		commande+="&menu_bas="+document.menus.menu_bas_courant.value
	window.open(commande,'Imprimer','toolbar=yes,status=yes,titlebar=yes,menubar=yes,resizable=yes,scrollbars=yes, vscrollbars=yes, width=640,height=500,left=20,top=20');
}

function envoyer_ami(langue) {
		window.open("/medias/commun/scripts/envoi_page/preparation_envoi_"+langue+".php?url=" + window.document.location.href,"Envoyez","width=600,height=610,scrollbars=no,location=no,menubar=no,resizable=no,status=no,toolbar=no");
}

