﻿var lang = 's';
var button;



var popUp;
    function checkRange(sender, args)   
    {  
      
        if (args.Value.length > 150)  
            args.IsValid = false;  
        else  
            args.IsValid = true;  
   }  
   function initHotel()
    {
     charCounter();
     //colorChange(button);
    }

    function charCounter()
    {
            var tID = document.getElementById("SearchInfoArea");
            var num = tID.value.length;
            var color = "black";
            if(num>=150)
                color = "red";
            document.getElementById("lblCharCounter").style.color = color;
            document.getElementById("lblCharCounter").innerHTML = "Tecken: "+num+"/150";
    }

function SetControlValue(controlID, newDate, isPostBack)
{
    popUp.close();
    document.forms[0].elements[controlID].value=newDate;
}

function OpenPopupPage (pageUrl, controlID, isPostBack)
{
    popUp=window.open(pageUrl+'?controlID='+controlID+'&isPostBack='+ isPostBack,'popupcal', 'width=250,height=350,left=200,top=250'); 
}

function removePicture()
{
    if(window.confirm("Bekräfta borttagning av bild"))
    {
        __doPostBack("Button4","");
    }
}

function loadHotel(id)
{
    document.getElementById("ctl00_ContentPlaceHolder1_TextBox1").value = id;
    __doPostBack("ctl00$ContentPlaceHolder1$Button1","");
}

function loadChain(id)
{
    document.getElementsByName("ctl00$ContentPlaceHolder1$TextBox2")[0].value = id;
    __doPostBack("ct100$ContentPlaceHolder1$Button3","");
}

function loadRegistration(id)
{
    document.getElementById("ctl00_ContentPlaceHolder1_TextBox1").value = id;
    __doPostBack("ctl00$ContentPlaceHolder1$Button8","");
}

function resetCoordinates()
{
    document.getElementById("ctl00_ContentPlaceHolder1_NewLongLabel").value = "";
    document.getElementById("ctl00_ContentPlaceHolder1_NewLatLabel").value = "";
}

function colorChange(arg)
{
    if(arg == "hotel")
    {
        document.getElementById('tdHotelButton').style.backgroundColor='#92CDCF';
        document.getElementById('tdRegButton').style.backgroundColor='';
        document.getElementById('divHotelList').style.display='';
        document.getElementById('divPending').style.display='none';
        button = arg;
    }
    else
    {
        document.getElementById('tdHotelButton').style.backgroundColor='';
        document.getElementById('tdRegButton').style.backgroundColor='#92CDCF';
        document.getElementById('divHotelList').style.display='none';
        document.getElementById('divPending').style.display='';
        button = 'reg';
    }
}

function tabSwitch(arg)
{
    if(arg == "hotel")
    {
        document.getElementById("tdHotelInfo").style.backgroundColor = "#92CDCF";
        document.getElementById("tdCustomerInfo").style.backgroundColor = "";
        document.getElementById("tdPicturesInfo").style.backgroundColor = "";
        document.getElementById("divHotelInfo").style.display = "";
        document.getElementById("divCustomerInfo").style.display = "none";
        document.getElementById("divPicturesInfo").style.display = "none";
    }
    else if(arg == "pic")
    {
        document.getElementById("tdHotelInfo").style.backgroundColor = "";
        document.getElementById("tdCustomerInfo").style.backgroundColor = "";
        document.getElementById("tdPicturesInfo").style.backgroundColor = "#92CDCF";
        document.getElementById("divHotelInfo").style.display = "none";
        document.getElementById("divCustomerInfo").style.display = "none";
        document.getElementById("divPicturesInfo").style.display = "";
    }
    else
    {
        document.getElementById("tdHotelInfo").style.backgroundColor = "";
        document.getElementById("tdCustomerInfo").style.backgroundColor = "#92CDCF";
        document.getElementById("tdPicturesInfo").style.backgroundColor = "";
        document.getElementById("divHotelInfo").style.display = "none";
        document.getElementById("divCustomerInfo").style.display = "";
        document.getElementById("divPicturesInfo").style.display = "none";
    }
}

