/* JS

Authored Brett Taylor, Copyright © 2009 Brett Taylor, all rights reserved.

Non-exclusive non-transferrable licence granted to Eye Inside Productions Ltd.

Built using jQuery 1.3.2 http://www.jquery.com

*/

jQuery(document).ready(function() {
	// find all soundtrack mp3 links
	var soundtrack_selectorpattern = '.soundtracks li';
	// detect flash
	//if(flashembed.isSupported([20,0])) {
	if(flashembed.isSupported([9,0])) {
		// add mini flash players
		$(soundtrack_selectorpattern).each(function() {
			var mp3 = jQuery(this).children('a').attr('target','_blank').attr('href');
			$(this).append('<span></span>')
				   .children('span')
				   .css('width','50px')
				   .css('height','25px')
				   .css('margin-right','1px')
				   .each(function() {
						flashembed(this, "http://www.eyeinside.co.nz/soundtrackplayer.swf", { mp3: mp3, wmode:'transparent'} );
					});
		});
	} else {
		// use embeds, assumes qt player
		$(soundtrack_selectorpattern).each(function() {
			var mp3 = jQuery(this).children('a').attr('target','_blank').attr('href');
			$(this).append('<span>HEAR IT</span>');
			$(this).children('span')
					.addClass('justtext')
					.css('width','60px')
					.one("click", function() {
						$(this).css('width','105px')
							   .html("<embed src='eyeinside.co.nz/mp3files/+mp3+' autostart='true' height='16' width='105' />");
			});
		});
		// <embed src="http://www.eyeinside.co.nz/mp3files/Atmos.mp3" autostart="false" id="" name="Atmos" height="16" width="127">
	}
});
