isNS  = navigator.appName.indexOf("Netscape")  != -1;
isNS4 = isNS && document.layers;
isIE  = navigator.appName.indexOf("Microsoft") != -1
isNS6 = !isIE && document.getElementById ? true: false;

function NewDiv(window, id, body, left, top, width, height, zIndex, absolute) {
    this.window = window;
    this.id     = id;
    this.body   = body;
    var d = window.document;
    d.writeln('<STYLE TYPE="text/css">#' + id + ' {');
	if (absolute) d.write('position:absolute;');
	else          d.write('position:relative;');
    if (left)   d.write('left:'  + left  + ';');
    if (top)    d.write('top:'   + top   + ';');
    if (width)  d.write('width:' + width + ';');
	if (height) d.write('height:' + height + ';');
	if (zIndex) d.write('z-index:' + zIndex + ';');
    d.writeln('}</STYLE>');
}
if (isNS4) {
    NewDiv.prototype.output             = function()      { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.layer = d[this.id];}
    NewDiv.prototype.moveTo             = function(x,y)   { this.layer.moveTo(x,y); }
    NewDiv.prototype.moveBy             = function(x,y)   { this.layer.moveBy(x,y); }
    NewDiv.prototype.show               = function()      { this.layer.visibility = "show"; }
    NewDiv.prototype.hide               = function()      { this.layer.visibility = "hide"; }
    NewDiv.prototype.setZ               = function(z)     { this.layer.zIndex = z; }
    NewDiv.prototype.setBgColor         = function(color) { this.layer.bgColor = color; }
    NewDiv.prototype.setBgImage         = function(image) { this.layer.background.src = image;}
    NewDiv.prototype.getX               = function() { return this.layer.left; }
    NewDiv.prototype.getY               = function() { return this.layer.top; } //was right .. ??
    NewDiv.prototype.getWidth           = function() { return this.layer.width; }
    NewDiv.prototype.getHeight          = function() { return this.layer.height; }
    NewDiv.prototype.getZ               = function() { return this.layer.zIndex; }
    NewDiv.prototype.isVisible          = function() { return this.layer.visibility == "show"; }
    NewDiv.prototype.setBody            = function() { for(var i = 0; i < arguments.length; i++) this.layer.document.writeln(arguments[i]);this.layer.document.close();}
    NewDiv.prototype.addEventHandler    = function(eventname, handler) {this.layer.captureEvents(NewDiv._eventmasks[eventname]); var newdivel = this;this.layer[eventname] = function(event) { return handler(newdivel, event.type, event.x, event.y, event.which, event.which,((event.modifiers & Event.SHIFT_MASK) != 0),((event.modifiers & Event.CTRL_MASK)  != 0),((event.modifiers & Event.ALT_MASK)   != 0));}}
    NewDiv.prototype.removeEventHandler = function(eventname)          {this.layer.releaseEvents(NewDiv._eventmasks[eventname]);delete this.layer[eventname];}
    NewDiv.prototype.centerX            = function() {this.layer.moveTo(Math.round((window.pageXOffset+document.width-100)/2),this.layer.top)}
    NewDiv._eventmasks                  = {onabort:Event.ABORT,onblur:Event.BLUR,onchange:Event.CHANGE,onclick:Event.CLICK,ondblclick:Event.DBLCLICK, ondragdrop:Event.DRAGDROP,onerror:Event.ERROR, onfocus:Event.FOCUS,onkeydown:Event.KEYDOWN,onkeypress:Event.KEYPRESS,onkeyup:Event.KEYUP,onload:Event.LOAD,onmousedown:Event.MOUSEDOWN,onmousemove:Event.MOUSEMOVE, onmouseout:Event.MOUSEOUT,onmouseover:Event.MOUSEOVER, onmouseup:Event.MOUSEUP,onmove:Event.MOVE,onreset:Event.RESET,onresize:Event.RESIZE,onselect:Event.SELECT,onsubmit:Event.SUBMIT,onunload:Event.UNLOAD};
}

