//======================== SCROLLING ENGINE
self.onError=null;
currentX = currentY = 0;  
whichIt = null;           
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat() {
	if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
	if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
	if(diffY != lastScrollY) {
		percent = .1 * (diffY - lastScrollY);
		if(percent > 0) percent = Math.ceil(percent);
			else percent = Math.floor(percent);
				if(IE) document.all.slide.style.pixelTop += percent;
				if(NS) document.slide.top += percent; 
				lastScrollY = lastScrollY + percent;
	}
	if(diffX != lastScrollX) {
		percent = .1 * (diffX - lastScrollX);
		if(percent > 0) percent = Math.ceil(percent);
			else percent = Math.floor(percent);
				if(IE) document.all.slide.style.pixelLeft += percent;
				if(NS) document.slide.left += percent;
				lastScrollX = lastScrollX + percent;
	}
}
function checkFocus(x,y) { 
	var totalY, totalX;
	floatx = document.slide.pageX;
	floaty = document.slide.pageY;
	floatwidth = document.slide.clip.width;
	floatheight = document.slide.clip.height;
	if(20 == 0) totalY = floatheight;
		else totalY = 20;
	if(0 == 0) totalX = floatwidth;
		else totalX = 0;
	if( (x > floatx && x < (floatx+totalX)) && (y > floaty && y < (floaty+totalY))) return true;
		else return false;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);

//======================== MENU ENGINE
tra=ld('images/tra.gif');
tr=ld('images/tr.gif');
function ld(location){image=new Image();image.src=location;return image}
function show(where,what){document.images[where].src=eval(what+".src")}

function dw(s){document.write(s)}
function newMI(aName,aCaption,aUrl,aTitle){
 o = new Object()
 o.name=aName
 o.caption=aCaption
 o.url=aUrl
 o.title=aTitle
 o.isSel=false
 return o
}
function setSel(arr,aName){
 for(i=0;i<arr.length;i++){
  if(arr[i].name==aName){
    arr[i].isSel=true
    break
  }
 }
}
function buildMenu(mItems){
 for(i=0;i<mItems.length;i++){
   buildMI(mItems[i])
 }
}
function buildMI(mi){
 if (mi.isSel) {
  dw('<img src=images/trh.gif width=15 height=12 name='+mi.name+'>');
  dw('<font id=mt>&nbsp;'+mi.caption+'</font><br>');
 } else {
  dw('<img src=images/tr.gif width=15 height=12 name='+mi.name+'>');
  dw('<a id="');
  dw(mi.isSel?'mt':'mn');
  dw('" href="'+mi.url);
  dw('" title="'+mi.title);
  dw('" onMouseOver="show(\''+mi.name+'\',\'tra\'); return true" ');
  dw('onMouseOut="show(\''+mi.name+'\',\'tr\');">&nbsp;'+mi.caption+'</a><br>');
 }
}