function languageSwitch(arg)
{
    if(lang == arg)
    {
        return;
    }
    lang = arg;
    var temp;
    
    temp = document.getElementById("sweLink").style.display;
    document.getElementById("sweLink").style.display = document.getElementById("engLink").style.display;
    document.getElementById("engLink").style.display = temp;
    
    temp = document.getElementById("ctl00_ContentPlaceHolder1_divPresentationArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_divPresentationArea").style.display = document.getElementById("ctl00_ContentPlaceHolder1_EngdivPresentationArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivPresentationArea").style.display = temp;
    temp = document.getElementById("ctl00_ContentPlaceHolder1_divPriceArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_divPriceArea").style.display = document.getElementById("ctl00_ContentPlaceHolder1_EngdivPriceArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivPriceArea").style.display = temp;
    temp = document.getElementById("ctl00_ContentPlaceHolder1_divFacilitiesArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_divFacilitiesArea").style.display = document.getElementById("ctl00_ContentPlaceHolder1_EngdivFacilitiesArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivFacilitiesArea").style.display = temp;
    temp = document.getElementById("ctl00_ContentPlaceHolder1_divTravelGuideArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_divTravelGuideArea").style.display = document.getElementById("ctl00_ContentPlaceHolder1_EngdivTravelGuideArea").style.display;
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivTravelGuideArea").style.display = temp;
}

function textAreaSwitch(id, td)
{
    var s = "";
    if(lang == "e")
    {
        s = "Eng";
    }
    document.getElementById("ctl00_ContentPlaceHolder1_divPresentationArea").style.display = "none";
    document.getElementById("tdPresentationButton").style.backgroundColor = "";
    document.getElementById("ctl00_ContentPlaceHolder1_divPriceArea").style.display = "none";
    document.getElementById("tdPriceButton").style.backgroundColor = "";
    document.getElementById("ctl00_ContentPlaceHolder1_divFacilitiesArea").style.display = "none";
    document.getElementById("tdFacilitiesButton").style.backgroundColor = "";
    document.getElementById("ctl00_ContentPlaceHolder1_divTravelGuideArea").style.display = "none";
    document.getElementById("tdTravelButton").style.backgroundColor = "";
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivPresentationArea").style.display = "none";
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivPriceArea").style.display = "none";
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivFacilitiesArea").style.display = "none";
    document.getElementById("ctl00_ContentPlaceHolder1_EngdivTravelGuideArea").style.display = "none";
    document.getElementById("ctl00_ContentPlaceHolder1_" + s + id).style.display = "";
    document.getElementById(td).style.backgroundColor = "#92CDCF";
}

function altLanguageSwitch(arg)
{
    if(lang == arg)
    {
        return;
    }
    lang = arg;
    var temp;
    
    temp = document.getElementById("sweLink").style.display;
    document.getElementById("sweLink").style.display = document.getElementById("engLink").style.display;
    document.getElementById("engLink").style.display = temp;
    
    temp = document.getElementById("divPresentationArea").style.display;
    document.getElementById("divPresentationArea").style.display = document.getElementById("EngdivPresentationArea").style.display;
    document.getElementById("EngdivPresentationArea").style.display = temp;
    temp = document.getElementById("divPriceArea").style.display;
    document.getElementById("divPriceArea").style.display = document.getElementById("EngdivPriceArea").style.display;
    document.getElementById("EngdivPriceArea").style.display = temp;
    temp = document.getElementById("divFacilitiesArea").style.display;
    document.getElementById("divFacilitiesArea").style.display = document.getElementById("EngdivFacilitiesArea").style.display;
    document.getElementById("EngdivFacilitiesArea").style.display = temp;
    temp = document.getElementById("divTravelGuideArea").style.display;
    document.getElementById("divTravelGuideArea").style.display = document.getElementById("EngdivTravelGuideArea").style.display;
    document.getElementById("EngdivTravelGuideArea").style.display = temp;
}

function altTextAreaSwitch(id, td)
{
    var s = "";
    if(lang == "e")
    {
        s = "Eng";
    }
    document.getElementById("divPresentationArea").style.display = "none";
    document.getElementById("tdPresentationButton").style.backgroundColor = "";
    document.getElementById("divPriceArea").style.display = "none";
    document.getElementById("tdPriceButton").style.backgroundColor = "";
    document.getElementById("divFacilitiesArea").style.display = "none";
    document.getElementById("tdFacilitiesButton").style.backgroundColor = "";
    document.getElementById("divTravelGuideArea").style.display = "none";
    document.getElementById("tdTravelButton").style.backgroundColor = "";
    document.getElementById("EngdivPresentationArea").style.display = "none";
    document.getElementById("EngdivPriceArea").style.display = "none";
    document.getElementById("EngdivFacilitiesArea").style.display = "none";
    document.getElementById("EngdivTravelGuideArea").style.display = "none";
    document.getElementById(s + id).style.display = "";
    document.getElementById(td).style.backgroundColor = "#F47F1F";
}

function showTooltip(id)
{
    document.getElementById(id).style.display = "block";
}

function hideTooltip(id)
{
    document.getElementById(id).style.display = "none";   
}


