Element.implement({
  css: function(property,value) {
    var type = $type(property);
    if(value == undefined && type != 'object') {
      return this.getStyle(property);
    }
    else {
      var pvs = property;
      if(type != 'object') { pvs = {}; pvs[property] = value; }
      return this.setStyles(pvs);
    }
  },
  attr: function(property,value) {
    var type = $type(property);
    if(value == undefined && type != 'object') {
      return this.get(property);
    }
    else {
      var pvs = property;
      if(type != 'object') { pvs = {}; pvs[property] = value; }
      return this.set(pvs);
    }
  }
});
window.addEvent('domready', function(){

	// activer le sous menu en fonction de l'onglet actif
	var tab_id = $$('ul#navigation li a.active').attr("id");
	$$("div#secondary_navigation ul").css('display', 'none');
	$$("div#secondary_navigation").removeClass('item_special');
	$$("div#secondary_navigation ul#for_"+tab_id).css('display','inline');
	if(tab_id == 'item_special')
	{
		$$("div#secondary_navigation").addClass('item_special');
	}
	
	// Ajouter l'ecoute sur les menus pour afficher le sous menu en question
	$$('ul#navigation li a').addEvents({
		mouseenter: function() {
			var tab_id = $$(this).attr("id");
			// si une sous nav correspondante existe, on l'afficher et on cache l'actuelle 
			$$("ul#navigation li a").removeClass("active");
			$$("div#secondary_navigation").removeClass('item_special');
			$$(this).addClass("active");

			$$("div#secondary_navigation ul").css('display', 'none');
			$$("div#secondary_navigation ul#for_"+tab_id).css('display','inline');
			if(tab_id == 'item_special')
			{
				$$("div#secondary_navigation").addClass('item_special');
			}
		},
		mouseleave: function() {
			
		}
	});
});

/* Fonctions menu principal */
function menu_general (obj)
{
	//style onglet + sous menu
	if(!$(obj).hasClass('active')){
		// on cache le menu visible par d�faut
		$$('dl#top_menu_dl dt.hover ul').setStyles({display: 'none' });
		$(obj).addClass('hover').addClass('jshover');
	}
}

function hidemenu_general(obj, menu)
{
		
	//style onglet + sous menu
	$(obj).removeClass('hover').removeClass('jshover');
	
	// on affiche le menu visible par d�faut => menu
	$$('ul#ss_'+menu).setStyles({display: 'block' });
	
}
////////////////////////////////////////////////

function menu (obj)
{
	if(!$(obj).hasClass('active'))
		$(obj).addClass('hover').addClass('jshover');
}

function hidemenu(item)
{
	$$('#'+item+' li.jshover').removeClass('hover').removeClass('jshover');
}

var curZoom=1;
function changeZoomAuto() {
	curZoom=curZoom+1;
	if(curZoom>3) curZoom=1;
	changeZoomFlash(tabZoom[curZoom],curZoom,false);
	
}

function changeZoom(item) {
	
	$('zoomActus').style.display='none';
	$('zoomProches').style.display='none';
	$('zoomCoeurs').style.display='none';
	
	$('zoom'+item).style.display='block';

	$('liActus').removeClass('active').removeClass('hover');
	$('liProches').removeClass('active').removeClass('hover');
	$('liCoeurs').removeClass('active').removeClass('hover');
	
	$('li'+item).addClass('active').addClass('hover');
}

var i=0;
function changeZoomFlash(item,pos,clearTime) {
	
	if(clearTime) {
		clearInterval(myTimer);
		myTimer = setInterval("changeZoomAuto()", 7000);
	}
	else
	{
		++i;
		if(i > 2){
			clearInterval(myTimer);
			myTimer = setInterval("changeZoomAuto()", 7000);
		}
	}
	curZoom=pos;
	var dataDiv = 'bloc_zoom_flash';

	if(pos!=1) document.getElementById('zoom_sur_pub1').className='zoom_opacity';
	else  document.getElementById('zoom_sur_pub1').className='zoom_no_opacity';
	if(pos!=2) document.getElementById('zoom_sur_pub2').className='zoom_opacity';
	else  document.getElementById('zoom_sur_pub2').className='zoom_no_opacity';
	if(pos!=3) document.getElementById('zoom_sur_pub3').className='zoom_opacity';
	else  document.getElementById('zoom_sur_pub3').className='zoom_no_opacity';
	
	var myAjax = new Request({
			url: '/js/ajax/pubFlash.php',
			method: 'post',
			data:"pub_flash_id="+item,
			evalScripts: true,
			onComplete: function(responseText) { // no default update element, we do it manually
            	$(dataDiv).set('html', responseText);
	        }
		}
	).send();
	

	
}

