var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isDyn=isDOM||isIE||isNS4;

function getRef(id, par)
{
 par=!par?document:(par.navigator?par.document:par);
 return isIE ? par.all[id] :
  (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
  (isNS4 ? par.layers[id] : null));
}

function getSty(id, par)
{
 var r=getRef(id, par);
 return r?(isNS4?r:r.style):null;
}

if (!window.LayerObj) var LayerObj = new Function('id', 'par',
 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');
function getLyr(id, par) { return new LayerObj(id, par) }

function LyrFn(fn, fc)
{
 LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px"; ' +
  'with (this) { '+fc+' }');
}
LyrFn('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)');
LyrFn('w','if (p) (isNS4?sty.clip:sty).width=p+px; ' +
 'else return (isNS4?ref.document.width:ref.offsetWidth)');
LyrFn('h','if (p) (isNS4?sty.clip:sty).height=p+px; ' +
 'else return (isNS4?ref.document.height:ref.offsetHeight)');
LyrFn('vis','sty.visibility=p');

function ilsLoad(pageToLoad) { with (this) {
 if (!isDyn) return;

 if (timer) { clearInterval(timer); timer = null }

 if (div) {
  (isNS4?div:divCont).vis('hidden');
  div = null;
 }

 pageName = pageToLoad;
 scrollTo(0, 0);
}}

function ilsScrollTo(xPos, yPos) { with (this) {
 if (!pageName || !isDyn) return;

 if (!div) {
  divCont = getLyr(myName + '_Container' + (isNS4?'':'_'+pageName));
  if (!divCont.ref) return;

  if (isNS4) { scrW = divCont.sty.clip.width; scrH = divCont.sty.clip.height }

  div = getLyr(myName + '_' + pageName, isNS4?divCont.ref:null);
  if (!div.ref) return;

  (isNS4?div:divCont).vis('visible');

  if (isIE) div.ref.onmousewheel = new Function(myName +
   '.scrollBy(0,event.wheelDelta/-3); return false');
 }

 var divW = div.w(), divH = isOp?div.sty.pixelHeight:div.h();

 if (xPos + scrW > divW) xPos = divW - scrW;
 if (xPos < 0) xPos = 0;
 scrLeft = xPos;
 div.x(0 - parseInt(xPos));

 if (yPos + scrH > divH) yPos = divH - scrH;
 if (yPos < 0) yPos = 0;
 scrTop = yPos;
 div.y(0 - parseInt(yPos));
}}

function ilsScrollBy(xDiff, yDiff) { with (this) {
 if (!pageName) return;
 scrollTo(scrLeft + xDiff, scrTop + yDiff);
}}

function ilsSetScroll(newX, newY, steps) { with (this) {
 if (!pageName || !isDyn) return;

 stepsLeft = steps;

 if (timer) { clearInterval(timer); timer = null }
 timer = setInterval('with (' + myName + ') { if (stepsLeft > 0) { xSpeed += ' +
  ((newX-xSpeed)/steps) + '; ySpeed += ' + ((newY-ySpeed)/steps) + '; stepsLeft-- } ' +
  'scrollBy(xSpeed, ySpeed) }', 50);
}}

function ilsAutoScroll(xDiff, yDiff) { with (this) {
 if (!pageName || !isDyn) return;

 if (timer) { clearInterval(timer); timer = null }
 var divW = div.w();
 var divH = isOp?div.sty.pixelHeight:div.h();

 timer = setInterval(
  'with ('+myName+') {'+
   'if (!pause) {'+
    'xSpeed='+xDiff+';'+
    'ySpeed='+yDiff+';'+
    'if (div) {'+
     'if (scrLeft>='+divW+') {scrLeft=0-scrW; xSpeed=0;}'+
     'if (scrTop>='+divH+') {scrTop=0-scrH; ySpeed=0;}'+
    '}'+
    'scrollBy(xSpeed,ySpeed);'+
   '}'+
  '}',
  50);
}}

function ilsPrint() { with (this) {
 if (!pageName || !isDyn || !div || !div.ref) return;
 if (isNS4) return;
 
 var end;
 end = div.ref.innerHTML.indexOf("<script");
 if (end<0)  end = div.ref.innerHTML.indexOf("<SCRIPT");
 if (end<0)  end = div.ref.innerHTML.length;
 content = div.ref.innerHTML.substring(0,end);

 var prWin = open('','',
              'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,'+
              'resizable=0,width='+scrW+',height='+scrH+',dependent=1');
 prWin.document.write(
  '<html>'+
  '<script language="JavaScript1.2">'+
  'function printThis() {'+
  ' self.print();'+
  ' setTimeout("self.close()",5000);'+
  '}'+
  '</script>'+
  '<body onload="printThis()">'+
  content+
  '</body>'+
  '</html>');
 prWin.document.close();
}}

function ilsStartArea(w, h) { with (this) {
 scrW = w;
 scrH = h;
 document.write('<div id="'+myName+'_Container" style="position: relative; width: '+w+'px; height: '+h+'px; overflow: hidden">');
}}

function ilsStartPage(pN) { with (this) {
 document.write('<div id="' + myName + '_Container_' + pN + '" style="position: absolute; ' +
  'width: '+scrW+'px; height: '+scrH+'px; clip:rect(0px '+scrW+'px '+scrH+'px 0px); ' +
  'overflow: hidden; visibility: hidden"><div id="' + myName + '_' + pN + '" style="position: ' +
  (isIE?'absolute':'relative') + '">');
}}

function InlineScrollbox(myName) {
 this.myName = myName;
 this.divCont = null;
 this.div = null;
 this.pageName = '';

 this.scrW = this.scrH = this.scrTop = this.scrLeft = 0;
 this.xSpeed = this.ySpeed = this.stepsLeft = 0;
 this.pause = false;

 this.timer = 0;

 this.load = ilsLoad;
 this.scrollTo = ilsScrollTo;
 this.scrollBy = ilsScrollBy;
 this.setScroll = ilsSetScroll;
 this.startArea = ilsStartArea;
 this.startPage = ilsStartPage;
 this.autoScroll = ilsAutoScroll;
 this.print = ilsPrint;
}
