/** JavaScript Document
 NOTA: Guardar como "Nombre del player".js o incluir en la estructura del html
 dentro de las etiquetas script correspondientes.
 NOTA2: Los nombres de las funciones declaradas se pueden cambiar si es necesario.

 Esta serie de funciones se comunican con el player para ejecutar distintas acciones.
 La funcion interna se llama "callAccion", recibe 2 parametros: "accion", "datos"
 	Accion			Usa parametro Datos
	PLAY			NO
	PAUSE			NO
	STOP			NO
	NEXT			NO
	PREVIEW			NO
	LOADANDPLAY		SI (Objeto con la estructura de un item de la lista)
	PLAYINDEX		SI (index valido de la lista de reproduccion)
	
**/

function jsInterfaseMP3()
{
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window['Player'];
	} else {
		return document['Player'];
	}
}

/////////////////////////////
// Una funci�n generica
/////////////////////////////
function EjAccionPlayer(accion, datos)
{
	// La llamada comunica el resultado de la accion
	return jsInterfaseMP3().callAccion(accion, datos);
}

/////////////////////////////
// Funciones prearmadas
/////////////////////////////
function EjPlayerPlay()
{
	return jsInterfaseMP3().callAccion('PLAY', '');
}

function EjPlayerPause()
{
	return jsInterfaseMP3().callAccion('PAUSE', '');
}

function EjPlayerPlayPause()
{
	return jsInterfaseMP3().callAccion('PLAYPAUSE', '');
}


function EjPlayerStop()
{
	return jsInterfaseMP3().callAccion('STOP', '');
}

function EjPlayerNext()
{
	return jsInterfaseMP3().callAccion('NEXT', '');
}

function EjPlayerPreview()
{
	return jsInterfaseMP3().callAccion('PREVIEW', '');
}

function EjPlayerLoadAndPlay(file, songname, album, artistname, chartname, image, date)
{
	var datos = {"file":file, "songname":songname, "album":album, "artistname":artistname, "chartname":chartname, "image":image, "date":date};
	return jsInterfaseMP3().callAccion('LOADANDPLAY', datos);
}

function EjPlayerPlayIndex(index)
{
	return jsInterfaseMP3().callAccion('PLAYINDEX', index);
}

