function initialiser(){
 new Ajax.Autocompleter (
      're_nom',      // ID of the source field
      'prn_update',  // ID of the DOM element to update
      '../ajax/rech_an_auto.php', // Remote script URI
      {method: 'post', paramName: 'nom',choices:10,frequency: 0.1}
    );
    }

function OuvrirPop(url, nom, largeur,hauteur, div)
		{
			var haut=(screen.height-hauteur)/2;
			var gauche=(screen.width-largeur)/2;
			test = window.open(url,nom,"top="+haut+",left="+gauche+",width="+largeur+",height="+hauteur);
			test.document.write('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\" ><head><title>Bande Annonce de '+nom+'</title><style type=\"text/css\">a {display:none;}</style><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /><link rel=\"stylesheet\" media=\"screen\" type=\"text/css\" title=\"design\" href=\"design.css\" /></head><body style=\"background-color:#000000;\">'+div+'</body></html>');
			//console.log(div);
			
		}
		
  function chgpage(formulaire)
  {    
  if (formulaire.listepages.selectedIndex != 0) 
  location.href = formulaire.listepages.options[formulaire.listepages.selectedIndex].value;
  } 

/*****LISTE FILM DEROULANTE****/
    
function chgpage(formulaire)
  {    
  if (formulaire.listepages.selectedIndex != 0) 
  location.href = formulaire.listepages.options[formulaire.listepages.selectedIndex].value;
  }     

/*******************************************
init xmlhttp
*******************************************/
var xmlhttp=false;
if(window.XMLHttpRequest){
	xmlhttp=new XMLHttpRequest();
	xmlhttp.overrideMimeType('text/xml');
}else if(window.ActiveXObject){
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

}

/*******************************************
recadrage des photos
*******************************************/
function resize_img_doc(t){
var ph_doc=document.images;
for(var e=0;e<ph_doc.length;e++){
var n=document.images[e];
var image_art_h=n.height;
var image_art_w=n.width;
if(image_art_h>t){
	var resize_art=image_art_h/t;
		var newh_art_h=image_art_h/resize_art;
		var neww_art_w=image_art_w/resize_art;
		n.setAttribute("width",neww_art_w);
		n.setAttribute("height",newh_art_h);	
	}
	}
	}
	/*******************************************
recadrage des photos pour la page accueil
*******************************************/
function resize_img_index(){
var ph_doc=document.images;

for(var e=0;e<ph_doc.length;e++){
/*var n=document.images[e];
var image_art_h=n.height;
var image_art_w=n.width;

if(image_art_h>t){
	var resize_art=image_art_h/t;
		var newh_art_h=image_art_h/resize_art;
		var neww_art_w=image_art_w/resize_art;
		n.setAttribute("width",neww_art_w);
		n.setAttribute("height",newh_art_h);	
	}*/
	}
	}

	
	/*******************************************
recadrage des photos et centrage de l'annuaire
*******************************************/
function resize_img_an(t){
var ph_doc=document.images;

for(var e=0;e<ph_doc.length;e++){
var n=document.images[e];

var image_art_h=n.height;
var image_art_w=n.width;
if(image_art_h>t){
var h_parent=n.parentNode.offsetHeight;

var marge=(h_parent-t)/3;
if(marge>0){

n.style.marginTop=marge+"px";
n.style.marginBottom=marge+"px";}
	var resize_art=image_art_h/t;
		var newh_art_h=image_art_h/resize_art;
		var neww_art_w=image_art_w/resize_art;
		n.setAttribute("width",neww_art_w);
		n.setAttribute("height",newh_art_h);	
	}
	}
	}

/*******************************************
liste article
*******************************************/

function ch_cadr(n){

n.style.borderColor="#ff00FF";
}
function re_cadr(n){

n.style.borderColor="#ddd";
}
function env(n){
window.location.href=n.childNodes[1];
}

