if(typeof com == "undefined") var com = new Object();
if(typeof com.rtp == "undefined") com.rtp = new Object();
if(typeof com.rtp.util == "undefined") com.rtp.util = new Object();
if(typeof com.rtp.IPIXObjectUtil == "undefined") com.rtp.IPIXObjectUtil = new Object();
com.rtp.IPIXObject = function(url,classUrl,jarUrl,id,h,w){
  if (!document.createElement || !document.getElementById) return;
  this.params = new Object();
  this.attributes = new Array();

	this.addParam('url', url);		
	
	this.setAttribute('code', classUrl);
	this.setAttribute('archive', jarUrl);
	
	if (id) {
	  this.setAttribute('id', id);
		this.setAttribute('name', id);
	}
  if(h) this.setAttribute('height', h);
	if(w) this.setAttribute('width', w);
}
com.rtp.IPIXObject.prototype = {
  setAttribute: function(name, value){
    this.attributes[name] = value;
  },
  getAttribute: function(name){
    return this.attributes[name];
  },
  addParam: function(name, value){
    this.params[name] = value;
  },
  getParams: function(){
    return this.params;
  },
  createParamTag: function(n, v){
    var p = document.createElement('param');
    p.setAttribute('name', n);
    p.setAttribute('value', v);
    return p;
  },
  getAppletHTML: function() {
    var strAppletTag = "";
    strAppletTag += "<applet code=\""+this.getAttribute('code')+"\" ";
		strAppletTag += "archive=\""+this.getAttribute('archive')+"\" ";
    strAppletTag += "id=\""+this.getAttribute('id')+"\" ";
		strAppletTag += "name=\""+this.getAttribute('name')+"\" ";
		strAppletTag += "width=\""+this.getAttribute('width')+"\" ";
    strAppletTag += "height=\""+this.getAttribute('height')+"\">";
    var params = this.getParams();
    for(var key in params) {
      strAppletTag += '<param name="'+ key +'" value="'+ params[key] +'" />';
    }
    strAppletTag += "</applet>";

    return strAppletTag;
  },
  write: function(elementId){
    if (com.rtp.IPIXObjectUtil.hasJavaEnabled()) {
		  var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
      n.innerHTML = this.getAppletHTML();
		}
  }
}

/* ---- detection functions ---- */
com.rtp.IPIXObjectUtil.hasJavaEnabled = function(){
  return navigator.javaEnabled();
}

/* ---- get value of query string param ---- */
com.rtp.util = {
  getRequestParameter: function(param){
    var q = document.location.search || document.location.hash;
    if(q){
      var startIndex = q.indexOf(param +"=");
      var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
      if (q.length > 1 && startIndex > -1) {
        return q.substring(q.indexOf("=", startIndex)+1, endIndex);
      }
    }
    return "";
  }
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = com.rtp.util.getRequestParameter;
var IPIXObject = com.rtp.IPIXObject;

