dom.event.addEventListener(window, 'load', init);

var msIE;
var header = 86;
var footer = 56;

function init() {
	
	//msIE6 = (navigator.userAgent.indexOf("MSIE 6") != -1)? true : false;
	msIE = navigator.appVersion.charAt(22);
	var mapScroll = util.$('map_scroll');
	var tree1 = util.$('treeMenu1');
	var tree2 = util.$('treeMenu2');
	var scY = getScreenSize().y;
	//tree1.style.backgroundColor = "#EEEEEE";
	setPosition();
	tree1.style.height = (mapScroll.offsetHeight + mapScroll.offsetTop) - (tree1.offsetHeight+tree1.offsetTop) + tree1.offsetHeight + "px";
	dom.event.addEvent(window, 'resize', setPosition);
}

function setPosition() {
	var mapScroll = util.$('map_scroll');
	var tree1 = util.$('treeMenu1');
	var tree2 = util.$('treeMenu2');
	var scY = getScreenSize().y;
	if(scY > 400) {
		if(document.getElementById('marquee')) {
				var marq = document.getElementById('marquee').offsetHeight;
				mapScroll.style.height = (scY-(header+footer+marq ))+"px";
				if(tree1.style.display =="block") {
					tree1.style.height = (mapScroll.offsetHeight + mapScroll.offsetTop) - (tree1.offsetHeight+tree1.offsetTop) + tree1.offsetHeight + "px";
					ies(36,30);
				}
				if(tree2.style.display =="block") {
					tree2.style.height = (mapScroll.offsetHeight + mapScroll.offsetTop) - (tree2.offsetHeight+tree2.offsetTop) + tree2.offsetHeight + "px";
					ies(36,30);
				}
		} else {
			if(msIE == "6") {
				//util.$("footer").style.marginTop = "-7px";
			}
			mapScroll.style.height = (scY-(header+footer))+"px";
			if(tree1.style.display =="block") {
				tree1.style.height = (mapScroll.offsetHeight + mapScroll.offsetTop) - (tree1.offsetHeight+tree1.offsetTop) + tree1.offsetHeight + "px";
				ies(10,10);
			}
			if(tree2.style.display =="block") {
				tree2.style.height = (mapScroll.offsetHeight + mapScroll.offsetTop) - (tree2.offsetHeight+tree2.offsetTop) + tree2.offsetHeight + "px";
				ies(10,10);
			}
		}
	}
	else {
			mapScroll.style.height = "610px";
			tree1.style.height = "400px";
			tree2.style.height = "400px";
	}
	
}

function ies(ie6Num,ie7Num) {
	var mapScroll = util.$('map_scroll');
	var tree1 = util.$('treeMenu1');
	var tree2 = util.$('treeMenu2');
	if(msIE == "6") {
		if(tree1.style.display != "none") {
			tree1.style.height = ((mapScroll.offsetHeight + mapScroll.offsetTop) - (tree1.offsetHeight+tree1.offsetTop) + tree1.offsetHeight)-ie6Num + "px";
		}
		if(tree2.style.display != "none") {
			tree2.style.height = ((mapScroll.offsetHeight + mapScroll.offsetTop) - (tree2.offsetHeight+tree2.offsetTop) + tree2.offsetHeight)-ie6Num + "px";
		}
				}
	if(msIE == "7") {
			if(tree1.style.display != "none") {
				tree1.style.height = ((mapScroll.offsetHeight + mapScroll.offsetTop) - (tree1.offsetHeight+tree1.offsetTop) + tree1.offsetHeight)-ie7Num + "px";
			}
			if(tree2.style.display != "none") {
				tree2.style.height = ((mapScroll.offsetHeight + mapScroll.offsetTop) - (tree2.offsetHeight+tree2.offsetTop) + tree2.offsetHeight)-ie7Num + "px";
			}
	}
}


function getScreenSize() {
		var obj = new Object();
		obj.x = document.documentElement.clientWidth  || document.body.clientWidth  || document.body.scrollWidth;
		obj.y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;
		obj.mx = parseInt((obj.x)/2);
		obj.my = parseInt((obj.y)/2);
		return obj;
}
