function $id(id){ return document.getElementById(id); }
function $n(name){ return document.getElementsByName(name); }
function $tn(p, tagName){ return p.getElementsByTagName(tagName); }

function addEvent(e, t, f){
	if(e.attachEvent){
		e.attachEvent('on'+t,f);
	}else if(e.addEventListener){
		e.addEventListener(t,f,false);
	}else{
		e['on'+t] = f;
	}
}

var AgentUI = AgentUI||{};

AgentUI.getBrowser = function(){ 
	var b = "ie6";
	var ua = navigator.userAgent; 
	if(ua.indexOf("compatible")>-1){
		if(ua.indexOf("MSIE 6.0") > -1)
		   b = "ie6"
		else if(ua.indexOf("MSIE 7.0") > -1)
		   b = "ie7";
		else if(ua.indexOf("MSIE 8.0") > -1)
		   b = "ie8";
	}
	else if(ua.indexOf("Gecko") > -1)
		b = "firefox";
  return b;
};

AgentUI.resizeFrame = function(){
	var _this = this;
	window.setTimeout(function(){ _this.resizeFrame(); }, 500);
	try{
		var f1 = $id("mFrame").contentWindow.document.body.scrollHeight;
		var f2 = $id("mFrame").contentWindow.document.documentElement.scrollHeight;
		var fh = this.getBrowser()=="firefox" ? f1 : f2;
		var dh = 420;
		var rh = Math.max(fh, dh, $id("side").scrollHeight)+1;
		$id("mFrame").style.height = rh+"px";
	}catch(E){}
}