function truebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function getedge(){
	var edge;
	edge = truebody().clientWidth ? truebody().clientWidth : window.innerWidth&&truebody().offsetHeight<=window.innerHeight? window.innerWidth :  window.innerWidth? window.innerWidth-20 : 0;
	edge += window.pageXOffset? window.pageXOffset : truebody().scrollLeft? truebody().scrollLeft: 0;
	return edge;
}

function movein(el_id){
	var menu = document.getElementById(el_id);
	if(menu.moving) clearTimeout(menu.moving);

	if(parseInt(menu.style.width)+10<menu.maxwidth){
		menu.style.width = (parseInt(menu.style.width)+10)+'px';
		menu.moving = setTimeout(function(){movein(menu.id)}, menu.menuspeed)
	}
	else{
		menu.style.width = menu.maxwidth+'px';
	}
}

function moveout(el_id){
	var menu = document.getElementById(el_id);
	if(menu.moving) clearTimeout(menu.moving);
	menu.moving=setTimeout(function(){moveout1(menu.id)}, menu.menupause);
}

function moveout1(el_id){
	var menu = document.getElementById(el_id);
	if(menu.moving) clearTimeout(menu.moving);

	if(parseInt(menu.style.width)-10>menu.minwidth){
		menu.style.width = (parseInt(menu.style.width)-10)+'px';
		menu.moving = setTimeout(function(){moveout1(menu.id)}, menu.menuspeed)
	}
	else{
		menu.style.width = menu.minwidth+'px';
	}
}

function init_right_menu(){
	var menu = document.getElementById('rightmenu');
	var bar = document.getElementById('rightmenu_bar');
	var m1 = menu.getElementsByTagName('div')[0];

	menu.menupause="500";
	menu.menuspeed="20";
	menu.maxwidth = menu.offsetWidth;
	menu.minwidth = bar.offsetWidth;
	//menu.style.width = bar.offsetWidth+'px';
	menu.style.width = menu.offsetWidth+'px';
	
	//menu.style.height = m1.offsetHeight+'px';
	//if(menu.kviewtype=='absolute') menu.style.left=getedge()-menu.offsetWidth+'px';
}

function out(st){
document.getElementById('txtout').value = st;
}

if (window.attachEvent) window.attachEvent("onload", init_right_menu);
else if (window.addEventListener) window.addEventListener("load", init_right_menu, false);
