// close other audio players
// called by audio player when click on play button 
function ap_stopAll(player_id)
{
	$('.a[href$=.mp3]').each(function(){
		if($(this).attr('id') != player_id)
		{
			$(this).find('object')[0].SetVariable("closePlayer", 1);
		}
		else 
		{
			$(this).find('object')[0].SetVariable("closePlayer", 0);
		}
	});
}

$(document).ready(function() {

	$('a[href$=.mp3]').each(function() {
		audio_file = $(this).attr('href'); 
		audio_title = $(this).text();
		audio_id = $(this).attr('id');
		
		div = $('<div class="audio_flash" id="' + audio_id + '"></div>');		
		$(this).after(div);
		
		$(this).remove();
		div.flash(
			{
				swf: '/template/flash/audioplayer.swf',
				flashvars:
				{
					soundFile: audio_file,
					playerID: "'" + audio_id + "'",
					quality: 'high',
					lefticon: '0x999999',
					righticon: '0xFFFFFF',
					leftbg: '0xcccccc',
					rightbg: '0xcccccc',
					rightbghover: '0x999999',wmode: 'transparent'


				},
				height: 50, 
			}
		);
	});	

		$("a.zoom").fancybox({
		'imageScale' : false,
		'centerOnScroll' : false
		});

		$('#fade1').cycle({ 
		    fx:'fade', 
		    speed:2000,
		    timeout:5500
		 });
		
		$('#fade2').cycle({ 
		    fx:'fade', 
		    speed:2000,
		    timeout:5500
		 });
		$('#fade3').cycle({ 
		    fx:'fade', 
		    speed:2000,
		    timeout:5500
		 });
		
	});

// added 101123 JM
//    $(function() {
//		$('a[href$=.mp3]').media( { width: 300, height: 22 } );
//    });
//	$.fn.media.defaults.mp3Player = '/template/mediaplayer/player.swf';
//	$.fn.media.defaults.caption = false;


