// JS for FLOW3 website, requires jQuery
// @author christian jul jensen, http://mocsystems.com

equalHeightCols = {
	selectors: '#innerleft, #centercolumn, #rightcolumn',

	colHeight: null,
	adjustification : 0,
	resize: function() {
		$(equalHeightCols.selectors)
		.each(
			function(){
				equalHeightCols.colHeight = Math.max($(this).height(),equalHeightCols.colHeight);
				// changed from 150 to 340 by Ken
				if(equalHeightCols.colHeight < 340) {
					equalHeightCols.colHeight = 340;
				}

			}
		).each(
			function(){
				if($(this).attr("id") == 'innerleft'){
					//equalHeightCols.adjustification = 0;
					if($(".leftcolsaved").length > 0){
					//	equalHeightCols.adjustification = $(".leftcolsaved").height()-55;
					}
					if($(".sMultifile").length > 0) {
						equalHeightCols.adjustification += 115;//$("li.sMultifile").height();
					}
					var searchBoxHeight = $('#search').height()+42;
					var totalpadding = 0;
					$('#columncontent').find('div').each(function(){
						totalpadding += parseInt($(this).css('paddingTop'))+parseInt($(this).css('paddingBottom'));
					});
					$(this).height(equalHeightCols.colHeight+equalHeightCols.adjustification-searchBoxHeight+totalpadding);
					if($(this).height() < $('#columncontent').height()){
						$(this).height($('#columncontent').height());
					}
					if($.browser.msie){
						$(this).height($(this).height()+5);
					}
					//$(this).height(equalHeightCols.colHeight+adjustification);
				}else{
					//$(this).height(equalHeightCols.colHeight);
					$(this).height(equalHeightCols.colHeight+equalHeightCols.adjustification);
				/*	if($(this).attr("id") == 'centercolumn' && $(".specscal").length > 0){
						$(this).css({"height":"auto"});
					} */
					if($(this).attr("id") == 'centercolumn'){
						$(this).css({"height":"auto"});
					}
				}
			}
		);
	}
}

doc = {
	load : function() {
		$(document).resize(doc.resize);
		doc.resize();
	},

	resize : function() {
		equalHeightCols.resize();
	}
}

$(doc.load);