
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 (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) }', 10);
}}

function ilsStartArea(w, h) { with (this)
{

 scrW = w;
 scrH = h;
 document.write('<div 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.timer = 0;

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

var scr = new InlineScrollbox('scr');

var ilsOldOL = window.onload;
window.onload = function()
{
 if (ilsOldOL) ilsOldOL();

 scr.load('Page1');
}

var nsWinW = window.innerWidth, nsWinH = window.innerHeight;
function ns4BugCheck()
{
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) history.go(0);
}

var ilsOldOR = window.onresize;
window.onresize = function()
{
 if (ilsOldOR) ilsOldOR();
 ns4BugCheck();
}




	
