/* get ********************************************************************************************/
var $ = function(id){
	return document.getElementById(id);
}

/* window and screen geometry *********************************************************************/

var Geometry = {};

if( window.innerWidth ){//all browser but IE
	Geometry.getViewportWidth = function(){ return window.innerWidth; }
	Geometry.getViewportHeight = function(){ return window.innerHeight; }
	
} else if( document.documentElement && document.documentElement.clientWidth ){//IE
	Geometry.getViewportWidth = function(){ return document.documentElement.clientWidth; }
	Geometry.getViewportHeight = function(){ return document.documentElement.clientHeight; }
}

/* Math Object Implementation *********************************************************************/
Math._float = function(number,after)
{
	return Math.round(number*Math.pow(10,after))/Math.pow(10,after);	
}

/* XMLtoXHTML *************************************************************************************/
function XMLtoXHTML(xmlElement)
{
	//Text Node
	if( xmlElement.nodeType == 3 ){
		var txt = document.createTextNode(xmlElement.data);
		return txt;
	}		
		
	//Element Node
	if( xmlElement.nodeType == 1 ){
		var xhtmlElement = {};
		xhtmlElement.name = xmlElement.nodeName;
		
		//create and link to document
		var rtn = document.createElement(xhtmlElement.name);
		
		//attribute transfer
		for(var i=0;i<xmlElement.attributes.length;i++){
			rtn.setAttribute(xmlElement.attributes[i].nodeName,xmlElement.attributes[i].nodeValue);
		}
		
		//children transfer
		for(var i=0;i<xmlElement.childNodes.length;i++){
				rtn.appendChild(XMLtoXHTML(xmlElement.childNodes[i]));
		}
		
		//return DOM object
		return rtn;
	}
}

Element.prototype.innerElement = function(children)
{
	//empty node
	while( this.hasChildNodes() ){
		this.removeChild(this.firstChild);
	}
	
	//fill node
	if( !children.concat ){//test if children is array type
		children[0] = children;
	}
	
	for(var i=0;i<children.length;i++){
		this.appendChild(children[i].cloneNode(true));
	}
}

/* removing javascript warning ****************************************************************/
//document.getElementById('css_nojs').disabled = true;
//document.getElementById('css_onjs').disabled = false;

