var JadeCss = {
	_initial: function(){
		if($.lng('alignment')){ $.CSS.Include(Jade.path.replace('/lib/js/','')+'/style/'+CONFIG.CSS_STYLE+'/right_language.css'); }
	},
	GetById: function (id, cssProperty) 
	{
		function $(stringId) {return document.getElementById(stringId);}
		if($(id).currentStyle) 
		{
			var convertToCamelCase = cssProperty.replace(/\-(.)/g, function(m, l){return l.toUpperCase()});
			return $(id).currentStyle[convertToCamelCase];
		}
		else if (window.getComputedStyle) {
			var elementStyle = window.getComputedStyle($(id), '');
			return elementStyle.getPropertyValue(cssProperty);
		}
		return 0;
	},
	GetClass: function (strStyleSheet, strClass)
	{
		var objRules = new Array();
		for(var i=0; i<document.styleSheets.length; i++)
		{
			var strStyle=document.styleSheets[i].href;
			strStyle=strStyle.substring(strStyle.lastIndexOf("/")+1);
			if(strStyle==strStyleSheet)
			{
				if (document.styleSheets[i].cssRules)
				{
					objRules = document.styleSheets[i].cssRules;
				}
				else if (document.styleSheets[i].rules)
				{
					objRules = document.styleSheets[i].rules;
				}
			}
		}
		var objReturn;
		for(var i=0; i<objRules.length; i++)
		{
			if(objRules[i].selectorText.toLowerCase()==strClass) { objReturn=objRules[i].style; }
			Jade.Debug.Add('Style selector: '+ strClass +' - '+objRules[i].selectorText.toLowerCase(),'warn' );
		}
		return objReturn;
	},
	GetStyleSheets: function ()
	{
		return document.styleSheets;
	},
	GetAllRules: function ()
	{
		var arrayRules = new Array();
		for(var i=0; i<document.styleSheets.length; i++)
		{
			var objRules = new Array();
			if (typeof(document.styleSheets[i].rules)!="undefined")
			{
				objRules = document.styleSheets[i].rules;
			}
			else if (typeof(document.styleSheets[i].cssRules)!="undefined")
			{
				objRules = document.styleSheets[i].cssRules;
			}
			
			for(var x =0; x<objRules.length; x++ )
			{
				arrayRules.push(objRules[x]);	
			}
		}
		return arrayRules;
	},
	GetStyle: function (element, cssRule)
	{
		var strValue = '';
		if(document.defaultView && document.defaultView.getComputedStyle)
		{
			element.style.display = 'block';
			strValue = document.defaultView.getComputedStyle(element, '').getPropertyValue(cssRule);
			//alert(document.defaultView.getComputedStyle(element.parentNode, null).getPropertyValue('display'));
		}
		else if(element.currentStyle)
		{
			cssRule = cssRule.replace(/\-(\w)/g, function (strMatch, p1){	return p1.toUpperCase(); });
			strValue = element.currentStyle[cssRule];
		}
		return strValue;
	},
	GetHeight: function(element){
		var height=$.Convert.ToInt(element.offsetHeight);
		if(height==0){ height=$.Convert.ToInt($.Css.GetStyle(element, 'height')); }
		return height;
	},
	RealPosition: function (obj) 
	{
		var currentLeft = 0;
		var currentTop = 0;
		while(true)	{
			currentLeft += obj.offsetLeft;
			currentTop += obj.offsetTop;
			currentTop -=obj.scrollTop;
			if(typeof(obj.offsetParent)!="undefined" && obj.offsetParent!=null){
				obj=obj.offsetParent;
			}
			else{ break; }
		}
		return [currentLeft,currentTop];
	},
	Include: function (file, document)
	{
		if(typeof(document)=="undefined") { document=top.document; }
			var cssNew=document.createElement('link');
			cssNew.setAttribute('type','text/css');
			cssNew.setAttribute('rel','stylesheet');
			cssNew.setAttribute('href',file);
			document.getElementsByTagName('head').item(0).appendChild(cssNew);
	}
};
Jade.LoadLibrary('Css',JadeCss);