
function show_image(name, mode) {
  if (document.images) {
    document.images[name].src=eval(name + mode + '.src');
  }
}

function make_remote(url, wname, params) {
  remote=window.open(url, wname, params);
  remote.opener=self;
  if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)>=4) {
    remote.moveTo(100,100);
    remote.focus();
  }
}

function make_remote_tool(url, wname, width, height, center, scroll) {
  var scroll_flag = (scroll != 0) ? 'yes': 'no';
  var params = 'width=' + width + ',height=' + height + ',scrollbars=' + scroll_flag + ',resizable=' + scroll_flag + ',toolbar=no,location=no,menubar=no,status=no';
  make_remote(url, wname, params);
}

function make_remote_modeless(url, wname, width, height, center, scroll) {
  if (window.showModelessDialog) {
    var params = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;center:' + center + ';scroll:' + scroll + ';help:0;status:0';
    var remote2=window.showModelessDialog(url, wname, params);
    remote2.opener=self;
  }
  else {
    make_remote_tool(url, wname, width-6, height-32, center, scroll);
  }
}

function make_remote_modal(url, wname, width, height, center, scroll) {
  if (window.showModalDialog) {
    var params = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;center:' + center + ';scroll:' + scroll + ';help:0;status:0';
    var remote2=window.showModalDialog(url, wname, params);
    remote2.opener=self;
  }
  else {
    make_remote_tool(url, wname, width-6, height-32, center, scroll);
  }
}

function set_row_color(theRow, color) {
  if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') {
    return false;
  }

  var row_cells_cnt = theRow.cells.length;
  for (var c = 0; c < row_cells_cnt; c++) {
    theRow.cells[c].bgColor = color;
  }

  return true;
}

function add_field(form, fieldType, fieldName, fieldValue) {
  if (document.getElementById) {
    var input = document.createElement('INPUT');
      if (document.all) { // what follows should work 
                          // with NN6 but doesn't in M14
        input.type = fieldType;
        input.name = fieldName;
        input.value = fieldValue;
      }
      else if (document.getElementById) { // so here is the
                                          // NN6 workaround
        input.setAttribute('type', fieldType);
        input.setAttribute('name', fieldName);
        input.setAttribute('value', fieldValue);
      }
    form.appendChild(input);
  }
}

var qqs = location.search.substring(1);
var qnv = qqs.split('&');
var qprefix = "";
for(i = 0; i < qnv.length; i++)
{
  if (qnv[i].indexOf("postprefix") >= 0) {
    eq = qnv[i].indexOf('=');
    qprefix = unescape(qnv[i].substring(eq + 1));
    break;
  }
}
var url = new Object();
if (qprefix != "") {
  for(i = 0; i < qnv.length; i++)
  {
    eq = qnv[i].indexOf('=');
    url[qnv[i].substring(0,eq).replace(qprefix, "")] = unescape(qnv[i].substring(eq + 1));
  }
}
else {
  for(i = 0; i < qnv.length; i++)
  {
    eq = qnv[i].indexOf('=');
    url[qnv[i].substring(0,eq)] = unescape(qnv[i].substring(eq + 1));
  }
}

var QeWindowWidth = 630, QeWindowHeight = 460;

function init_window_dim()
{
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
      QeWindowWidth = window.innerWidth;
      QeWindowHeight = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      if( document.documentElement &&
         ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        QeWindowWidth = document.documentElement.clientWidth;
        QeWindowHeight = document.documentElement.clientHeight;
      }
      else {
        if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
          //IE 4 compatible
          QeWindowWidth = document.body.clientWidth;
          QeWindowHeight = document.body.clientHeight;
        }
      }
    }
  }
}

