if (!document.defaultView)
{
	document.defaultView = function ()
	{
	}
}

if (!ComputedCSSStyleDeclaration)
{
	function ComputedCSSStyleDeclaration(element)
	{
		this.o = element;
		
		this.getPropertyValue = function(p)
		{
			var newP;

			if (this.o.currentStyle)
			{
			
				// Convert CSS values like "line-height" into mullered values like "lineHeight"
				
				if (p.indexOf('-') > -1)
				{
					newP = "";
					
					for (var a = 0; a < p.length; a++)
					{
						if (p.substr(a, 1) == '-')
						{
							a++;
							if (a < p.length)
							{
								newP += p.substr(a, 1).toUpperCase();
							}
						}
						else
						{
							newP += p.substr(a, 1);
						}
					}
				}
				else
				{
					newP = p;
				}
				return eval("this.o.currentStyle." + newP);
			}
		}
	}
	
}

if (!document.defaultView.getComputedStyle)
{
	document.defaultView.getComputedStyle = function (element, other)
	{
		this.other = other
		var CCSS = new ComputedCSSStyleDeclaration(element);
		return CCSS;
	}
}

if (!document.getElementsByTagNameAndClass)
{

	document.getElementsByTagNameAndClass = function (TagName, ClassName)
	{
		var aAllElements = document.getElementsByTagName(TagName);
		var aElements = new Array();
		var i;
		var x;
		
		x = 0;
		
		for (i = 0; i < aAllElements.length; i++)
		{
			if (aAllElements[i].className == ClassName)
			{
				aElements[x++] = aAllElements[i];
			}
		
		}
		return aElements;
	}
}

if (!document.getElementById)
{
	if (document.all)
	{
		document.getElementById = function (elementId)
		{
			return eval("document.all." + elementId)
		}
	}
}

if (!document.getElementsByClass)
{

	document.getElementsByClass = function (ClassName)
	{
		// Warning: IE makes this run very slowly!
		return this.getElementsByTagNameAndClass("*", ClassName);
	}
	/*
		var aAllElements = document.getElementsByTagName("*");
		var aElements = new Array();
		var i;
		var x;
		
		x = 0;
		
		for (i = 0; i < aAllElements.length; i++)
		{
			if (aAllElements[i].className == ClassName)
			{
				aElements[x++] = aAllElements[i];
			}
		}
		return aElements;
	}
	*/

/*
	document.getElementsByClass = function (needle)
	{
	  function _GetElementsByClass(outArray, seed, needle)
	  {
	    while (seed) {
	      if (seed.nodeType == Node.ELEMENT_NODE) {
		if (seed.hasAttribute("class")) {
		  var c = " " + seed.className + " ";
		  if (c.indexOf(" " + needle + " ") != -1)
		    outArray.push(seed);
		}
		_GetElementsByClass(outArray, seed.firstChild, needle)
	      }
	      seed = seed.nextSibling;
	    }
	  }
	
	  var outArray = new Array();
	  _GetElementsByClass(outArray, document.documentElement, needle);
	  return outArray;
	}
*/
}



// Ok so this isn't DOM....
window.innerHeightX = function ()
{
	if (!window.innerHeight)
	{
		if (document.documentElement && document.documentElement.clientHeight)
		{
			return document.documentElement.clientHeight;
		}
		else if (document.body)
		{
			return document.body.clientHeight;
		}
		else
		{
			return 0;
		}
	}
	else
	{
		return window.innerHeight;
	}
}

if (!window.innerWidth)
{
	window.innerWidth = function()
	{
		if (document.documentElement && document.documentElement.clientWidth)
		{
			return document.documentElement.clientWidth;
		}
		else if (document.body)
		{
			return document.body.clientWidth;
		}
	}
}

// Keypress trapping

if (!document.addEventListener && document.attachEvent)
{
	document.addEventListener = function(eventToWatch, functionToCall, l)
	{
		document.attachEvent("on" + eventToWatch, functionToCall);
	}
}

if (!window.sidebar && window.external)
{
	window.sidebar = function()
	{
	}
	window.sidebar.addPanel = function(title, contentURL, customizeURL)
	{
		window.external.addFavorite(contentURL, title);
	}
}
