function ShowHide(idDiv)
{
var divStyle = document.getElementById(idDiv).style.display ;
	if ( ( divStyle == 'none' ) || ( divStyle == null ) )
	{
   	document.getElementById(idDiv).style.display="block";
	} else {
    document.getElementById(idDiv).style.display="none";
	}
}

function Show(idDiv)
{
	if ( typeof( hideMenuTimeout ) != "undefined" ) { KillTimeoutMenu() ; }
	document.getElementById('ul_la_vie').style.display="none";
	document.getElementById('ul_le_reve').style.display="none";
	document.getElementById('ul_la_ville').style.display="none";
	document.getElementById('ul_magazine').style.display="none";
	if(document.getElementById(idDiv))
	document.getElementById(idDiv).style.display="block";

// hack_iemac
if(agt.indexOf("mac")!=-1 && agt.indexOf("msie")!=-1)
{
document.getElementById("navigation").style.display="none";
document.getElementById("navigation").style.display="block";
}
}


function neo_roll_image(id,image_1,image_2)
{
var image_traitee=document.getElementById(id).src;

if(image_1.slice(-8) == image_traitee.slice(-8))
{
document.getElementById(id).src=image_2;
}
else
{document.getElementById(id).src=image_1;}
}


function show_destination(couleur)
{
var Roll_destination_couleur = new Array ()
Roll_destination_couleur["la_vie"] = "rgb(168,100,63)";
Roll_destination_couleur["le_reve"] = "rgb(0,126,178)";
Roll_destination_couleur["la_ville"] = "rgb(93,137,38)";
Roll_destination_couleur["magazine"] = "rgb(162,4,5)";
if ( typeof( hideDestinationTimeout ) != "undefined" ) { KillTimeoutDestination() ; }
document.getElementById('navigation_bas_destination').style.backgroundColor = Roll_destination_couleur[couleur];
}

function navigation_Hide(idDiv,idroll)
{
HideMenu(idDiv);
var action_menu_gauche = "RollNav(14,0,'exit')";
hideMenuNavTimeout = setTimeout(action_menu_gauche,1000) ;
var action_destination = "document.getElementById('navigation_bas_destination').style.backgroundColor = 'rgb(158,170,176)'";
hideDestinationTimeout = setTimeout(action_destination,1000) ;
}

function hide_destination()
{
var echooo='oupela';
}


function Hide(idDiv)
{
//alert("execute hide '"+idDiv+"'")
	document.getElementById(idDiv).style.display="none";
// hack_iemac
if(agt.indexOf("mac")!=-1 && agt.indexOf("msie")!=-1)
{
document.getElementById("navigation").style.display="none";
document.getElementById("navigation").style.display="block";
}
}

function HideMenu(l_element)
{
hideMenuTimeout = setTimeout("Hide('"+l_element+"')",1000) ;
ShowMenuTimeout = setTimeout("Show('ul_"+rubrique+"')",1100) ;

if(rubrique!="")
{
ShowMenuGaucheTimeout = setTimeout("ShowMenu_orig()",1000) ;
}
}

function ShowMenu_orig()
{
var indice;
if(rubrique=="la_vie")
{indice=11;}
if(rubrique=="le_reve")
{indice=12;}
if(rubrique=="la_ville")
{indice=13;}
if(rubrique=="magazine")
{indice=14;}

for ( i=11 ; i<=14 ; i++ )
			{


				if(i==indice)
				{ document.images["roll-"+i].src = RollImageOver[i].src ;

				 }
				else
				{ document.images["roll-"+i].src = RollImageOn[i].src ;
	}
}
}

function KillTimeoutMenu()
{
//var hideMenuNavTimeout ;
if ( typeof( hideMenuNavTimeout ) != "undefined" ) {clearTimeout(hideMenuNavTimeout);}
if ( typeof( hideMenuTimeout ) != "undefined" ) {clearTimeout(hideMenuTimeout);}
if ( typeof( ShowMenuTimeout ) != "undefined" ) {clearTimeout(ShowMenuTimeout);}
if(rubrique!="") {
if ( typeof( ShowMenuGaucheTimeout ) != "undefined" ) {
clearTimeout(ShowMenuGaucheTimeout);}
}
}

