/*******************
auteur : gerardal1@free.fr
*******************/
var ancre = "";
function NewUrl(page){
  window.location.hash = "#page-"+page;
  charge(page);
  ancre = window.location.hash;
    document.title="Machet Energie nouvelle-"+nom(page);
  return true;
}
function urlHistory(){
  if ( window.location.hash =="#direct" ) return;
  if ( window.location.hash != ancre ){
    if(!window.location.hash){
        window.location.hash = "#page-accueil";
        ancre = window.location.hash;
        charge("accueil");
        }
    else {
        ancre = window.location.hash;
        var newpage = ancre.substring(6);
        charge(newpage);
        }
    }  
 return true;
}
function tateUrl() {	//vérifie l'url toutes les secondes
  urlHistory();
  window.setInterval("urlHistory()", 1000);
  return true;
}
function charge(page){
if(page){
    if(controlpage1(page) && page!="videos") actionmenu('xpage',page,'php');
    else if(controlpage1(page) && page=="videos") video('gg');
    }
}
var ppage=new Array('accueil','production','tourisme1','histoire','fonctionnement','galerie','index_a','venir','contact2','divers','livreor','videos');
function controlpage1(page){
for(i=0;i<=11;i++){
    if(page==ppage[i])return true;
    }
}
function nom(page){
switch (page) {
	case "accueil":return "Accueil";break;
	case "production":return "Le bois";break;
	case "tourisme1":return "Tourisme";break;
	case "histoire":return "Histoire";break;
	case "galerie":return "Galerie";break;
	case "index_a":return "Vie associative";break;
	case "fonctionnement":return "Technique";break;
	case "venir":return "Venir à Machet";break;
	case "contact2":return "Contact-Adhésion";break;
	case "divers":return "Divers";break;
	case "livreor":return "Livre d'or";break;
	case "videos":return "Vidéos";break;
    }
}
