		var lnkCount = 0;
		
		var stateMax = 10;
		
		var speed = new Array();
		speed[0] = 20;
		speed[1] = 30;
		
		var color_bg = new Array();
		color_bg[0] = new Array(); 
		color_bg[1] = new Array();
		color_bg[2] = new Array();
		color_bg[3] = new Array();
		color_bg[0][0]  = 163; // \    BG Off
		color_bg[0][1]  = 186; //  |-> #F7FBFD
		color_bg[0][2]  = 202; // /
		color_bg[1][0]  = 251; // \    BG On
		color_bg[1][1]  = 191; //  |-> #4D5577 #FBBF44
		color_bg[1][2]  = 68; // /
		
		color_bg[2][0]  = 55; // \    TEXT Off
		color_bg[2][1]  = 83; //  |-> #F7FBFD
		color_bg[2][2]  = 109; // /
		color_bg[3][0]  = 255; // \    TEXT On
		color_bg[3][1]  = 255; //  |-> #4D5577
		color_bg[3][2]  = 255; // /
		var color_fg_off = '#a3baca'; //#4D5577  #a3baca
		var color_fg_on = '#37536d';  //#F7FBFD #446689 #37536d
		
		var iTimerIDs = new Array();
		var iLinkStates = new Array();
		var lnkName = new Array();
		var lnkUrl = new Array();
		var bIsColorizing = new Array();

		function DecToHex(dec){
			dec = Math.floor(Math.abs(dec));
			var hex = "";
			var a = "" + dec;
			a = a.length;
			var h = "0123456789ABCDEF";
			for (n=0; n<a; n++){
				he = h.charAt(dec - Math.floor(dec/16) * 16);
				dec = (dec - h.indexOf(he)) / 16;
				hex = he + hex;
			}
			if((hex.charAt(0) == "0") && (hex.length > 2)) {
				hex = hex.substring(1, hex.length);
			}
			return hex;
		}

		function toColorHex(color) {
			var s = "#";
			for (var i = 0; i < 3; i++) {
				s += DecToHex(color[i]);
			}
			return s;
		}
		
		function doInitialize(index) {
			iTimerIDs[index] = 0;
			iLinkStates[index] = 0;
		}
		
		function doColorize(onoff, index, idPrefix) {
			if(!iLinkStates[index]) {
				doInitialize(index);
 			}
			clearTimeout(iTimerIDs[index]);
			if (iLinkStates[index] > 10) {
				iLinkStates[index] = 10;
			} else if (iLinkStates[index] < 0) {
				iLinkStates[index] = 0;
			} else {
				var diff = iLinkStates[index] / stateMax;
				var color = new Array();
				var textColor = new Array();
				idPrefix = idPrefix || 'link';
				for (var i = 0; i < 3; i++) {
					var colorDiff = diff * (color_bg[0][i]-color_bg[1][i]);
					color[i] = color_bg[0][i] - colorDiff;
					colorDiff = diff * (color_bg[2][i]-color_bg[3][i]);
					textColor[i] = color_bg[2][i] - colorDiff;
				}
				if (onoff == 1) {
					iLinkStates[index]++;
				} else {
					iLinkStates[index]--;
				}
				try {
					document.getElementById(idPrefix + index).style.color = toColorHex(textColor);
				}
				catch(er) {
					alert('test: ' + toColorHex(textColor));
				}
				document.getElementById(idPrefix + index).style.backgroundColor = toColorHex(color);
				
				if (iLinkStates[index] <= 10 && iLinkStates[index] >= 0) {
					iTimerIDs[index] = setTimeout('doColorize(' + onoff + ', ' + index + ', \'' + idPrefix + '\')', speed[onoff]);
				} else {
					if (iLinkStates[index] > 10) {
						iLinkStates[index] = 10;
					} else if (iLinkStates[index] < 0) {
						iLinkStates[index] = 0;
					}
				}
			}
		}
		
		function linkOn(numbah) {
			doColorize(1, numbah);
		}
		function linkOff(numbah) {
			doColorize(0, numbah);
		}
		function linkGo(numbah) {
			document.location = lnkUrl[numbah];
		}
		function addLink(name, url) {
			lnkName[lnkCount] = name;
			lnkUrl[lnkCount] = url;
			iTimerIDs[lnkCount] = 0;
			iLinkStates[lnkCount] = 0;
			bIsColorizing[lnkCount] = false;
			lnkCount++;
		}
		function writeLinks() {
			document.write("<table cellpadding=\"1\" cellspacing=\"1\" width=\"800\" align=\"center\">\n");
			document.write("	<tr>\n");
			for (var i = 0; i < lnkCount; i++) {
				document.write("<td class=\"linkcell\" id=\"link" + i + "\" onmouseover=\"linkOn('" + i + "');\" onmouseout=\"linkOff('" + i + "');\" onmousedown=\"linkGo('" + i + "')\" width=\"" + (100/lnkCount) + "%\">" + lnkName[i] + "</td>\n");
			}
			document.write("	</tr>\n");
			document.write("</table>\n");
		}
