var mainLayer = (ns) ? "home.htm" : "home";

var st = 0;
var scr = 0;
var currItem = 0;
var rate = 6;
var scrollTop = 1;
var scrollSpeed = 10;

function hide(item)
{
  el = (ns) ? (item + 'r.document.' + item) : (item);
  vizElement(el, HIDE);
  if (st) clearTimeout(st);
}

function show(item)
{
  if (currItem) hide(currItem);
  currItem = item;
  el = (ns) ? (item + 'r.document.' + item) : (item);
  vizElement(el, SHOW);
}

function mOver(item)
{
  if (st) clearTimeout(st);
}

function mOut(item)
{
  st = setTimeout("hide('"+item+"')", 1000);	
}

function eleClip(eleId, x0, y0, x1, y1)
{
   if (ns4) 
   {
     var ele = eval('document.' + eleId);
     ele.clip.top = y0;
     ele.clip.right = x1;
     ele.clip.bottom = y1;
     ele.clip.left = x0;
   } 
   else if (ie4) 
   {
     clipStr = 'rect(' + y0 + ',' + x1 + ',' + y1 + ',' + x0 + ')';
     if (ie4) 
	 {
//	 	document.title = clipStr;
		ele = eval('document.all.' + eleId + '.style.clip = "' + clipStr + '"');
	 }	 
   } 
   else 
   if (docom) 
   	  document.getElementById(eleId).style.clip = 'rect(' + y0 + ',' + x1 + ',' + y1 + ',' + x0 + ')';
}

function eleYMove(eleId, offY)
{
  if (ns4) eval('document.' + eleId + '.top = ' + (offY));
  else if (ie4) eval('document.all.' + eleId + '.style.top = ' + offY);
  else if (docom) document.getElementById(eleId).style.top = offY;
}

function eleHeight(eleId)
{

   if (ie4)
     return eval('document.all.' + eleId + '.offsetHeight');
   else if (ns4)
   {
//   	alert('document.' + eleId + '.document.height');
     return eval('document.' + eleId + '.document.height');
	}	 
   else if (docom)
     return document.getElementById(eleId).offsetHeight;
}

function vScrollTo(fT)
{ 
  eleClip(mainLayer, 0, fT+1, 454, fT+67);
  eleYMove(mainLayer, -fT);
}

function vScroll(Nsign)
{
  newTop = scrollTop + (Nsign * rate);
  testVal = (Nsign > 0) ? "newTop + 68 <= eleHeight(mainLayer)" : "newTop > 0";
  if (eval(testVal))
  {
    scrollTop = newTop;
  }	
  else
  {
    (Nsign > 0) ? scrollTop = eleHeight(mainLayer) - 68 : scrollTop = 0;
  }	
  vScrollTo(scrollTop);
} 

function start(Nsign)
{
  if (eleHeight(mainLayer) < 67) return;
  vScroll(Nsign);
  scr = setTimeout("start(" + Nsign + ")", scrollSpeed);
}

function stop()
{
	if (scr) clearTimeout(scr);
}

function init()
{
 if (dhtmlBrowser) 
 {
  vScrollTo(0);
  if (document.all) this.focus();
  if (ns4) 
  {
    winW = window.innerWidth;
    winH = window.innerHeight;
  }
  if (ns) vizElement('m0r.document.m0', SHOW);
  else vizElement('m0', SHOW);
  vizElement(mainLayer, SHOW);
 }
}




// Simple browser detection (NS4.x, IE4.x, DOCOM[5+] browsers)
var ns = (navigator.appName == 'Netscape');
var gen3 = (parseInt(navigator.appVersion) >= 3 && parseInt(navigator.appVersion) < 4);
var ns4 = (ns && parseInt(navigator.appVersion) >= 4 && parseInt(navigator.appVersion) < 5);
var ie = (navigator.appName == 'Microsoft Internet Explorer');
var ie3 = (ie && navigator.appVersion < 4);
var ie4 = (ie && parseInt(navigator.appVersion) >= 4);
var docom = (document.getElementById);
var win2k = (navigator.userAgent.indexOf('Windows NT 5.0') != -1);
var ie4mac = (ie && !docom && navigator.userAgent.indexOf('Macintosh') != -1);
var dhtmlBrowser = (ie4 || ns4 || docom);
var win31 = (navigator.appVersion.indexOf("Win16") != -1);

var SHOW, HIDE;
if (ie4 || docom) {
  SHOW = "visible";
  HIDE = "hidden";
} else if (ns4) {
  SHOW = "show";
  HIDE = "hide";
}

var zoomWindow = null;

function vizElement(eleId, vizProp)
{
  if (docom) document.getElementById(eleId).style.visibility = vizProp;
  else if (ie4) eval('document.all.' + eleId + '.style.visibility = "' + vizProp + '"');
  else if (ns4) eval('document.' + eleId + '.visibility = "' + vizProp + '"');
}





