// JavaScript Document
//the log function requires jquery
function log(msg){
	if($){
		if($.browser.mozilla){
			console.log(msg);
		}
	}
}

function fix_height(){
	//get the location height
	//get the leftbar height;
	//get the mainarea height;
//	alert("fix height started!");
	var loc_h = 0, left_h = 0, main_h = 0;
	var loc = document.getElementById("location");
	if(!loc) return;
	var left = document.getElementById("leftbar");
	if(!left) return;
	var main = document.getElementById("mainarea");
	if(!main) return;
	
	loc_h = loc.offsetHeight;
	left_h = left.offsetHeight;
	main_h = main.offsetHeight;
	

	
//	alert("Location height: "+loc_h);
//	alert("Leftbar height: "+left_h);
//	alert("Mainarea height: "+main_h);

	var m_h = loc_h+main_h;
	if(m_h == left_h){
//		alert("Everything is equal\n");
		return;
	}else if(m_h < left_h){
//		alert("Main is too small\n");
//		var new_mh = left_h-loc_h;
		var spacer = left_h-m_h;
//		alert("Will set mainarea spacer to: "+spacer);
		var ms = document.getElementById("mainarea-spacer");
		if(ms) ms.height = spacer;
		else{
			alert("not found!");
		}
//		alert("Will set mainarea height to: "+new_mh);	
		//main.style.height=new_mh-1;
		return;
	}else if(m_h > left_h){
//		alert("Main is too big\n");
//		alert("will set leftbar height to :"+m_h);
//		alert("Before: "+left.offsetHeight);
		var spacer = m_h-left_h;
//		alert("will set leftbar spacer height to: "+spacer);
		var ls = document.getElementById("leftbar-spacer");
		if(ls) ls.height = spacer;
//		left.style.height = m_h-1;
//left.setAttribute("height", m_h);
//		alert("After: "+left.offsetHeight);
//		aleft("After: "+left.style.height);
//		left.offsetHeight=m_h;
		return;
	}

}