﻿//////显示出HTML内容/////
//底层DIV（黑色背景层）
document.write("<div id='BoxParent' style='display:none;position:absolute;z-index:100;background:#333;opacity:0.3; filter:alpha(opacity=30);margin:0px;top:0px;width:100%;'></div>");
//显示窗口最外层DIV
document.write("<div id='BoxParent2' style='z-index:101;position:absolute;width:100%;left:0px;top:0px;text-align:center;'></div>");

//得到页面中的对象
function GetObj(name)
{
    return document.getElementById(name);
}

//给窗口最外层DIV赋值,显示内容
function ShowWindow(width,height,top,title,src)
    {
        var IsIE=document.all ? true :false;
        var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 
        GetObj("BoxParent").style.display="block";
        var boxparent=GetObj("BoxParent2");
        boxparent.style.display="block";
        boxparent.innerHTML="    <div id='BoxChild' style='margin:"+(top+scrollTop)+"px auto 0px;width:"+eval(width+2)+"px;background:#FFF;'>"+
                            "        <div style='background:url(/AjaxWindows/HeadBg.jpg);border:1px solid #333;'>"+
                            "            <div style='cursor:move;text-align:left;font-weight:bold;'><span style='float:right;'><img style='margin:6px 6px 0px 0px;cursor:pointer;' onclick='CloseWindow()' src='/AjaxWindows/Close.jpg' alt='关闭窗口' title='关闭窗口' /></span>"+
                            "            <span style='font-size:13px;color:#F60;padding-left:9px;line-height:27px;'>『"+title+"』</span></div>"+
                            "            <div style='height:"+height+"px;background:#FFF;'>"+
                            "                <iframe id='MyFrame' src='"+src+"' width='"+width+"' height='"+height+"' scrolling='no' frameborder='0'></iframe>"+
                            "            </div>"+
                            "        </div>"+
                            "    </div>";
        if(IsIE){
            GetObj("BoxParent").style.height=document.body.clientHeight;
        }
        else
        {
            GetObj("BoxParent").style.height=document.body.clientHeight+'px';
        }
    }
    
function CloseWindow()
    {
        GetObj("BoxParent").style.display="none";
        GetObj("BoxParent2").style.display="none";
        GetObj("MyFrame").src="";
    }
    
    
function ViewImg(src){
        var IsIE=document.all ? true :false;
        
        GetObj("BoxParent").style.display="block";
        var boxparent=GetObj("BoxParent2");
        boxparent.style.display="block";
        boxparent.innerHTML="<span style='padding:30px;background:#FFF;margin:300px auto 0px ;display:inline-block;'><img src='"+src+"' onclick='CloseImg()' onmousewheel='return bbimg(this)' class='hand' title='点击关闭,滚动鼠标缩放图片' /></span>";

        if(IsIE){
            GetObj("BoxParent").style.height=document.body.clientHeight;
        }
        else
        {
            GetObj("BoxParent").style.height=document.body.clientHeight+'px';
        }
}

function CloseImg(){
        GetObj("BoxParent").style.display="none";
        GetObj("BoxParent2").style.display="none";
}

function bbimg(o){
    var zoom=parseInt(o.style.zoom,10)||100;
    zoom+=event.wheelDelta/12;
    if(zoom>0) o.style.zoom=zoom+'%';
    return false;
}




/*-------------------------鼠标拖动代码---------------------*/ 
function ResumeError() { 
return true; 
} 
window.onerror = ResumeError; 
var od = document.getElementById("BoxParent2"); 
var dx,dy,mx,my,mouseD; 
var odrag; 
var isIE = document.all ? true : false; 
document.onmousedown = function(e){ 
    var e = e ? e : event; 
    if(e.button == (document.all ? 1 : 0)) 
    { 
    mouseD = true; 
    } 
} 


document.onmouseup = function(){ 
    mouseD = false; 
    odrag = ""; 
    if(isIE) 
    { 
        od.releaseCapture(); 
        //od.filters.alpha.opacity = 100; 
    } 
    else 
    { 
        window.releaseEvents(od.MOUSEMOVE); 
        //od.style.opacity = 1; 
    } 
} 

od.onmousedown = function(e){ 
    odrag = this; 
    var e = e ? e : event; 
    if(e.button == (document.all ? 1 : 0)) 
    { 
        mx = e.clientX; 
        my = e.clientY; 
        od.style.left = od.offsetLeft + "px"; 
        od.style.top = od.offsetTop + "px"; 
        if(isIE) 
        { 
            od.setCapture(); 
            //od.filters.alpha.opacity = 50; 
        } 
        else 
        { 
            window.captureEvents(Event.MOUSEMOVE); 
            //od.style.opacity = 0.5; 
        } 
        //alert(mx); 
        //alert(my); 
    } 
} 

document.onmousemove = function(e){ 
    var e = e ? e : event; 
    //alert(mrx); 
    //alert(e.button); 
    if(mouseD==true && odrag) 
    { 
        var mrx = e.clientX - mx; 
        var mry = e.clientY - my; 
        od.style.left = parseInt(od.style.left) +mrx + "px"; 
        od.style.top = parseInt(od.style.top) + mry + "px"; 
        mx = e.clientX; 
        my = e.clientY; 
    } 
} 
/*-------------------------鼠标拖动代码结束---------------------*/ 

/*-------------------------显示提示代码开始---------------------*/ 

/*-------------------------显示提示代码结束---------------------*/ 