if (isIE) {
    NewDiv.prototype.output             = function()                   { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.element = d.all[this.id];this.style = this.element.style;}
    NewDiv.prototype.moveTo             = function(x,y)                { this.style.pixelLeft = x;this.style.pixelTop = y;}
    NewDiv.prototype.moveBy             = function(x,y)                { this.style.pixelLeft += x;this.style.pixelTop += y;}
    NewDiv.prototype.show               = function()                   { this.style.visibility = "visible"; }
    NewDiv.prototype.hide               = function()                   { this.style.visibility = "hidden"; }
    NewDiv.prototype.setZ               = function(z)                  { this.style.zIndex = z; }
    NewDiv.prototype.setBgColor         = function(color)              { this.style.backgroundColor = color; }
    NewDiv.prototype.setBgImage         = function(image)              { this.style.backgroundImage = image;}
    NewDiv.prototype.getX               = function()                   { return this.style.pixelLeft; }
    NewDiv.prototype.getY               = function()                   { return this.style.pixelRight; }
    NewDiv.prototype.getWidth           = function()                   { return this.style.width; }
    NewDiv.prototype.getHeight          = function()                   { return this.style.height; }
    NewDiv.prototype.getZ               = function()                   { return this.style.zIndex; }
    NewDiv.prototype.isVisible          = function()                   { return this.style.visibility == "visible"; }
    NewDiv.prototype.setBody            = function()                   { var body = "";for(var i = 0; i < arguments.length; i++) {body += arguments[i] + "\n";}this.element.innerHTML = body;}
    NewDiv.prototype.addEventHandler    = function(eventname, handler) { var NewDiv = this;this.element[eventname] = function() { var e = NewDiv.window.event;e.cancelBubble = true;return handler(NewDiv, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey); }}
    NewDiv.prototype.removeEventHandler = function(eventname)          { delete this.element[eventname];}
	NewDiv.prototype.centerX            = function()                   { this.style.pixelLeft=Math.round((document.body.clientWidth+document.body.scrollLeft-300)/2)}
}

if (isNS6) {
    NewDiv.prototype.output             = function()                   { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.element = d.getElementById(this.id);this.style = this.element.style;}
    NewDiv.prototype.moveTo             = function(x,y)                { this.style.pixelLeft = x;this.style.pixelTop = y;}
    NewDiv.prototype.moveBy             = function(x,y)                { this.style.pixelLeft += x;this.style.pixelTop += y;}
    NewDiv.prototype.show               = function()                   { this.style.visibility = "visible"; }
    NewDiv.prototype.hide               = function()                   { this.style.visibility = "hidden"; }
    NewDiv.prototype.setZ               = function(z)                  { this.style.zIndex = z; }
    NewDiv.prototype.setBgColor         = function(color)              { this.style.backgroundColor = color; }
    NewDiv.prototype.setBgImage         = function(image)              { this.style.backgroundImage = image;}
    NewDiv.prototype.getX               = function()                   { return this.style.pixelLeft; }
    NewDiv.prototype.getY               = function()                   { return this.style.pixelRight; }
    NewDiv.prototype.getWidth           = function()                   { return this.style.width; }
    NewDiv.prototype.getHeight          = function()                   { return this.style.height; }
    NewDiv.prototype.getZ               = function()                   { return this.style.zIndex; }
    NewDiv.prototype.isVisible          = function()                   { return this.style.visibility == "visible"; }
    NewDiv.prototype.setBody            = function()                   { var body = "";for(var i = 0; i < arguments.length; i++) {body += arguments[i] + "\n";}this.element.innerHTML = body;}
    NewDiv.prototype.addEventHandler    = function(eventname, handler) { var NewDiv = this;this.element[eventname] = function() { var e = NewDiv.window.event;e.cancelBubble = true;return handler(NewDiv, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey); }}
    NewDiv.prototype.removeEventHandler = function(eventname)          { delete this.element[eventname];}
	NewDiv.prototype.centerX            = function()                   { this.style.pixelLeft=Math.round((document.body.clientWidth+document.body.scrollLeft-300)/2)}
}

var div1abc = new NewDiv(window,"daba","iframe",0,0,330,220,10,true);
function initme() {div1abc.centerX();return;}

var isIE  = document.all?true:false;
var isNS4 = document.layers?true:false;
var isNS6 = !isNS4&&!isIE&&document.getElementById?true:false;

div1abc.output();
hideDiv();
function showDiv(_v)
{
  var _offset=0;
  var _baseY=0;
  if(isIE)
    _offset=document.body.scrollTop;
  if(isNS4||isNS6)
    _offset=window.pageYOffset;
  div1abc.moveTo(div1abc.getX(),_baseY+_offset);
  if(isIE||isNS6)
    div1abc.setBody('<div style="border-width: 0;width: 338; position:relativ;" align=left><table border=0 cellpadding=0><tr><td>'+_v+'</td></tr></table></div>');
  if(isNS4)
    div1abc.setBody('<div align=left><div style="border-width: 0;width: 338;position: relative"><table border=0 cellpadding=0><tr><td><table width="338" height="100%" cellpadding=0><tr><td><font color=#000060>'+_v+'</font></td></tr></table></td></tr></table></div></div>');
  div1abc.show();
}

function hideDiv()
{
  div1abc.hide();
}



// Copyright 1999 - 2002 by Ray Stott, Pop-up Windows Script ver 2.0
// OK to use if this copyright is included
// Script is available at http://www.crays.com/jsc          

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }

function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }
