﻿// JScript File
var isDOM   = document.getElementById ? 1 : 0,
      isIE  = document.all ? 1 : 0,
      isNS4 = navigator.appName == 'Netscape' && !isDOM ? 1 : 0,
      isOp  = self.opera ? 1 : 0,
      isDyn = isDOM || isIE || isNS4;
      
if (!self.page) var page = { win:self, minW:0, minH:0, MS:isIE&&!isOp };
page.db = function(p) { with (this.win.document) return (isDOM?documentElement[p]:0)||body[p]||0 };

page.winW=function() { with (this) return Math.max(minW, MS ? db('clientWidth') : win.innerWidth) };
page.winH=function() { with (this) return Math.max(minH, MS ? db('clientHeight') : win.innerHeight) };

page.scrollX=function() { with (this) return MS ? db('scrollLeft') : win.pageXOffset };
page.scrollY=function() { with (this) return MS ? db('scrollTop') : win.pageYOffset };



function ToggleDiv(elemId, e)
{
//alert("test");
      var div = document.getElementById(elemId);
      if(div)
      {
            if(div.style.visibility != "visible")
            {
                if(!e) var e = window.event;
                  var x = e.clientX;
                  var y = e.clientY;
                  var pH = div.clientHeight >= div.scrollHeight ? div.clientHeight : div.scrollHeight;
                  var pW = div.clientWidth >= div.scrollWidth ? div.clientWidth : div.scrollWidth;
                  var winW = page.winW();
                  var winH = page.winH();
                  var sX = page.scrollX();
                  var sY = page.scrollY();
                  
                  var pX = x + sX + 5;
                  var pY = y + sY + 5;
                  
                  if (!isIE||isOp) 
                  { 
                        winW-=16; 
                        winH-=16;
                  }
                  
                  if (x + pW + 5 > sX + winW) pX = sX + winW - pW - 5;
                  if (y + pH + 5 > sY + winH) pY = sY + winH - pH - 5;
                  if(pX < sX + 5)pX = sX + 5;
                  if(pY < sY + 5) pY = sY + 5;
                  
                  //div.style.top = pY;
                  //div.style.left = pX;
                  div.style.top = pY.toString() + 'px';
                  div.style.left = pX.toString() + 'px';
                  
                  
                  //setTimeout('FadeIn(\'' + elemId + '\',' + pW + ',' + pH + ',10)', 10)
                  //div.style.height = "0px";
                  //div.style.width = "0px";
                  //div.style.overflow = "hidden";                
            }
            div.style.visibility = (div.style.visibility != "visible") ? "visible" : "hidden";         
      }
}

function FadeIn(elemId, width, height, timeout)
{
      var elem = document.getElementById(elemId)
      var fivepercentW = width * .05;
      var fivepercentH = height * .05;
      
      if(parseInt(elem.style.height) < height)
      {
            if(parseInt(elem.style.height) < 20 || parseInt(elem.style.width) == width)
            {
                  var newHeight = parseInt(elem.style.height) + fivepercentH;
                  elem.style.height = newHeight + "px";
                  setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
                  return;
            }
      }
      else
      {
            elem.style.height = height;
      }
      if(parseInt(elem.style.width) < width)
      {
            var newWidth = parseInt(elem.style.width) + fivepercentW;
            elem.style.width = newWidth + "px";
            setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
            return;
      }
      else
      {
            elem.style.width = width;
      }
      if(parseInt(elem.style.width) != width || parseInt(elem.style.height) != height)
      {
            setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
      }
      else
      {
            elem.style.overflow = "";
//          var child = elem.children[0];
//          if(child)
//          {
//                child.onresize = function()
//                                              {
//                                                          elem.style.height = elem.scrollHeight + "px";
//                                                          elem.style.width = elem.scrollWidth + "px";
//                                              };
//          }
      }
}

// JScript File
var isDOM   = document.getElementById ? 1 : 0,
      isIE  = document.all ? 1 : 0,
      isNS4 = navigator.appName == 'Netscape' && !isDOM ? 1 : 0,
      isOp  = self.opera ? 1 : 0,
      isDyn = isDOM || isIE || isNS4;
      
if (!self.page) var page = { win:self, minW:0, minH:0, MS:isIE&&!isOp };
page.db = function(p) { with (this.win.document) return (isDOM?documentElement[p]:0)||body[p]||0 };

page.winW=function() { with (this) return Math.max(minW, MS ? db('clientWidth') : win.innerWidth) };
page.winH=function() { with (this) return Math.max(minH, MS ? db('clientHeight') : win.innerHeight) };

page.scrollX=function() { with (this) return MS ? db('scrollLeft') : win.pageXOffset };
page.scrollY=function() { with (this) return MS ? db('scrollTop') : win.pageYOffset };



function ToggleDiv(elemId, e)
{
//alert("test");
      var div = document.getElementById(elemId);
      if(div)
      {
            if(div.style.visibility != "visible")
            {
                if(!e) var e = window.event;
                  var x = e.clientX;
                  var y = e.clientY;
                  var pH = div.clientHeight >= div.scrollHeight ? div.clientHeight : div.scrollHeight;
                  var pW = div.clientWidth >= div.scrollWidth ? div.clientWidth : div.scrollWidth;
                  var winW = page.winW();
                  var winH = page.winH();
                  var sX = page.scrollX();
                  var sY = page.scrollY();
                  
                  var pX = x + sX + 5;
                  var pY = y + sY + 5;
                  
                  if (!isIE||isOp) 
                  { 
                        winW-=16; 
                        winH-=16;
                  }
                  
                  if (x + pW + 5 > sX + winW) pX = sX + winW - pW - 5;
                  if (y + pH + 5 > sY + winH) pY = sY + winH - pH - 5;
                  if(pX < sX + 5)pX = sX + 5;
                  if(pY < sY + 5) pY = sY + 5;
                  
                  //div.style.top = pY;
                  //div.style.left = pX;
                 div.style.top = pY.toString() + 'px';
                  div.style.left = pX.toString() + 'px';
                  
                  
                  //setTimeout('FadeIn(\'' + elemId + '\',' + pW + ',' + pH + ',10)', 10)
                  //div.style.height = "0px";
                  //div.style.width = "0px";
                  //div.style.overflow = "hidden";                
            }
            div.style.visibility = (div.style.visibility != "visible") ? "visible" : "hidden";         
      }
}

