﻿function $(e){return top.document.getElementById(e);}

function CreatDiv(){
	//外框
	var _d1 = document.createElement("div");
	_d1.id = "_d1";
	_d1.style.position = "absolute";
	_d1.style.border = "solid 0px #ca43d8";
	_d1.style.width = "200px";
	_d1.style.height = "520px";
	_d1.style.left = "0px";
	_d1.style.top = "0px";
	var ey = 0, ex = 0, lx = 0, ly = 0, canDrg = false, thiso = null;
	var _x, _y, rw, rh;
	var ttop, tleft;
	var cDiv = top.document.createElement;
	_d1.onmousedown = function(){
		thiso = this;
		canDrg = true;
		if (!top.document.all) {
			lx = event.clientX;
			ly = event.clientY;
		}
		else {
			lx = event.x;
			ly = event.y;
		}
		if (top.document.all) 
			thiso.setCapture();
	}
	
	_d1.onmousemove = function(){
		if (!top.document.all) {
			_x = e.clientX;
			_y = e.clientY;
		}
		else {
			_x = event.x;
			_y = event.y;
		}
		if (canDrg) {
			var ofsx = _x - lx;
			thiso.style.left = parseInt(thiso.style.left) + ofsx;
			lx = _x;
			var ofsy = _y - ly;
			thiso.style.top = parseInt(thiso.style.top) + ofsy;
			ly = _y;
		}
	}
	
	_d1.onmouseup = function(){
		canDrg = false;//拖拽变量设为false
		if (top.document.all && thiso != null) { //ie下，将清捕获;
			thiso.releaseCapture();
			thiso = null;
		}
	}
	document.body.appendChild(_d1);
	//头部
	var _d2 = cDiv("div");
	_d2.id = "_d2";
	_d2.style.cursor = "move"
	_d2.style.backgroundColor = "#ca43d8";
	_d2.style.color = "white";
	_d2.style.fontWeight = "bold";
	_d2.style.fontSize = "10pt";
	_d2.style.padding = "3px";
	_d2.style.height = "15px";
	_d1.appendChild(_d2);
	//主题
	var _d3 = cDiv("div");
	_d3.style.styleFloat = "left";
	_d3.innerHTML = "在线列表";
	//关闭
	var _d4 = cDiv("div");
	_d4.style.styleFloat = "right";
	_d4.style.cursor = "hand"
	_d4.innerHTML = "关闭";
	_d4.onclick = function(){
		_d1.parentNode.removeChild(_d1);
	}
	_d2.appendChild(_d3);
	_d2.appendChild(_d4);
	//内容
	var _d5 = cDiv("div");
	_d1.appendChild(_d5);
	var frm = cDiv("iframe");
	frm.id="iframelist";
	frm.setAttribute('frameborder', '0', 0);
	frm.style.width = "200px";
	frm.style.height = "520px";
	frm.src = "http://www.liehunwang.com/html/liaolist.html";
	_d5.appendChild(frm);
	reloadfrm();	
}

function reloadfrm(){
 window.frames["iframelist"].location.reload();
} 
