bgcol = new Array("","","");
var these = "<a href='javascript:bgc();'>Change Colours</a> - <a href='javascript:savecol();'>save</a>";
var those = "<a href='javascript:insult();'>!Insult</a>: You're a";

function isAlpha(s) {
	if(s == null) return false;
	if(s.length == 0) return false;
	for(var i=0; i<s.length; ++i) {
		if("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-".indexOf(s.charAt(i)) < 0) {
			return false;
		}
	}
	return true;
}
function checked(name, pass) {
	if ( isAlpha(name) == false || isAlpha(pass) == false ) {
		alert("names and passwords are alphanumeric only");
		return false;
	}
	if ( name.length == 0  || name.length > 16 ) {
		alert("invalid name length");
		return false;
	}
	if (checkpass(pass) == false) return false;
	return true;
}
function checkpass(pass) {
	if ( pass.length == 0  || pass.length > 16 ) {
		alert("invalid pass length");
		alert(pass.length);
		return false;
	}
	return true;
}

function checkEnter(that, e) {
	var characterCode;

	if(e && e.which){
		e = e;
		characterCode = e.which;
	}
	else{
		e = event;
		characterCode = e.keyCode;
	}

	if(characterCode == 13) {
//		document.forms[0].submit();
		document.forms(that).submit();
		//alert(document.getElementById(that)+" "+document.forms(that).name);
		return false;
	}
	else{
		return true;
	}
}

function convert(number) {
		switch(number)
		{	case 10:number= 'a';break;
			case 11:number= 'b';break;
			case 12:number= 'c';break;
			case 13:number= 'd';break;
			case 14:number= 'e';break;
			case 15:number= 'f';break;
		}
		return(number);
}
function randclr() {

	clr=new Array(0,0,0,0,0,0);
	clr2=new Array(0,0,0,0,0,0);
	clr3=new Array(0,0,0,0,0,0);
	total="";
	total2="";
	total3="";
	coin = Math.floor(Math.random()*2);
	for(ind=0; ind<6;ind++)	{
		number=Math.floor(Math.random()*16);
		if ( 0 == coin) {
			number2=((number+8)%16);
			number3=(15-number);
		} else {
			number2=(15-number);
			number3=((number+8)%16);
		}
		//alert(number+" "+number2);
 		clr[ind]=convert(number);
 		clr2[ind]=convert(number2);
 		clr3[ind]=convert(number3);
	}
	for(ind=0; ind<6;ind++)	{total = total + "" + clr[ind]};
	for(ind=0; ind<6;ind++)	{total2 = total2 + "" + clr2[ind]};
	for(ind=0; ind<6;ind++)	{total3 = total3 + "" + clr3[ind]};
	returner = new Array(total,total3, total2);
	return(returner);
}	//i made it myself

function bgc(again) {
	bgcol = randclr();

	document.getElementById('body').style.scrollbarFaceColor= "#"+bgcol[0];
	document.getElementById('body').style.scrollbarTrackColor= "#"+bgcol[0];

	document.getElementById('div2').style.color="#"+bgcol[1];


if(	document.getElementById('scroll1')) document.getElementById('scroll1').style.color="#"+bgcol[1];
if( document.getElementById('scroll2')) document.getElementById('scroll2').style.color="#"+bgcol[1];

	document.getElementById('div2').style.backgroundColor="#"+bgcol[0];

	document.getElementById('headdiv').style.color="#"+bgcol[2];
	document.getElementById('headdiv').style.border="5px solid #"+bgcol[2];

	if (again == 1) to2 = setTimeout("bgc(1)", 500);
}

var i = 0
var i2 = 0
function scroller(text, target, fixed) {
	document.getElementById(target).value = fixed + text.substring(i,text.length) + text.substring(0,i)
	if(i++>text.length) i = 0;
	t3xt=text;	//stupid non-recursive parameters
	t4rget=target;
	f1xed=fixed;
	//clearTimeout(mytime); //this should stop mulitple instances right?
	mytime1 = setTimeout("scroller( t3xt , t4rget , f1xed)", 111);
}
function scroller2(w3rds2, what2){
	document.getElementById(what2).value = w3rds2.substring(i2,w3rds2.length) + w3rds2.substring(0,i2)
	if(i2++>w3rds2.length) i2 = 0;
	werds2=w3rds2;	//stupid non-recursive parameters
	wh4t2=what2;
	//clearTimeout(mytime); //this should stop mulitple instances right?
	mytime2 = setTimeout("scroller2( werds2 , wh4t2)", 144);
}

function disabletext(e){
	return nohl;
}

function reEnable(){
	return true;
}

//if the browser is IE4+
document.onselectstart=disabletext;

//if the browser is NS6
if (window.sidebar){
document.onmousedown=disabletext;
document.onclick=reEnable;
}

function checklength(thebox, thelen) {

document.getElementById(thebox).value = document.getElementById(thebox).value.substring(0,thelen)
//alert(document.getElementById(thebox).length);
	if (document.getElementById(thebox).value.length >= thelen ) return false;
	else return true;

}
function toggle(which, anchor, maxwidth) {

//alert(document.getElementById(which).style.display);

	if(document.getElementById(which).style.display == 'none' ) {

		document.getElementById(which).style.display = 'inline';
		document.getElementById(anchor).innerHTML = "Hide";
		document.cookie=which+" = Hide";
	}
	else {
		document.getElementById(which).style.display = 'none';
		document.getElementById(anchor).innerHTML = "Show";
		document.cookie=which+" = Show";
	}

}

