/* ---------------------------------------------------------
:: Permet d'afficher dynamiquement un sous rubrique du menu
--------------------------------------------------------- */
function montre_ss_rub(id) 
{
	var ress_bloc = document.getElementById(id);
	for (var i = 1; i<=10; i++) 
	{
		if (document.getElementById('ss_menu_'+i))
			document.getElementById('ss_menu_'+i).style.display='none';
	}
	if (ress_bloc) 
		ress_bloc.style.display='block';
}

/* -------------------------------------------------------
:: Permet de masquer les sous rubriques du menu déployées
------------------------------------------------------- */
function cache_ss_rub() 
{
	for (var i = 1; i<=10; i++) 
	{
		if (document.getElementById('ss_menu_'+i))
			document.getElementById('ss_menu_'+i).style.display='none';
	}
}

/* --------------------------------------------------
:: Permet d'afficher dynamiquement un bloc de prévis
-------------------------------------------------- */
function montre(nom_bloc, nom_menu_param)
{
	// On montre le bloc, me sous menu et les logos
	document.getElementById(nom_bloc).style.display='block';

	// On regarde s'il y a des logos
	if (document.getElementById('logo_graphe_'+indice))
		document.getElementById('logo_graphe_'+indice).style.display='block';

	if (document.getElementById('logo_excel_'+indice))
		document.getElementById('logo_excel_'+indice).style.display='block';

	if(document.getElementById(nom_menu_param))
		document.getElementById(nom_menu_param).style.display='block';

	// On cache/montre les pictos
	txt_montre_picto = "document.getElementById('montre_" + nom_bloc + "').style.display='none'";

	txt_cache_picto = "document.getElementById('cache_" + nom_bloc + "').style.display='block'";

	eval(txt_montre_picto);
	eval(txt_cache_picto);

}

/* --------------------------------------------------
:: Permet de masquer dynamiquement un bloc de prévis
-------------------------------------------------- */
function cache(nom_bloc, nom_menu_param)
{
	// Extraction de l'indice
	indice = nom_bloc.substring(5, 6);

	// On cache le bloc, le menu associé et les logos
	document.getElementById(nom_bloc).style.display='none';

	if (document.getElementById('logo_graphe_'+indice))
		document.getElementById('logo_graphe_'+indice).style.display='none';

	if (document.getElementById('logo_excel_'+indice))
		document.getElementById('logo_excel_'+indice).style.display='none';

	if(document.getElementById(nom_menu_param))
		document.getElementById(nom_menu_param).style.display='none';

	// On cache/montre les pictos
	txt_montre_picto = "document.getElementById('montre_" + nom_bloc + "').style.display='block'";

	txt_cache_picto = "document.getElementById('cache_" + nom_bloc + "').style.display='none'";

	eval(txt_montre_picto);
	eval(txt_cache_picto);
}

/* ----------------------------------------------------------------------
:: Permet d'afficher dynamiquement la liste des variables d'un paramètre
---------------------------------------------------------------------- */
function montre_var_param(id) 
{
	var ress_bloc = document.getElementById(id);
	for (var i = 1; i<=10; i++) 
	{
		if (document.getElementById('var_param'+i))
			document.getElementById('var_param'+i).style.display='none';
	}
	if (ress_bloc && ress_bloc.style.display == 'none') 
		ress_bloc.style.display='block';

	else
		ress_bloc.style.display='none';
}


/* ----------------------------------------------------------------
:: Permet de cacher la liste des variables d'un paramètre courante
------------------------------------------------------------------ */
function cache_var_param(id) 
{
	var ress_bloc = document.getElementById(id);
	if (ress_bloc) 
		ress_bloc.style.display='none';
}

/* --------------------------------------------------
:: Validation d'un formulaire
-------------------------------------------------- */
function nav_chiffree(url)
{
	document.Form_Moteur_Recherches.action=url;
	document.Form_Moteur_Recherches.submit();
}

/* -----------------------------------------------------------------------
:: Modification d'un paramètre => Màj de la liste des seuils en conséquent
------------------------------------------------------------------------ */
function Modif_Liste_Seuil()
{
	num_param=document.commande.num_parametre.options[document.commande.num_parametre.options.selectedIndex].value;

	// On masque les listes
	for(i=1; i<num_param+1; i++)
	{
		if(document.getElementById('liste_seuil_'+i))
			document.getElementById('liste_seuil_'+i).style.display='none';
	}
	// On affiche la bonne liste
	document.getElementById('liste_seuil_'+num_param).style.display='block';
}


/* --------------------------------------------------------------------------------
:: Ouvre les popups affichant la vidéo du jour et les animations satellite et radar
--------------------------------------------------------------------------------- */
function open_video_jour(langue_addurl) {
   the_width = 495;
   the_height = 510;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	the_popup_video_jour = window.open("/popup/popup_video_jour.php?"+langue_addurl, "popup_video_jour", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_video_jour.focus();
}

function open_video_satel(langue_addurl,zone) {
   the_width = 495;
   the_height = 510;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	the_popup_video_satel = window.open("/popup/popup_video_satel.php?"+langue_addurl+"&"+zone, "popup_video_satel", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_video_satel.focus();
}

function open_video_radar(langue_addurl) {
   the_width = 495;
   the_height = 510;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	the_popup_video_radar = window.open("/popup/popup_video_radar.php?"+langue_addurl, "popup_video_radar", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_video_radar.focus();
}

function open_video_obs(langue_addurl) {
   the_width = 495;
   the_height = 510;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	the_popup_video_jour = window.open("/popup/popup_video_observations.php?"+langue_addurl, "popup_video_observations", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_video_observations.focus();
}

function open_video_region(langue_addurl,zone) {
   the_width = 495;
   the_height = 510;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	the_popup_video_region = window.open("/popup/popup_video_region.php?"+langue_addurl+"&"+zone, "popup_video_region", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_video_region.focus();
}

function open_video_we(langue_addurl) {
   the_width = 495;
   the_height = 510;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	the_popup_video_jour = window.open("/popup/popup_video_week_end.php?"+langue_addurl, "popup_video_week_end", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_video_we.focus();
}

function open_flash(langue_addurl) {
   the_width = 750;
   the_height = 550;
   the_posx = (screen.width - the_width) / 2;
   the_posy = (screen.height - the_height) / 2;
	 the_popup_flash = window.open("/presentation.php?"+langue_addurl, "the_popup_flash", "toolbar=no,status=no,scrollbars=auto,location=no,menubar=no,directories=no,resizable=yes,left="+the_posx+",top="+the_posy+",width="+the_width+",height="+the_height);
   the_popup_flash.focus();
}

