// fix document.getElementById in IE7 which get meta named "title" instead of input with id "title"
// http://www.sixteensmallstones.org/ie-javascript-bugs-overriding-internet-explorers-documentgetelementbyid-to-be-w3c-compliant-exposes-an-additional-bug-in-getattributes


(function()
{
	if (/msie/i.test (navigator.userAgent)) //only override IE
	{
		document.nativeGetElementById = document.getElementById;
		document.getElementById = function(id)
		{
			var elem = document.nativeGetElementById(id);
			if(elem)
			{
				//make sure that it is a valid match on id
				if(elem.attributes['id'].value == id)
				{
					return elem;
				}
				else
				{
					//otherwise find the correct element
					for(var i=1;i<document.all[id].length;i++)
					{
						if(document.all[id][i].attributes['id'].value == id)
						{
							return document.all[id][i];
						}
					}
				}
			}
			return null;
		};
	}
})();

