var cloud = 0;
$(document).ready(function() {
	$("#featured").css("background-position", "0px 0px");
	activateMenu();
	$("#featured").everyTime(50, function(i) {		
		cloud = (cloud==957)?0:cloud + 1;
		$("#featured").css("background-position", cloud+"px 0px");
	}, 0);
});

function activateMenu() {
//	if (jQuery.browser.msie && jQuery.browser.version=="6.0") return false;	
	$("#nav .genre, #nav .artist").hover( 
		function() {
			$(this).toggleClass("flyout").css("z-index","4");
			$(this).find("ul").show();
		},
		function() {
			$(this).find("ul").hide();
			$(this).toggleClass("flyout").css("z-index","0");
		}
	);
}

function isOver(pointer, obj) {
	x = pointer.pageX;
	y = pointer.pageY;
	offset = $(obj).offset();
	leftBound = offset.left;
	topBound = offset.top;
	rightBound = leftBound + $(obj).width();
	bottomBound = topBound + $(obj).height();
	return (x>=leftBound && x<=rightBound && y>=topBound && y<=bottomBound);
}

function togglePlayMode() {
	if (song.playState==0 || song.paused) {
		play();
	}
	else {
		pause();
	}
}

function play() {
	if (song.paused) song.resume();
	else song.play();
}

function pause() {
	song.pause();
}

function convertTime(milliseconds) {
	seconds = Math.round(milliseconds/1000);
	minutes = Math.floor(seconds/60);
	seconds = Math.round(seconds - minutes*60);
	if (seconds< 10) seconds = "0"+seconds;
	return minutes + ":" + seconds;
}