var isIe=(document.all)?true:false;
//弹出方法
function showMessageBox(wTitle,content, wWidth, wHeight)
{
	closeWindow();

	/*背景的宽高*/
	var bWidth=parseInt(document.documentElement.scrollWidth);
	var bHeight=parseInt(document.documentElement.scrollHeight)+50;

	/*当前浏览器的宽高*/
	var bodyObjCW=document.documentElement.clientWidth || document.body.clientWidth;
	var bodyObjCH=document.documentElement.clientHeight || document.body.clientHeight;
	var leftpx = parseInt((bodyObjCW - wWidth) / 2);
	var toppx = parseInt((bodyObjCH - wHeight) / 2);

	/*背景*/
	var back=document.createElement("div");
	back.id="back";
	var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
	styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
	back.style.cssText=styleStr;
	document.body.appendChild(back);
	showBackground(back,10);
	/*end背景*/

	var mesW=document.createElement("div");
	mesW.id="mesWindow";
	mesW.className="mesWindow";
	mesW.innerHTML="<div class='mesWindowTop'><table width='100%' height='100%'><tr><td>"+wTitle+"</td><td style='width:1px;'><input type='button' onclick='closeWindow();' title='关闭窗口' class='close' value='关闭' /></td></tr></table></div><div class='mesWindowContent' id='mesWindowContent'>"+content+"</div><div class='mesWindowBottom'></div>";
	styleStr="left:" + leftpx + "px;top:" + toppx + "px;position:absolute;width:"+wWidth+"px;";
	mesW.style.cssText=styleStr;
	document.body.appendChild(mesW);
}
//让背景渐渐变暗
function showBackground(obj,endInt){
	if(isIe){
		obj.filters.alpha.opacity+=1;
		if(obj.filters.alpha.opacity<endInt){
		setTimeout(function(){showBackground(obj,endInt)},5);
	}
	}else{
		var al=parseFloat(obj.style.opacity);al+=0.01;
		obj.style.opacity=al;
		if(al<(endInt/100)){setTimeout(function(){showBackground(obj,endInt)},5);}
	}
}
//关闭窗口
function closeWindow(){
	if(document.getElementById('back')!=null){
		document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
	}
	if(document.getElementById('mesWindow')!=null){
		document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
	}
}

//测试弹出
function openBox(url, wWidth, wHeight){
	messContent="<iframe src=\"" + url + "\" height=\"" + (wHeight-50) + "\" width=\"" + (wWidth-50) + "\" frameborder=0></iframe>";
	showMessageBox('加精网址', messContent, wWidth, wHeight);

}

