
// scripts (c) CopySense 2003-2005 (M.S. Latter)

var db=document.getElementById?1:0;
var ie4=(document.all && !db && !window.opera)?1:0;
var oldOp=(window.opera && !document.createComment)?1:0;

function init()
{
	cbtxt('title');
}

window.onerror=eh;
window.onload=init;

function cbtxt(id)
{
	var ih=(db)?((oldOp)?0:1):0;
	if (!(ih||ie4)) return;
	var idobj=ih?document.getElementById(id):document.all[id];
	var txt=idobj.innerHTML;
	var txtlen=txt.length;
	var r=30,b=30,g=30,i=0,os='';
	var rd=Math.round(150/txtlen);
	var gd=Math.round(150/txtlen);
	var bd=Math.round(150/txtlen);

	for (;i<txtlen;i++)
	{
		r+=rd;
		g+=gd;
		b+=bd;
		os+='<span style="color:rgb('+r+','+g+','+b+')">'+txt.charAt(i)+'</span>';
	}

	idobj.innerHTML=os;
}

function winpop(u,n,w,h,winopts,s)
{
	if (window.opera&&document.createComment) return;
	var sb=s?',scrollbars':'';
	var nbw=winopts?',toolbar,location,status,menubar':'';
	var opts=',width='+w+',height='+h+',left=200,top=200,resizable'+sb+nbw;
	var pop=window.open(u,n,opts);
	pop.focus();
	return false;
	// legacy function - Opera is a pain
}

function highlight()
{
	if (!ih) return;
	var code=document.getElementById('output');
	code.focus();
	code.select();
}

function eh()
{
	return true;
}
