// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header
// Customized by Henry Shing at Auphan Software

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function popup_ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  hotDog=isIE ? event.srcElement : e.target;
  whichDog=document.getElementById("popup_window");
  if ( hotDog ) {
     while (hotDog && hotDog.id!="popup_title_bar" && hotDog.tagName!=topDog){
       hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
     }
     if (hotDog && hotDog.id=="popup_title_bar"){
       offsetx=isIE ? event.clientX : e.clientX;
       offsety=isIE ? event.clientY : e.clientY;
       nowX=parseInt(whichDog.style.left);
       nowY=parseInt(whichDog.style.top);
       ddEnabled=true;
       document.onmousemove=popup_dd;
     }
   }
}

function popup_dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=(isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx) + "px";
  whichDog.style.top=(isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety)  + "px";
  return false;
}


function hide_popup(){
   whichDog.style.visibility="hidden";
}

function show_popup(){
   whichDog.style.visibility="visible";
}

document.onmousedown=popup_ddInit;
document.onmouseup=Function("ddEnabled=false");

function load_popup( url ) {
   popup_loader.location.href = url;
}

popup_fn_convert_regexp = /function\s+(\w+)/g;

function popup_loaded() {
   whichDog=document.getElementById("popup_window");
   whichDog.innerHTML = popup_loader.document.body.innerHTML;
   var titlebar = document.getElementById("popup_title_bar");
   if ( titlebar ) {
      titlebar.onMouseover=Function( "isHot=true;");
      titlebar.onMouseout=Function("isHot=false;");
   }
   if ( whichDog ) {
      if ( self.pageYOffset != null ) {
         var doc_body = document.body;
         var x = self.pageXOffset;
         var y = self.pageYOffset;
      }
      else {
         var doc_body = document.documentElement;
         var x = doc_body.scrollLeft;
         var y = doc_body.scrollTop;
      }
      whichDog.style.top = y + ((doc_body.clientHeight - whichDog.offsetHeight)/2) + "px";
      whichDog.style.left = x + ((doc_body.clientWidth - whichDog.offsetWidth)/2) + "px";

   }
   popup_script = popup_loader.document.getElementById( 'popup_script' );

   if ( popup_script ) {
      var converted_popup_script = popup_script.innerHTML.replace( popup_fn_convert_regexp, 'window.$1 = function' );
      eval( converted_popup_script )
   }
   show_popup();
}
document.writeln('<iframe frameborder="0" name="popup_loader" style="width:1px;height:1px;display:none;" src=""></iframe>');
