//place content at 100% height and make columns match in height
$(document).ready(function(){

	var viewportwidth;
	var viewportheight;	 
	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight	 
	 if (typeof window.innerWidth != 'undefined')
	 {
		  viewportwidth = window.innerWidth,
		  viewportheight = window.innerHeight
	 }
	 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)	
	 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientWidth !=
		 'undefined' && document.documentElement.clientWidth != 0)
	 {
		   viewportwidth = document.documentElement.clientWidth,
		   viewportheight = document.documentElement.clientHeight
	 }	 
	 // older versions of IE	 
	 else
	 {
		   viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		   viewportheight = document.getElementsByTagName('body')[0].clientHeight
	 }
	
	var nVer = navigator.appVersion;
	var nAgt = navigator.userAgent;
	var browserName  = '';
	var fullVersion  = 0; 
	var majorVersion = 0;
	
	if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
		 browserName  = "Microsoft Internet Explorer";
		 fullVersion  = parseFloat(nAgt.substring(verOffset+5));
		 majorVersion = parseInt(''+fullVersion);
		 if (majorVersion == 6) {
				var viewportheight2 = viewportheight - 211 + "px";
				var viewportheight = viewportheight + "px";
			} else if (majorVersion == 7) {
				var viewportheight2 = viewportheight - 221 + "px";
				var viewportheight = viewportheight + "px";
			} else if (majorVersion == 8) {
				var viewportheight2 = viewportheight - 221 + "px";
				var viewportheight = viewportheight + "px";
			}
		}
		// In Firefox, the true version is after "Firefox" 
		 else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
		 browserName  = "Firefox";
		 fullVersion  = parseFloat(nAgt.substring(verOffset+8));
		 majorVersion = parseInt(''+fullVersion);
		 var viewportheight2 = viewportheight - 210 + "px";
		 var viewportheight = viewportheight + "px";
		}
		// In Safari, the true version is after "Safari"
		else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
	 	browserName  = "Safari";
	 	fullVersion  = parseFloat(nAgt.substring(verOffset+8));
	 	majorVersion = parseInt(''+fullVersion);
		var viewportheight2 = viewportheight - 211 + "px";
		var viewportheight = viewportheight + "px";
		}
	

	
	//var viewportheight2 = viewportheight - 316 + "px";
	//var viewportheight = viewportheight + "px";
	//document.getElementById('container-bg').style.height = viewportheight;
	document.getElementById('container').style.minHeight = viewportheight;	
	document.getElementById('small-left-column').style.height = viewportheight2;
	
	  
	var small_left_height = $('#small-left-column').height();
	var small_right_height = $('#small-right-column').height();
	var small_middle_height = $('#small-middle-column').height();

	if(small_right_height > small_middle_height) {
		$('#small-left-column').height(small_right_height);
		var small_right_height2 = $('#small-right-column').height() - 61;
		$('#small-left-column .content').height(small_right_height2);

		$('#small-middle-column').height(small_right_height);
	  }
	else if(small_left_height > small_middle_height) {
		if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
		 browserName  = "Microsoft Internet Explorer";
		 fullVersion  = parseFloat(nAgt.substring(verOffset+5));
		 majorVersion = parseInt(''+fullVersion);
		 if (majorVersion == 6) {
				var small_left_height2 = $('#small-left-column').height() - 66;
			} else if (majorVersion == 7) {
				var small_left_height2 = $('#small-left-column').height() - 61;
			}
		}
		// In Firefox, the true version is after "Firefox" 
		else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
		 browserName  = "Firefox";
		 fullVersion  = parseFloat(nAgt.substring(verOffset+8));
		 majorVersion = parseInt(''+fullVersion);
		 var small_left_height2 = $('#small-left-column').height() - 60;
		}
		// // In Safari, the true version is after "Safari" 
		else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
	 	 browserName  = "Safari";
	 	 fullVersion  = parseFloat(nAgt.substring(verOffset+8));
	 	 majorVersion = parseInt(''+fullVersion);
		 var small_left_height2 = $('#small-left-column').height() - 60;
		}
		$('#small-left-column .content').height(small_left_height2);
		$('#small-middle-column').height(small_left_height);
		$('#small-right-column').height(small_left_height);
	  }
	else if(small_middle_height > small_left_height) {
		$('#small-left-column').height(small_middle_height);
		if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
		 browserName  = "Microsoft Internet Explorer";
		 fullVersion  = parseFloat(nAgt.substring(verOffset+5));
		 majorVersion = parseInt(''+fullVersion);
		 if (majorVersion == 6) {
				var small_middle_height2 = $('#small-middle-column').height() - 66;
			} else if (majorVersion == 7) {
				var small_middle_height2 = $('#small-middle-column').height() - 61;
			}
		}
		// In Firefox, the true version is after "Firefox" 
		else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
		 browserName  = "Firefox";
		 fullVersion  = parseFloat(nAgt.substring(verOffset+8));
		 majorVersion = parseInt(''+fullVersion);
		 var small_middle_height2 = $('#small-middle-column').height() - 60;
		}
		$('#small-left-column .content').height(small_middle_height2);
		$('#small-right-column').height(small_middle_height);
		}

		//toggle drop down for products link on all global pages
		$("ul.sidenav li.products").click(function() {
			$("ul.sidenav li.products").toggleClass("on");
			$("ul.extra").toggle("slow");			
		});

});


//startList = function() {
//	if (document.all&&document.getElementById) {
//		navRoot = document.getElementById("nav");
//		for (i=0; i<navRoot.childNodes.length; i++) {
//			node = navRoot.childNodes[i];
//			if (node.nodeName=="LI") {
//				node.onmouseover=function() {
//					this.className+=" over";
//				}
//				node.onmouseout=function() {
//					this.className=this.className.replace(" over", "");
//				}
//			}
//		}
//	}
//}
//window.onload=startList;