/*******************************************
position pointeur
*******************************************/
var pos1;
var pos2;
var rollX=0;
var rollY=0;
function posit(evnt){
	var evt=evnt?evnt:window.event;
pos1=evt.clientX;
pos2=evt.clientY;


	if(document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ){
rollX=document.documentElement.scrollLeft;
rollY=document.documentElement.scrollTop;}
else if(document.body && ( document.body.scrollLeft || document.body.scrollTop )){
rollX=document.body.scrollLeft;
rollY=document.body.scrollTop;
}else{
	rollX=0;
	rollY=0;
}
	
return rollX;
return rollY;
return pos1;
return pos2;

}
/*******************************************
position pointeur hauteur largeur fenetre
*******************************************/
var larg_fen;
var	haut_fen;
var	larg_ecran;
var	haut_ecran;
function getPageSize(){ 
	 
	var xScroll, yScroll; 
	 
	if (window.innerHeight && window.scrollMaxY) {	 
		xScroll = document.body.scrollWidth; 
		yScroll = window.innerHeight + window.scrollMaxY; 
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 
		xScroll = document.body.scrollWidth; 
		yScroll = document.body.scrollHeight; 
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 
		xScroll = document.body.offsetWidth; 
		yScroll = document.body.offsetHeight; 
	} 
	 
	var windowWidth, windowHeight; 
	if (self.innerHeight) {	// all except Explorer 
		windowWidth = self.innerWidth; 
		windowHeight = self.innerHeight; 
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode 
		windowWidth = document.documentElement.clientWidth; 
		windowHeight = document.documentElement.clientHeight; 
	} else if (document.body) { // other Explorers 
		windowWidth = document.body.clientWidth; 
		windowHeight = document.body.clientHeight; 
	}	 
	 
	// for small pages with total height less then height of the viewport 
	if(yScroll < windowHeight){ 
		pageHeight = windowHeight; 
	} else {  
		pageHeight = yScroll; 
	} 
 
	// for small pages with total width less then width of the viewport 
	if(xScroll < windowWidth){	 
		pageWidth = windowWidth; 
	} else { 
		pageWidth = xScroll; 
	} 
 
 
	larg_fen=pageWidth;
	haut_fen=pageHeight;
	larg_ecran=windowWidth;
	haut_ecran=windowHeight;  
	return larg_fen; 
	return haut_fen; 
	return larg_ecran; 
	return haut_ecran; 
} 
/*******************************************
menu 
*******************************************/
function menu(){
	var menu_prin=document.getElementById("menu_principale");
	
	var liste=menu_prin.childNodes;

	/*for(var i=0;i<(liste.length-1);i++){
		document.getElementById("sous_menu"+i).style.display="none";
	}*/
}
function montre_menu(n){
	document.getElementById("sous_menu"+n).style.display="block";
}
function cache_menu(n){
	document.getElementById("sous_menu"+n).style.display="none";
}

