var isIE = navigator.appName.toLowerCase().indexOf('internet explorer')+1; Player = function(id) { this.id = id; this.o = this.getPlayer(); } Player.prototype.getPlayer = function() { var idstr = (isIE) ? this.id + "_ie" : this.id + "_moz"; var p = document.getElementById(idstr); return p; } Player.prototype.setVariable = function(name, value) { this.o.SetVariable(name, value); } Player.prototype.getVariable = function(name) { return this.o.GetVariable(name); } Player.prototype.play = function() { this.setVariable("command","play"); } Player.prototype.stop = function() { this.setVariable("command","stop"); } Player.prototype.halt = function() { this.setVariable("command","halt"); } Player.prototype.next = function() { this.setVariable("command","next"); this.setVariable("command","play"); } Player.prototype.prev = function() { this.setVariable("command","prev"); } Player.prototype.jump = function(pos) { this.setVariable("value",pos); this.setVariable("command","jump"); }