function KillTimeoutDestination()
{
if ( typeof( hideDestinationTimeout ) != "undefined" ) {clearTimeout(hideDestinationTimeout); }
}

function KillTimeoutNav()
{
//clearTimeout(hideDestinationTimeout);
}

// ajout pour les roll over

if ( path == "undefined" )
	{
	path = ""
	}

var agt=navigator.userAgent.toLowerCase();


var RollImage = new Array ()

var RollImagePathNav = path+"xox_01/images/navigation/"
RollImage[11] = "la_vie"
RollImage[12] = "le_reve"
RollImage[13] = "la_ville"
RollImage[14] = "magazine"

var RollImagePath = "/xox_01/images/bucolique/"
RollImage[21] = "bloc_pratique-agenda"
RollImage[22] = "bloc_pratique-droitsetdemarches"
RollImage[23] = "bloc_pratique-portaildesassociations"

RollImage[24] = "bloc_pratique-coordonneesutiles"
RollImage[25] = "bloc_pratique-plandelaville"
RollImage[26] = "bloc_pratique-cartespostales"
RollImage[27] = "bloc_pratique-newsletter"
//RollImage[28] = "bloc_pratique-revuedepresse"
RollImage[28] = "bloc_pratique-liens-utiles"
RollImage[29] = "bloc_pratique-votremessagerie"

RollImage[31] = "bloc_interactif-mairie"
RollImage[32] = "bloc_interactif-forums"
RollImage[33] = "bloc_interactif-chats"
RollImage[34] = "bloc_interactif-blogs"

RollImage[35] = "bloc_pratique"
RollImage[36] = "bloc_interactif"

RollImage[37] = "bloc_interactif-eateliers"

RollImage[38] = "bloc_interactif-telecharger"
RollImage[39] = "bloc_interactif-marches"

RollImage[40] = "bloc_pratique-evennements-vie"

var RollImageLength = RollImage.length -1 ;
var RollImageFormat = ""

if ( document.images )
	{
	var RollImageOn = new Array (RollImageLength)
	var RollImageOff = new Array (RollImageLength)
	var RollImageOver = new Array (RollImageLength)
	for ( i=0 ; i<=RollImageLength ; i++ )
		{
		if ( ( i > 10 ) && ( i < 15 ) )
			{
			RollImageOn[i] = new Image() ; RollImageOn[i].src = RollImagePathNav + RollImage[i] + '_on_' + couleur + '.gif';
			RollImageOff[i] = new Image() ; RollImageOff[i].src = RollImagePathNav + RollImage[i] + '_off_' + couleur + '.gif';
			RollImageOver[i] = new Image() ; RollImageOver[i].src = RollImagePathNav + RollImage[i] + '_over_' + couleur + '.gif';
			}

		else
			{
			if ( ( i > 34 ) && ( i < 37 ) )
				{
				RollImageOn[i] = new Image() ; RollImageOn[i].src = RollImagePath + RollImage[i] + '_on.gif';
				RollImageOff[i] = new Image() ; RollImageOff[i].src = RollImagePath + RollImage[i] + '.gif';
				}
			else
				{
				RollImageOff[i] = new Image() ; RollImageOff[i].src = RollImagePath + RollImage[i] + '.gif';
				RollImageOver[i] = new Image() ; RollImageOver[i].src = RollImagePath + RollImage[i] + '_hover.gif';
				}
			}
		}
	}

function Roll(position,action)
	{
	RollImageName = "roll-" + position
	if ( action )
		{
		document.images[RollImageName].src = RollImageOver[position].src
		}
	else
	    {
    	document.images[RollImageName].src = RollImageOff[position].src
    	}
	}