/*MAP GOOGLE */
var map;
var baseIcon;
function aff_map(){ 
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl()); 
map.setCenter(new GLatLng(45.774438, 4.831753), 13);
}
var marquer;
/*FENETRE FLOTTANTE*/
function aff_carte(lien,lg,h,color,coo){
getPageSize();

var fond=document.createElement('div');
fond.setAttribute('id','fond');
fond.style.position="absolute";
fond.style.top=0;
fond.style.left=0;
fond.style.zIndex="2";
fond.style.width="100%";
fond.style.height=haut_fen+"px";
fond.style.backgroundColor="#fff";
if(navigator.appName=="Microsoft Internet Explorer"){
	fond.style.filter="alpha(opacity=70)";
}else{
	fond.style.opacity="0.7";
}

var disc=document.getElementById('cont_map');
document.getElementById("body").appendChild(fond);
disc.style.position="absolute";
disc.style.zIndex="3";
disc.style.width=lg+'px';
disc.style.textAlign="center";
disc.style.padding="18px";
disc.style.height=h+'px';
disc.style.backgroundColor="#"+color;
disc.style.border="#"+color+" 1px solid";
disc.style.top=(((haut_ecran-h)/2)+rollY)+"px";
disc.style.left=(((larg_fen-lg)/2))+"px";
disc.style.visibility="visible";

map.setCenter(new GLatLng(coo.coo1,coo.coo2), 15);
baseIcon = new GIcon();
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(32, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);
var letteredIcon=new GIcon(baseIcon);
letteredIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
var point=new GLatLng(coo.coo1,coo.coo2);
marquer=new GMarker(point,{ icon:letteredIcon });
map.addOverlay(marquer,"(coo.coo1,coo.coo2)");

}
function affiche_disc(){
	if(xmlhttp.readyState==4){
		var disc=document.getElementById("disc");
		disc.innerHTML=xmlhttp.responseText;
		
			}
}
function eff_carte(){
var fond=document.getElementById("fond");
document.getElementById("cont_map").style.visibility="hidden";

document.getElementById("body").removeChild(fond);
map.removeOverlay(marquer);
}




/*******************************************
newsletter
*******************************************/
function insert_news(){
var champ=document.newsletter_form.t_newsletter.value;

var url='/ajax/insert_news.php?mail='+champ;
xmlhttp.open('GET',url,true);
xmlhttp.onreadystatechange=affiche_merci;
xmlhttp.send(null);
}
function affiche_merci(){
	if(xmlhttp.readyState==4){
		
		alert(xmlhttp.responseText);
		
	}
	}



/*******************************************
Gallerie
*******************************************/
function resize_photo(n,t){
var image_art_h=n.height;
var image_art_w=n.width;

if(image_art_h>t){
	var resize_art=image_art_h/t;
		var newh_art_h=image_art_h/resize_art;
		var neww_art_w=image_art_w/resize_art;
		n.setAttribute("width",neww_art_w);
		n.setAttribute("height",newh_art_h);	
	}
	}



//fonction qui recadre la photo principale

function resize_photo_art(n,t){
var image_art_h=n.height;
var image_art_w=n.width;
if(image_art_h>t){
	var resize_art=image_art_h/t;
		var newh_art_h=image_art_h/resize_art;
		var neww_art_w=image_art_w/resize_art;
		n.setAttribute("width",neww_art_w);
		n.setAttribute("height",newh_art_h);	
	}
	
	}

//fonction qui fait disparaitre les load de chaque photo	
     
	function efface_load(n){
	var p_a=document.getElementById("p_a");
    resize_photo_art(p_a,160);
	redim_image(n.parentNode.parentNode);
	n.parentNode.parentNode.removeChild(n.parentNode.parentNode.firstChild);
	
	}
	
	
//fonction qui recadre les images de la gallerie	
function redim_image(n){
	
   var taillew=n.lastChild.firstChild.width;
		var tailleh=n.lastChild.firstChild.height;
		if(taillew>tailleh){
		var resize=tailleh/100;
		}else{
		var resize=taillew/100;
		}
		var newh=tailleh/resize;
		var neww=taillew/resize;
		n.lastChild.firstChild.setAttribute("width",neww);
		n.lastChild.firstChild.setAttribute("height",newh);
		n.style.backgroundColor="#000";
				
}


/*******************************************
auteur
*******************************************/

/*window.addEvent('domready' , function(){

if($('auteur')){

$('auteur').observe('mouseover' , aff_auteur_new );
$('auteur').observe('mouseout' , cache_auteur );

var auth = $("carte_auteur").clone();
$("carte_auteur").destroy();

auth.id = "carte_auteur";

$('body').insert(auth);

}

function aff_auteur_new(evt){

var carte=$("carte_auteur");
var posx = evt.clientX; 
var posy = evt.clientY; 

//console.log('%o,%o',evt,posy);

carte.appear({ duration: .3 });

carte.setStyle({'top': ( posy+ 15 ) + rollY + 'px'});
carte.setStyle({'left': ( posx -30 ) +rollX + 'px'});


}


});

function aff_auteur(n){
	
	var carte=document.getElementById("carte_auteur");
	

carte.style.display="block";
carte.style.top=(pos2+8)+rollY+"px";
carte.style.left=(pos1-30)+rollX+"px";

}
function cache_auteur(){
	var carte=document.getElementById("carte_auteur");
	carte.style.display="none";
	
} 
*/





