function getWindowScrollTop(win){
var scrollTop=0;
if(win.document.documentElement&&win.document.documentElement.scrollTop){
scrollTop=win.document.documentElement.scrollTop;
}else if(win.document.body){
scrollTop=win.document.body.scrollTop;
}
return scrollTop;
}
function setWindowScrollTop(win, topHeight)
{
if(win.document.documentElement)
{
win.document.documentElement.scrollTop = topHeight;
}
if(win.document.body){
win.document.body.scrollTop = topHeight;
}
}
function getWindowScrollLeft(win){
var scrollLeft=0;
if(win.document.documentElement&&win.document.documentElement.scrollLeft){
scrollLeft=win.document.documentElement.scrollLeft;
} else if(win.document.body){
scrollLeft=win.document.body.scrollLeft;
}
return scrollLeft;
}
function getWindowHeight(win){
var clientHeight=0;
if(win.document.body.clientHeight&&win.document.documentElement.clientHeight){
clientHeight = (win.document.body.clientHeight
win.document.body.clientHeight:win.document.documentElement.clientHeight;
}else{
clientHeight = (win.document.body.clientHeight>win.document.documentElement.clientHeight)?
win.document.body.clientHeight:win.document.documentElement.clientHeight;
}
return clientHeight;
}
function getWindowWidth(win){
var clientWidth=0;
if(win.document.body.clientWidth&&win.document.documentElement.clientWidth){
clientWidth = (win.document.body.clientWidth
win.document.body.clientWidth:win.document.documentElement.clientWidth;
}else{
clientWidth = (win.document.body.clientWidth>win.document.documentElement.clientWidth)?
win.document.body.clientWidth:win.document.documentElement.clientWidth;
}
return clientWidth;
}
function unpop()
{
try{
var win = (top && top!=self)?top:window;
}
catch(e)
{
return ;
}
win.document.getElementById('mask').style.display = "none";
win.document.getElementById("id_popdiv").style.display = "none";
win.document.getElementById("id_iframe_pop").setAttribute('src', '');
}
function pop(url,width,height)
{
try{
var win = (top && top!=self)?top:window;
}
catch(e)
{
return ;
}
var topWindowHeight = getWindowHeight(win);
var topWindowWidth = getWindowWidth(win);
var lvTop=parseInt((topWindowHeight-height)/2)+parseInt(getWindowScrollTop(win));
var lvLeft=parseInt((topWindowWidth-width)/2)+parseInt(getWindowScrollLeft(win));
lvTop = lvTop<=0?1:lvTop;
lvLeft = lvLeft<=0?1:lvLeft;
win.document.getElementById("id_popdiv").style.top=lvTop+"px";
win.document.getElementById("id_popdiv").style.left=lvLeft+"px";
win.document.getElementById("id_popdiv").style.margin="0";
win.document.getElementById("id_iframe_pop").setAttribute('src', url);
win.document.getElementById("id_iframe_pop").setAttribute('width', width);
win.document.getElementById("id_iframe_pop").setAttribute('height', height);
win.document.getElementById('mask').style.display = "block";
win.document.getElementById("id_popdiv").style.display = "block";
}