function subscribeMailing() {
	jQuery.ajax({
		type: "POST",
		url: "/sabonner.php",
		data: "courriel="+escape(jQuery('#mailingtxt').val()),
		success: function() { alert('Votre adresse a été ajouté à la liste de diffusion.');jQuery('#mailingtxt').val('Votre adresse courriel') }
	})
}

function demandeSpeciale() {
		jQuery.ajax({
			type: "POST",
			url: "/demandespeciale.php",
			data: "demande="+escape(jQuery('#demandetxt').val()),
			success: function() { alert('Votre demande spéciale a été envoyée à nos DJs!');jQuery('#demandetxt').val('') }
		})
	}

jQuery(document).ready(function() {
	
	// EVENT SWITCHER
	jQuery('#eventlist a').click(function() {
		if (jQuery(this).parent().find('span').hasClass('active')) {
			jQuery(this).blur();
			return false;
		}
		
		jQuery(this).blur();
		var ev_id = jQuery(this).attr('id').substring(3);
		jQuery('#img_photo_evenement').attr('src','/fichiers/evenements/m_'+jQuery(this).attr('img'));
		jQuery('#cadre_photo_evenement').attr('href','/fichiers/evenements/l_'+jQuery(this).attr('img'));
		jQuery('#cadre_photo_evenement').attr('title',jQuery(this).html());
			jQuery('#div_main_event').load('/evenementdesc.php?id=' + ev_id);
		return false;
		
	});
	
	// DJ LIST SHOW / HIDE...
	jQuery('#djlist a').click(function() {
		if (jQuery(this).parent().find('span').hasClass('active')) {
			jQuery(this).blur();
			return false;
		}
		jQuery('#djlist span.active').slideUp(400).removeClass('active');
		jQuery(this).parent().find('span').slideDown(400).addClass('active');
		jQuery(this).blur();
		var djid = jQuery(this).attr('id').substring(3);
		jQuery('#img_photo_dj').attr('src','/fichiers/djs/m_'+jQuery(this).attr('img'));
		jQuery('#cadre_photo_dj').attr('href','/fichiers/djs/l_'+jQuery(this).attr('img'));
		jQuery('#cadre_photo_dj').attr('title',jQuery(this).html());
		jQuery('#djtop').load('/top5.php?id='+djid);
		return false;
	});


	// ALBUM PHOTO SWITCHER
	jQuery('#albumlist a').click(function() {
		var alid = jQuery(this).attr('id').substring(3);
		jQuery('#photo_table_abs').load('/album.php?id='+alid,function() { jQuery('a.lightboxAL').lightBox();	init_fleches_photos(); });
		jQuery('#album_info').load('/albuminfos.php?id='+alid);
		jQuery(this).blur();
		return false;
	});	
	// Mouse over images des menus
	
	var hoverimg = jQuery('.mnuover img');
	for(var x=0;x<hoverimg.length;x++) jQuery(hoverimg[x]).clone().addClass('hoverimg').attr('src',jQuery(hoverimg[x]).attr('hsrc')).prependTo(jQuery(hoverimg[x]).parent());
	jQuery('.mnuover').hover(function() { 
		if (navigator.userAgent.match(/msie/i)) jQuery(this).find('img.hoverimg').show();
		else jQuery(this).find('img.hoverimg').fadeIn(300);
	},function() {
		if (navigator.userAgent.match(/msie/i)) jQuery(this).find('img.hoverimg').hide();
		else jQuery(this).find('img.hoverimg').fadeOut(300);
	});
	
	// Stripping alt on images...
	
	jQuery('img').attr('alt','');
	
	// Initiating lightbox...
	jQuery('a.lightboxDJ').lightBox();
	jQuery('a.lightboxEV').lightBox();
	jQuery('a.lightboxAL').lightBox();
});


// Album photo script...

var tblWidth = 268;
var init_fleches_photos = function() {
	tblWidth = 	jQuery('#photo_table_abs table:eq(0)').width();
	jQuery('#photo_table_abs').css('left','0px');
	update_status_fleche();
	jQuery('#photo_fleche_droite').click(function() { 
		if (jQuery('#photo_fleche_droite').attr('clickdisabled')=='1') return;
		jQuery('#photo_table_abs').animate({ left:'-='+tblWidth+'px' },1000,"swing",update_status_fleche);
		jQuery('#photo_fleche_gauche').attr('src','/images/fleche-gauche-na.png');
		jQuery('#photo_fleche_droite').attr('src','/images/fleche-droite-na.png');
		jQuery('#photo_fleche_droite').attr('clickdisabled','1');
		jQuery('#photo_fleche_gauche').attr('clickdisabled','1');
	});
	jQuery('#photo_fleche_gauche').click(function() { 
		if (jQuery('#photo_fleche_gauche').attr('clickdisabled')=='1') return;
		jQuery('#photo_table_abs').animate({ left:'+='+tblWidth+'px' },1000,"swing",update_status_fleche);
		jQuery('#photo_fleche_gauche').attr('src','/images/fleche-gauche-na.png');
		jQuery('#photo_fleche_droite').attr('src','/images/fleche-droite-na.png');
		jQuery('#photo_fleche_droite').attr('clickdisabled','1');
		jQuery('#photo_fleche_gauche').attr('clickdisabled','1');
	});
}	
var update_status_fleche = function() { 
	jQuery('#photo_fleche_gauche').attr('src','/images/fleche-gauche-na.png');
	jQuery('#photo_fleche_droite').attr('src','/images/fleche-droite-na.png');
	jQuery('#photo_fleche_droite').attr('clickdisabled','1');
	jQuery('#photo_fleche_gauche').attr('clickdisabled','1');
	if (parseInt(jQuery('#photo_table_abs').css('left'),10)<0) {
		jQuery('#photo_fleche_gauche').attr('src','/images/fleche-gauche.png');
		jQuery('#photo_fleche_gauche').attr('clickdisabled','0');
	}
	if (parseInt(jQuery('#photo_table_abs').css('left'),10)>(jQuery('#photo_table_abs table').length-1) * (-1 * tblWidth)) {
		jQuery('#photo_fleche_droite').attr('src','/images/fleche-droite.png');
		jQuery('#photo_fleche_droite').attr('clickdisabled','0');						
	}
}
jQuery(document).ready(init_fleches_photos);
