//this function is because i'm lazy and to save on bandwidth, saves typing document.getelementbyid all the time
function $(e){return document.getElementById(e);}

//these three functions faciliate easily adding/removing a classname to an element
//this is a much better thing to do than to manually change the styles in JS
//put the styles in the css file, and then just change the classname
//DO NOT do ".style.backgroundColor=" etc.  Keep all your styles in the CSS file
function addClass(e,c) {
	if(!e.className)
		e.className=c;
	else
		if(!hasClass(e,c))
			e.className+=' '+c;
}

function delClass(e,c) {
	if(e.className)
	{
		if(e.className.split(' ').length>1)
			e.className=e.className.replace(new RegExp(' '+c+'\\b'),'');
		else
			e.className=e.className.replace(new RegExp(c+'\\b'),'');
	}
}

function hasClass(e,c) {
	if(e.className)
	{
		cs = e.className.split(' ');
		for(var i=0;i<cs.length;i++)
			if(cs[i]==c) return true;
	}
	return false;
}

//good crossbrowser way to run scripts on an events
function addEventSimple(o,e,f) {
	if (o.addEventListener)
		o.addEventListener(e,f,false);
	else if (o.attachEvent)
		o.attachEvent('on'+e,f);
}