function show(){
var iWidth = document.documentElement.clientWidth;
var iHeight = document.documentElement.clientHeight;
var bgObj = document.createElement("div");
bgObj.setAttribute("id","bgbox");
bgObj.style.width = iWidth+"px";
bgObj.style.height =Math.max(document.body.clientHeight, iHeight)+"px";
document.body.appendChild(bgObj);
var oShow = document.getElementById('show');
oShow.style.display = 'block';
oShow.style.left = (iWidth-302)/2+"px";
oShow.style.top = (iHeight-202)/2+"px";
var oClosebtn = document.createElement("span");
oClosebtn.innerHTML = "×";
oShow.appendChild(oClosebtn);
function oClose(){
oShow.style.display = 'none';
document.body.removeChild(bgObj);
oShow.removeChild(oClosebtn);
}
oClosebtn.onclick = oClose;
bgObj.onclick = oClose;
function getEvent() {
return window.event || arguments.callee.caller.arguments[0];
}
document.onkeyup = function(){
var event = getEvent();
if (event.keyCode == 27){
oClose();
}
}
var moveX = 0;
var moveY = 0;
var moveTop = 0;
var moveLeft = 0;
var moveable = false;
var docMouseMoveEvent = document.onmousemove;
var docMouseUpEvent = document.onmouseup;
titleBar =  document.getElementById('titlebar');
titleBar.onmousedown = function() {
var evt = getEvent();
moveable = true;
moveX = evt.clientX;
moveY = evt.clientY;
moveTop = parseInt(oShow.style.top);
moveLeft = parseInt(oShow.style.left);
document.onmousemove = function() {
if (moveable) {
var evt = getEvent();
var x = moveLeft + evt.clientX - moveX;
var y = moveTop + evt.clientY - moveY;
if ( x > 0 &&( x + 302 < iWidth) && y > 0 && (y + 202 < iHeight) ) {
oShow.style.left = x + "px";
oShow.style.top = y + "px";
}
}
};
document.onmouseup = function () {
if (moveable) {
document.onmousemove = docMouseMoveEvent;
document.onmouseup = docMouseUpEvent;
moveable = false;
moveX = 0;
moveY = 0;
moveTop = 0;
moveLeft = 0;
}
};
}
}
