Playa = {};

/**
  * Internal function to retrieve player-object
  * @private
  */
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;
};

/**
  * Starts the playa
  * @public
  */
Playa.start = function() {
	if (Playa.__isStarted) {
		return;
	}
	Playa.__isStarted = true;
};

/**
  * Starts playing, if the playback is stopped
  * @public
  */
Playa.doPlay = function() {
	var p = Playa.__getPlaya();
	if (p != null) {
		p.SetVariable("remoteRequest", "Play");
	}
};

/**
  * Stops playback if it's playing
  * @public
  */
Playa.doStop = function() {
	var p = Playa.__getPlaya();
	if (p != null) {
		p.SetVariable("remoteRequest", "Stop");
	}
};

/**
  * Pause playback if it's playing
  * @public
  */
Playa.doPause = function() {
	var p = Playa.__getPlaya();
	if (p != null) {
		p.SetVariable("remoteRequest", "Pause");
	}
};

/**
  * Halt playback if it's playing
  * @public
  */
Playa.doHalt = function() {
	var p = Playa.__getPlaya();
	if (p != null) {
		p.SetVariable("remoteRequest", "Halt");
	}
};

/**
  * unHalt playback if it's playing
  * @public
  */
Playa.dounHalt = function() {
	var p = Playa.__getPlaya();
	if (p != null) {
		p.SetVariable("remoteRequest", "unHalt");
	}
};
/*** Start processing */
Playa.start();
