var annoy=true;function debug(msg){ if(annoy)annoy=confirm(msg); }

// improved addEvent functions by John Resig & others,
// http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
function addEvent( obj, type, fn ){
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent){
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn ){
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent){
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}



//*** This code is copyright 2002-2003 by Gavin Kistner and Refinery; www.refinery.com
//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt
function AddClass(obj,cName){KillClass(obj,cName);return obj&&(obj.className+=(obj.className.length>0?' ':'')+cName);}
function KillClass(obj,cName){return obj&&(obj.className=obj.className.replace(new RegExp("^"+cName+"\\b\\s*|\\s*\\b"+cName+"\\b",'g'),''));}
function HasClass(obj,cName){return(!obj||!obj.className)?false:(new RegExp("\\b"+cName+"\\b")).test(obj.className);}