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.Threading;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((string)Session["culture"] == "pl-PL")
        {
            this.ImageButton1.Enabled = false;
        }
        if ((string)Session["culture"] == "en-US")
        {
            this.ImageButton2.Enabled = false;
        }
    }    

    protected void FlagaPL_Click(object sender, EventArgs e)
    {
        if (Thread.CurrentThread.CurrentCulture.Name == "en-US")
        {
            Session["culture"] = "pl-PL";
            string zapytanie = Request.QueryString.ToString();
            if (zapytanie != "") { zapytanie = "?" + zapytanie; }
            Response.Write(zapytanie);
            Response.Redirect(Request.Url.LocalPath + zapytanie);
        }   
        
    }

    protected void FlagaGB_Click(object sender, EventArgs e)
    {
        if (Thread.CurrentThread.CurrentCulture.Name == "pl-PL")
        {
            Session["culture"] = "en-US";
            string zapytanie = Request.QueryString.ToString();
            if (zapytanie != "") { zapytanie = "?" + zapytanie; }
            Response.Redirect(Request.Url.LocalPath + zapytanie);
        }   

    }
}
