var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try
{
divTop = parseInt(document.getElementById("loft_win").style.top,10);
divLeft = parseInt(document.getElementById("loft_win").style.left,10);
divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
docWidth = document.documentElement.clientWidth;
docHeight = document.documentElement.clientHeight;
document.getElementById("loft_win").style.top = parseInt(document.documentElement.scrollTop,10) + docHeight + 0;// divHeight
document.getElementById("loft_win").style.left = parseInt(document.documentElement.scrollLeft,10) + docWidth - divWidth;
document.getElementById("loft_win").style.visibility="visible";
objTimer = window.setInterval("moveDiv()",10);
}
catch(e){}
}
//初始化位置
function resizeDiv()
{
i+=1;
//if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
try
{
divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
docWidth = document.documentElement.clientWidth;
docHeight = document.documentElement.clientHeight;
document.getElementById("loft_win").style.top = docHeight - divHeight + parseInt(document.documentElement.scrollTop,10);
document.getElementById("loft_win").style.left = docWidth - divWidth + parseInt(document.documentElement.scrollLeft,10);
}
catch(e){}
}
//最小化
function minsizeDiv()
{
i+=1
//if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
try
{
divHeight = parseInt(document.getElementById("loft_win_min").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win_min").offsetWidth,10);
docWidth = document.documentElement.clientWidth;
docHeight = document.documentElement.clientHeight;
document.getElementById("loft_win_min").style.top = docHeight - divHeight + parseInt(document.documentElement.scrollTop,10);
document.getElementById("loft_win_min").style.left = docWidth - divWidth + parseInt(document.documentElement.scrollLeft,10);
}
catch(e){}
}
//移动
function moveDiv()
{
try
{
if(parseInt(document.getElementById("loft_win").style.top,10) <= (docHeight - divHeight + parseInt(document.documentElement.scrollTop,10)))
{
window.clearInterval(objTimer);
objTimer = window.setInterval("resizeDiv()",1);
}
divTop = parseInt(document.getElementById("loft_win").style.top,10);
document.getElementById("loft_win").style.top = divTop -1;
}
catch(e){}
}
function minDiv()
{
closeDiv();
document.getElementById('loft_win_min').style.visibility='visible';
objTimer = window.setInterval("minsizeDiv()",1);
}
function maxDiv()
{
document.getElementById('loft_win_min').style.visibility='hidden';
document.getElementById('loft_win').style.visibility='visible';
objTimer = window.setInterval("resizeDiv()",1);
//resizeDiv()
getMsg();
}
function closeDiv()
{
document.getElementById('loft_win').style.visibility='hidden';
document.getElementById('loft_win_min').style.visibility='hidden';
SetCookie("littlewinopen", 1);
if(objTimer) window.clearInterval(objTimer);
}
