 /******************************
 *  BROWSWER AND SOHO FIXES    *
 *  BY MATT WILCOX             *
 *	CLS VISUAL COMMUNICATIONS  *
 *	http://www.clsvis.com      *
 *******************************/

function addSub(){
	var currentLocation = document.location.toString();
	var check = currentLocation.substring(7,10);
	var secure = currentLocation.indexOf('s');
	var urlLength = currentLocation.length;
	var protocol = 'http://';
	var subDomain = 'www';
	var output;
	if (secure != 4)
	{
		if (check != subDomain)
		{
			output = protocol + subDomain + '.' + currentLocation.substring(7,urlLength);
			window.location=output;
		}
	}
}

function menuStyle() {
	var myList = document.getElementById('HMAINS').getElementsByTagName('a');
	var lastItem = myList.length-1;
	myList[lastItem].style.border="none";
}

function equalCols () {
	if(document.getElementById('rel-wrapper'))
	{
		var leftHeight = document.getElementById('abs-wrapper').offsetHeight - 125;
		var rightHeight = document.getElementById('abs-wrapper').offsetHeight - 145;
		var minHeight = document.getElementById('VMAINS').offsetHeight + 122;
		if(minHeight > leftHeight)
		{
			leftHeight = minHeight + 30;
			rightHeight = minHeight;
		}
		leftHeight = leftHeight.toString() + 'px';
		rightHeight = rightHeight.toString() + 'px';	
		document.getElementById('left-navigation-container').style.height=leftHeight;
		document.getElementById('rel-wrapper').style.height=rightHeight;
	}
}

function footerTopPosition(){
	var top = document.getElementById('abs-wrapper').offsetHeight + 15;
	top = top.toString() + 'px';
	document.getElementById('footer').style.top=top;
}

function indexRequestImageTopPosition(){
	if(document.getElementById('index-request-help'))
	{
		var imgTop = document.getElementById('VMAINS').offsetHeight + 60;
		imgTop = imgTop.toString() + 'px';
		document.getElementById('index-request-help').style.top=imgTop;
		document.getElementById('index-request-help').style.visibility="visible";
	}
}

function screenFix() {
	var screenW = screen.width;
	var negativeMargin = 405;
	var screenMargin = (screenW * .95) / 2;
	
	if (screenMargin <= negativeMargin)
	{
		document.getElementById('abs-wrapper').style.margin="0px";
		document.getElementById('abs-wrapper').style.left="0px";
	}	
}

function init(){
	var thisVersion = navigator.appVersion.toString().substring(17,25);
	var badVersion = 'MSIE 6.0';
	if (thisVersion == badVersion)
	{
		addSub();
	}
	screenFix();
	menuStyle();
	equalCols();
	footerTopPosition();
	indexRequestImageTopPosition();
}

window.onload=init;