function GraphicTools() {

	function isPixels( dimension ) {
		return dimension.indexOf('px') > -1;
	}

	function isEm( dimension ) {
		return dimension.indexOf('em') > -1;
	}

	function getNumVal( dimension ) {
		var result = dimension;
		result = result.replace('px', '');
		result = result.replace('%', '');
		return result;
	}

	this.isPixels 	= isPixels;
	this.isEm 		= isEm;
	this.getNumVal 	= getNumVal;
}

// ---------------------
function CrossBrowserLib() {

	function getBrowseWidth() {
		if (self.innerWidth) {
			return self.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientWidth) {
			return document.documentElement.clientWidth;
		}
		else if (document.body)	{
			return document.body.clientWidth;
		}
		else {
			return -1;
		}
	}

	function getBrowseHeight() {
		if (self.innerWidth) {
			return self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientWidth) {
			return document.documentElement.clientHeight;
		}
		else if (document.body)	{
			return document.body.clientHeight;
		}
		else {
			return -1;
		}
	}

	function getElementById(divID, doc) {
	    if (!doc) doc = document;

	    if( doc.layers ) { //Netscape layers
	        return doc.layers[divID]; }
	    if( doc.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
	        return doc.getElementById(divID); }
	    if( doc.all ) { //Proprietary DOM; IE4
	        return doc.all[divID]; }
	    if( doc[divID] ) { //Netscape alternative
	        return doc[divID]; }
	    return false;
	}
/*
	function getFrameDocById( id ) {
		if ( browser.isNS ) {
		  var iframe=document.getElementById(id);
		  if (!iframe) iframe=getElementById(id);
		  if (iframe) return iframe.contentDocument
		  else return false;
		}
		else {
			return window.frames[id].document;
		}
			
	}
*/

	function getURLContentToDiv(url, div) {
		var contentdoc = null ;

		var div_el = getElementById(div);

		function contentload(url) {
			if (typeof window.ActiveXObject != 'undefined' ) {
				contentdoc = new ActiveXObject("Microsoft.XMLHTTP");
				contentdoc.onreadystatechange = contentprocess ;
		        } else {
		        	contentdoc = new XMLHttpRequest();
		        	contentdoc.onload = contentprocess ;
		        }
			contentdoc.open( "GET", url, true );
			contentdoc.send( null );
		}
  
		function contentprocess() {
			if ( contentdoc.readyState != 4 )
			  return;

		      	div_el.innerHTML = contentdoc.responseText;
		}

		contentload(url);
	}


	this.getBrowseWidth  = getBrowseWidth;
	this.getBrowseHeight = getBrowseHeight;
	this.getElementById  = getElementById;
	this.getURLContentToDiv = getURLContentToDiv;
//	this.getFrameDocById = getFrameDocById

}

function BrowserDetection() { // Klasse

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isOP    = false;  // Opera
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as Netscape 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }

  s = "MSIE";
  if ((i = ua.indexOf(s))) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
}

var gtools  = new GraphicTools();
var browser = new BrowserDetection();
var cblib   = new CrossBrowserLib();