// (c) www.einhorn-net.de
// do not reuse without permission
var lastId="";
var lastTo=-1;
function onTopic(id) {
	clearTimeout(lastTo);
	if(lastId!=id) turnOff(lastId);
	document.getElementById(id).className="sthilite";
	document.getElementById(id+'H').className="mthilite";
	lastId=id;
}
function offTopic(id) {
//	lastTo=setTimeout("turnOff('"+id+"')", 500);	
	lastTo=setTimeout("turnOff()", 1500);	
}

function turnOff() {
if(lastId!="") {
	document.getElementById(lastId).className="st";
	document.getElementById(lastId+'H').className="mt";
	
}
lastId="";
}

aCol=new Array ("#101088", "#101080", "#101078", "#101070", "#101078", "#101080");
var lastCol=0;

function stepCol() {
	for(i=0; i<6; i++) {
		st="c"+String(i);
		document.getElementById(st).style.borderColor=aCol[(i+lastCol)%6];
	}
	lastCol=(lastCol+1)%6;
	//setTimeout('stepCol()', 3000);
}

function timeCol() {
var dDate=new Date();
var nMod=60*dDate.getHours()+dDate.getMinutes();
var nR=Math.ceil(255*(720-nMod)*(nMod)/129600);
var nG=Math.ceil(255*(1080-nMod)*(nMod-360)/129600);
var nB=Math.ceil(255*(1440-nMod)*(nMod-720)/129600);
var sRGB="#"+sHC(nR)+sHC(nG)+sHC(nB);
//alert(nMod+" R="+nR+" G="+nG+" B="+nB+" ="+sRGB);
document.getElementById("clr").style.backgroundColor=sRGB;
//off stepCol();
setTimeout('timeCol()', 5000);
}

function sHC(nDC) {
var sH;
if (nDC<0) nDC=0;
if (nDC>255) nDC=255;
nL=nDC%16; nL+=48; if(nL>57) nL+=39;
nH=nDC>>4; nH+=48; if(nH>57) nH+=39;
sH=String.fromCharCode(nH,nL);
return (sH);
}


var nSW=0;
var nSH=0;
var nEw=0;
var nEh=0;
var nSp=2;
var nMx=nSp;
var nMy=nSp;
var bMove=0;


function eAni(nOpt) {
var bPrev=bMove;
if(!document.getElementById("eibg")) return;
// 0=off, 1=on, 2=toggle, 3=reinit
if((nOpt==1)|(nOpt==0)) {bMove=nOpt;}
if(nOpt==2){ parent.window.focus(); bMove++; if(bMove>1) bMove=0;}
nEw=parseInt(document.getElementById("eibg").style.width,10);
nEh=parseInt(document.getElementById("eibg").style.height,10);
if((bPrev==0)&(bMove==1)) setTimeout('MoveEi()', 10);
}

function MoveEi() {
if(nEw>=512) {nMx=-nSp;}
if(nEw<=16) {nMx=nSp;}
if(nEh>=512) {nMy=-nSp;}
if(nEh <=16) {nMy=nSp;}
nEw+=nMx;
nEh+=nMy;
document.getElementById("eibg").style.width=(nEw+"px");
document.getElementById("eibg").style.height=(nEh+"px");
if(bMove) setTimeout('MoveEi()', 40);
}

function winResize() {
eAni(3);
}
//this.name="einhorn";
window.onresize=winResize;
setTimeout('timeCol()', 500);
//setTimeout('eAni(1)', 15000);