/*******************************************
calendrier
*******************************************/
function aff_cal(a,m){
	var calendrier=document.getElementById("calendrier");

var url='cal.php?annee='+a+'&mois='+m;
xmlhttp.open('GET',url,true);
xmlhttp.onreadystatechange=affiche_cal;
xmlhttp.send(null);
}
function affiche_cal(){
	if(xmlhttp.readyState==4){
		
		document.getElementById('calendrier').innerHTML=xmlhttp.responseText;
		
	}
	}
function aff_ev(rdat){
var evenement=document.getElementById('evenement');
	evenement.innerHTML="";
	var url='rech_ev.php?jour='+rdat;
xmlhttp.open('GET',url,false);
xmlhttp.onreadystatechange=affiche_ev;
xmlhttp.send(null);

}

function cache_ev(){
	var evenement=document.getElementById('evenement');
	evenement.style.display="none";
}
function affiche_ev(){
	var evenement=document.getElementById('evenement');
	if(xmlhttp.readyState==4 && xmlhttp.status==200){
	
	evenement.innerHTML=xmlhttp.responseText;
	evenement.style.top=(pos2+5)+rollY+"px";
evenement.style.left=(pos1+5)+rollX+"px";
evenement.style.display="block";
	
}


}

/*******************************************
agenda
*******************************************/
function aff_agend(e,p){
getPageSize();

	var cache=document.getElementById("cache");
	cache.style.position="absolute";
	cache.style.top=0+"px";
	cache.style.left=0+"px";
	cache.style.zIndex="3";
	cache.style.width=larg_fen+"px";
	cache.style.height=haut_fen+"px";
    cache.style.backgroundColor="#fff";
if(navigator.appName=="Microsoft Internet Explorer"){
	cache.style.filter="alpha(opacity=60)";
}else{
	cache.style.opacity="0.6";
}

var chargement=document.getElementById("char");
chargement.style.position="absolute";
chargement.style.zIndex="3";
chargement.style.top=((haut_ecran/2)+rollY)+"px";
chargement.style.left=((larg_fen/2)-15)+"px";
chargement.style.display="block";
cache.style.display="block";
var url='ag.php?annee='+e+'&mois='+p;
xmlhttp.open('GET',url,true);
xmlhttp.onreadystatechange=affiche_ag;
xmlhttp.send(null);

}

function affiche_ag(){
	if(xmlhttp.readyState==4){
	var cache=document.getElementById("cache");
cache.style.display="none";
		var chargement=document.getElementById("char");
			chargement.style.display="none";

		document.getElementById('agen').innerHTML=xmlhttp.responseText;
		
	}
	}

