﻿var strCurrentLanguage = "is";

LoadLanguage("default", strCurrentLanguage);

function LoadLanguage(_strSection,_strLang) {
    $.ajax
            (
                {
                    type: "POST",
                    url: "/Ajax/Functions.asmx/ReturnLanguageArray",
                    data: "{'_strSection':'" + _strSection + "','_strLang':'" + _strLang + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    error: function (objRequest, strTextStatus, errErrorThrown) {
                        alert("Error fetching ajax, contact 123.is about this: " + strTextStatus + " " + errErrorThrown);
                    },
                    success: function (msg) {
                        langItems = msg.d;                       
                    }
                }
           )
            }

            function GetLanguageElement(_strLangElementName) {
                
                for (i = 0; i < langItems.length;i++) {
                    
                    if (langItems[i].Name == _strLangElementName) {
                        return (langItems[i].Value);
                    }

                }
                return ("N/A");
            }
