// getStyle
// USO: getStyle(el, styleProp)
function getStyle(el,styleProp) {
	if(String(typeof(el)) != "object") {
		var x = document.getElementById(el);
	}
	else {
		var x = el;	
	}
	if (x.currentStyle) {
		var y = x.currentStyle[styleProp];
		if(styleProp == "height") {
			y = x.scrollHeight + "px";
		}
	}
	else if (window.getComputedStyle) {
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	}
	return y;
}

function getElementsByClass(searchClass, node, tag) {
	var classElements = new Array();
	if(node == null) {
		node = document;
	}
	else if(typeof(node) == "string") {
		node = document.getElementById(node);
	}
	if(tag == null) {
		tag = '*';
	}
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for(i = 0; i < elsLen; i++) {
		if(pattern.test(els[i].className)) {
			classElements.push(els[i]);
		}
	}
	return classElements;
}

function px2int(pValue) {
	if(String(pValue).indexOf("px") != -1) {
		var intReturn = pValue.substring(0, (pValue.length - 2));
		intReturn = parseInt(intReturn);
		return intReturn;
	}
	else {
		return;
	}
}

function getSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == "number" ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return {"width": myWidth, "height": myHeight};
}

function hasClass(obj, cName) {
	return new RegExp('\\b'+cName+'\\b').test(obj.className);
}

function addClass(obj, cName) {
	if (!hasClass(obj,cName)) {
		obj.className += obj.className ? ' ' + cName : cName;
	}
}

function removeClass(obj, cName) {
	if (!hasClass(obj,cName)) {
		return false;
	}
	var rep = obj.className.match(' '+cName) ? ' ' + cName:cName;
	obj.className = obj.className.replace(rep,'');
}
