﻿<!--//
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}

var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;

function getMsg(){
	try{
		divTop = parseInt(document.getElementById("wangkuAd").style.top,10);
		divLeft = parseInt(document.getElementById("wangkuAd").style.left,10);
		divHeight = parseInt(document.getElementById("wangkuAd").offsetHeight,10);
		divWidth = parseInt(document.getElementById("wangkuAd").offsetWidth,10);
		docWidth = document.documentElement.clientWidth;
		docHeight = document.documentElement.clientHeight;
		document.getElementById("wangkuAd").style.top = parseInt(document.documentElement.scrollTop,10) + docHeight + 10 + "px";
		document.getElementById("wangkuAd").style.left = parseInt(document.documentElement.scrollLeft,10) + docWidth - divWidth + "px";
		document.getElementById("wangkuAd").style.visibility="visible";
		objTimer = window.setInterval("moveDiv()",10);
	}
	catch(e){}
}

function resizeDiv(){
	i+=1;
	//if(i>500) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
	try{
		divHeight = parseInt(document.getElementById("wangkuAd").offsetHeight,10);
		divWidth = parseInt(document.getElementById("wangkuAd").offsetWidth,10);
		docWidth = document.documentElement.clientWidth;
		docHeight = document.documentElement.clientHeight;
		document.getElementById("wangkuAd").style.top = docHeight - divHeight + parseInt(document.documentElement.scrollTop,10) + "px";
		document.getElementById("wangkuAd").style.left = docWidth - divWidth + parseInt(document.documentElement.scrollLeft,10) + "px";
	}
	catch(e){}
}

function moveDiv(){
	try{
		if(parseInt(document.getElementById("wangkuAd").style.top,10) <= (docHeight - divHeight + parseInt(document.documentElement.scrollTop,10)) + 5){
			window.clearInterval(objTimer);
			objTimer = window.setInterval("resizeDiv()",1);
		}
		divTop = parseInt(document.getElementById("wangkuAd").style.top,10);
		document.getElementById("wangkuAd").style.top = divTop - 5 + "px";
	}
	catch(e){}
}

function closeDiv(){
	document.getElementById('wangkuAd').style.visibility='hidden';
	if(objTimer) window.clearInterval(objTimer);
}
-->

