﻿window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("eMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}

function resizeDiv()
{
i+=1
//if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}

try{
divHeight = parseInt(document.getElementById("seMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("seMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("seMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("seMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}

function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').parentNode.removeChild(document.getElementById('eMeng'))
if(objTimer) window.clearInterval(objTimer)
}
function hideDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
try{
divTop = parseInt(document.getElementById("seMeng").style.top,10)
divLeft = parseInt(document.getElementById("seMeng").style.left,10)
divHeight = parseInt(document.getElementById("seMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("seMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("seMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10-40;// divHeight
document.getElementById("seMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("seMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}

function showDiv()
{
document.getElementById('seMeng').style.visibility='hidden';
document.getElementById('eMeng').style.visibility='visible';
}

document.writeln("<style type='text/css'>"
	//+ " * { padding:0; margin:0;} "
	+ "body{height:100%;position:relative;} "
	+ "html{ overflow:hidden; height:100% } "
	+ ".showRightOverFlow{ width:300px; height:300px;position:absolute;right:22px;bottom:20px;border: solid 1px #432B6A;z-index:99999;} "
	+ ".msg_div_main_but {background:url(img/buttonbg.gif);width:65px;heigt:20px;border:none;padding-top:3px;font-size:12px;}"
	+ "</style>"
	+ "<div id='main' style='height: 100%; overflow: auto;'>"
	+ "<DIV id=eMeng class='showRightOverFlow' style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 265px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute;  HEIGHT: 255px; BACKGROUND-COLOR: #c9d3f3'>"
	+ "<TABLE width='265' border=0 cellPadding=0 cellSpacing=0 bgColor=#AFDCF3 style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid'>"
	+ "<TR bgColor=#6699cc>"
	+ "<TD height=20 style='font-size: 12px; background-image: url('msgTopBg.gif'); color: #000000'>&nbsp;<b>英语周报社多媒体视窗</b></TD>"
	+ "<TD style='background-image: url('msgTopBg.gif'); padding-right: 2px; padding-top: 2px' vAlign=center align=right>"
	+ "<span title=最小化 style='CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:5px;' onclick=hideDiv() >—</span>"
	+ "<span title=关闭 style='CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:15px;' onclick=closeDiv() >X</span></TD></TR><TR>"
	+ "<TD height=225 colSpan=2 align='left' valign='bottom' style=' padding-right: 1px; padding-bottom: 1px'><span style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #728eb8 0px solid; PADDING-LEFT: 0px; FONT-SIZE: 12px; PADDING-BOTTOM: 0px; BORDER-LEFT: #728eb8 0px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 0px; BORDER-BOTTOM: #b9c9ef 0px solid; HEIGHT: 100%'>"
	+ "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='265' height='235'><param name='movie' value='http://www.ew.com.cn/download/ad/Flvplayer.swf' /><param name='quality' value='high' /><param name='allowFullScreen' value='true' /><param name='FlashVars' value='vcastr_file=ew2010113xwlb.flv&LogoText=www.ew.com.cn&BufferTime=3&IsAutoPlay=1&IsContinue=1' /><embed src='http://www.ew.com.cn/download/ad/Flvplayer.swf' allowfullscreen='true' flashvars='vcastr_file=http://www.ew.com.cn/download/ad/ew2010113xwlb.flv&LogoText=www.ew.com.cn&BufferTime=3&IsAutoPlay=1&IsContinue=1' quality='high'  pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='261' height='230'></embed></object>  "
	+ "</span></TD></TR></TABLE></DIV>"
	+ "<DIV id=seMeng class='showRightOverFlow' style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999;  VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 265px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; HEIGHT: 20px; BACKGROUND-COLOR: #c9d3f3'>"
	+ "<TABLE width='265' border=0 cellPadding=0 cellSpacing=0 bgColor=#AFDCF3 style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid'>"
	+ "<TR bgColor=#6699cc><TD height=20 style='font-size: 12px; background-image: url('msgTopBg.gif'); color: #000000'>&nbsp;<b>英语周报社多媒体视窗</b></TD>"
	+ "<TD style='background-image: url('msgTopBg.gif'); padding-right: 2px; padding-top: 2px' vAlign=center align=right>"
	+ "<span title=最大化 style='CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;' onclick=showDiv() >¤</span>"
	+ "</TR>"
	+ "</TABLE>"
	+ "</DIV>");
