var hold=25; // in seconds
var xmax=300; // pixels - move farther right and close sub menu
var ylast=0;
var timer,x,y,osub,csub,dsub;
var hold=1000*hold;
var activated=false;
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var ns6=document.getElementById&&!document.all;
var ns4=document.layers;

var ypixels= -6; // vertical pixels

var xpixels=100; // horizontal pixels
if (ns6) xpixels= - 100; // horizontal pixels
if (ns4) xpixels= - 100; // horizontal pixels
 
//configure the below five variables to change the style of the scroller
var scrollerwidth=140;
var scrollerheight=200;
var scrollerbgcolor='#FF33CC';
var scrollspeed = 100;
var scrollpause = 3000;
var maxmessages=0;

////// scrolling routines

function move1(whichlayer){
  tlayer=eval(whichlayer)
  if (tlayer.top>0&&tlayer.top<=maxmessages){
      tlayer.top=0
      setTimeout("move1(tlayer)",scrollpause)
      setTimeout("move2(document.scmain.document.scsecond)",scrollpause)
      return
  }
  if (tlayer.top>=tlayer.document.height*-1){
      tlayer.top-=maxmessages;
      setTimeout("move1(tlayer)",scrollspeed)
  }else{
      tlayer.top=scrollerheight
      tlayer.document.write(messages[i])
      tlayer.document.close()
      if (i==messages.length-1){i=0;}else{i++;}
  }
}

function move2(whichlayer){
    tlayer2=eval(whichlayer);
    if (tlayer2.top>0&&tlayer2.top<=maxmessages){
       tlayer2.top=0;
       setTimeout("move2(tlayer2)",scrollpause);
       setTimeout("move1(document.scmain.document.scfirst)",scrollpause);
       return
    }
    if (tlayer2.top>=tlayer2.document.height*-1){
        tlayer2.top-=maxmessages;
        setTimeout("move2(tlayer2)",scrollspeed);
    }else{
        tlayer2.top=scrollerheight;
        tlayer2.document.write(messages[i]);
        tlayer2.document.close();
        if (i==messages.length-1){i=0;}else{i++;}
    }
}

function move3(whichdiv){
    tdiv=eval(whichdiv);
    if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=maxmessages){
        tdiv.style.pixelTop=0;
        setTimeout("move3(tdiv)",scrollpause);
        setTimeout("move4(scsecond2)",scrollpause);
        return;
    }
    if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
        tdiv.style.pixelTop-=maxmessages;
        setTimeout("move3(tdiv)",scrollspeed);
    }else{
        tdiv.style.pixelTop=scrollerheight;
        tdiv.innerHTML=messages[i];
        if (i==messages.length-1){i=0;}else{i++;}
    }
}

function move4(whichdiv){
    tdiv2=eval(whichdiv);
    if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=maxmessages){
        tdiv2.style.pixelTop=0;
        setTimeout("move4(tdiv2)",scrollpause);
        setTimeout("move3(scfirst2)",scrollpause);
        return;
    }
    if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
        tdiv2.style.pixelTop-=maxmessages;
        setTimeout("move4(scsecond2)",scrollspeed);
    }else{
        tdiv2.style.pixelTop=scrollerheight;
        tdiv2.innerHTML=messages[i];
        if (i==messages.length-1){i=0;}else{i++;}
    }
}

function startscroll(){
  if (ie4||ns6) {
      move3(scfirst2);scsecond2.style.top=scrollerheight;
      scsecond2.style.visibility='visible';
  }else if (ns4){
      document.scmain.visibility='show';
      move1(document.scmain.document.first);
      document.scmain.document.second.top=scrollerheight+maxmessages;
      document.scmain.document.second.visibility='show';
  }
}
///// end scrolling routines

function popipix (){
   window.open('construction.html','ipixit','toolbar=no,status=no,menubar=no,width="100%",height=300,left=0,top=0');
}

