/* FlashHandler
--------------------------------------------------------------------*/
function FlashHandler(ver,pro) {
  this._classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
  this._type = "application/x-shockwave-flash";
  var vertmp = ver.split(",");
  for(var i = 4; i > vertmp.length; i--)
    ver += (ver.match(/,$/)) ? "0,0" : ",0";
  this._ver  = ver;
  this._must = parseInt(ver.toString().replace(/^([0-9]+),.*$/,"$1"));
  this._pro  = (pro.match(/^https?$/)) ? pro : "http";
  this._apply = false;
  this._plugin = (
    (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
      ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
      : 0
  );
  if(this._plugin) {
    var tmp = navigator.plugins["Shockwave Flash"].description;
    this._apply = (tmp.match(/\s([0-9.]*)\s/)[1] >= this._must);
  } else if(navigator.userAgent.indexOf("MSIE") != -1) {
    if(navigator.appVersion.indexOf("Win") != -1) { try {
      applytmp = false;
      execScript(
        "on error resume next : applytmp = " +
        "(IsObject(CreateObject('ShockwaveFlash.ShockwaveFlash." +
        this._must + "')))", "VBScript"
      );
      this._apply = applytmp;
    } catch(e) {} }
  }
  this.checkPlugin = function() { return this._apply; };
  this.getCode = function(id,size,param) {
    var ua = navigator.userAgent, pro = this._pro, type = this._type;
    var ids = (
      (id.match(/^[a-zA-Z].*$/))
        ? [' id="' + id + '"',' name="' + id + '"']
        : ["",""]
    );
    var tg = [
      '<object' + ids[0] + ' classid="' + this._classid +
      '" codebase="' + pro + '://download.macromedia.com/pub/' +
      'shockwave/cabs/flash/swflash.cab#version=' + this._ver + '"' +
      ' type="' + type + '" width="' + size[0] + '" height="' +
      size[1] + '">',
      '<embed' + ids[1] + ' type="' + type + '" pluginspage="' + pro +
      '://www.macromedia.com/go/getflashplayer" width="' + size[0] +
      '" height="' + size[1] + '"',
      '></embed>',
      '</object>'
    ];
    for(var i in param) {
      tg[0] += '<param name="' + i + '" value="' + param[i] + '" />';
      tg[1] += ' ' + ((i == "movie") ? 'src' : i) + '="' + param[i] + '"';
    }
    return (
      (ua.indexOf("Mac") != -1 && ua.indexOf("MSIE") != -1 && ua.indexOf("Opera") == -1)
        ? tg[1] + tg[2]
        : tg.join("")
    );
  };
}


/*--------------------------------------------------------------------*/
/* AlternateWindow
--------------------------------------------------------------------*/

function AlternateWindow() {
	/* function object */
}

/**
 *  ATTRIBUTES
 */
AlternateWindow.prototype.attributeString = "";
AlternateWindow.prototype.attributes = new Object();
AlternateWindow.prototype.attributes.width = "width=430";
AlternateWindow.prototype.attributes.height = "height=250";
AlternateWindow.prototype.attributes.resizable = "resizable=yes";
AlternateWindow.prototype.attributes.scrollbars = "scrollbars=no";
AlternateWindow.prototype.attributes.left = "20";
AlternateWindow.prototype.attributes.top = "10";



/**
 * METHODS
 */
AlternateWindow.prototype.setValue = function(attr,value) {
	if( !!attr && !!value ) {
		this.attributes[ attr ] = attr+"="+value;
	}
}
AlternateWindow.prototype.setAttributeString = function() {
	for( var item in this.attributes ) {
		this.attributeString = this.attributeString + this.attributes[ item ] + ",";
	}
}
AlternateWindow.prototype.setWindow = function(windowName) {
	if( !!!windowName ) windowName = "";
	this.setAttributeString();
	window.open( "", windowName, this.attributeString );
}

/**
 * ini.js
 */
var altWindow;
var onLoadReceiver = function() {
}
window.onload = function() {
	onLoadReceiver();
	altWindow = new AlternateWindow();
//	altWindow.setValue( "width","300" );
	this.focus();
}

