<%@ Page Language="C#" Inherits="Ycbw.Data.OleDbClient" %>

<script language="c#" runat="server">
private void Page_Load(object sender, EventArgs e)
{
	string script = "";

	if( Request.QueryString["v1"] != null && Request.QueryString["v2"] != "" )
	{
		string w = Request.QueryString["v1"];
		string h = Request.QueryString["v2"];
		
		script = "<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 id=scriptmain name=scriptmain codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 width="+ w +" height="+ h +">";
		script += "  <param name=movie value=articles/images/focus1.swf?bcastr_xml_url=../articles/focus1-"+ Request.QueryString["id"] +".aspx>";
		script += "  <param name=quality value=high>";
		script += "  <param name=scale value=noscale>";
		script += "  <param name=LOOP value=false>";
		script += "  <param name=menu value=false>";
		script += "  <param name=wmode value=transparent>";
		script += "  <embed src=articles/images/focus1.swf?bcastr_xml_url=../articles/focus1-"+ Request.QueryString["id"] +".aspx width="+ w +" height="+ h +" loop=false quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash salign=T name=scriptmain menu=false wmode=transparent></embed>";
		script += "  </object>";
		
		Response.Write( "document.write('"+ script +"')" );
	}
	else
	{
		string sql = "Select top 6 * from [v_articles] where picture like '%jpg'";
		
 		if( Request.QueryString["id"] != null && Request.QueryString["id"] != "" )
		{
			int cid = Int32.Parse(Request.QueryString["id"]);
			
 			sql += " and (cid = "+ cid +" or cid in (select id from [b_article_categories] where parent = "+ cid +"))";
		}

		this.Fill( sql + " order by state desc, addtime desc", "data_focus" );

		string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><bcaster autoPlayTime=\"5\">";

		foreach(System.Data.DataRow dr in this.Data.Tables[0].Rows )
		{
			if( dr["link"].ToString() != "" )
				xml += "<item item_url=\""+ dr["picture"].ToString() +"\" link=\""+ dr["link"].ToString() +"\" itemtitle=\"\"></item>";
			else
				xml += "<item item_url=\""+ dr["picture"].ToString() +"\" link=\""+ dr["file"].ToString() +"-"+ dr["id"].ToString() +".aspx\" itemtitle=\"\"></item>";
		}

		xml += "</bcaster>";
        
		Response.Write( xml );		
	}
}
</script>