function initiate() {	
/////    if (!document.all&&!document.getElementById&&!document.layers){return;}
    if (!ie4&&!ns4&&!ns6) {return;}
    csub=ie4? eval("document.all.main.style") : ns4? eval("document.main") : eval(document.getElementById("main").style);
    osub=csub;    activated=true;
    if (maxmessages>1) {startscroll ();}
//    var imgname = eval("document.images[0].name");
//    if (imgname == "ipix") {popipix();}
}


function show(wsub) {
	if (activated) {	
	    csub.visibility=(ie4||ns6)? "hidden" : "hide";
	    csub=ie4? eval("document.all."+wsub+".style") : ns6? document.getElementById(wsub).style : eval("document."+wsub);
	    osub=csub;
	    if (ie4) {osub.posTop=y+ypixels;osub.posLeft=xpixels;}
	    else     {osub.top=y+ypixels;osub.left=xpixels;}
	    ylast=y+ypixels;
	    osub.visibility="visible";
	    timer=setTimeout("hidesubmenu()",hold);
	}
}
	
function show2(wsub) {
	if (activated) {	
	    csub.visibility=(ie4||ns6)? "hidden" : "hide";
	    csub=ie4? eval("document.all."+wsub+".style") : ns6? document.getElementById(wsub).style : eval("document."+wsub);
	    osub=csub;
	    if (ie4) {osub.posTop=ylast;osub.posLeft=xpixels;}
	    else     {osub.top=ylast;osub.left=xpixels;}
	    osub.visibility="visible";
	    timer=setTimeout("hidesubmenu()",hold);
	}
}

function hidesubmenu() {
	clearTimeout(timer);
	if (csub) {csub.visibility="hidden";}
	if (osub) {osub.visibility="hidden";}
}

function handlerMM(e){
	x = ie4 ? document.body.scrollLeft+event.clientX : ns6? document.body.scrollLeft+e.clientX : e.pageX;
	y = ie4 ? document.body.scrollTop+event.clientY : ns6? document.body.scrollTop+e.clientY : e.pageY;
        if (x > xmax) {hidesubmenu();}
}

function subtop (dn) {document.write ("<div id='"+dn+"' style='position:absolute;visibility:hidden'>");
                      document.write ("<table bgcolor='#FFFFFF' border='1' cellpadding='1' cellspacing='0'>\n");}
function subline (link,text,target) {document.write ("<tr><td width=200 nowrap><a href='"+link+"' class='out'>"+text+"</a></td></tr>\n");}
function sublinet (link,text,target) {document.write ("<tr><td width=200 nowrap><a href='"+link+"' target='"+target+"' class='out'>"+text+"</a></td></tr>\n");}
function subbot (dn) {document.write ("</table></div>\n");}

function mainline (link,text,target) {
   document.write ("<tr><td><table border='1' width='100%' bgcolor='#FFFFFF' cellspacing='0'>");
//	document.write ("<tr><td><a href='"+link+"' target='"+target+"' class='over' onmouseover=\"javascript:hidesubmenu()\">"+text+"</b></a></div></td></tr>");
	document.write ("<tr><td><a href='"+link+"' class='over' onmouseover=\"javascript:hidesubmenu()\">"+text+"</b></a></div></td></tr>");
	document.write ("</table></td></tr>");
}
function showline (dn,text) {
   document.write ("<tr><td><table border='1' width='100%' bgcolor='#FFFFFF' cellspacing='0'>");
	document.write ("<tr><td><a href='' class='over' onmouseover=\"javascript:show('"+dn+"')\">"+text+"...</b></a></td></tr>\n");
	document.write ("</table></td></tr>");
}
function showbox (dn,text) {
//   document.write ("<tr><td><table border='1' width='100%' bgcolor='#FFFFFF' cellspacing='0'>");
	document.write ("<tr><td width=200><a href='' class='over' onmouseover=\"javascript:show2('"+dn+"')\"><font size=3>"+text+"...</font></b></a></td></tr>\n");
//	document.write ("</table></td></tr>");
}


if (ns4){document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove=handlerMM;
window.onload=initiate;