function FadeIn(elemId, width, height, timeout)
{
      var elem = document.getElementById(elemId)
      var fivepercentW = width * .05;
      var fivepercentH = height * .05;
      
      if(parseInt(elem.style.height) < height)
      {
            if(parseInt(elem.style.height) < 20 || parseInt(elem.style.width) == width)
            {
                  var newHeight = parseInt(elem.style.height) + fivepercentH;
                  elem.style.height = newHeight + "px";
                  setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
                  return;
            }
      }
      else
      {
            elem.style.height = height;
      }
      if(parseInt(elem.style.width) < width)
      {
            var newWidth = parseInt(elem.style.width) + fivepercentW;
            elem.style.width = newWidth + "px";
            setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
            return;
      }
      else
      {
            elem.style.width = width;
      }
      if(parseInt(elem.style.width) != width || parseInt(elem.style.height) != height)
      {
            setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
      }
      else
      {
            elem.style.overflow = "";
//          var child = elem.children[0];
//          if(child)
//          {
//                child.onresize = function()
//                                              {
//                                                          elem.style.height = elem.scrollHeight + "px";
//                                                          elem.style.width = elem.scrollWidth + "px";
//                                              };
//          }
      }
}

// JScript File
var isDOM   = document.getElementById ? 1 : 0,
      isIE  = document.all ? 1 : 0,
      isNS4 = navigator.appName == 'Netscape' && !isDOM ? 1 : 0,
      isOp  = self.opera ? 1 : 0,
      isDyn = isDOM || isIE || isNS4;
      
if (!self.page) var page = { win:self, minW:0, minH:0, MS:isIE&&!isOp };
page.db = function(p) { with (this.win.document) return (isDOM?documentElement[p]:0)||body[p]||0 };

page.winW=function() { with (this) return Math.max(minW, MS ? db('clientWidth') : win.innerWidth) };
page.winH=function() { with (this) return Math.max(minH, MS ? db('clientHeight') : win.innerHeight) };

page.scrollX=function() { with (this) return MS ? db('scrollLeft') : win.pageXOffset };
page.scrollY=function() { with (this) return MS ? db('scrollTop') : win.pageYOffset };



function ToggleDiv(elemId, e)
{

      var div = document.getElementById(elemId);
      if(div)
      {
            if(div.style.visibility != "visible")
            {
                if(!e) var e = window.event;
                  var x = e.clientX;
                  var y = e.clientY;
                  var pH = div.clientHeight >= div.scrollHeight ? div.clientHeight : div.scrollHeight;
                  var pW = div.clientWidth >= div.scrollWidth ? div.clientWidth : div.scrollWidth;
                  var winW = page.winW();
                  var winH = page.winH();
                  var sX = page.scrollX();
                  var sY = page.scrollY();
                  
                  var pX = x + sX + 5;
                  var pY = y + sY + 5;
                  
                  if (!isIE||isOp) 
                  { 
                        winW-=16; 
                        winH-=16;
                  }
                  
                  if (x + pW + 5 > sX + winW) pX = sX + winW - pW - 5;
                  if (y + pH + 5 > sY + winH) pY = sY + winH - pH - 5;
                  if(pX < sX + 5)pX = sX + 5;
                  if(pY < sY + 5) pY = sY + 5;
                  
                  //div.style.top = pY;
                  //div.style.left = pX;
                  div.style.top = pY.toString() + 'px';
                  div.style.left = pX.toString() + 'px';
      
    
                  //setTimeout('FadeIn(\'' + elemId + '\',' + pW + ',' + pH + ',10)', 10)
                  //div.style.height = "0px";
                  //div.style.width = "0px";
                  //div.style.overflow = "hidden";                
            }
            div.style.visibility = (div.style.visibility != "visible") ? "visible" : "hidden";         
      }
}

function FadeIn(elemId, width, height, timeout)
{
      var elem = document.getElementById(elemId)
      var fivepercentW = width * .05;
      var fivepercentH = height * .05;
      
      if(parseInt(elem.style.height) < height)
      {
            if(parseInt(elem.style.height) < 20 || parseInt(elem.style.width) == width)
            {
                  var newHeight = parseInt(elem.style.height) + fivepercentH;
                  elem.style.height = newHeight + "px";
                  setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
                  return;
            }
      }
      else
      {
            elem.style.height = height;
      }
      if(parseInt(elem.style.width) < width)
      {
            var newWidth = parseInt(elem.style.width) + fivepercentW;
            elem.style.width = newWidth + "px";
            setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
            return;
      }
      else
      {
            elem.style.width = width;
      }
      if(parseInt(elem.style.width) != width || parseInt(elem.style.height) != height)
      {
            setTimeout('FadeIn(\'' + elem.id + '\',' + width + ',' + height + ',' + timeout + ')', timeout);
      }
      else
      {
            elem.style.overflow = "";
//          var child = elem.children[0];
//          if(child)
//          {
//                child.onresize = function()
//                                              {
//                                                          elem.style.height = elem.scrollHeight + "px";
//                                                          elem.style.width = elem.scrollWidth + "px";
//                                              };
//          }
      }
}