function opacityFlash(div,item) {
	if(document.getElementById('cur_zoom_id').innerHTML!=item) {
		document.getElementById(div).className='zoom_opacity';
	}
}
function noOpacityFlash(div,item) {
	if(document.getElementById('cur_zoom_id').innerHTML!=item) {
		document.getElementById(div).className='zoom_no_opacity';
	}
}

function changeCalendar(mois,annee) {
	
	var dataDiv = 'bloc_monagenda';
	
	var myAjax = new Request({
		url: '/js/ajax/changeCalendar.php',
		method: 'post',
		data:"mois_encours="+mois+"&annee_encours="+annee,
		evalScripts: true,
		onComplete: function(responseText) { // no default update element, we do it manually
           	$(dataDiv).set('html', responseText);
	    }
	}).send();
	
}


var fondDiv = false;
var dataDiv = false;
var resaDiv = false;
function infoConcert(id) {
	removeDivResa();
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '2000',
	   visibility: 'hidden'
	});
	
	$(fondDiv).onclick=function() {
		removeDivConcert();
	}
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: 'transparent',
	   width: '536px',
	   height: '505px',
	   position: 'absolute',
	  /* border: '1px solid #000',*/
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-267px',	   
	   marginTop: (getScrollTop()-267) + 'px',	   	   	   
	   zIndex: '2001',
	   visibility: 'hidden'
	});

	var myAjax = new Request({
			url: '/p_ficheconcert.php',
			method: 'post',
			data:"concert_id="+id,
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
            	$(dataDiv).set('html', responseText);
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	        }
		}
	).send();

}

function infoResa(id) {

	if(!resaDiv){
		resaDiv = document.createElement('div');
		resaDiv.style.position = 'absolute';
		document.body.appendChild(resaDiv);
	}

	$(resaDiv).setStyles({
	   backgroundColor: 'transparent',
	   width: '104px',
	   height: '100px',
	   position: 'absolute',
	   zIndex: '1600000',
	   visibility: 'hidden'
	});


	var Pos = $('lien_resa_'+id).getPosition();
	resaDiv.style.left = Pos.x + 'px';
	resaDiv.style.top = Pos.y + 'px';

	var myAjax = new Request({
			url: '/p_inforesa.php',
			method: 'post',
			data:"concert_id="+id,
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
            	$(resaDiv).set('html', responseText);
				$$(resaDiv).setStyles({visibility: 'visible' });
	        }
		}
	).send();
}

function removeDivConcert() {
	removeDivResa();
	if(fondDiv){
		$(fondDiv).destroy();
		fondDiv = false;
	}	
	if(dataDiv){
		$(dataDiv).destroy();
		dataDiv = false;
	}
	if($('pub_right')) $('pub_right').setStyles({visibility: 'visible' });
}

function removeDivResa() {
	if(resaDiv){
		$(resaDiv).destroy();
		resaDiv = false;
	}
	if($('pub_right')) $('pub_right').setStyles({visibility: 'visible' });
}

function removeDivBip() {
	if(fondDiv2){
		$(fondDiv2).destroy();
		fondDiv2 = false;
	}	
	if(dataDiv2){
		$(dataDiv2).destroy();
		dataDiv2 = false;
	}
	$$('select').setStyles({visibility: 'visible' });
	if($('pub_right')) $('pub_right').setStyles({visibility: 'visible' });
}


