using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class WebMain_dyAD_aboutus : System.Web.UI.UserControl
{
    private string IDD;
    public int wimg;
    public int himg;
    public string ADid
    {
        set { IDD = value.ToString().Trim(); }
    }
    public string widthAD
    {
        set { wimg =Convert.ToInt32(value.ToString().Trim()); }
    }
    public string heightAD
    {
        set { himg =Convert.ToInt32(value.ToString().Trim()); }
    }
    public string swfurl;
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd = new SqlCommand("select * from Baseadvertisement where id=" + IDD, conn);
        SqlDataReader sdr = smd.ExecuteReader();
        sdr.Read();
        if (sdr["type"].ToString() != "swf")
        {
            IMG1.Src = "/images/ad/" + sdr["pic"].ToString();
            IMG1.Height = himg;
            IMG1.Width = wimg;
            IMG1.Attributes.Add("onclick", "window.open('" + sdr["href"].ToString() + "')");
            this.IMG1.Alt =sdr["alt"].ToString();
            this.Panel1.Visible = true;
            this.IMG1.Border = 0;
            this.IMG1.Style.Add("cursor", "hand");
        }
        else
        { 
                swfurl ="/images/AD/"+sdr["pic"].ToString();
                Panel2.Visible = true;    
                Page.DataBind();
        }
        sdr.Close();
        conn.Close();


        
    }
}
