//Begin client detection
//The code below is needed for categorylist page to work propertly on all the browsers
//Browsers tested: PC - IE 5.x, Netscape 4.x, Netscape 6, Mozilla. Mac - IE 5.x, Netscape 4.x
//The code below solves the following problems:
//1. Getting the correct placement of the divs on the page. That includes making sure that
//   if header part becomes larger in height, the divs would move down, left and right divs
//   align propertly to each other and with correct background color (for Netscape browsers),
//   the bottom div is aligned vertically under the left div and does not have an extra space
//   in between itself and the left/right divs.
//   Also, includes the fix for the Mac IE browser. On Mac IE, there is a bug that moves each
//   table (except for the very first one) inside the div to the right the same amount of
//   space as the div itself. Made sure that it doesn't happen.
//2. For Netscape browsers, making sure that all the links and linked images can be clickable.
//   There is a problem on Netscape browser that it moves the text of the link or image 
//   together with the div, but it doesn't move the link itself. Because of this, when user
//   tries to click on the link or the image, he/she can't unless they move the mouse to the
//   left of the link/image. Made sure that doesn't happen.

var isNS4 = (document.layers) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;
var isNS6 = (!document.all && document.getElementById) ? true : false;
var isMacIE = false
var strUA = navigator.userAgent.toLowerCase();

if (strUA.indexOf('mac') != -1)
{
	isMacIE = true;
}

function setDivs(strColor)
{
	var leftDivHeight;
	var rightDivHeight;

	if (isNS4)	//for netscape 4
	{
		leftDivHeight = document.layers["leftdiv"].clip.height;
		rightDivHeight = document.layers["rightdiv"].clip.height;
		document.layers["leftdiv"].bgColor = strColor;

		if (leftDivHeight > rightDivHeight)
		{
			document.height = document.height + document.layers["leftdiv"].clip.height + document.layers["bottomsection"].clip.height;
			document.layers["bottomsection"].moveTo(0, document.layers["leftdiv"].top + document.layers["leftdiv"].clip.height );
		}
		else
		{
			document.height = document.height + document.layers["rightdiv"].clip.height + document.layers["bottomsection"].clip.height;
			document.layers["bottomsection"].moveTo(0, document.layers["rightdiv"].top + document.layers["rightdiv"].clip.height );
			document.layers["leftdiv"].clip.height = document.layers["rightdiv"].clip.height;
		}
	}
	else if (isIE5)		//for ie
	{
		leftDivHeight = leftdiv.offsetHeight;
		rightDivHeight = rightdiv.offsetHeight;
			
		if (leftDivHeight > rightDivHeight)
		{
			//bottomsection.style.left = leftdiv.offsetLeft;
			bottomsection.style.top = leftdiv.offsetHeight + leftdiv.offsetTop;
		}
		else
		{
			if (!isMacIE)
			{
				bottomsection.style.top = rightdiv.offsetHeight + rightdiv.offsetTop;
			}
			leftdiv.style.height = rightdiv.offsetHeight;
		}

		if (isMacIE)
		{
			leftdiv.style.backgroundColor = strColor;
			rightdiv.style.backgroundColor = "white";
			var newHeight = document.body.offsetHeight + bottomsection.offsetHeight;
			document.body.style.height = document.body.offsetHeight + 100;
		}
		bottomsection.style.visibility = 'visible';
	}
	else if	(isNS6)		//for netscape 6, mozilla
	{
		leftDivHeight = document.getElementById("leftdiv").offsetHeight;
		rightDivHeight = document.getElementById("rightdiv").offsetHeight;
		if (leftDivHeight > rightDivHeight)
		{
			//document.getElementById("bottomsection").style.left = document.getElementById("leftdiv").offsetLeft;
			document.getElementById("bottomsection").style.top = document.getElementById("leftdiv").offsetHeight + document.getElementById("leftdiv").offsetTop;
		}
		else
		{
			document.getElementById("bottomsection").style.top = document.getElementById("rightdiv").offsetHeight + document.getElementById("rightdiv").offsetTop;
			document.getElementById("leftdiv").style.height = document.getElementById("rightdiv").offsetHeight;
		}
		document.getElementById("bottomsection").style.visibility = 'visible';
	}
}