var fondDiv2 = false;
var dataDiv2 = false;
function noReg() {
		removeDivResa();
		if(!fondDiv2){
			fondDiv2 = document.createElement('div');
			fondDiv2.style.position = 'absolute';
			document.body.appendChild(fondDiv2);
		}
		fondDiv2.innerHTML = '';
		//alert(getHeight());
	
		$(fondDiv2).setStyles({
		   backgroundColor: '#000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.5',
		   overflow: 'hidden',
		   top: '0px',
		   left: '0px',
		   zIndex: '5000',
		   visibility: 'hidden'
		});
		
		$(fondDiv2).onclick=function() {
			removeDivBip();
		}
	
		if(!dataDiv2){
			dataDiv2 = document.createElement('div');
			dataDiv2.style.position = 'absolute';
			document.body.appendChild(dataDiv2);
		}
	
		$(dataDiv2).setStyles({
		   backgroundColor: 'transparent',
		   width: '360px',
		   height: '214px',
		   position: 'absolute',
		  /* border: '1px solid #000',*/
		   top: '50%',
		   left: '50%',	   
		   marginLeft: '-180px',	   
		   marginTop: (getScrollTop()-180) + 'px',	   	   	   
		   zIndex: '5001',
		   visibility: 'hidden'
		});
		
		var myAjax = new Request({
			url: '/p_popup_login.php',
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
            	$(dataDiv2).set('html', responseText);
				$$(fondDiv2).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
				$$(dataDiv2).setStyles({visibility: 'visible' });
	        }
		}
		).send();		

}


function bipnclic(typeBip,idBip) {

		removeDivResa();
		if(!fondDiv2){
			fondDiv2 = document.createElement('div');
			fondDiv2.style.position = 'absolute';
			document.body.appendChild(fondDiv2);
		}
		fondDiv2.innerHTML = '';
		//alert(getHeight());
	
		$(fondDiv2).setStyles({
		   backgroundColor: '#000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.5',
		   overflow: 'hidden',
		   top: '0px',
		   left: '0px',
		   zIndex: '5000',
		   visibility: 'hidden'
		});
		
		$(fondDiv2).onclick=function() {
			removeDivBip();
		}
	
		if(!dataDiv2){
			dataDiv2 = document.createElement('div');
			dataDiv2.style.position = 'absolute';
			document.body.appendChild(dataDiv2);
		}
	
		$(dataDiv2).setStyles({
		   backgroundColor: 'transparent',
		   width: '360px',
		   height: '214px',
		   position: 'absolute',
		  /* border: '1px solid #000',*/
		   top: '50%',
		   left: '50%',	   
		   marginLeft: '-180px',	   
		   marginTop: (getScrollTop()-180) + 'px',	   	   	   
		   zIndex: '5001',
		   visibility: 'hidden'
		});
	
		var myAjax = new Request({
			url: '/p_popup_bipnclic.php',
			method: 'post',
			data:"typeBip="+typeBip+"&idBip="+idBip,
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
            	$(dataDiv2).set('html', responseText);
				$$(fondDiv2).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
				$$(dataDiv2).setStyles({visibility: 'visible' });
	        }
		}
		).send();
}


function suiteAvis(idAvis) {
	
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '533px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
			url: '/js/ajax/suite_avis.php',
			method: 'post',
			data:"avis_id="+idAvis,
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
            	$(dataDiv2).set('html', responseText);
				$$(fondDiv2).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
				$$(dataDiv2).setStyles({visibility: 'visible' });
	        }
		}
		).send();
}

function ajout_avis(typeAvis,entAvis,idAvis) {
	
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '533px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
		url: '/js/ajax/avis.php',
		method: 'post',
		data:"avis_type_id="+typeAvis+"&avis_assoc_type="+entAvis+"&assoc_id="+idAvis,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
			$$(fondDiv2).setStyles({visibility: 'visible' });
			/*$$('select').setStyles({visibility: 'hidden' });*/
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();

}

function submit_avis(idForm) {
	
	var myAjax = new Request({
		url: '/js/ajax/avis.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
        }
	}
	).send();
}

// Forum
function ajout_reponse(idParent, idForum) {
	
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '533px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
		url: '/js/ajax/forum_reponse.php',
		method: 'post',
		data:"forum_post_parent="+idParent+"&forum_id="+idForum,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
			$$(fondDiv2).setStyles({visibility: 'visible' });
			/*$$('select').setStyles({visibility: 'hidden' });*/
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();	

}

function submit_reponse(idForm) {
	
	var myAjax = new Request({
		url: '/js/ajax/forum_reponse.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
        }
	}
	).send();	
}