function aff_disc(){
getPageSize();
var fond=document.createElement('div');
fond.setAttribute('id','fond');
fond.style.position="absolute";
fond.style.top=0;
fond.style.left=0;
fond.style.zIndex="2";
fond.style.width="100%";
fond.style.height=haut_fen+"px";
fond.style.backgroundColor="#fff";
if(navigator.appName=="Microsoft Internet Explorer"){
	fond.style.filter="alpha(opacity=70)";
}else{
	fond.style.opacity="0.7";
}
document.getElementById("texte").appendChild(fond);
var disc=document.createElement('div');
disc.setAttribute('id','disc');
disc.style.position="absolute";
disc.style.zIndex="3";
disc.style.width="320px";
disc.style.textAlign="justify";
disc.style.padding="20px";
disc.style.height="170px";
disc.style.backgroundColor="#f1f1f1";
disc.style.border="#ccc 1px solid";
disc.style.top=(((haut_ecran/2)-80)+rollY)+"px";
disc.style.left=((larg_fen/2)-150)+"px";

document.getElementById("texte").appendChild(disc);
var url='/ajax/aff_disc.php?id=0';
xmlhttp.open('GET',url,true);
xmlhttp.onreadystatechange=affiche_disc;
xmlhttp.send(null);
}
function affiche_disc(){
	if(xmlhttp.readyState==4){
		var disc=document.getElementById("disc");
		disc.innerHTML=xmlhttp.responseText;
			}
}
function eff_disc(){
var fond=document.getElementById("fond");
var disc=document.getElementById("disc");

document.getElementById("texte").removeChild(fond);
document.getElementById("texte").removeChild(disc);
}



function aff_im(n){
	
	var image=n.nextSibling;
image.style.display="block";
image.style.left=(image.style.left)+50+"px";

}
function cache_im(n){
var image=n.nextSibling;

	
	image.style.display="none";
	
} 

/*******************************************
lyon clubbing tv
*******************************************/

function aff_lect(){
getPageSize();

	var lecteur=document.getElementById("fen_lect");
	var foot=document.getElementById("foot");
	var cache=document.getElementById("cache");
	
	
	
	cache.style.position="absolute";
	cache.style.top=0+"px";
	cache.style.left=0+"px";
	cache.style.backgroundColor="#fff";
	cache.style.zIndex=3;
	cache.style.width=larg_fen+"px";
	cache.style.height=haut_fen+"px";
	
	lecteur.style.top=(((haut_ecran/2)-250)+rollY)+"px";
	lecteur.style.left=((larg_fen/2)-500/2)+"px";
	lecteur.style.zIndex=4;
	lecteur.style.display="block";
	cache.style.display="block";
	if(navigator.appName=="Microsoft Internet Explorer"){
	var f=100;
	for(var a=0;a<30;a++){
	cache.style.filter="alpha(opacity="+f+")";
	cache.style.display='none';
	f--;}
}else{
var f=10;
	for(var a=0;a<3;a++){
	cache.style.opacity="0.7";
	f--;}
}
	
}

function fer_lect(){
	


	var lecteur=document.getElementById("fen_lect");
	var video=document.getElementById("lecteur");
	var cache=document.getElementById("cache");
	
	cache.style.display="none";
lecteur.style.display="none";


}

/*******************************************
formulaire event+ann
*******************************************/


/*******************************************
lyon clubbing tv
*******************************************/

function aff_ba(n){
getPageSize();

	var lecteur=n.nextSibling;
	var foot=document.getElementById("foot");
	var cache=document.getElementById("cache");
	
	
	
	cache.style.position="absolute";
	cache.style.top=0+"px";
	cache.style.left=0+"px";
	cache.style.backgroundColor="#fff";
	cache.style.zIndex=3;
	cache.style.width=larg_fen+"px";
	cache.style.height=haut_fen+"px";
	
	var rollY = rollY == undefined ? 0 : rollY;
	lecteur.style.position="absolute";
	
	lecteur.style.top=(((haut_ecran/2)-200)+rollY)+"px";
	
	lecteur.style.left=((larg_fen/2)-270)+"px";
	lecteur.style.zIndex=4;
	lecteur.style.display="block";
	
	if(navigator.appName=="Microsoft Internet Explorer"){
	
	
	cache.style.filter="alpha(opacity=70)";
	//cache.style.display='none';
	
}else{
cache.style.display="block";

	cache.style.opacity="0.7";
	
}
	
}

function fer_ba(n){
	


	var lecteur=n.parentNode;
	
	var cache=document.getElementById("cache");
	
	cache.style.display="none";
lecteur.style.display="none";


}






