/**
 * @author Oleg Korovin (http://olegrorovin.spb.ru/)
 */


var Styles = {

 /***************************************************************************/
	push : function(obj, styles) {
		for(var i in styles) {
			obj["_style"+ i] = obj.style[i] || "";
			obj.style[i] = styles[i];
		}
	},

 /***************************************************************************/
	pop : function(obj, styles) {
		for(var i = 0; i < styles.length; i++)
			obj.style[styles[i]] = obj["_style"+ styles[i]];
	},

 /***************************************************************************/
	get : function(obj, style, _int, intradix) {
		var dv = document.defaultView;
		if (dv && dv.getComputedStyle) {
		var value = dv.getComputedStyle(obj, '').getPropertyValue(style.replace(/[A-Z]/g,
				function(match, _char) {
					return "-" + match.toLowerCase();
				} )
			);
		} else if (obj.currentStyle)
			var value = obj.currentStyle[style];
		else
			var value = obj.style[style] || "";
		return _int ? (parseInt(value, intradix || 10) || 0) : value;
	},

 /***************************************************************************/
	getPureWidth : function(obj) {
		var gs = this.get;
		return obj.offsetWidth - gs(obj, "borderLeftWidth", 1) - gs(obj, "paddingLeft", 1) - gs(obj, "paddingRight", 1) - gs(obj, "borderRightWidth", 1);
	},


 /***************************************************************************/
	matchClass : function(oElement,sClassName){
		return oElement && oElement.className && oElement.className.match(new RegExp('(^|\\s+)' + sClassName + '($|\\s+)'));
	},

 /***************************************************************************/
	addClass : function(oElement,sClassName){
		if( oElement && !this.matchClass(oElement, sClassName) ){
			oElement.className += ' ' + sClassName;
		}
	},

 /***************************************************************************/
	removeClass : function(oElement,sClassName){
		if( oElement && oElement.className ){
			oElement.className = oElement.className.replace(new RegExp('(.*)(^|\\s+)(' + sClassName + ')($|\\s+)(.*)'), '$1$4$5').replace(/(^)\s/, '$1');
		}
	},

 /***************************************************************************/
	setClass : function(oElement,sClassName,bAdd){
		if(bAdd)
			this.addClass(oElement,sClassName);
		else
			this.removeClass(oElement,sClassName);
	},

 /***************************************************************************/
	opacity : function(elNode,iValue){
		if(elNode.runtimeStyle) {
			elNode.runtimeStyle.filter = 'Alpha(opacity=' + iValue + ')';
		}
		else {
			elNode.style.opacity = iValue / 100;
		}
	},

 /***************************************************************************/
	invis : function(elNode){
		elNode.style.visibility = 'hidden';
	},

 /***************************************************************************/
	vis : function(elNode){
		elNode.style.visibility = 'visible';
	},

 /***************************************************************************/
	show : function(elNode){
		elNode.style.display = '';
	},

 /***************************************************************************/
	hide : function(elNode){
		elNode.style.display = 'none';
	}
};

/**/


