function fixNavHeights(insideID,insideID2)
{
	var left = document.getElementById("navwrapper");
	var right = document.getElementById(insideID);
	
	var leftHeight = left.scrollHeight + 80;
	var rightHeight = right.scrollHeight;
	
	var expandLeft = document.getElementById("navfiller");
	var expandRight = document.getElementById(insideID2);
	
	if(leftHeight > rightHeight)
	{
		var add = leftHeight-rightHeight;
		var current = expandRight.scrollHeight;
		var sum = add+current;
		
		if(detectBrowser() == "Microsoft Internet Explorer")
		{
			expandRight.style.height = sum  + "px";
		}
		else
		{
			expandRight.style.setProperty("height",sum+"px","");
		}
	}
	else if(leftHeight < rightHeight)
	{
		var add = rightHeight-leftHeight;
		var current = expandLeft.scrollHeight;
		var sum = add+current;
		
		if(detectBrowser() == "Microsoft Internet Explorer")
		{
			expandLeft.style.height = sum  + "px";
		}
		else
		{
			expandLeft.style.setProperty("height",sum+"px","");
		}
	}
	
	//alert(leftHeight + " " + rightHeight);
}

//Makes all columns the same height.
function fixColumnsHeights(insideID)
{
	var highest = 0;
	
	var wrapper = document.getElementById("wrapper");
	var col1 = document.getElementById("content");
	var col2 = document.getElementById(insideID);
	//var navfiller = document.getElementById("navfiller");
	//var navigation = document.getElementById("navigation");
	
	//if(insideID == "home_inside")
	//	var rightnavfiller = document.getElementById("rightnavfiller");
	//else
	//	var rightnavfiller = document.getElementById("rightnavfiller_main");
	
	//Array to store the heights of the columns
	var nums = new Array()
	nums[0] = wrapper.scrollHeight;
	nums[1] = col1.scrollHeight;
	nums[2] = col2.scrollHeight;
	
	
	for(var i=0;i<3;i++)
	{
		if(nums[i] > highest) highest = nums[i];
	}
	
	
	//THE overSum is the amount of space before we get to the navfiller
	//148 is the height of #top_1 (or the search area etc.)
	//160 is the space from the end of top_1 up to the point where the left nav starts
	//35 is the area for the footer of the left column (the rounded area)
	//var overSum = 148 + 160 + 35 + navigation.scrollHeight;
	//var navfillerHeight = highest - overSum;
	
	
	//var rightoverSum = 148;
	//var rightnavfillerHeight = highest - rightoverSum;
	
	if(detectBrowser() == "Microsoft Internet Explorer")
	{
		col1.style.height = highest  + "px";
		wrapper.style.height = highest  + "px";
		
		//if(navfillerHeight > 100)
		//{
		//	navfiller.style.height = navfillerHeight  + "px";
		//}
		
		//rightnavfiller.style.height = rightnavfillerHeight  + "px";
		
		//if(insideID == "home_inside")
		//	col2.style.height = highest + 190  + "px";
		//else
			//col2.style.height = highest  + "px";
	}
	else
	{
		col1.style.setProperty("height",highest+"px","");
		//col2.style.setProperty("height",highest+"px","");
		wrapper.style.setProperty("height",highest + "px","");
		
		//if(navfillerHeight > 100) 
		//{
		//	navfiller.style.setProperty("height",navfillerHeight + "px","");
		//}
		//else
		//{
		//	navfiller.style.setProperty("height",navfillerHeight + 10 + "px","");
		//}
		//rightnavfiller.style.setProperty("height",rightnavfillerHeight + "px","");
	}
}

/*	Detects the browser */
function detectBrowser()
{
	var browser=navigator.appName;
	return browser;
}

function changeBG(elementID,color,activate)
{
	//The anchor
	var element = document.getElementById(elementID);
	
	if(activate) changeLinkColor(element,"white");
	else changeLinkColor(element,"black");
	
	if(detectBrowser() == "Microsoft Internet Explorer")
	{
		element.style.backgroundColor = color;
	}
	else
	{
		element.style.setProperty("background-color",color,"");
	}
}

function changeLinkColor(element,linkColor)
{
	
	if(detectBrowser() == "Microsoft Internet Explorer")
	{
		element.style.color = linkColor;
	}
	else
	{
		element.style.setProperty("color",linkColor,"");
	}
}

function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}

function resizeImages(c, imageID)
{
	// size image
	// set constant--this is the max width and height 
	var constant = c;
	var imgW = 0;
	var imgH = 0;
	// get width and height of image
	imgW = document.getElementById('asset' + imageID);
	imgW = imgW.scrollWidth;
	imgH = document.getElementById('asset' + imageID);
	imgH = imgH.scrollHeight;
	
	if (imgH  > imgW)
	{
		document.getElementById('asset' + imageID).height = constant;
		var new_width = Math.ceil((constant*imgW)/imgH);
		document.getElementById('asset' + imageID).width = new_width;
	}
	else if(imgW > imgH)
	{
		document.getElementById('asset' + imageID).width = constant;
		var new_height = Math.ceil((constant*imgH)/imgW);
		document.getElementById('asset' + imageID).height = new_height;
	}
	//If they are the same, they both become the constant
	else 
	{
		document.getElementById('asset' + imageID).height = constant;
		document.getElementById('asset' + imageID).width = constant;
	}
}