var __comm;
var __data;

function getContentDocument(id)
{
  var doc = null;

  try {
    if(browser.ns6)
      doc = document.getElementById('subframe').contentWindow.document
    else
      doc = subframe.document;
  } catch(Error) {
    alert("Can't access content document !");
  }
  return doc;
};

function Comm(target)
{
  this.comboid = "";
  this.target = target;
};

Comm.prototype.execute = function (key,para,para2,para3)
{
	
  var html = "";
  html+= "<html>";
  html+= "<body>";
  html+= "<form name='frmComm' id='frmComm' name='frmComm' target='_self' method ='POST' action='" + this.target + "'>";
  html+= "<input type='hidden' id='key' name='key'>";
  html+= "<input type='hidden' id='para' name='para'>";
  html+= "<input type='hidden' id='para2' name='para2'>";
  html+= "<input type='hidden' id='para3' name='para3'>";
  
  html+= "</form>";
  html+= "</body>";
  html+= "</html>";
  var doc = getContentDocument("subframe");
  doc.open();
  doc.write(html);
  doc.close();
  doc.getElementById("key").value = key;
  doc.getElementById("para").value = para;
  doc.getElementById("para2").value = para2;
  doc.getElementById("para3").value = para3;
  doc.getElementById("frmComm").submit();
};

Comm.prototype.receive = function (key)
{
  if(key == 'SAVE') {
    if(__data != "OK")
      alert("Error while saving file to web !");
  }
  if(key == 'GETTEXT') {
    var aTexts = __data.split("~");
    var combo = document.getElementById(this.comboid);
    while(combo.length) {
      combo.remove(0);
    }

    for(var i=0;i<aTexts.length-1;i++) {
      var aText = aTexts[i].split("|");
      var item = document.createElement("option");
      item.text = aText[0];
      item.value = aText[1];
      if(browser.ie) {
        combo.add(item);
      } else {
        combo.add(item,null);
      }
    }
  }
  if(key == 'SETTEXT') {
    editGetTextModule(this.comboid);
  }
  if(key == 'REMOVETEXT') {
    editGetTextModule(this.comboid);
  }
  if(key == 'INTELLI') {
    __intelliProcess(__data);
  }
  editSetFocus();
};