function ajout_sujet(idForum) {
	
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '533px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
		url: '/js/ajax/forum_sujet.php',
		method: 'post',
		data:"forum_id="+idForum,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
			$$(fondDiv2).setStyles({visibility: 'visible' });
			/*$$('select').setStyles({visibility: 'hidden' });*/
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();	

}

function submit_sujet(idForm) {
	
	var myAjax = new Request({
		url: '/js/ajax/forum_sujet.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
        }
	}
	).send();
}

function update_post(idPost, typePost, statut) {
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '360px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
		url: '/js/ajax/forum_statut.php',
		method: 'post',
		data:"forum_post_id="+idPost+"&forum_post_parent="+typePost+"&forum_statut_id="+statut,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
			$$(fondDiv2).setStyles({visibility: 'visible' });
			/*$$('select').setStyles({visibility: 'hidden' });*/
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();

}

function submit_update_post(idForm) {
	
	var myAjax = new Request({
		url: '/js/ajax/forum_statut.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
        }
	}
	).send();
}

function supprimer_mon_compte(idMembre) {
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '360px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
		url: '/js/ajax/mon_infoconcert.php',
		method: 'post',
		data:"membre_id="+idMembre,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
			$$(fondDiv2).setStyles({visibility: 'visible' });
			/*$$('select').setStyles({visibility: 'hidden' });*/
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();

}

function submit_supprimer_mon_compte(idForm) {
	
	var myAjax = new Request({
		url: '/js/ajax/mon_infoconcert.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
        }
	}
	).send();

}

function alerter_moderateur(idForum, idSujet) {
	
	if(!fondDiv2){
		fondDiv2 = document.createElement('div');
		fondDiv2.style.position = 'absolute';
		document.body.appendChild(fondDiv2);
	}
	fondDiv2.innerHTML = '';
	
	$(fondDiv2).setStyles({
	   backgroundColor: '#000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '5000',
	   visibility: 'hidden'
	});
	
	$(fondDiv2).onclick=function() {
		removeDivBip();
	}
	
	if(!dataDiv2){
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		document.body.appendChild(dataDiv2);
	}
	
	$(dataDiv2).setStyles({
	   backgroundColor: 'transparent',
	   width: '533px',
	   height: '214px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-180px',	   
	   marginTop: (getScrollTop()-180) + 'px',	   	   	   
	   zIndex: '5001',
	   visibility: 'hidden'
	});
	
	var myAjax = new Request({
		url: '/js/ajax/forum_moderateur.php',
		method: 'post',
		data:"forum_id="+idForum+"&forum_post_parent="+idSujet,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
			$$(fondDiv2).setStyles({visibility: 'visible' });
			/*$$('select').setStyles({visibility: 'hidden' });*/
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();

}

function submit_alerte_moderateur(idForm) {
	
	var myAjax = new Request({
		url: '/js/ajax/forum_moderateur.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$(dataDiv2).set('html', responseText);
        }
	}
	).send();

}


function showPopupCal(id,concerts) {
	
	if($('popup_cal_'+id).style.display=='none') {
	
		for(i=1;i<=31;i++) {
			if($('popup_cal_'+i)) { $('popup_cal_'+i).style.display="none"; }
		}
		
		var myAjax = new Request({
			url: '/js/ajax/bulle_concert.php',
			method: 'post',
			data:"concert="+concerts,
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
	        	$('popup_cal_'+id).set('html', responseText);
				$('popup_cal_'+id).style.display="block";
	        }
		}
		).send();
	}	
}

function kill_popup_cal(id) {
	$('popup_cal_'+id).style.display="none";
	

}


