// Universal event handler
// Please don't use "onload = functionName" etc
// use instead this "addEvent(window, 'load', functionName);"
function addEvent(obj, strEvent, objFunction)
{ 
	if (obj.addEventListener)
	{ 
		obj.addEventListener(strEvent, objFunction, true); 
		return true; 
	}
	else if (obj.attachEvent)
	{ 
		var returnValue = obj.attachEvent("on"+strEvent, objFunction); 
		return returnValue; 
	} 
	else return false; 
}


if (screen.width <= 800)
{
	document.write('<link rel="stylesheet" href="../_css/800.css" type="text/css" media="screen, projection, print, all">');
}

/////////////////////////////////////

function resizeHpBoxes() 
{
	if (document.getElementById('homeBody'))
	{
		var arrPageDivs = document.getElementsByTagName('DIV');
		var arrBoxes;
		var lBoxHeadCurHeight, lBoxCellCurHeight;
		var lBoxHeadMaxHeight = 0;
		var lBoxCellMaxHeight = 0;
		var i, j;
		var lPadCompTH = document.all ? 8 : 0;
		var lPadCompTD = document.all ? 12 : 0;
		for (i = 0; i < arrPageDivs.length; i++ )
		{
			if (arrPageDivs[i].className == 'hpFeaturesLine')
			{
				arrBoxes = arrPageDivs[i].getElementsByTagName('TABLE');
				for (j = 0; j < arrBoxes.length; j++)
				{
					lBoxHeadCurHeight = arrBoxes[j].getElementsByTagName('TH')[0].offsetHeight;
					lBoxCellCurHeight = arrBoxes[j].getElementsByTagName('TD')[0].offsetHeight;
					if (lBoxHeadCurHeight > lBoxHeadMaxHeight) lBoxHeadMaxHeight = lBoxHeadCurHeight;
					if (lBoxCellCurHeight > lBoxCellMaxHeight) lBoxCellMaxHeight = lBoxCellCurHeight;
				}
				for (j = 0; j < arrBoxes.length; j++)
				{
					arrBoxes[j].getElementsByTagName('TH')[0].style.height = (lBoxHeadMaxHeight - lPadCompTH) + 'px';
					arrBoxes[j].getElementsByTagName('TD')[0].style.height = (lBoxCellMaxHeight - lPadCompTD) + 'px';
				}
			}
		}
	}
}
addEvent(window, 'load', resizeHpBoxes);
