//获取ID
function $id(id){
    return document.getElementById(id);
}
function ShowMsg(){
    document.writeln("<div id=\"msgdiv\" style=\"position:absolute;display:none;\"><\/div>");
    document.writeln("<div id=\"overdiv\" style=\"position:absolute;display:none;\">");
    document.writeln("<\/div>");
    this.show=function(msgtitle,msgcontent){
        var tempobj1=$id("msgdiv");
        var tempobj2=$id("overdiv");
        tempobj2.style.filter="alpha(opacity=60)";
        tempobj2.style.MozOpacity = 7/100;   //背景透明度
        tempobj2.style.backgroundColor = "#000000";
        tempobj2.style.display = '';
        tempobj2.style.zIndex= 100;
		tempobj2.style.width= (screen.availWidth-21)+"px";  //背景宽度  screen.availWidth+
        tempobj2.style.height= (screen.availHeight-130)+"px"; //背景高度  screen.availHeight+"px"
        tempobj2.style.left=0;
        tempobj2.style.top=0;
        tempobj1.style.display="none";
        tempobj1.style.display= '';
        tempobj1.style.width=800+"px";   //对话框宽度
		msheight=400+"px";  //对话框高度
		//alert(((tempobj1.style.width))+"px")
		tempobj1.style.left=((screen.availWidth-21-800)/2)+"px"; //125对话框对到左边的距离
        tempobj1.style.top= ((screen.availHeight-130-400)/2)+"px";  //对话框对到上边的距离
        //tempobj1.style.height=300+"px";  //对话框高度
		
        tempobj1.style.zIndex= 200;
        tempobj1.style.backgroundColor = "#CDDAF1";
        var OutStr;
        OutStr="<div class=\"mstitle\"><input type=\"button\" class=\"closebu\" value=\"x\" onclick=\"ShowMsgo.resertwindow();\">"+msgtitle+"</div>"
        OutStr=OutStr+"<div class=\"msbody\"><iframe id=\"msiframe\" src=\""+msgcontent+"\" frameborder=\"0\" width=\""+tempobj1.style.width+"\" height=\""+(msheight)+"\"><\/iframe></div>"
           
        tempobj1.innerHTML=OutStr;
        var md=false,mobj,ox,oy
        document.onmousedown=function(ev){
            var ev=ev||window.event;
            var evt=ev.srcElement||ev.target;
            if(typeof(evt.getAttribute("canmove"))=="undefined"){
                return;
                 }
                 if(evt.getAttribute("canmove")){
                md = true;
                mobj = document.getElementById(evt.getAttribute("forid"));
                ox = mobj.offsetLeft - ev.clientX;
                oy = mobj.offsetTop - ev.clientY;
                 }
             }
             document.onmouseup= function(){md=false;}
             document.onmousemove= function(ev){
            var ev=ev||window.event;

            if(md){
                mobj.style.left= (ev.clientX + ox)+"px";
                mobj.style.top= (ev.clientY + oy)+"px";
            }
        }
    }
    this.resertwindow=function(){
            $id('msgdiv').style.display='none';
            $id('overdiv').style.display='none';
    }
}
var ShowMsgo=new ShowMsg();