﻿// JScript 文件


function getPosition() {
var top = document.documentElement.scrollTop;
var left = document.documentElement.scrollLeft;
var height = document.documentElement.clientHeight;
var width = document.documentElement.clientWidth;
return {top:top,left:left,height:height,width:width};
} 
function showPop(id,width,height){

var obj = document.getElementById(id);

obj.style.display = "block";
obj.style.position = "absolute";
obj.style.zindex = "100";
obj.style.width = width + "px";
obj.style.height = height + "px";

var obj2 = document.getElementById("sad");
obj2.style.display = "block";
if(window.ActiveXObject)
{
    //obj2.style.filters.alpha.opacity="50";//div层透明度为50%，在IE下
}
else
{
    obj2.style.opacity="0.5";//div层透明度为50%，在FF下
}

var Cheight=document.documentElement.scrollHeight;
if(Cheight<=600)
 {
    Cheight=700;
 }


obj2.style.height = Cheight+"px";
obj2.style.width = document.documentElement.clientWidth+"px";


//document.getElementById("sad").style.backgroundColor="#ccc";//div层变暗
//document.getElementById("sad").
//document.getElementById("sad").




var Position = getPosition();
leftadd = (Position.width-width)/2;
topadd = (Position.height-height)/2;
obj.style.top = (Position.top + topadd) + "px";
obj.style.left = (Position.left + leftadd) + "px";

window.onscroll = function (){
var Position = getPosition();
obj.style.top = (Position.top + topadd) +"px";
obj.style.left = (Position.left + leftadd) +"px";
};
}

function hidePop(id){
document.getElementById(id).style.display = "none";
document.getElementById("sad").style.display = "none";
}



