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;
        }
        if ((string)Session["culture"] == "fr-FR")
        {
            this.ImageButton3.Enabled = false;
        }
        if ((string)Session["culture"] == "it-IT")
        {
            this.ImageButton4.Enabled = false;
        }
        if ((string)Session["culture"] == "de-DE")
        {
            this.ImageButton5.Enabled = false;
        }
    }    

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

    }

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

    }

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

    }

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

    }
}
