$().ready(function(){
	// simple accordion
	jQuery('#list1a').accordion();

	// contenflow
	var s = getParamValue('id');
	var myNewFlow = new ContentFlow('discoFlow', {
		onclickActiveItem: function() {
			var item = this.getActiveItem().element.itemIndex;
			var baseTag = document.getElementsByTagName("base");
			for(var i=0; i<baseTag.length; i++) {
				var baseId = baseTag[i].id;
				var baseHref = baseTag[i].href;
			}
			document.location = baseHref + 'disco.php?id=' + item;
		},
		startItem: s,
		visibleItems: 5,
		maxItemHeight: 150
	});
   function getParamValue(param,url) {
      var u = url == undefined ? document.location.href : url;
      var reg = new RegExp('(\\?|&amp;|^)'+param+'=(.*?)(&amp;|$)');
      matches = u.match(reg);
      return matches[2] != undefined ? decodeURIComponent(matches[2]).replace(/\+/g,' ') : '';
	}

   // les div modifiés quand on veut écouter un morceau
	$(".mouse img").livequery("click", function(f) {
		f.preventDefault();
		var id = $(this).attr("id");
		$(".download-sound").load("audiofile-dl-button-disco.php", { v: id }, function() {
			player.sendEvent("STOP");
			var mp3file = $("#dl-url").val();
			player.sendEvent("LOAD", { file: mp3file, type: "sound" });
			player.sendEvent("PLAY", "true");
		});
	});
});