function save_search(idForm) {

		removeDivResa();
		if(!fondDiv2){
			fondDiv2 = document.createElement('div');
			fondDiv2.style.position = 'absolute';
			document.body.appendChild(fondDiv2);
		}
		fondDiv2.innerHTML = '';
		//alert(getHeight());
	
		$(fondDiv2).setStyles({
		   backgroundColor: '#000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.5',
		   overflow: 'hidden',
		   top: '0px',
		   left: '0px',
		   zIndex: '5000',
		   visibility: 'hidden'
		});
		
		$(fondDiv2).onclick=function() {
			removeDivBip();
		}
	
		if(!dataDiv2){
			dataDiv2 = document.createElement('div');
			dataDiv2.style.position = 'absolute';
			document.body.appendChild(dataDiv2);
		}
	
		$(dataDiv2).setStyles({
		   backgroundColor: 'transparent',
		   width: '360px',
		   height: '214px',
		   position: 'absolute',
		  /* border: '1px solid #000',*/
		   top: '50%',
		   left: '50%',	   
		   marginLeft: '-180px',	   
		   marginTop: (getScrollTop()-180) + 'px',	   	   	   
		   zIndex: '5001',
		   visibility: 'hidden'
		});
	
		var myAjax = new Request({
			url: '/js/ajax/save_search_av.php',
			method: 'post',
			data:$(idForm).toQueryString(),
			evalScripts: true,
			onSuccess: function(responseText) { // no default update element, we do it manually
	        	$(dataDiv2).set('html', responseText);
				$$(fondDiv2).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
				$$(dataDiv2).setStyles({visibility: 'visible' });
	        }
		}
		).send();

}

function delete_search(idsearch) {

	var myAjax = new Request({
		url: '/js/ajax/save_search_av.php',
		method: 'post',
		data:"membre_search_id="+idsearch,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
			document.getElementById('bloc_search_av'+idsearch).style.display = 'none';
        }
	}
	).send();

}


function get_search(idsearch) {

	var myAjax = new Request({
		url: '/js/ajax/bloc_search_av.php',
		method: 'post',
		data:"membre_search_id="+idsearch,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	$('sbloc_search_av'+idsearch).set('html', responseText);

        }
	}
	).send();
	
}

function delBipNClic(typBip,idBip) {

	var myAjax = new Request({
		url: '/js/ajax/del_bip.php',
		method: 'post',
		data:"type="+typBip+"&id="+idBip,
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
        	document.getElementById('bipnclic'+typBip+idBip).style.display = 'none';
        }
	}
	).send();

}


function sendFriend(typeBip,idBip) {
	
	concert_id = 'concert_id';	
	membre_prenom = 'membre_prenom';	
	membre_email = 'membre_email';	
	flag_submit = 'flag_submit';	
	email = 'email';	
	message = 'message';	
	artiste_nom = 'artiste_nom';
	ville_nom = 'ville_nom';

	/*concertValue = $(concert_id).value;	
	mprenomValue =  $(membre_prenom).value;	
	memailValue =  $(membre_email).value;	
	submitValue = $(flag_submit).value;	
	emailValue =  $(email).value;	
	messageValue =  $(message).value;	
	artisteValue =  $(artiste_nom).value;	
	villeValue =  $(ville_nom).value;	*/

	var myAjax = new Request({
		url: '/p_popup_bipnclic.php',
		method: 'post',
		data:$(typeBip).toQueryString(),
		evalScripts: true,
		onSuccess: function(responseText) { // no default update element, we do it manually
			$(dataDiv2).set('html', responseText);
        	$$(fondDiv2).setStyles({visibility: 'visible' });
			$$('select').setStyles({visibility: 'hidden' });
			if($('pub_right')) $('pub_right').setStyles({visibility: 'hidden' });
			$$(dataDiv2).setStyles({visibility: 'visible' });
        }
	}
	).send();
}

function openWindowPage(url, width, height) {
window.open(url,"_blank","width="+width+",height="+height+",scrollbars=no" );
}

// Publier sur MySpace
function GetThis(T, C, U, L)
{
    var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T)
    + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L;
    openWindowPage(targetUrl, 800, 540);
}

// Check Form
function checkNb(c,NbCarac)
{
	if(document.getElementById(c).value.length > 1){
		if(document.getElementById(c).value.length < NbCarac)
		{
			document.getElementById(c + "_statut").innerHTML="<img src='/style/ko.gif' width='15' height='15' align='left'/>&nbsp;Au moins " + NbCarac + " caractères.";
		}else{
				
			document.getElementById(c + "_statut").innerHTML="<img src='/style/ok.gif' width='15' height='15' align='left'/>";
		}
	}
}
function checkRequis(c)
{
	if(document.getElementById(c).value.length < 1){
		document.getElementById(c + "_statut").innerHTML="<img src='/style/ko.gif' width='15' height='15' align='left'/>&nbsp;Champ requis.";
	}else{
		document.getElementById(c + "_statut").innerHTML="<img src='/style/ok.gif' width='15' height='15' align='left'/>";
	}
}

