isIE=document.all;
isNN=!document.all&&document.getElementById;
ddEnabled=false;
min_y = 0;

/*
registerEvent = function( obj, event_, func) {
	document.all?obj.attachEvent( "on".concat( event_), func):obj.addEventListener( event_, func, false);
}

registerEvent( document, "mousedown",
function(e){
  topDog=isIE ? "BODY" : "HTML";
  hotDog=isIE ? event.srcElement : e.target;  
  try {
    if( !hotDog.id ) return;
  } catch(e) {}
  while (hotDog.id && hotDog.id.indexOf( "titleBar")!=0 && hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id.indexOf( "titleBar") == 0 ){
    name = hotDog.id.substr( 8);
    whichDog=isIE ? document.all[name] : document.getElementById(name);
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
  }
}
);
registerEvent( document, "mousemove",
function(e){
  if (!ddEnabled) return;
  left_=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  top_=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  if ( top_ < min_y ) top_ = min_y;
  whichDog.style.left=left_;
  whichDog.style.top=top_;
  return false;  
}
)
registerEvent( document, "mouseup", function() { ddEnabled=false})
*/
function PopLayer2_hideMe(){
  this.Layer.innerHTML = "";
  if (isIE||isNN) this.Layer.style.visibility="hidden";
  ddEnabled = false;
  this.open = false;
}
function PopLayer2_showMe(){
  if (isIE||isNN){
    c = str_replace( "$$content$$", this.content, this.header);
    c = str_replace( "$$title$$", this.title, c);
    c = str_replace( "$$name$$", this.name, c);
    c = str_replace( "$$width$$", this.width, c);
    this.Layer.innerHTML = c;
    this.Layer.style.visibility="visible";
    o = document.body;
    this.m_pos_y = isIE ? (o.scrollTop+o.clientHeight/2)-(this.Layer.clientHeight/2): (o.scrollTop+o.clientHeight/2)-(this.Layer.scrollHeight/2);
    this.m_pos_x = isIE ? (o.scrollLeft+o.clientWidth/2)-(this.Layer.clientWidth/2): (o.scrollLeft+o.clientWidth/2)-(this.Layer.scrollWidth/2);
    if ( this.m_pos_y < this.min_y ) this.m_pos_y = this.min_y;
    this.Layer.style.left = this.m_pos_x;
    this.Layer.style.top = this.m_pos_y;
    this.open = true;
  }
}
function PopLayer2( name, title, content, header)
{
  //-------------------------------------
  //          Local Variables
  //-------------------------------------
  this.whichDog=false;
  this.content = content;
  this.name = name;
  this.title = title;
  this.min_y = 260;
  this.m_pos_y = 0;
  this.m_pos_x = 0;
  this.offsetx = 0;
  this.offsety = 0;
  this.width = 1;
  this.open = false;
  if ( !header )
  {
    this.header = '\
    <table width="$$width$$" border="0" BGCOLOR="#007DBD" cellspacing="0" cellpadding="1">\
      <tr>\
        <td width="100%">\
          <table border="0" width="100%" cellspacing="0" cellpadding="3" height="36">\
            <tr>\
              <td ID="titleBar$$name$$" style="cursor:move" width="100%"><b class=normal style="color:#FFFFFF;cursor:move">$$title$$</b></td>\
              <td style="cursor:hand" valign="top"><a href="./" onClick="'+name+'_.hideMe();return false"><img src="./images/ico_close.gif" border=0></a></td>\
            </tr>\
            <tr>\
              <td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2">\
                 <table width="100%" border="0" cellpadding="1" cellspacing="1" valign=top>\
                   <tr>\
                     <td bgcolor="#FFFFFF" align=center>$$content$$</td>\
                   </tr>\
                   <tr>\
                     <td align=center><a href="./" onClick="'+name+'_.hideMe();return false"><img src="./images/but_close2.gif" border=0></a></td>\
                   </tr>\
                 </table>\
              </td>\
            </tr>\
          </table>\
        </td>\
      </tr>\
    </table>\
    ';
  }
  else
  {
    this.header = header;
  }
  this.Layer = isIE ? document.all[name] : document.getElementById(name);
  //-------------------------------------
  //              Methods
  //-------------------------------------
  this.hideMe = PopLayer2_hideMe;
  this.showMe = PopLayer2_showMe;
}