namespace VoServices.Footprint.Web
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		Summary description for Banner.
	/// </summary>
	public class Banner : System.Web.UI.UserControl
	{

		private string _type;
		private string _position;
		private int _width;
		private int _height;

		public Banner()
		{
			_type = "";
			_position = "";
			_width = 0;
			_height = 0;
		}

		protected override void Render(System.Web.UI.HtmlTextWriter writer)
		{
			System.Random rnd = new System.Random();
			string parameters = "SiteID=" + Application["AdServerSiteId"] + "&Type=" + _type + "&Pos=" + _position + "&Num=" + rnd.Next();

			writer.Write("<a href=\"" + (string) Application["AdServer"] + "/link.asp?" + parameters + "\">");
			writer.Write("<img border=\"0\" src=\"" + Application["AdServer"] + "/banner.asp?" + parameters + "\" width=\"" + _width + "\" height=\"" + _height + "\">");
			writer.Write("</a>");
		}

		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion

		public string Type
		{
			get
			{
				return _type;
			}
			set
			{
				_type = value;
			}
		}

		public string Position
		{
			get
			{
				return _position;
			}
			set
			{
				_position = value;
			}
		}

		public int Width
		{
			get
			{
				return _width;
			}
			set
			{
				_width = value;
			}
		}

		public int Height
		{
			get
			{
				return _height;
			}
			set
			{
				_height = value;
			}
		}
	}
}
