/**
 * 制作:  叶风
 * 版权:  2.0
 * 主页:  www.25-25.cn
 * Email: ye.fn@163.com 
 * 
 * 弹出
 */
var bgObj;
var msgObj;
var box =function(id, str, msgw, msgh){	
	var msgbordercolor="#336699";//提示窗口的边框颜色
	var msgcolor="#f0f0f0";//
	var titlecolor="#336699";//提示窗口的标题颜色
	if(!bgObj)
	  {	
	  	bgObj =document.createElement("div");
		document.getElementById(id).appendChild(bgObj);
		bgObj.style.position="absolute";
		bgObj.style.top="0";
		bgObj.style.background="#777";
		bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
		bgObj.style.opacity="0.6";
		bgObj.style.left="0";
		bgObj.style.width= document.body.offsetWidth + "px";
		bgObj.style.height= Math.max(document.body.offsetHeight, 500) + "px";
		bgObj.style.zIndex = "50";		
		
		msgObj =document.createElement("div");
		document.getElementById(id).appendChild(msgObj);
		msgObj.style.background="#fff";
		msgObj.style.border="1px solid " + msgbordercolor;
		msgObj.style.background = msgcolor;
		if (document.all)
			msgObj.style.position = "absolute";
		else
			msgObj.style.position = "fixed";	
		msgObj.style.zIndex = "101";
		msgObj.style.left = screen.availWidth/2 - (msgw?msgw:0) + 'px';
		msgObj.style.top = screen.availHeight/2 - (msgh?msgh:200) + 'px';
		if(msgw) msgObj.style.width = msgw + "px";
		if(msgh) msgObj.style.height = msgh + "px";		
		
		var title=document.createElement("h4");
		msgObj.appendChild(title);
		title.style.margin="0";
		title.style.padding="3px";
		title.style.background = titlecolor;
		title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
		title.style.opacity="0.75";
		title.style.border="1px solid " + titlecolor;
		title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
		title.innerHTML="&nbsp; 提示";
		title.onmousedown = function(e){
			if(!e)e=event  //FOR IE
			x	= e.screenX;
			y	= e.screenY;
			obj = msgObj;
			l   = parseInt(obj.style.left);
			t   = parseInt(obj.style.top);
			document.onmousemove = function(e)
			{   if(!e)e=event
				if(!obj) return;
				window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();	
				document.all ? obj.style.position="absolute" : obj.style.position = 'fixed';
				obj.style.left = e.screenX - x + l + 'px';
				obj.style.top = e.screenY - y + t + 'px';
			} 
			document.onmouseup = function()
			{	if(obj)obj=null;}
		}
				
		var close_bnt=document.createElement("span");
		title.appendChild(close_bnt);
		close_bnt.style.color = "white";
		close_bnt.style.cursor = "pointer";
		close_bnt.style.position = "absolute";
		close_bnt.style.right = "5px";
		close_bnt.innerHTML="关闭";
		close_bnt.onclick = new Function("close_box('"+id+"')");	
	  }
	  
	var txt=document.createElement("div");
	msgObj.appendChild(txt);
	txt.style.margin="1em 0"
	txt.setAttribute("align","center");
	txt.innerHTML= str;
}
var close_box =function(id)
{
	if(!bgObj) 	return;
	if(id){
		document.getElementById(id).removeChild(bgObj);
		document.getElementById(id).removeChild(msgObj);
	  }
	else{
		bgObj.parentNode.removeChild(bgObj);
		msgObj.parentNode.removeChild(msgObj);
	  }
	bgObj = '';
}