// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function playSong(id) {
	$("#imeem-box").replaceWith("<div id=\"imeem-box\" style=\"display: none\"><div id=\"close-box\"><div style=\"float: left; margin-left: 2px; width: 120px; text-align: left;\">Powered by <a href=\"http://imeem.com\">Imeem</a></div><div id=\"close-box\"><div style=\"float: right; width: 120px;\"><a href=\"#\" onclick=\"closeBox();\">[x] Close Box</a></div></div><object width=\"300\" height=\"110\"><param name=\"movie\" value=\"http://media.imeem.com/m/" + id + "/aus=true/\"></param><param name=\"wmode\" value=\"transparent\"></param><param name=\"FlashVars\" value=\"backColor=000000&primaryColor=000000&secondaryColor=FFFF00&linkColor=51A001\" /><embed src=\"http://media.imeem.com/m/" + id + "/aus=true/\" type=\"application/x-shockwave-flash\" width=\"300\" height=\"60\" wmode=\"transparent\" FlashVars=\"backColor=000000&primaryColor=000000&secondaryColor=FFFF00&linkColor=FFFF00\"></embed></object></div>");
	$("#imeem-box").fadeIn("fast");
}


function playSongNew(url, title, artist) {
	so.addVariable('file', url);
	so.addVariable('autostart', 'true');
	so.write('player');
	$("#sample-box").fadeIn("fast");
	$("#title").html(title);
	$("#artist").html(artist);
}

function closeBox() {
	$("#imeem-box").fadeOut("fast");
	$("#imeem-box").replaceWith("<div id=\"imeem-box\" style=\"display: none\"></div>")
}

function loadImages() {
	$(".image").map(function() {
		var img = new Image();
		var url = this.id;
		$(img).load(function() {
			$(this).hide();
			$("#" + id).removeClass('loading').append(this);
			$(this).fadeIn();
			alert(url);
		}).attr('src', url)
	});
}
