function addHandler (target,evt,func,dx) { if (target.attachEvent) { target.attachEvent('on'+evt,func); } else { target.addEventListener(evt,func,dx); } return func; }
function removeHandler (target,evt,func,cap) { if (target.detachEvent) { target.detachEvent('on'+evt,func); } else { target.removeEventListener(evt,func,cap); } return true; }
function unPX (str) { return parseInt(str.replace('px','')); }
function getElementsByClassName(root,className) { var results = []; walkTheDOM(root, function (node) { var a; var i; var c = node.className; if (c) { a = c.split(' '); for (i = 0; i < a.length; i += 1) { if (a[i] === className) { results.push(node); break; } } } }); return results; }
function walkTheDOM (node,func) { func(node); node = node.firstChild; while (node) { walkTheDOM(node, func); node = node.nextSibling; } }
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, 'g'); }
function alertArray (arr) { var str = ""; for (key in arr) { str += key + " : " + arr[key] + "\r\n"; } alert(str); }
function addClassName (obj,newclass) {
	var spacer = ' ';
	if (!obj.className) { var spacer = ''; }
	if (!checkClassName(obj,newclass)) {
		obj.className = obj.className + spacer + newclass;
	}
}
function remClassName (obj,oldclass) {
	if (checkClassName(obj, oldclass)) {
		obj.className = obj.className.replace(oldclass, '');
	}
}
function checkClassName (obj,checkclass) {
	if (obj.className.indexOf(checkclass) > -1) {
		return true;
	} else {
		return false;
	}
}
function adjustOpacity (obj,amt) {
	if (obj.style.filter != null) {
		obj.style.filter = "alpha(opacity = "+amt+")";
	}
	else {
		obj.style.opacity = amt / 100;
	}
}

function Fade (obj,start,end,step,int,delay,disp,vis,func) {
	adjustOpacity(obj,start);
	if (delay) {
		var temp = setTimeout(function(){
			new Fade(obj, start, end, step, int, 0, disp, vis);
		}, delay);
		return;
	}
	var curpos = start;
	var curstep = step;
	var that = this;
	if (start > end) {
		this.inthandle = setInterval(function () {
			curpos = curpos - curstep;
			if (curpos <= end) {
				clearInterval(that.inthandle);
				if (disp) { obj.style.display = 'none'; }
				if (vis) { obj.style.visibility = 'hidden'; }
				if (func) { func(that); }
			}
			adjustOpacity(obj,curpos);
		},int);
	} else if (start < end) {
		this.inthandle = setInterval(function () {
			if (curpos == start) {
				if (disp) { obj.style.display = disp; }
				if (vis) { obj.style.visibility = 'visible'; }
			}
			curpos = curpos + curstep;
			if (curpos >= end) { clearInterval(that.inthandle); if (func) { func(that); } }
			adjustOpacity(obj,curpos);

		},int);
	} else {
		return false;
	}
}
/* Imported SKLIB Functions */
function sklib_getMaxWH () {
  if (ie) { sklib_winWidth = window.document.body.clientWidth; sklib_winHeight = window.document.body.clientHeight; } else { sklib_winWidth = window.innerWidth; sklib_winHeight = window.innerHeight; }
}