function checkConfirm(c)
{
	if(document.getElementById(c).value != ""){
		if(document.getElementById(c).value == document.getElementById(c+'_confirm').value)
			document.getElementById(c + "_confirm_statut").innerHTML="<img src='/style/ok.gif' width='15' height='15' align='left'/>";
		else
			document.getElementById(c + "_confirm_statut").innerHTML="<img src='/style/ko.gif' width='15' height='15' align='left' title='Les champs ne correspondent pas'/>";	
	}
}

function checkEmail(c)
{
	if(document.getElementById(c).value.indexOf("@") != -1){
		texte = file('/js/ajax/verifEmail.php?mail=' + document.getElementById(c).value);

		if (texte.indexOf("true") != -1){
			document.getElementById(c + "_statut").innerHTML = "<img src='/style/ok.gif' width='15' height='15' align='left'/>";
		} else if (texte.indexOf("equal") != -1){
			document.getElementById(c + "_statut").innerHTML="<img src='/style/ko.gif' width='15' height='15' align='left' title='Adresse e-mail invalide'/>&nbsp;Adresse e-mail invalide";			
		} else {
			document.getElementById(c + "_statut").innerHTML = "<img src='/style/ko.gif' width='15' height='15' align='left' title='Adresse e-mail déjà utilisée'/>&nbsp;Adresse e-mail déjà utilisée";
		}
	}else{
		document.getElementById(c + "_statut").innerHTML = "";
	}	
}

function checkLogin(c)
{
	if(document.getElementById(c).value.length > 2){
		var login = document.getElementById(c).value;
		var mask = /^[0-9a-zA-Z\-]+$/;
	  	if(!login.match(mask))
		{
			document.getElementById(c + "_statut").innerHTML="<img src='/style/ko.gif' width='15' height='15' align='absmiddle' title='Caractères alphanumériques et tirets (-) autorisés.'/>";
		}else{ 
			texte = file('/js/ajax/verifLogin.php?login=' + document.getElementById(c).value);
	
			if (texte.indexOf("true") != -1){
				document.getElementById(c + "_statut").innerHTML = "<img src='/style/ok.gif' width='15' height='15' align='right'/>";
			} else {
				document.getElementById(c + "_statut").innerHTML = "<img src='/style/ko.gif' width='15' height='15' align='right' title='Adresse déjà utilisée.'/>";
			}
		}
	}else{
		document.getElementById(c + "_statut").innerHTML = "<img src='/style/ko.gif' width='15' height='15' align='right' title='Au moins 3 caractères.'/>";
	}
}

function checkTel(c,t)
{
	if(document.getElementById(c).value.length > 2){
		var tel = document.getElementById(c).value;
		if(t == 1) // Mobile
		var mask = /^06|07/;
		else // Fixe
		var mask = /^01|02|03|04|05|08|09/;
		
	  	if(!tel.match(mask))
		{
			document.getElementById(c + "_statut").innerHTML="<img src='/style/ko.gif' width='15' height='15' align='left' title='Mauvais numéro'/>";
		}else{ 
			if(document.getElementById(c).value.length > 9){
				document.getElementById(c + "_statut").innerHTML = "<img src='/style/ok.gif' width='15' height='15' align='left'/>";
			} else {
				document.getElementById(c + "_statut").innerHTML = "<img src='/style/ko.gif' width='15' height='15' align='left' title='Numéro trop court'/>";
			}
		}
	}else if(document.getElementById(c).value.length == 0){
		document.getElementById(c + "_statut").innerHTML = "";
	}else{
		document.getElementById(c + "_statut").innerHTML = "<img src='/style/ko.gif' width='15' height='15' align='left' title='Au moins 3 caractères.'/>";
	}
}
function file(fichier)
{	
	if(window.XMLHttpRequest) // FIREFOX
	  xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // IE
	  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else 
	  return(false); 
	xhr_object.open("GET", fichier, false); 
	xhr_object.send(null); 
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);

}