function RollNav(position,action,f_couleur)
	{

	if(f_couleur != 'exit') {
	var indice;
	if ( action )
		{
		for ( i=11 ; i<=14 ; i++ )
			{
			if ( i == position )
				{
				document.images["roll-"+i].src = RollImageOver[i].src ;
				}
			else
				{

				document.images["roll-"+i].src = RollImageOn[i].src ;
				}
			}
		}
  else
    {
		for ( i=11 ; i<=14 ; i++ )
			{

			//DEBUT
			if(couleur=="la_vie")
{
indice=11;
}
if(rubrique=="le_reve")
{
indice=12;
}
if(rubrique=="la_ville")
{
indice=13;
}
if(rubrique=="magazine")
{
indice=14;
}

				if(i==indice)
				{ document.images["roll-"+i].src = RollImageOver[i].src ; }
				else
				{ document.images["roll-"+i].src = RollImageOff[i].src ; }


			}
		}
		}
		else if(rubrique=="")
		{
		for ( i=11 ; i<=14 ; i++ )
		{

		document.getElementById("roll-"+i).src = RollImageOff[i].src ;
		}
		}
		else
		{
		if(rubrique!=""){  ShowMenu_orig(); }
		}
	}


function Roll_menu(position)
{

var image_en_cours=document.getElementById('roll-'+position).src;
if(image_en_cours == RollImageOn[position].src )
	{
	document.getElementById('roll-'+position).src=RollImageOff[position].src ;
	}
else
	{
	document.getElementById('roll-'+position).src=RollImageOn[position].src ;
	}
}

//Fonction gestion des puces du menu de navigation du site
function roll_puce(puce_id)
{
document.getElementById('puce-'+puce_id).src="/xox_01/images/navigation/puce_on.gif";
}

//FONCTION DESACTIVANT LES PUCES pour les sous rubriques
function roll_puce_out(puce_id)
{
document.getElementById('puce-'+puce_id).src="/xox_01/images/navigation/puce_off.gif";
}


//Fonction gestion image de la catégorie Agenda

function roll_agenda_choix_on(choix_on,etat_initial)
{
var roll_agenda_path_on = "/xox_01/images/information/agenda_bouton_on.gif"
var roll_agenda_path_out = "/xox_01/images/information/agenda_bouton_out.gif"
if(choix_on != etat_initial)
{
document.getElementById(choix_on).src=''+roll_agenda_path_on;
document.getElementById(etat_initial).src=''+roll_agenda_path_out;
}
}

//FONCTION remise etat initial de la page agenda
function roll_agenda_choix_out(choix_out,etat_initial)
{
var roll_agenda_path_on = "/xox_01/images/information/agenda_bouton_on.gif"
var roll_agenda_path_out = "/xox_01/images/information/agenda_bouton_out.gif"
if(choix_out!=etat_initial)
{
document.getElementById(choix_out).src=roll_agenda_path_out;
document.getElementById(etat_initial).src=roll_agenda_path_on;
}
}
//FONCTION ASSIGNATION BONNES VALEURS AU FORMULAIRE DU FORUM + POSITIONNEMENT ANCRE
function display_bloc_reponse(message_code,message_link_1,message_link_2,message_link_3,message_level)
{
document.getElementById('f_forum_message_code').value=message_code;
document.getElementById('f_forum_message_link_1').value=message_link_1;
document.getElementById('f_forum_message_link_2').value=message_link_2;
document.getElementById('f_forum_message_link_3').value=message_link_3;
document.getElementById('f_forum_message_level').value=message_level;
document.getElementById('form_forum_reponse').style.display='';
document.location="#formulaire";
}

//FONCTION POUR AFFICHAGE FORM DE RECOMMANDATION DANS LES PAGES ARTICLES
function display_bloc_recommandation()
{
Show('form_recommandation');
document.getElementById('recommandation_post').style.display='none';
document.location="#recommandation";
}


function popup_newsletter()
{
if(document.getElementById('recherche_thema').value != "") 
{ 
window.open('http://www.pau.fr/mailing/'+document.getElementById('recherche_thema').value); 
}
}

function verification_email(elm)
{
	if ( elm.value.indexOf("@") != "-1" && elm.value.indexOf(".") != "-1" && elm.value != "")
	{
		return true;
	}
	else
	{
		return false;
	}
}

function valid_prerequis_question()
{
	if (verification_email(document.getElementById("f_email")) == false)
	{
		alert("L'E-mail saisie n'est pas valide");
		return false;
	}
	else if (document.getElementById("f_titre").value == "")
	{
		alert("La saisie du Titre est obligatoire");
		return false;
	}
	else if (document.getElementById("f_question").value == "")
	{
		alert("Le saisie du Message est obligatoire");
		return false;
	}
	else
	{
		return true;
	}
}