protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/workstation_components_scripts.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oWorkstation = new Workstations(intProfile, dsn);
     if (Request.QueryString["id"] == null)
     {
         if (Request.QueryString["parent"] == null)
         {
             LoadComponents();
         }
         else
         {
             panAdd.Visible = true;
             int intParent = Int32.Parse(Request.QueryString["parent"]);
             hdnParent.Value = intParent.ToString();
             lblParent.Text  = oWorkstation.GetComponent(intParent, "name");
         }
     }
     else
     {
         panAdd.Visible = true;
         intID          = Int32.Parse(Request.QueryString["id"]);
         if (!IsPostBack)
         {
             DataSet ds        = oWorkstation.GetComponentScript(intID);
             int     intParent = Int32.Parse(ds.Tables[0].Rows[0]["componentid"].ToString());
             hdnParent.Value    = intParent.ToString();
             lblParent.Text     = oWorkstation.GetComponent(intParent, "name");
             txtName.Text       = ds.Tables[0].Rows[0]["name"].ToString();
             txtScript.Text     = ds.Tables[0].Rows[0]["script"].ToString();
             chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
         }
     }
     btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnParent.ClientID + "','" + hdnOrder.ClientID + "&type=COMPONENT_SCRIPTS" + "',false,400,400);");
     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
 }