var Playa = {}; Playa.VERSION = "1.5"; Playa.STATE_STOPPED = 0; Playa.STATE_PLAYING = 1; Playa.__isStarted = false; Playa.onPlayStop = function() {}; Playa.onPlayStart = function() {}; Playa.onStateChange = function() {}; Playa.title = ""; Playa.playListPosition = -1; Playa.playlistSize = -1; Playa.path = ""; Playa.state = Playa.STATE_STOPPED; Playa.btnState = "Cargando..."; Playa.__getPlaya = function() { if (navigator.appName.indexOf ("Microsoft") !=-1) {	var p = window["playa"]; } else { var p = document["playa"]; } if (typeof(p) != "undefined") {	if (p.PercentLoaded() == 100) {	return p; } } return null; }; Playa.poll = function() { var p = Playa.__getPlaya(); setTimeout("Playa.poll()", 200); if (p != null) { var previousState = Playa.state; var previousPath = Playa.path; Playa.title = p.GetVariable("Response_title"); Playa.playListPosition = parseInt(p.GetVariable("Response_playListPosition")); Playa.path = p.GetVariable("Response_path"); Playa.btnState = p.GetVariable("Response_btnState"); Playa.playlistSize = parseInt(p.GetVariable("Response_playlistSize")); if (Playa.btnState == "Play") { Playa.state = Playa.STATE_STOPPED; } else if (Playa.btnState == "Stop") { Playa.state = Playa.STATE_PLAYING; } if (Playa.state != previousState || previousPath != Playa.path) { if (Playa.state == Playa.STATE_STOPPED) { Playa.onPlayStop(); } else { Playa.onPlayStart(); }	Playa.onStateChange(); } } };
Playa.start = function() { if (Playa.__isStarted) { return; } Playa.poll(); Playa.__isStarted = true; };
Playa.doPlayStop = function() { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_command", "PlayStop"); } };
Playa.doPlay = function() { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_command", "Play"); } };
Playa.doStop = function() { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_command", "Stop"); } };
Playa.doNext = function() { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_command", "Next"); } };
Playa.doPrev = function() { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_command", "Prev"); } };
Playa.doPlayUrl = function(sUrl) { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_args", sUrl); p.SetVariable("Request_command", "PlayUrl"); } };
Playa.doJump = function(nIndex) { var p = Playa.__getPlaya(); if (p != null) { p.SetVariable("Request_args", "" + nIndex); p.SetVariable("Request_command", "PlayPosition"); } };
Playa.start();
