var Style = {
	getElementStyle: function(elem, property, pInt){
		var value;
		if(window.getComputedStyle){
			var compStyle = window.getComputedStyle(elem, '');
			value = compStyle.getPropertyValue(property);
		}else if(elem.currentStyle){
			if(property == "float"){
				property = "style-float";
			}
			value  = elem.currentStyle[property.camelize()]; //!!String.camelize()
		}
		return pInt ? parseInt(value) : value;
	},
	getDimensions: function(elem){
		var width, height;
		if(window.resizeable && elem instanceof resizeable){
			width = elem.width;
			height = elem.height;
		}else{
			width = parseInt(this.getElementStyle(elem, "width"));
			if(isNaN(width)){
				width = elem.offsetWidth;
			}
			height = parseInt(this.getElementStyle(elem, "height"));		
			if(isNaN(height)){
				height = elem.offsetHeight;
			}
		}

		return {width: width, height: height};
	},
	setElementStyle: function(elem, propName, propVal, usePx){
		if(typeof propName == "string"){
			if(usePx && (typeof propVal == "number")){
				propVal += "px";
			}
			elem.style[propName] = propVal;
		}else if(typeof propName == "object"){
			for(var i in propName){
				var val = propName[i];
				if(typeof val == "number" && usePx){
					val += "px";
				}//
				elem.style[i] = val;
			}//
		}//
	},
	getCoords: function(elem){
		var left = parseInt(this.getElementStyle(elem, 'left'));
		var top = parseInt(this.getElementStyle(elem, 'top'));
		var right = parseInt(this.getElementStyle(elem, 'right'));
		var bottom = parseInt(this.getElementStyle(elem, 'bottom'));
		left = isNaN(left) ? 0 : left;
		top = isNaN(top) ? 0 : top;
		right = isNaN(right) ? 0 : right;
		bottom = isNaN(bottom) ? 0 : bottom;
		return {
			left: left,
			top: top,
			right: right,
			bottom: bottom
		}

	},
	_check_browser: function(){
		if(window.getComputedStyle){
			if(window.opera)	{
				return "Opera";
			}else{
				return "Gecko";
			}
		}else{
			return "IE";
		}
	},
	_browser_version: function(){
		return this["_" + this._browser + "_version"]();
	},
	_IE_version: function(){
		var i = navigator.appVersion.indexOf("MSIE") + 5;
		var version = "";
		while(navigator.appVersion.charAt(i) != ";"){
			version += navigator.appVersion.charAt(i);
			i++;
		}
		return version;
	},
	_Gecko_version: function(){
		if(navigator.userAgent.indexOf("Firefox") == -1){
			return "unknown";
		}
		var i = navigator.userAgent.indexOf("Firefox\/") + 8;
		return navigator.userAgent.substr(navigator.userAgent.indexOf("Firefox\/") + 8);
		
	},
	_Opera_version: function(){
		return navigator.appVersion.substring(0, navigator.appVersion.indexOf(" "));
	}
};
Style._getParents = function(elem){
	var pars = [];
	elem = elem.parentNode;
	while(elem.tagName.toUpperCase() != "BODY"){
		pars.push(elem);
		elem = elem.parentNode;
	}
	return pars;
};
Style._browser = Style._check_browser();
Style._br_version = Style._browser_version();
Style.$ = Style.getElementStyle;
Style.$D = Style.getDimensions;
Style.$C = Style.getCoords;
Style.set = Style.setElementStyle;
Style.__loaded = true;