var baseDivName = "zsMDiv"; //最外边的DIV的ID
var topDivName = "zsTDiv"; //DIV内，顶部DIV的ID
var divFrameName = "zsSubmits"; //DIV内，IFRAME的ID
var baseURL = "http://www.zhuansoo.com/doubt/kh/"; //网站的绝对地址，以下调用的文件 是该地址的相对地址
var _defaultHeight = 1; //层的默认高度
var username; //用户名
var openORclose='o'; //默认 层是打开 还是关闭，o:表示打开
var divWhere='br'; //层的位置，默认 右下角，tr:右上角 bl:左下角
var imageName1 = 'openIcon'; //第一个图表名
var imageName2 = 'closeIcon'; //第二个图表名

/**层的出现方式*/
function divCome() {
	var framObj = document.getElementById(divFrameName);
	framObj.height=_defaultHeight;
	if(_defaultHeight<=201){
		_defaultHeight += 5;
		window.setTimeout("divCome()","10");
	}else{
		getCorG('c');
	}
}
/**层的缩小方式*/
function divGo() {
	var framObj = document.getElementById(divFrameName);
	framObj.height=_defaultHeight-5;
	
	if(_defaultHeight>1){
		_defaultHeight -= 5;
		window.setTimeout("divGo()","10");
	}else{
		getCorG('f');
	}
}
/**返回顶部层，是显示缩小 还是显示 放大*/
function getCorG(corg) {
	var _image1 = document.getElementById(imageName1);
	var _image2 = document.getElementById(imageName2);
	if(corg=='c'){
		_image2.style.display='none';
		_image1.style.display='block';
	}
	if(corg=='f'){
		_image1.style.display='none';
		_image2.style.display='block';
	}
}

function showDiv() {
	var divClass = "position: absolute;z-index: 9999;width: 200;top:expression((document.body.clientHeight-this.offsetHeight-1)+document.body.scrollTop);left:expression(document.body.clientWidth-this.offsetWidth-1);";
	var divTableImage = 'index_08_2.gif';
	if(divWhere=='tr'){
		divTableImage = "index_08.gif";
		divClass = "position: absolute;z-index: 9999;width: 200;top:expression(this.offsetHeight-this.offsetHeight+document.body.scrollTop+1);left:expression(document.body.clientWidth-this.offsetWidth-1);";
	}else if(divWhere=='bl'){
		divClass = "position: absolute;z-index: 9999;width: 200;top:expression((document.body.clientHeight-this.offsetHeight)+document.body.scrollTop);left:expression(this.offsetWidth-this.offsetWidth+1);";
	}
	var rootDivStart = "<div id='"+baseDivName+"' style='"+divClass+"'>";
	var titleDiv = "<div id='"+topDivName+"' style='width: 200;height: 24;text-align:right;'>"+'<table width="200" border="0" cellspacing="0" cellpadding="0"><tr><td height="24" align="right" valign="top" background="'+baseURL+'images/'+divTableImage+'"><a href="http://www.zhuansoo.com/" target="_blank" title="查留学信息 上留学专搜"><div style="width:52px;height:10px;margin-top:3px;margin-left: 4px;float:left;cursor: hand;"></div></a><img style="display:none;" id="'+imageName1+'" src="'+baseURL+'images/index_03.gif" alt="" width="31" height="18" hspace="5" vspace="1" border="0" onclick="divGo();return false;"/><img style="display:none;" id="'+imageName2+'" src="'+baseURL+'images/index_05.gif" alt="" width="31" height="18" hspace="5" vspace="1" border="0" onclick="divCome();return false;"/></td></tr></table>'+"</div>";
	var iframeDiv = "<IFRAME width='200' src='"+baseURL+"mess.jsp?uid="+username+"' id='"+divFrameName+"' height='0' frameborder='0' marginwidth='0' marginheight='0' scrolling='no'></IFRAME>";
	var rootDivEnd = "</div>";
	document.write(rootDivStart+ (divWhere=='tr'?(titleDiv+iframeDiv):(iframeDiv+titleDiv)) +rootDivEnd);
	if(openORclose=='c'){
		divGo();
	}else{
		window.setTimeout("divCome()","2000");
	}
}

function CreateZS() {
	this.show=function(bot,ooc,uid){
		if(bot!=null){
			divWhere = bot;
		}
		if(ooc!=null){
			openORclose = ooc;
		}
		username = encodeURIComponent(uid);
		showDiv();
	}
}
CreateDiv = new CreateZS();
CreateDiv.show(st,'o',uid);