<?xml version="1.0" encoding="utf-8"?>
<window screenLeft="0" screenTop="0" width="228" height="130" titleBar="false" resizeMargins="0,0,0,0" maxWidth="228" maxHeight="130" maximizable="false" onload="WindowOnLoad();">
	<script src="common.js"/>
	<script>
	<![CDATA[
		function WindowOnLoad()
		{
			window.ShowPushPOP = ShowPushPOP;
			window.closetime=0;
			window.timeid=0;
			window.url="http://www.pptv.com";
			window.taskid=0;
			var  pplDac=Components.GetObject("@pplive.com/PPLStat;1");
			window.PopPushAD = function(taskid,title,content,picture,url,closetime,fb)
			{

				window.taskid=0;
				var NoShowPush = 0;
				var passport = Components.GetObject("@pplive.com/passport;1");
				if(passport && passport.IsVipUser)
				{
					var registry = Components.CreateObject("@pplive.com/registry;1");
					if (registry.open(registry.HKCU, "Software\\PPLive\\vip",IRegistry.KEY_READ))
					{
						NoShowPush = registry.readDWORD("Push");
						if(NoShowPush==1)
						{
							if(pplDac)pplDac.PPLPushDac(taskid,"J",7,0,1);
							return;
						}
					}
				}
				window.taskid=taskid;
				$("lblTitle").value=title;
				$("lblContent").value=content;

				$("lblTitle2").value=title;
				$("lblContent2").value=content;

				$("imgPicture").src=picture;

				if(picture.length==0)
				{
					$("lblTitle").visible=false;
					$("lblContent").visible=false;
					$("lblTitle2").visible=true;
					$("lblContent2").visible=true;
				}
				else
				{
					$("lblTitle2").visible=false;
					$("lblContent2").visible=false;
					$("lblTitle").visible=true;
					$("lblContent").visible=true;
				}
				window.url=url;

				ShowPushPOP(1);

				if(closetime>0)
				{
					var exp = "ShowPushPOP(0)";
					window.closetime = window.setTimeout(exp, closetime);
				}
				var skinid = getActiveSkinId();
				if(skinid=="0" || skinid=="3")
				{	
					OnSkinChange("blue");
				}
				else
				{
					OnSkinChange("black");
				}
			}
			var uiMainWindow = Components.GetObject("@pplive.com/ui/mainwindow;1");
			if(uiMainWindow)
			{
				uiMainWindow.vecOnSkinChange["pushpop"] = OnSkinChange;
			}
		}
		function OnSkinChange(skinValue)
		{
			if(skinValue == "black")
			{
				$("backwindow").backgroundColor = "#191919";
			}
			else if(skinValue == "blue")
			{
				$("backwindow").backgroundColor = "#01274c";
			}
			else
			{
				$("backwindow").backgroundColor = "#191919";
			}
		}


		function WindowMoveUp(pixel)
		{
			if(window.timeid)window.clearTimeout(window.timeid);
			var screen = window.screen;
			if(window.screenTop - pixel > screen.availTop+screen.availHeight - window.outerHeight)
			{
				window.moveSizeTo(screen.width-window.outerWidth,window.screenTop-pixel,window.outerWidth,window.outerHeight);
			}
			else
			{
				window.moveSizeTo(screen.width-window.outerWidth,screen.availTop+screen.availHeight - window.outerHeight,window.outerWidth,window.outerHeight);	
			}			

			if(screen.availTop+screen.availHeight-window.screenTop<window.outerHeight)
			{
				
				var exp = "WindowMoveUp(7)";
				window.timeid = window.setTimeout(exp, 20);
			}
			else
			{
				WindowStayTop(0);
			}
		}
		function ShowPushPOP(lcmd)
		{
			if(window.timeid)
			{
				window.clearTimeout(window.timeid);
				window.timeid=0;
			}
			if(window.closetime)
			{
				window.clearTimeout(window.closetime);
				window.closetime=0;
			}
			var screen = window.screen;
			if(lcmd==0)
			{
				var  pplDac=Components.GetObject("@pplive.com/PPLStat;1");
				if(pplDac)
				{
					pplDac.PPLPushDac(window.taskid,"J",-1,0,1);
				}				
				window.visible = false;
				ResumeOtherPOP();
			}
			else
			{
				var  pplDac=Components.GetObject("@pplive.com/PPLStat;1");
				if(pplDac)
				{
					pplDac.PPLPushDac(window.taskid,"F",1,0,0);
					pplDac.PPLPushPop(1,0);
				}
				CloseOtherPOP();

				if(EwaIsFullScreen())
				{
					window.topmost=true;
				}
				else
				{
					var TrayIcon = Components.GetObject2("SkinForm1");
					if(TrayIcon && TrayIcon.FindFullScreenWindow()==0)
					{
						window.topmost=true;
					}
				}

				//上移型
				//window.moveSizeTo(screen.width-window.outerWidth,screen.height,window.outerWidth,window.outerHeight);
				//WindowMoveUp(0);
				
				//直接出现型
				window.moveSizeTo(screen.width-window.outerWidth,screen.availTop+screen.availHeight - window.outerHeight,window.outerWidth,window.outerHeight);
				WindowStayTop(0);
				
				window.visible = true;
			}
		}
		function ResumeOtherPOP()
		{
			//恢复气泡
			try
			{
				var ad = Components.GetObject2("AD");
				if(ad)ad.PushBalloonShowed(false);
			}
			catch(e)
			{
			}
		}
		function CloseOtherPOP()
		{
			//关闭其他气泡
			var pop_vip = Components.GetObject2("POP_VIP");
			if(pop_vip)
			{
				pop_vip.Show(0);
			}

			var pop_msg = Components.GetObject2("POP_MESSAGE");
			if(pop_msg)
			{
				pop_msg.Show(0);
			}

			var pushpop = Components.GetObject2("@pplive.com/pushpop2;1");
			if(pushpop)pushpop.ShowPushPOP(0);

			try
			{
				var channelNumTip = Components.GetObject2("@pplive.com/channelnumtip;1");
				if(channelNumTip)channelNumTip.ShowNumTip(0,0);
			}
			catch(e)
			{
			}
			try
			{
				var ad = Components.GetObject2("AD");
				if(ad)ad.PushBalloonShowed(true);
			}
			catch(e)
			{
			}
		}
		function WindowStayTop(count)
		{
			if(window.timeid)window.clearTimeout(window.timeid);
			var thisCount = count+1;
			if(thisCount<20*10)
			{
				if(EwaIsFullScreen())
				{
					window.topmost=true;
				}
				var exp = "WindowStayTop(" + thisCount + ")";
				window.timeid = window.setTimeout(exp, 50);	
			}
			else
			{
				if(EwaIsFullScreen())
				{
					window.topmost=false;
				}
			}
		}

		function WindowOpenUrl()
		{
			ShowPushPOP(0);
			var url = window.url;
			var lowerurl = url.toLowerCase();
			if(lowerurl.length>0)
			{
				var  pplDac=Components.GetObject("@pplive.com/PPLStat;1");
				if(pplDac)
				{
					pplDac.PPLPushDac(window.taskid,"I",1,0,0);
					pplDac.PPLPushPop(0,1);
				}
				if(lowerurl.indexOf("http://")==0)
				{
					window.openurl(window.url);
				}
				else
				{
					var ppframe = Components.GetObject("@pplive.com/PPFrame;1");
					try
					{
						ppframe.CreatePlayer();
					}
					catch(e)
					{
					} 

					var ppp = Components.GetObject2("PPP");
					if(!ppp) return;
					if(lowerurl.indexOf("pptv://")==0)
					{
						ppp.URL2(window.url,21);
					}
					else if(lowerurl.indexOf("synacast://")==0)
					{
						ppp.URL2(window.url,21);
					}
					else if(lowerurl.indexOf("ppl://")==0)
					{
						ppp.URL2(window.url,21);
					}
				}
			}
		}
	]]>
	</script>
	<subwindow left="0" top="0" width="228" height="130" passThrough="false">
		<!-- top left -->
		<subwindow left="0" top="0" width="20" height="129" backgroundImage="gbg_left_top.bmp" clippingColor="#FF00FF" />
		<!-- top -->
		<subwindow left="20" top="0" width="188" height="129" backgroundImage="gbg_top.bmp" clippingColor="#FF00FF" horizontalAlignment="stretch" backgroundImageStretchMode="stretch" backgroundColor="#000000"/>
		<!-- top right -->
		<subwindow left="208" top="0" width="20" height="129" backgroundImage="gbg_right_top.bmp" clippingColor="#FF00FF" horizontalAlignment="right"/>
		<!-- right -->
		<subwindow left="226" top="27" width="2" height="101" backgroundImage="gbg_right.bmp" clippingColor="#FF00FF" horizontalAlignment="right" verticalAlignment="stretch" backgroundImageStretchMode="stretch" backgroundColor="#FF0000" />
		<!-- bottom right -->
		<subwindow left="226" top="251" width="2" height="2" backgroundImage="gbg_right_bot.bmp" clippingColor="#FF00FF" horizontalAlignment="right" verticalAlignment="bottom" />
		<!-- bottom -->
		<subwindow left="2" top="128" width="224" height="2" backgroundImage="gbg_bot.bmp" clippingColor="#FF00FF" horizontalAlignment="stretch" verticalAlignment="bottom"  backgroundImageStretchMode="stretch" backgroundColor="#000000"/>
		<!-- bottom left -->
		<subwindow left="0" top="128" width="2" height="2" backgroundImage="gbg_left_bot.bmp" clippingColor="#FF00FF" horizontalAlignment="left" verticalAlignment="bottom" />
		<!-- left -->
		<subwindow left="0" top="27" width="2" height="101" backgroundImage="gbg_left.bmp" clippingColor="#FF00FF" horizontalAlignment="left" verticalAlignment="stretch" backgroundImageStretchMode="stretch" backgroundColor="#000000"/>
		<!-- center -->
		<subwindow id="backwindow" left="2" top="27" width="224" height="101" horizontalAlignment="stretch" verticalAlignment="stretch" backgroundColor="#efefef">
			<button left="5" top="8" width="90" height="90" onclick="WindowOpenUrl();" cursor="hand">
				<image id="imgPicture" left="0" top="0" width="90" height="90" stretchMode="stretch" horizontalAlignment="stretch" verticalAlignment="stretch" />
			</button>
			<label id="lblTitle" left="98" top="8" width="126" height="18" value="" fontFace="宋体"  fontSize="12"  foregroundColor="#FFFFFF" textAlignment="left" fontStyle="bold"/>
			<label id="lblContent" left="98" top="24" width="126" height="70" value="" fontFace="宋体"  fontSize="12"  foregroundColor="#FFFFFF" textAlignment="left" wordWrap="true" cursor="hand" hoverFontStyle="underline" onclick="WindowOpenUrl();"/>
			
			<label id="lblTitle2" left="5" top="8" width="219" height="18" value="" fontFace="宋体"  fontSize="12"  foregroundColor="#FFFFFF" textAlignment="left" fontStyle="bold"/>
			<label id="lblContent2" left="5" top="24" width="219" height="70" value="" fontFace="宋体"  fontSize="12"  foregroundColor="#FFFFFF" textAlignment="left" wordWrap="true" cursor="hand" hoverFontStyle="underline" onclick="WindowOpenUrl();"/>
	
		</subwindow>
		<!-- close button -->
		<button left="192" top="0" width="26" height="23" image="close.bmp" hoverImage="close_hover.bmp" downImage="close_down.bmp" onclick="ShowPushPOP(0);" tooltip="关闭"/>
		<label id="windowTitle" left="7" top="3" width="180" height="20" value="PPTV即时推荐" fontFace="宋体"  fontSize="12"  foregroundColor="#efefef" passThrough="true" textAlignment="left vcenter"/>
	</subwindow>
</window>