
//ENVIA AL FLASH  SI HA SIDO CAMBIADO CORRECTAMENTE LA VARIABLE FAVORITO EN EL SERVIDOR
function resultadoFavoritos(resultado) 
{
	document.getElementById("principal").resultadoFavoritos(resultado);
}


//ENVIA AL FLASH  SI HA SIDO CAMBIADO CORRECTAMENTE LA VARIABLE PUNTUACION EN EL SERVIDOR
function resultadoPuntuacion(resultado, puntuacion) 
{
	document.getElementById("principal").resultadoPuntuacion(resultado, puntuacion);
}


//ENVIA AL FLASH  EL NUMERO DE VISITAS DEL PODCAST
function setVisitas(visitas)
{
	//document.getElementById("principal").setNumVisitas(visitas);
}
//ENVIA AL FLASH  LA RUTA DONDE SE ENCUENTRA EL ARHICVO PHP QUE DEVUELVE EL XML CON EL PODCAST A REPRODUCIR
function setRutaPhp(ruta)
{
	document.getElementById("principal").setRutaPhp(ruta);
}

//ENVIA AL FLASH  LA RUTA DONDE SE ENCUENTRA EL ARHICVO PHP QUE DEVUELVE LA HORA DEL SERVIDOR
function setRutaObtenerHora(ruta)
{
	document.getElementById("principal").setRutaObtenerHora(ruta);
}

function setRutaObtenerDia(ruta)
{
	document.getElementById("principal").setRutaObtenerDia(ruta);
}


//ENVIA AL FLASH  LA ORDEN PARA QUE CARGE EL PHP SETEADO EN LA FUNCION SETRUTAPHP Y COMIENCE A REPRODUCIR
function cargarDatos()
{
	document.getElementById("principal").cargarDatos();
}




/*SETEA EN EL FLASH EL VALOR DE FAVORITO
0- NO ES FAVORITO
1- ES FAVORITO
*/
function setFavorito(fav)
{
	//document.getElementById("principal").setFavorito(fav);
}

function setPuntuacion(puntos)
{
	//document.getElementById("principal").setPuntuacion(puntos);
}




function enviar_favorito(favorito)
{
	//alert("Enviando favorito: " + favorito);
	
	//TODO: Cambiar este if por una comparación si ha ido todo bien durante el proceso de envio de favoritos en la parte servidor
	if(true)
	{
		resultadoFavoritos(true);
	}
	else
	{
		resultadoFavoritos(false);
	}
}



function enviar_puntuacion(puntuacion)
{
	//alert("Enviando puntuacion: " + puntuacion);
	
	
	//TODO: Cambiar este if por una comparación si ha ido todo bien durante el proceso de votación en la parte servidor
	if(true)
	{
		resultadoPuntuacion(true, puntuacion);
	}
	else
	{
		resultadoPuntuacion(false, puntuacion);
	}
}



function cambio_audio(id)
{
	//alert("Cambio audio: " + id);
	
	//TODO: Cambiar estas lineas por valores reales del servidor
	var aleatorio = Math.round(Math.random() * 6000);
	setVisitas(aleatorio);
	setFavorito(1);
	setPuntuacion(2);
	//********************************
}


function iniciar()
{
	alert('hola mundo');
}
