document.write("\n<div id=\"helperouter\" class=\"help\">");
document.write("\n<div id=\"helper\" style=\"display:none;\"></div><!--[if lte IE 6.5]><iframe id=\"helperiframe\"></iframe><![endif]--></div>");
var oHelper = new clsHelper();

function clsHelper() {

   this.isIE    = document.all;
   this.isNav   = document.layers;
   this.isFF    = ( window.navigator.userAgent.indexOf("Firefox") >= 1 );
   this.isOther = ( this.isIE || this.isNav || this.isFF )?false: true;

   this.obj     = document.getElementById("helper");
   this.outer   = document.getElementById("helperouter");
   this.iframe  = document.getElementById("helperiframe");

   this.width   = "";
   this.height  = "";

   this.offsetX = "";
   this.offsetY = "";

   this.obj.style.left = 0;
   this.obj.style.top  = 0;
   this.obj.style.width = 0;
   this.obj.style.display = "none";
   this.outer.style.display = "none";

   this.title_style   = "background-color:#649acd;padding-top:5px;color:#ffffff;font-weight:bold;";

   this.outterTableBg = "#525252";
}

function __clsHelperShow( sTitle, sMsg ) {

   if ( __clsHelperShow.arguments.length == 2 ) {
      var ee = event;
   } else {
      var ee = __clsHelperShow.arguments[2];
   }

   var template = ""
   template += "\n<table width=\""+this.width+"\" height=\""+this.height+"\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\""+this.outterTableBg+"\">";
   template += "\n   <tr>";
   template += "\n      <td>";
   template += "\n         <table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">";
   template += "\n            <tr>";
   template += "\n               <td align=\"middle\" style=\""+this.title_style+"\">";
   template += "\n                  " + sTitle + "</td>";
   template += "\n            </tr>";
   template += "\n         </table>";
   template += "\n         <table width=\"100%=\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" bgcolor=\"#ffffff\">";
   template += "\n            <tr>";
   template += "\n               <td align=\"left\">";
   template += "\n                  " + sMsg + "</td>";
   template += "\n            </tr>";
   template += "\n         </table></td>";
   template += "\n   </tr>";
   template += "\n</table>";

   //if ( this.isOther || this.isNav ) {
   //   alert(msg);
   //   return;
   //}

   //if ( this.isIE ) {
      //this.obj.style.left = ( document.body.clientLeft / 2 ) - ( this.obj.offsetWidth / 2 );
      //this.obj.style.top  = ( document.body.clientTop / 2 )  - ( this.obj.offsetHeight / 2 );

      //this.outer.filters[1].Apply();
      this.obj.style.display = "block";
      this.outer.style.display = "block";
      //this.outer.style.visibility = "visible";
      //this.obj.style.visibility = "visible";
      this.obj.innerHTML = template;
      //my_alert2(this.outer.innerHTML);
      //this.outer.filters[1].play();

//my_alert2(""
//, "\ndocument.body.scrollLeft=", document.body.scrollLeft
//, "\ndocument.body.scrollTop=", document.body.scrollTop
//, "\nwindow.screen.width=", window.screen.width
//, "\nwindow.screen.height=", window.screen.height
//, "\ndocument.body.clientWidth=", document.body.clientWidth
//, "\ndocument.body.clientHeight=", document.body.clientHeight
//, "\nthis.obj.style.width=", this.obj.style.width
//, "\nthis.obj.clientWidth=", this.obj.clientWidth
//, "\nthis.obj.clientHeight=", this.obj.clientHeight
//, "\nthis.obj.offsetWidth=", this.obj.offsetWidth
//, "\nthis.obj.offsetHeight=", this.obj.offsetHeight
//, "\nthis.outer.style.width=", this.outer.style.width
//, "\nthis.outer.clientWidth=", this.outer.clientWidth
//, "\nthis.outer.clientHeight=", this.outer.clientHeight
//, "\nthis.outer.offsetWidth=", this.outer.offsetWidth
//, "\nthis.outer.offsetHeight=", this.outer.offsetHeight
//, "\nthis.iframe.style.width=", this.iframe.style.width
//, "\nthis.iframe.clientWidth=", this.iframe.clientWidth
//, "\nthis.iframe.clientHeight=", this.iframe.clientHeight
//, "\nthis.iframe.offsetWidth=", this.iframe.offsetWidth
//, "\nthis.iframe.offsetHeight=", this.iframe.offsetHeight
//, "\nevent.x=", event.x
//, "\nevent.y=", event.y
//);
      var y = ee.clientY
      var x = ee.clientX

      // 決定helper出現之y軸位置
      if ( y < this.obj.clientHeight ) {
         // 置於event觸發(滑鼠)下方
         var tmpTop = y + document.body.scrollTop;
      } else {
         // 置於event觸發(滑鼠)上方
         var tmpTop = y + document.body.scrollTop  - this.outer.clientHeight;
      }
      //alert(document.body.clientWidth);
      //alert(x);
      //alert(this.obj.clientWidth);

      // 決定helper出現之x軸位置
      if ( ( document.body.clientWidth - x ) < this.obj.clientWidth ) {
        // 置於event觸發(滑鼠)左方
         var tmp_clientWidth = this.obj.clientWidth;
         if (tmp_clientWidth == 0) tmp_clientWidth = this.outer.clientWidth;
        //var tmpLeft = x + document.body.scrollLeft - this.outer.clientWidth;
        var tmpLeft = x + document.body.scrollLeft - tmp_clientWidth;
        // 避免超出頁面左邊界
        if (tmpLeft < 0) tmpLeft = 0;
        // 避免超出頁面右邊界
        //if ( (tmpLeft + this.obj.clientWidth) > document.body.clientWidth) tmpLeft = document.body.clientWidth - this.obj.clientWidth;
      } else {
         // 置於event觸發(滑鼠)右方
         var tmp_clientWidth = this.obj.clientWidth;
         if (tmp_clientWidth == 0) tmp_clientWidth = this.outer.clientWidth;
         var tmpLeft = x + document.body.scrollLeft;
         // 避免超出頁面右邊界
         if ( (tmpLeft + tmp_clientWidth) > document.body.clientWidth) {
            tmpLeft = document.body.clientWidth - tmp_clientWidth;
         }
      }

      if ( this.isFF ) {
         this.outer.style.top  = tmpTop + this.offsetY;
         this.outer.style.left = tmpLeft + this.offsetX;
      } else {
         this.outer.style.top  = tmpTop + this.offsetY;
         this.outer.style.left = tmpLeft + this.offsetX;
     }
      this.outer.style.width = this.width;
   //}

}
clsHelper.prototype.show = __clsHelperShow;


function __clsHelperHide() {

   //if ( this.isIE ) {
      this.obj.style.left = 0;
      this.obj.style.top  = 0;
      this.obj.style.width = 0;
      this.obj.style.display = "none";
      this.outer.style.display = "none";
      //this.obj.style.visibility = "hidden";
      //this.outer.style.visibility = "hidden";
   //}
}
clsHelper.prototype.hide = __clsHelperHide;

function __clsHelpergetPosTop(o) {
   var top = o.offsetTop;
   var left = o.offsetLeft;
   while ( o = o.offsetParent ) {
      top  += o.offsetTop;
      left += o.offsetLeft;
   }
   return top;
}
clsHelper.prototype.getPosTop = __clsHelpergetPosTop;


function __clsHelpergetPosLeft(o) {
   var top = o.offsetTop;
   var left = o.offsetLeft;
   while ( o = o.offsetParent ) {
      top  += o.offsetTop;
      left += o.offsetLeft;
   }
   return left;
}
clsHelper.prototype.getPosLeft = __clsHelpergetPosLeft;

