using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using xabaraCOM;

public partial class js_ad : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            advertisement ad = new advertisement();

            string adID = xabara.safeSql(Request.QueryString["id"]);
            int w = (int)xabara.isNum(Request.QueryString["w"]);
            int h = (int)xabara.isNum(Request.QueryString["h"]);

            string adCode = ad.read(adID, w, h, 1, true, true, "");
            adCode = adCode.Replace("<script>", "\"<scr\" + \"ipt>");
            adCode = adCode.Replace("</script>", "\"</scr\" + \"ipt>");

            adCode = adCode.Replace("\"", "\\\"");

            Response.Write("document.writeln(\"" + adCode + "\");");
        }
    }
}