var beginPos=0;
function moveR(){
	var inch,var_id;
	if(document.documentElement&&document.documentElement.scrollTop)
	 inch=document.documentElement.scrollTop;
	else if(document.body)
	 inch=document.body.scrollTop;
	var pstart=.5*(inch-beginPos);
	if(pstart>0)pstart=Math.ceil(pstart);
	else pstart=Math.floor(pstart);
	var bdy = (document.documentElement&& document.documentElement.clientWidth)?document.documentElement:document.body;
	var pheight=bdy.clientHeight;
	var ltoph=0,ltoph2=pheight-30;
		switch(ttalign){
			case 2:document.getElementById('avn').style.right=0;break;
			case 3:ltoph=pheight-var_h-20;break;
			case 4:ltoph=pheight-var_h-20;
				document.getElementById('avn').style.right=0;
			break;
		}
	document.getElementById('avn').style.top=parseInt(document.getElementById('avn').style.top?document.getElementById('avn').style.top:ltoph)+pstart+"px";
	document.getElementById('avnMin').style.top=parseInt(document.getElementById('avnMin').style.top?document.getElementById('avnMin').style.top:ltoph2)+pstart+"px";
	beginPos = beginPos+pstart;
}

function ntvstart(){
document.writeln("<div id='avn' style='BORDER-RIGHT:#455690 1px solid; BORDER-TOP:#a6b4cf 1px solid; Z-INDEX:99999; BORDER-LEFT:#a6b4cf 1px solid; WIDTH:"+var_w+"px; BORDER-BOTTOM:#455690 1px solid; POSITION:absolute;'>");
document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='0' style='BORDER-TOP:#ffffff 1px solid; BORDER-LEFT:#ffffff 1px solid' bgcolor='#DBDBDB'>");
document.writeln("<tr><td align='right' style='BACKGROUND-IMAGE:url(images/msgTopBg.gif);PADDING-TOP:0px;text-align:right;' valign='middle' width='38'><img src='images/min.gif' hspace='3' style='CURSOR:pointer' onclick='minDiv()' title='最小化'\/><img src='images/close.gif' hspace='3' style='CURSOR:pointer' onclick='closeDiv()' title='关闭'\/><\/td>");
document.writeln("<\/tr><tr><td><IFRAME id='anvframe'  src='http:\/\/tv1998.cn\/anvtv\/?card_id="+var_cardid+"' frameBorder=0 width="+var_w+" scrolling=no height="+var_h+">     <\/IFRAME><\/td>");
document.writeln("<\/tr><\/table><\/div>");
document.writeln("<div id='avnMin' style='BORDER-RIGHT:#455690 1px solid; BORDER-TOP:#a6b4cf 1px solid; Z-INDEX:99999; BORDER-LEFT:#a6b4cf 1px solid; WIDTH:45px;height:25px;right:0;bottom:0; BORDER-BOTTOM:#455690 1px solid; POSITION:absolute; BACKGROUND-COLOR:#c9d3f3;'>");
document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='0' style='BORDER-TOP:#ffffff 1px solid; BORDER-LEFT:#ffffff 1px solid' bgcolor='#DBDBDB'>");
document.writeln("<tr><td align='right' style='BACKGROUND-IMAGE:url(images/msgTopBg.gif);PADDING-TOP:0px' valign='middle' width='38' style='padding-left:0px;'><img src='images/hai.gif' hspace='3' style='CURSOR:pointer' onclick='openDiv()' title='最大化'\/><img src='images/close.gif' hspace='3' style='CURSOR:pointer' onclick='closeDiv()' title='关闭'\/><\/td>");
document.writeln("<\/tr><\/table><\/div>");
document.getElementById("avnMin").style.visibility='hidden';
window.setInterval(moveR,1);
}
ntvstart();
function minDiv() {
	document.getElementById("avn").style.visibility='hidden';
	document.getElementById("avnMin").style.visibility='visible';
}
function closeDiv(){
	document.getElementById("avn").style.visibility='hidden';
	document.getElementById("avnMin").style.visibility='hidden';
	clearInterval(avnInter);
	parent.frames["anvframe"].location="about:blank";
}
function openDiv() {
	document.getElementById("avn").style.visibility='visible';
	document.getElementById("avnMin").style.visibility='hidden';
}