

var currentID = 5; // 0-indexed

var totalID = 10;
var movieName = "playerVistaWEB";

function nextMp3() {
	if(currentID == totalID-1) {
		switchMp3(0);
	} else {
		switchMp3(currentID+1);
	}
}

function prevMp3() {
	if(currentID == 0) {
		switchMp3(totalID-1);
	} else {
		switchMp3(currentID-1);
	}
}

function over(x) {
	/*
	if(currentID == x) {
		document.getElementById('spk_' + x).src = 'imgs/stop_btn_on.png';
	} else {
		document.getElementById('spk_' + x).src = 'imgs/play_btn_on.png';
	}
	*/
	
	document.getElementById('mp3_' + x).className = "songhover";
}

function off(x) {
	/*
	if(currentID == x) {
		document.getElementById('spk_' + x).src = 'imgs/stop_btn_off.png';
	} else {
		document.getElementById('spk_' + x).src = 'imgs/play_btn_off.png';
	}
	*/
	if(currentID != x) {
		document.getElementById('mp3_' + x).className = "song";
	}
}

function switchMp3(x) {
	//document.getElementById('spk_' + currentID).src = 'imgs/play_btn_off.png';
	document.getElementById('mp3_' + currentID).className = "song";
	currentID = x;
	//document.getElementById('spk_' + x).src = 'imgs/stop_btn_off.png';
	//document.getElementById('spk_' + x).src = 'imgs/play_btn_off.png';
	document.getElementById('mp3_' + currentID).className = "songhover";
	
	//var sp = document.getElementById('mp3_' + currentID).getElementsByTagName("span");
	//document.getElementById('songtitle').innerHTML = sp[0].innerHTML;

}

function playMp3(x) {
	if (movieIsLoaded(thisMovie(movieName))) {
		thisMovie(movieName).SetVariable("_root.tune", x);
		thisMovie(movieName).SetVariable("_root.newSong", true);
    	thisMovie(movieName).GotoFrame(5);
		thisMovie(movieName).Play();
		
  	}
	switchMp3(x);
}


function thisMovie(movieName) {
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}

function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}
