var player = null;
function playerReady(thePlayer) {
	player = document.getElementById(thePlayer.id);
	alert("entramos");
}
function getUpdate(typ,pr1,pr2,pid) {
	if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",280); }
}
function actualPos(_posy){ for(var j = 0; j<= 5; j++){	document.getElementById("contentMp3").scrollTop =  25*(_posy-1);}}
function getItemData(idx) {
	if(idcan){
		sendEvent('playitem',vPlay);
		idcan = false;
	}
	var obj = thisMovie("thePlayerId").itemData(idx);
	$("#listmp3 li").removeClass('over');
	$("#mp3"+obj["id"]).addClass('over');
	$("#tabI").val(obj["id"]);
	$("#mU").val(music[obj["id"]].url);
	$("#mC").html(music[obj["id"]].cancion);
	$("#mA").html(music[obj["id"]].artista);
	$("#playlistA").attr('href', '/backend/ajax.php?id='+obj["id"])
	$("#mLA").attr('href', music[obj["id"]].linkArtista);
	if(obj["id"] != actual){
		$.post("/backend/musica.php", { id_mp3: obj["id"] } );
		actual = obj["id"];
	}
}
function sendEvent(typ,prm) {
	
  	document.getElementById("thePlayerId").sendEvent(typ,prm);
}
function thisMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}
function get_musica(program,container,id,idt){
	$("#listmp3 li").removeClass('over');
	$("#mp3"+id).addClass('over');
	sendEvent('playitem',idt);
	actualPos(idt);
}
function processJson(data){
	$("#ajaxForm").html(data.message);
}
function procesado(data){
	$("#ajaxCompartir").html(data.message);
}
$(document).ready(function(){
$("#leermas").click(function () {
  $("#biografia p").toggle();
});
$("#ajaxForm").ajaxForm({dataType:  'json', success:   processJson}); 
$("#ajaxCompartir").ajaxForm({dataType:  'json', success:   procesado});
var y = $("#listmp3").height();
if(y < 480){
	$("#contentMp3").height(y + 12);
}
});
$(document).ready(function(){
	$('.Oartista').hide();				
	$('#Aartista').click(function() {
      $('.Oartista').toggle();
      
	  return false;
   });

 $(".contimage").hover(function() {
		$(this).animate({
			opacity:1
		},200);
	}, function() {
		$(this).animate({
			opacity:0.8
		},200);
	});
	$('#submitform').ajaxForm({
		target: '#error',
		success: function() {
		$('#error').fadeIn('slow');
		}
});
$('a[rel*=facebox]').facebox();
});