// created 08/07/2007#MA
function XBrowser(){};

	XBrowser.getWindowHeight = function()
	{
		var myHeight = 0;
		var __intIE_TOP_OFFSET = 0;		//110;
		if( typeof( window.innerWidth ) == 'number' )
		{
			//Non-IE
			myHeight = window.innerHeight + __intIE_TOP_OFFSET;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		{
			//IE 6+ in 'standards compliant mode'
			myHeight = document.documentElement.clientHeight + __intIE_TOP_OFFSET;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
			//IE 4 compatible
			myHeight = document.body.clientHeight;
		}
		return parseInt(myHeight);
	}

	XBrowser.getWindowWidth = function()
	{
		var myWidth = 0;
		if( typeof( window.innerWidth ) == 'number' )
		{
			//Non-IE
			myWidth = window.innerWidth;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		{
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
			//IE 4 compatible
			myWidth = document.body.clientWidth;
		}
		return parseInt(myWidth);
	}
	
	XBrowser.getElementLeft = function(strElement)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			return parseInt(objElement.offsetLeft);
		}
		else
		{
			return parseInt(objElement.offsetLeft);
		}
	}
	
	XBrowser.getElementHeight = function(strElement)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			return parseInt(objElement.style.height);
		}
		else
		{
			return parseInt(objElement.style.height);
		}
	}

	XBrowser.getElementWidth = function(strElement)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			return parseInt(objElement.style.width);
		}
		else
		{
			return parseInt(objElement.style.width);
		}
	}

	XBrowser.getElementTop = function(strElement)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			return parseInt(objElement.offsetTop);
		}
		else
		{
			return parseInt(objElement.offsetTop);
		}
	}

	XBrowser.setElementLeft = function(strElement, intPos)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			objElement.offsetLeft = intPos;
		}
		else
		{
			objElement.offsetLeft = intPos + "px";
		}
	}
	
	XBrowser.setElementTop = function(strElement, intPos)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			objElement.offsetTop = intPos;
		}
		else
		{
			objElement.offsetTop = intPos + "px";
		}
	}
	
	XBrowser.setElementHeight = function(strElement, intPos)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			objElement.style.height = intPos;
		}
		else
		{
			objElement.style.height = intPos + "px";
		}
	}
	
	XBrowser.setElementWidth = function(strElement, intPos)
	{
		var objElement = document.getElementById(strElement);
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			objElement.style.width = intPos;
		}
		else
		{
			objElement.style.width = intPos + "px";
		}
	}
	
	XBrowser.setElementPos = function(strElement, intLeftPos, intTopPos)
	{
		var objElement = document.getElementById(strElement);
		objElement.style.left = intLeftPos + "px";
		objElement.style.top = intTopPos + "px";
	}
	
	// created 12/07/2007#ma
	XBrowser.hasScrollBars = function(objBrowser)
	{
		if (objBrowser != null)
			return (document.getElementById(objBrowser).style.scrollbars.indexof("scroll") > -1 ? true : false)
		else
			return false;
	}
	
	XBrowser.MaximiseWindow = function()
	{
		/***********************************************
		* Auto Maximize Window Script- © Dynamic Drive (www.dynamicdrive.com)
		* This notice must stay intact for use
		* Visit http://www.dynamicdrive.com/ for this script and 100's more.
		***********************************************/
		
		top.window.moveTo(0,0);
		if (document.all)
		{
			top.window.resizeTo(screen.availWidth, screen.availHeight);
		}
		else if (document.layers || document.getElementById)
		{
			if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth)
			{
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
			}
		}
	}
	
	XBrowser.showDiv = function(strElement)
	{
		var objElement = document.getElementById(strElement);
		objElement.style.display = 'block';
	}

	XBrowser.hideDiv = function(strElement)
	{
		var objElement = document.getElementById(strElement);
		objElement.style.display = 'none';
	}

	// xGetComputedStyle r7, Copyright 2002-2007 Michael Foster (Cross-Browser.com)
	// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
	XBrowser.xGetComputedStyle = function(e, p)
	{
		e = XBrowser.xGetElementById(e);
		if (e == null)
			return null;
	  
	  	var s, v = 'undefined', dv = document.defaultView;
	  	if(dv && dv.getComputedStyle)
	  	{
			s = dv.getComputedStyle(e, '');
			if (s)
				v = s.getPropertyValue(p);
	  	}
	  	else if(e.currentStyle)
	  	{
			v = e.currentStyle[XBrowser.xCamelize(p)];
	  	}
	  	else
	  		return null;
		
	  	//return i ? (parseInt(v) || 0) : v;
	  	return v;
	}
	
	// xCamelize r1, Copyright 2007 Michael Foster (Cross-Browser.com)
	// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
	XBrowser.xCamelize = function(cssPropStr)
	{
	  	var i, c, a = cssPropStr.split('-');
	  	var s = a[0];
	  	for (i=1; i<a.length; ++i) {
			c = a[i].charAt(0);
			s += a[i].replace(c, c.toUpperCase());
	  	}
	  	return s;
	}
	
	// xGetElementById r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
	// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
	XBrowser.xGetElementById = function(e)
	{
	  if(typeof(e) == 'string')
	  {
		if(document.getElementById)
			e = document.getElementById(e);
		else if(document.all)
			e = document.all[e];
		else
			e=null;
	  }
	  return e;
	}	



	XBrowser.getStyleObject = function(objectId)
	{
		// cross-browser function to get an object's style object given its id
		if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId).style;
		} else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId).style;
		} else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
		} else {
		return false;
    }
	
} // getStyleObject


// xGetComputedStyle r7, Copyright 2002-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xGetComputedStyle(e, p, i)
{
  if(!(e=xGetElementById(e))) return null;
  var s, v = 'undefined', dv = document.defaultView;
  if(dv && dv.getComputedStyle){
    s = dv.getComputedStyle(e,'');
    if (s) v = s.getPropertyValue(p);
  }
  else if(e.currentStyle) {
    v = e.currentStyle[xCamelize(p)];
  }
  else return null;
  return i ? (parseInt(v) || 0) : v;
}


// xGetElementById r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xGetElementById(e)
{
  if(typeof(e)=='string') {
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
  }
  return e;
}


// xCamelize r1, Copyright 2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xCamelize(cssPropStr)
{
  var i, c, a = cssPropStr.split('-');
  var s = a[0];
  for (i=1; i<a.length; ++i) {
    c = a[i].charAt(0);
    s += a[i].replace(c, c.toUpperCase());
  }
  return s;
}
