function objGet(x,d)	{d=d==null?document:d; return (d.getElementById?d.getElementById(x):d.all?d.all[x]:d.layers?d.layers[x]:null);}

function zeroFill(s,x)	{var a,i; a = s.length; if (a<x) {for (i=0;i<(x-a);i++) {s = "0" + s;}} return s;}

function dec2hexA(numb,x)
{
return zeroFill((numb).toString(16).toUpperCase(),x);
}

function dec2hexB(numb,x)
{
var hexx = "0123456789ABCDEF";
var i,b,c,s;
s = "";
i = numb;
while (i>0)
	{
	b = i>>4;
	c = i - (b<<4);
	s = hexx.charAt(c) + s;
	i = b;
	}
return zeroFill(s,x);
}

var dec2hex = (Boolean((1).toString(16))) ? dec2hexA : dec2hexB;
function hex2dec(hex)	{return parseInt(hex,16);}
function hex2dec3(hex)	{return new Array(hex2dec(hex.substring(0,2)),hex2dec(hex.substring(2,4)),hex2dec(hex.substring(4,6)));}
function dec2hex3(arr)	{return dec2hex(arr[0],2)+dec2hex(arr[1],2)+dec2hex(arr[2],2);}

function cl_round(color)
{
color = Math.round(color);
color = color<0 ? 0 : color>255 ? 255 : color;
return color;
}



// BEGIN rainbow2
// 2008 by KrazyDad http://www.krazydad.com/makecolors.php
function cl_rainbow2(k,len,y)
{
var i, r,g,b, phase,center,width, frequency;
phase  = 0 + 5;
if (y)	{center = y;   width = y>127 ? 255-y : y;}
else	{center = 128; width = 127;}
frequency = Math.PI * 2 / len;	//
for (i=0;i<len;++i)
	{
	r = Math.sin(frequency*i+2+phase) * width + center;
	g = Math.sin(frequency*i+0+phase) * width + center;
	b = Math.sin(frequency*i+4+phase) * width + center;
	cl_color[k+i] = dec2hex3(new Array(cl_round(r), cl_round(g), cl_round(b)));
	}
}
// END rainbow2

// BEGIN gradient
function cl_gradient(k,color1,color2,len)
{
var c1,c2,i,l,f, r,g,b;
cl_color[k] = color1;
if (len>1)
	{
	c1,c2 = new Array();
	l  = len-1;
	c1 = hex2dec3(color1);
	c2 = hex2dec3(color2);
	for (i=1;i<len;i++)
		{
		f = i/l;
		r = c1[0]*(1-f) + c2[0]*f;
		g = c1[1]*(1-f) + c2[1]*f;
		b = c1[2]*(1-f) + c2[2]*f;
		cl_color[k+i] = dec2hex3(new Array(cl_round(r), cl_round(g), cl_round(b)));
		}
	}
}
// END gradient

var cl_color = [];
function text_rainbow(text)
{
var c,len,i,t;
text= text.split('');
len = text.length;
cl_rainbow2(0,len,128);
t   = '';
for(i=0;i<len;i++)
	{t+='<font color="#'+cl_color[i]+'">'+text[i]+'</font>';}
return t;
}
