<%@ Page Language="C#"%>
<%
        
        String Adid = Request.QueryString.Get("Adid");
        if (!string.IsNullOrEmpty(Adid))
        {

            KstCmsBase.Entities.Ad.PicPlay_Ent PicPlay = KstCmsBase.DAL.Ad.PicPlay.Get_PicPlayInfo(Convert.ToInt32(Adid));
            string picw = PicPlay.PicW.ToString();
            string pich = PicPlay.PicH.ToString();        
            String js_str = "function ShwFlash" + Adid + "(){";
            js_str += "var pics = '', links = '', texts = '';";
           
            KstCmsBase.Collection.Ad.PicCollection PicItems = KstCmsBase.DAL.Ad.PicPlay.Get_PicPlay_PicList(Convert.ToInt32(Adid));
            foreach(KstCmsBase.Entities.Ad.PicEnt Pic  in PicItems)
            {
                string link=Pic.LinkUrl;
                js_str +=string.Format("pics += '|{0}';", Pic.PicPath);
                js_str += string.Format("links += '|{0}';", Server.UrlEncode(link));
                js_str += string.Format("texts += '|';", Pic.AdTitle);
            }
            js_str += "pics = pics.substring(1);";
            js_str += "links = links.substring(1);";
            js_str += "texts = texts.substring(1);";

            js_str += "var text_height = 0;";
            js_str += "var swf_height = " + pich + ";";
            js_str += "var focus_width = " + picw + ";";
            js_str += "var focus_height = " + pich + ";";
            js_str += "document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"' + focus_width + '\" height=\"' + swf_height + '\">');";
            js_str += "document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"/Scripts/PicPlay/pixviewer.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#f5f5f5\">');";
            js_str += "document.write('<param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"opaque\">');";
            js_str += "document.write('<param name=\"FlashVars\" value=\"pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '\">');";
            js_str += "document.write('<embed src=\"/Scripts/PicPlay/pixviewer.swf\" wmode=\"opaque\" FlashVars=\"pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '\" menu=\"false\" bgcolor=\"#f5f5f5\" quality=\"high\" width=\"' + focus_width + '\" height=\"' + swf_height + '\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');";
            js_str += "document.write('</object>');";
            js_str += "}";
            js_str += "ShwFlash" + Adid + "();";

            Response.Write(js_str);
        }
           
%>