function ConfirmLangChange(Link) { ChangeLang = confirm(MSG_ChangeLang); if(ChangeLang) window.location.href = Link.href; return ChangeLang; }function LangChange(Link) { window.location.href = Link.href; }function ConfirmPersonDelete(elem) { DeletePerson = confirmPersonDelete(MSG_DeletePerson, function () { deleteCurrentRow(elem); }); }function CalculatePriceMSG() { CalculatePerson = calculatePrice(MSG_PleaseWait, function () { }); }function ConfirmOldPersonNotInsured() { CalculatePerson = confirmOldPersonNotInsured(MSG_OldPersonNotInsured, function () { }); }// алиас для getElementById function _(ElementID) { return document.getElementById(ElementID); }function ElementHide(ElementID) { _(ElementID).style.display = "none"; return true; }function ElementShow(ElementID) { _(ElementID).style.display = "block"; return true; }function ScrollDocumentToElement(ElementID) { var ScrollToY = 0; Element = _(ElementID); while(Element != null) { ScrollToY += Element.offsetTop; Element = Element.offsetParent; } window.scrollTo(0, ScrollToY); return true; }function LayerShowHide(ElementID) { Element = _(ElementID); if(Element.style.display != "block") { Element.style.display = "block"; } else { Element.style.display = "none"; } }var CurrentFilterOpenedID = -1; function ShowFiltersPanel(Element) { if(CurrentFilterOpenedID == Element.id) { _(CurrentFilterOpenedID).className = ''; _('Filters_' + CurrentFilterOpenedID + '_handler').style.display = 'none'; CurrentFilterOpenedID = -1; } else { if(CurrentFilterOpenedID != -1) { _(CurrentFilterOpenedID).className = ''; _('Filters_' + CurrentFilterOpenedID + '_handler').style.display = 'none'; } Element.className = 'selected_filter'; _('Filters_' + Element.id + '_handler').style.display = 'block'; _('Field_' + Element.id + '_main').focus(self); if(_('Field_' + Element.id + '_main').tagName == 'INPUT') _('Field_' + Element.id + '_main').select(); CurrentFilterOpenedID = Element.id; } }function OCTASCConfirmationTextChange(Element) { _('OCTASCConfirmationTextButton').disabled = !Element.checked; }function OCTASCConfirmationTextSubmit() { _('OCTASCConfirmationTextForm').submit(); }function OpenEditor(ElementID) { w = 700; h = 700; s = 0; r = 0; l = (screen.width - w) / 2; t = (screen.height - h) / 2; url = "/admin/editor.php?ElementID=" + ElementID; target = "_blank"; window.open(url, target, "toolbar=0,scrollbars=" + s + ",resizable=" + r + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h); }function ShowWaitCursor() { for(i = 0; i < document.getElementsByTagName('fieldset').length; i++) { document.getElementsByTagName('fieldset')[i].style.cursor = 'wait'; } document.body.style.cursor = 'wait'; }function CorrectPolicyDateBegin(Element, MinDate, MaxDate) { // min mDateSplitted = MinDate.split('/'); MinDate = mDateSplitted[2] + mDateSplitted[1] + mDateSplitted[0]; cDateSplitted = Element.value.split('/'); CurrDate = cDateSplitted[2] + cDateSplitted[1] + cDateSplitted[0]; if(MinDate > CurrDate) Element.value = mDateSplitted[0] + '/' + mDateSplitted[1] + '/' + mDateSplitted[2]; // max mDateSplitted = MaxDate.split('/'); MaxDate = mDateSplitted[2] + mDateSplitted[1] + mDateSplitted[0]; cDateSplitted = Element.value.split('/'); CurrDate = cDateSplitted[2] + cDateSplitted[1] + cDateSplitted[0]; if(MaxDate < CurrDate) Element.value = mDateSplitted[0] + '/' + mDateSplitted[1] + '/' + mDateSplitted[2]; }var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i 0) { _(SpanElementID).style.color = 'black'; return true; } else { _(SpanElementID).style.color = 'red'; return false; } } Element.value = (Element.value + '').toUpperCase(); }function ChangePolicyPrice(Element) { //PolicyPriceWithCurrency = PolicyPrice[Element.value].split(' '); //_('PolicyPriceHolder').innerHTML = (PolicyPriceWithCurrency[0] * 1.05) + ' ' + PolicyPriceWithCurrency[1]; //_('PolicyPriceInternetHolder').innerHTML = PolicyPriceWithCurrency[0] + ' ' + PolicyPriceWithCurrency[1]; }function ShowSkNaudaDetailed(TextareaID) { w = 600; h = 600; s = 1; r = 0; l = (screen.width - w) / 2; t = (screen.height - h) / 2; url = "/admin/viewSkNauda.php?ElementID=" + TextareaID; target = "_blank"; window.open(url, target, "toolbar=0,scrollbars=" + s + ",resizable=" + r + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h); }function EditElements(SystemTreeID, ObjectKey) { Form = document.getElementById('TablefiltersControlForm'); w = 1000; h = 600; s = 1; r = 0; l = (screen.width - w) / 2; t = (screen.height - h) / 2; target = "_blank"; for(i = 0; i < Form.length; i++) { if(Form[i].type == 'checkbox') { if(Form[i].checked) { window.open("./?SingleWindowEdit&SystemTreeID=" + SystemTreeID + "&Mode=EditObject&ObjectID=" + Form[i].name + "&ObjectKey=" + ObjectKey + '&Editable', target, "toolbar=0,scrollbars=" + s + ",resizable=" + r + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h); } } } return false; }function DeleteElements(SystemTreeID, ObjectKey) { Form = document.getElementById('TablefiltersControlForm'); IDs = '0'; if(confirm('Vai tiešām dzēst?')) { for(i = 0; i < Form.length; i++) { if(Form[i].type == 'checkbox') { if(Form[i].checked) { IDs += ',' + Form[i].name; } } } if(IDs == '0') alert('Jums ir jāizvelas vismaz vienu objektu vispirms!'); else window.location = "./?SystemTreeID=" + SystemTreeID + "&Mode=DeleteObject&ObjectID=" + IDs + "&ObjectKey=" + ObjectKey; } return false; }function closeOneWinForm(hiddenVal, formName) { var newAction = _('ReturnURL').value; document.forms.editform.action = newAction; window.location = _('ReturnURL').value; //_('editform').submit(); } function ReturnToFirst(){ if (LanguageID == "1"){ location.replace("/lv/"); } else { location.replace("/ru/"); } }function Form_ChangePaymentType() { document.getElementById('edit_form').submit(); }function SetRegionInSession(Region) { AJAXLoad_WithPOSTData('SetCountryInSession', Serialize([ Base64.encode(Region) ]), 'SetRegionInSession_OK' ); }function SetRegionInSession_OK(){ eval(AJAXLastResponseText); document.location = '/' + NewRegion + '/'; }function ShowSelectRegion(id, type, firstOpt) { if (id.id) { var Arr = id.id.split("_"); } else { var Arr = id.split("_"); } var doc = document, select = doc.getElementById(id), showClassLeft, showClassRight, hideClassLeft, hideClassRight, selectedOpt = doc.getElementById(id + '_h'); if (selectedOpt.value == firstOpt) { showClassLeft = "select2-left select2-left-focus-white"; showClassRight = "select2-right select2-right-focus-white"; } else { showClassLeft = "select2-left select2-left-focus"; showClassRight = "select2-right select2-right-focus"; } hideClassLeft = "select2-left"; hideClassRight = "select2-right"; if (select.style.display == 'none') { select.style.display = "block"; doc.getElementById(id + '_DivLeft').className = showClassLeft; doc.getElementById(id + '_DivRight').className = showClassRight; } else { select.style.display = "none"; doc.getElementById(id + '_DivLeft').className = hideClassLeft; doc.getElementById(id + '_DivRight').className = hideClassRight; } }function ChangeSelectOptColorRegion(elem, optClass, selectID, type, first, firstOpt) { if (elem.id) { var Arr = elem.id.split("_"); } else { var Arr = elem.split("_"); } var doc = document, firstClassLeft, firstClassRight, classLeft, classRight, select = doc.getElementById(selectID), run = 1, selectedOpt = doc.getElementById(selectID + '_h'); if (select.style.display == 'none' || selectedOpt.value == Arr[2]) { run = 0; } if (run == 1) { if (selectedOpt.value == firstOpt) { firstClassLeft = "select2-left select2-left-focus-white"; firstClassRight = "select2-right select2-right-focus-white"; } else { firstClassLeft = "select2-left select2-left-focus-white"; firstClassRight = "select2-right select2-right-focus-white"; } if (selectedOpt.value == firstOpt) { classLeft = "select2-left select2-left-focus-white"; classRight = "select2-right select2-right-focus-white"; } else { classLeft = "select2-left select2-left-focus"; classRight = "select2-right select2-right-focus"; } if (first == 1) { doc.getElementById(selectID + '_DivLeft').className = firstClassLeft; doc.getElementById(selectID + '_DivRight').className = firstClassRight; } else { doc.getElementById(selectID + '_DivLeft').className = classLeft; doc.getElementById(selectID + '_DivRight').className = classRight; } if (selectedOpt.value == Arr[1]) { optClass = 'opt-selected'; } doc.getElementById(elem.id).className = 'select-option ' + optClass; } }function SelectOptionFromListRegion(id, value, type) { if (id.id) { var Arr = id.id.split("_"); } else { var Arr = id.split("_"); } var doc = document, selectedOpt = doc.getElementById(id + '_h'); ShowSelectRegion(id, type); doc.getElementById(id + '_' + selectedOpt.value).className = 'select-option opt'; doc.getElementById(id + '_Text').innerHTML = doc.getElementById(id + '_' + value).innerHTML; doc.getElementById(id + '_' + value).className = 'select-option opt-selected'; //alert(id + '_' + selectedOpt.value); if (value != selectedOpt.value) { selectedOpt.value = value; } //alert(selectedOpt.value); AJAXLoad('SetCountryInSession', Serialize([ Base64.encode(selectedOpt.value), doc.location ]), 'SetCountryInSession_OK' ); }function SetCountryInSession_OK() { eval(AJAXLastResponseText); document.location = NewRegion; }function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; }function SplitID(elem, type) { if (elem.id) { var Arr = elem.id.split(type); } else { var Arr = elem.split(type); } return Arr; }(function(){ if (allowSelectRegion) { if (eventtype == 1) { document.getElementById('RegionBG').onclick = function() {ShowSelectRegion('Region', 2, firstRegInList);} } else { document.getElementById('RegionBG').onmousedown = function() {ShowSelectRegion('Region', 2, firstRegInList);} } } $('form#profile-register-form').submit(function(e){ e.preventDefault(); var form = this; form.submit(); }); $('form#profile-remind-form').submit(function(e){ e.preventDefault(); var form = this; form.submit(); }); $('form#profile-login-form').submit(function(e){ e.preventDefault(); document.getElementById('profile-login-form').submit(); }); $('.login-button').click(function() { $('.login-button').attr('class', 'hidden login-button'); $('.login-wait-text').attr('class', 'resp-wait-text login-wait-text'); $('#profile-login-form').submit(); }); $('.register-button').click(function() { var data = $('#profile-register-form').serialize(), doc = document; if (Profile.checkForm('profile-register-form', true)) { if (doc.getElementById('pbanreg_password').value == doc.getElementById('pbanreg_password_2').value) { $('.register-button').attr('class', 'hidden register-button'); $('.register-wait-text').attr('class', 'resp-wait-text register-wait-text'); $.ajax({ url: window.location.protocol + '//polise.ban.lv/ajax.php', data: data + '&ServerMethod=RegisterNewUser&Arguments=1', type: "POST", success: function(data) { data = jQuery.parseJSON(data); if (data.Error == '0') { doc.getElementById('profile-register-form').className = 'hidden'; doc.getElementById('profile-register-form').reset(); doc.getElementById('pbanreg_name_Label').className = 'profile-text red'; doc.getElementById('pbanreg_surname_Label').className = 'profile-text red'; doc.getElementById('pbanreg_birthdateday_Label').className = 'profile-text red'; doc.getElementById('pbanreg_birthdatemonth_Label').className = 'profile-text red'; doc.getElementById('pbanreg_birthdateyear_Label').className = 'profile-text red'; doc.getElementById('pbanreg_email_Label').className = 'profile-text red'; doc.getElementById('pbanreg_password_Label').className = 'profile-text red'; doc.getElementById('pbanreg_password_2_Label').className = 'profile-text red'; } else { $('.register-button').attr('class', 'def-button register-button'); $('.register-wait-text').attr('class', 'hidden register-wait-text'); } doc.getElementById('profile-register-message').className = 'resp-text'; doc.getElementById('profile-register-message').innerHTML = data.Message; } }); } else { doc.getElementById('profile-register-message').className = 'resp-text'; doc.getElementById('profile-register-message').innerHTML = PROFILE_TEXT_PASSWORDSDOESNTMATCH; } } }); $('.remind-button').click(function() { var data = $('#profile-remind-form').serialize(), doc = document; if (Profile.checkForm('profile-remind-form', true)) { $('.remind-button').attr('class', 'hidden remind-button'); $('.remind-wait-text').attr('class', 'resp-wait-text remind-wait-text'); $.ajax({ url: window.location.protocol + '//polise.ban.lv/ajax.php', data: data + '&ServerMethod=RemindUserInfo&Arguments=1', type: "POST", success: function(data) { data = jQuery.parseJSON(data); if (data.Error == '0') { doc.getElementById('profile-remind').className = 'hidden'; doc.getElementById('profile-remind-form').reset(); doc.getElementById('pbanrem_email_Label').className = 'profile-text red'; doc.getElementById('pbanrem_birthdateday_Label').className = 'profile-text red'; doc.getElementById('pbanrem_birthdatemonth_Label').className = 'profile-text red'; doc.getElementById('pbanrem_birthdateyear_Label').className = 'profile-text red'; } doc.getElementById('profile-login-message').className = 'resp-text'; doc.getElementById('profile-login-message').innerHTML = data.Message; $('.remind-button').attr('class', 'def-button remind-button'); $('.remind-wait-text').attr('class', 'hidden remind-wait-text'); } }); } }); $('.profile-login').click(function() { Profile.showProfileOverlay('profile-login'); }); $('.profile-register').click(function() { Profile.showProfileOverlay('profile-register'); }); $('.forgot-password').click(function() { Profile.showForm('profile-remind'); }); $('#pbanreg_birthdateday').keyup(function() { Profile.checkField(this, '1');Profile.jumpToNextField('pbanreg_birthdateday', 2, 'pbanreg_birthdatemonth'); }); $('#pbanreg_birthdateday').blur(function() { Profile.checkField(this, '1'); }); $('#pbanreg_birthdateday').change(function() { Profile.checkField(this, '1'); }); $('#pbanreg_birthdatemonth').keyup(function() { Profile.checkField(this, '1');Profile.jumpToNextField('pbanreg_birthdatemonth', 2, 'pbanreg_birthdateyear'); }); $('#pbanreg_birthdatemonth').blur(function() { Profile.checkField(this, '1'); }); $('#pbanreg_birthdatemonth').change(function() { Profile.checkField(this, '1'); }); $('#pbanreg_birthdateyear').keyup(function() { Profile.checkField(this, '1');Profile.jumpToNextField('pbanreg_birthdatemonth', 4); }); $('#pbanreg_birthdateyear').blur(function() { Profile.checkField(this, '1'); }); $('#pbanreg_birthdateyear').change(function() { Profile.checkField(this, '1'); }); $('#pbanrem_birthdateday').keyup(function() { Profile.checkField(this, '1');Profile.jumpToNextField('pbanrem_birthdateday', 2, 'pbanrem_birthdatemonth'); }); $('#pbanrem_birthdateday').blur(function() { Profile.checkField(this, '1'); }); $('#pbanrem_birthdateday').change(function() { Profile.checkField(this, '1'); }); $('#pbanrem_birthdatemonth').keyup(function() { Profile.checkField(this, '1');Profile.jumpToNextField('pbanrem_birthdatemonth', 2, 'pbanrem_birthdateyear'); }); $('#pbanrem_birthdatemonth').blur(function() { Profile.checkField(this, '1'); }); $('#pbanrem_birthdatemonth').change(function() { Profile.checkField(this, '1'); }); $('#pbanrem_birthdateyear').keyup(function() { Profile.checkField(this, '1');Profile.jumpToNextField('pbanrem_birthdatemonth', 4); }); $('#pbanrem_birthdateyear').blur(function() { Profile.checkField(this, '1'); }); $('#pbanrem_birthdateyear').change(function() { Profile.checkField(this, '1'); }); $('#pbanreg_name,#pbanreg_surname,#pbanreg_email,#pban_email,#pbanrem_email').keyup(function() { Profile.checkField(this, '1'); }); $('#pbanreg_name,#pbanreg_surname,#pbanreg_email,#pban_email,#pbanrem_email').blur(function() { Profile.checkField(this, '1'); }); $('#pbanreg_name,#pbanreg_surname,#pbanreg_email,#pban_email,#pbanrem_email').change(function() { Profile.checkField(this, '1'); }); $('#pbanreg_password,#pbanreg_password_2').keyup(function() { Profile.checkField(this, '0'); }); $('#pbanreg_password,#pbanreg_password_2').blur(function() { Profile.checkField(this, '0'); }); $('#pbanreg_password,#pbanreg_password_2').change(function() { Profile.checkField(this, '0'); }); if ($("#profile-register-form").length > 0){ document.getElementById('profile-register-form').reset(); document.getElementById('profile-login-form').reset(); document.getElementById('profile-remind-form').reset(); } $(document).keydown(function (e) {if (e.keyCode === 27) {Profile.hideProfileOverlay('profile-login');}}); })();var Profile = { showForm: function(id) { document.getElementById(id).className = ""; document.getElementById('profile-login-message').className = "hidden"; }, hideForm: function(id) { document.getElementById(id).className = "hidden"; }, hideProfileOverlay: function(id) { var doc = document; doc.getElementById('login-overlay').className = 'hidden'; doc.getElementById('login-div').className = 'hidden'; doc.getElementById('login-error').className = 'hidden'; doc.getElementById(id).className = 'hidden'; doc.getElementById(id + '-message').className = 'hidden'; doc.getElementById(id + '-form').className = 'profile-form'; doc.getElementById('profile-register-form').reset(); doc.getElementById('profile-login-form').reset(); doc.getElementById('profile-remind-form').reset(); $('.remind-button').attr('class', 'def-button remind-button'); $('.remind-wait-text').attr('class', 'hidden remind-wait-text'); $('.register-button').attr('class', 'def-button register-button'); $('.register-wait-text').attr('class', 'hidden register-wait-text'); $('.login-button').attr('class', 'def-button login-button'); $('.login-wait-text').attr('class', 'hidden login-wait-text'); Profile.checkForm(id + '-form', false); if (id == 'profile-login') { this.hideForm('profile-remind'); Profile.checkForm('profile-remind-form', false); } }, showProfileOverlay: function(id) { var doc = document; doc.getElementById('login-overlay').className = 'overlay'; doc.getElementById('login-div').className = 'overlay-div'; document.getElementById(id).className = ''; doc.getElementById('login-close').onclick = function() { Profile.hideProfileOverlay(id); }; $(document).keydown(function (e) { if (e.keyCode === 27) { Profile.hideProfileOverlay(id); } }); }, validateField: function(elem) { var Arr = SplitID(elem, "_"), TextTypeArr = [], i, Numbers = ""; TextTypeArr[0] = [['Type', 'Default'], ['Numbers', '0123456789']]; TextTypeArr[1] = [['Type', 'name'], ['Numbers', 'AaĀāBbCcČčDdEeĒēFfGgĢģHhIiĪīJjKkĶķLlĻļMmNnŅņOoPpRrSsŠšTtUuŪūVvZzŽžQqWwYyXxÄäÕõÖöÜü ']]; TextTypeArr[2] = [['Type', 'surname'], ['Numbers', 'AaĀāBbCcČčDdEeĒēFfGgĢģHhIiĪīJjKkĶķLlĻļMmNnŅņOoPpRrSsŠšTtUuŪūVvZzŽžQqWwYyXxÄäÕõÖöÜü -']]; TextTypeArr[3] = [['Type', 'email'], ['Numbers', '0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpRrSsTtUuVvZzQqWwYyXx .@_!#$%&\'*+-/=?^_`{|}~']]; for (i in TextTypeArr) { if (Arr[1] == TextTypeArr[i][0][1] || Arr[1] + '_' + Arr[2] == TextTypeArr[i][0][1]) { Numbers = TextTypeArr[i][1][1]; } } if (Numbers == "") { Numbers = TextTypeArr[0][1][1]; } var field = elem, valo = "", chars = field.value.split(""); for (i = 0; i < chars.length; i++) { if (Numbers.indexOf(chars[i]) != -1) valo += chars[i]; } if (field.value != valo) field.value = valo; }, jumpToNextField: function(id, intSymb, next) { var doc = document; if (intSymb != 0) { if (doc.getElementById(id).value.length == intSymb) { if (doc.getElementById(next) === null) { doc.getElementById(next).focus(); } else { doc.getElementById(next).focus(); } } } }, checkField: function(Field, opt) { var doc = document, Arr, LabelItemName, FieldIsOk = true, ValidSensitiveInformation = true; $('.login-error').attr('class', 'login-error hidden'); $('#profile-register-message').attr('class', 'hidden'); $('#profile-login-message').attr('class', 'hidden'); if(Field.id) { LabelItemName = Field.id + '_Label'; Arr = Field.id.split("_"); if (Arr[1] == 'birthdateday' || Arr[1] == 'birthdatemonth' || Arr[1] == 'birthdateyear') { ValidSensitiveInformation = this.checkDate(Field); } if(Field.getAttribute('obligate') && (Field.getAttribute('obligate') == 'true') && (this.trim(Field.value) == '')) { doc.getElementById(LabelItemName).className = 'profile-text red'; FieldIsOk = false; } else { if(Field.getAttribute('expression')) { if(Field.getAttribute('model')) { re = new RegExp(Field.getAttribute('expression'), 'i'); if(re.test(Field.getAttribute('model')) == false) { alert(Field.tagName + '; type="' + Field.type + '"; name="' + Field.name + '"; id="' + Field.id + '"\n\nmodel does not match the expression\nmodel="' + Field.getAttribute('model') + '"; expression="' + Field.getAttribute('expression')); } if(re.test(Field.value) == true) { doc.getElementById(LabelItemName).className = 'profile-text'; FieldIsOk = true; } else { FieldIsOk = false; ModelLength = Field.getAttribute('model').length; FieldLength = Field.value.length; while(re.test(Field.value.substr(0, FieldLength) + Field.getAttribute('model').substr(FieldLength)) == false) { FieldLength--; Field.value = Field.value.substr(0, FieldLength); } if(re.test(Field.value) == true) { doc.getElementById(LabelItemName).className = 'profile-text'; FieldIsOk = true; } else { if (Field.id.search('Name') != -1) { doc.getElementById(Arr[0] + '_' + 'Name_Label').className = 'profile-text red'; } else { doc.getElementById(LabelItemName).className = 'profile-text red'; } FieldIsOk = false; } } } else { if(opt == "1") { this.validateField(Field); } re = new RegExp(Field.getAttribute('expression'), 'i'); if(re.test(Field.value) == false || ValidSensitiveInformation == false) { doc.getElementById(LabelItemName).className = 'profile-text red'; FieldIsOk = false; } else { doc.getElementById(LabelItemName).className = 'profile-text'; FieldIsOk = true; if (ValidSensitiveInformation == true && (Arr[1] == 'birthdateday' || Arr[1] == 'birthdatemonth' || Arr[1] == 'birthdateyear')) { doc.getElementById(Arr[0] + '_birthdateday_Label').className = 'profile-text'; doc.getElementById(Arr[0] + '_birthdatemonth_Label').className = 'profile-text'; doc.getElementById(Arr[0] + '_birthdateyear_Label').className = 'profile-text'; } } } } else { if(doc.getElementById(LabelItemName)) { doc.getElementById(LabelItemName).className = 'profile-text'; FieldIsOk = true; } } } } return(FieldIsOk); }, trim: function(str) { return str.replace(/(^\s+)|(\s+$)/g, ''); }, checkDate: function(elem) { var doc = document, Arr = elem.id.split("_"), datePart1 = doc.getElementById(Arr[0] + '_birthdateday').value, datePart2 = doc.getElementById(Arr[0] + '_birthdatemonth').value, datePart3 = doc.getElementById(Arr[0] + '_birthdateyear').value, Date = datePart1 + '-' + datePart2 + '-' + datePart3; if(datePart1.length > 1 && datePart2.length > 1 && datePart3.length > 3) { var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/, matchArray = Date.match(datePat), day = matchArray[1], month = matchArray[3], year = matchArray[5]; if ((month < 1) || (month > 12)) { return false; } else if (day < 1 || day > 31) { return false; } else if ((month==04 || month==06 || month==09 || month==11) && day==31) { return false; } else if (month == 02) { var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); if (day > 29 || (day==29 && !isleap)) { return false; } else { return true; } } else { return true; } } else { return false; } }, checkForm: function(formID, addBreak) { var doc = document, len = doc.getElementById(formID).length, i = 0, id, type, resp = true; for(i; i < len; i++) { if (doc.getElementById(formID)[i].id != 'pbanreg_password' && doc.getElementById(formID)[i].id != 'pbanreg_password_2') { type = '1'; } else { type = '0'; } if (this.checkField(doc.getElementById(formID)[i], type) == false) { if (addBreak) { resp = false; break; } } } return resp; } };var Analytics = { tracker: function(trValue) { if (typeof ECOM_gaTr !== 'undefined') { if (typeof ECOM_gaTr.active === 'undefined') { ECOM_gaTr.active = 0; };var ogaOpt = ECOM_gaTrOpt;if (ogaOpt.a === '1') {if (ECOM_gaTr.active == 0) {var tP = ogaOpt.m + '/' + trValue;ECOM_gaTr.active = 1; ga('create', ECOM_gaTr[0], 'auto', {'allowLinker': true}); ga('require', 'linker'); ga('linker:autoLink', [ECOM_gaTr[1]]); //ga('set', 'dimension1', Hash); ga('send', { 'hitType': 'pageview', 'page': tP, 'hitCallback': function() { ECOM_gaTr.active = 0; } });//gadījumā ja ir papildus informācija, nosūta veiktās transakcijas informāciju if (ogaOpt.spfs[trValue] != undefined) { ga('require', 'ecommerce'); ga('ecommerce:addTransaction', ogaOpt.spfs[trValue][0]); ga('ecommerce:addItem', ogaOpt.spfs[trValue][1]); ga('ecommerce:send'); }var obj = {}; obj[ogaOpt.m] = trValue;this.remarketing(obj); } else { setTimeout(function() {Analytics.tracker(trValue);}, 25); } } }},remarketing: function(obj) {var conversionIdArr = [1053775380, 1045818901, 939282444], i = 0;for (i = 0; i < 3; i++) { if (window.google_trackConversion != undefined) { window.google_trackConversion({ google_conversion_id: conversionIdArr[i], google_custom_params: obj, google_remarketing_only: true }); } }} };function Serialize(Args) { var SerializedString = ""; var Total = 0; for (var key in Args) { ++Total; SerializedString = SerializedString + "s:" + String(key).length + ":\"" + String(key) + "\";s:" + String(Args[key]).length + ":\"" + String(Args[key]) + "\";"; } SerializedString = "a:" + Total + ":{" + SerializedString + "}"; return SerializedString; }var AJAXLastResponseText = '';function AJAXLoad(ServerMethod, Arguments, CallbackFunctionName) { var Request; if (window.XMLHttpRequest) Request = new XMLHttpRequest(); else if (window.ActiveXObject) Request = new ActiveXObject('Microsoft.XMLHTTP'); Request.onreadystatechange = function () { if (Request.readyState == 4) { AJAXLastResponseText = Request.responseText; eval(CallbackFunctionName + '();'); delete(Request); } } Request.open('GET', '/ajax.php?LanguageID=' + LanguageID + '&ServerMethod=' + ServerMethod + '&Arguments=' + encodeURIComponent(Arguments) + '&' + Math.random(), true); Request.send(null); }function AJAXLoad_WithPOSTData(ServerMethod, Arguments, CallbackFunctionName, Evalue) { var Request; if (window.XMLHttpRequest) Request = new XMLHttpRequest(); else if (window.ActiveXObject) Request = new ActiveXObject('Microsoft.XMLHTTP'); Request.onreadystatechange = function () { if (Request.readyState == 4) { AJAXLastResponseText = Request.responseText; if(Evalue == "true"){ eval(CallbackFunctionName + '('+AJAXLastResponseText+');'); }else{ eval(CallbackFunctionName + '();'); } delete(Request); } } var parameters = "LanguageID=" + LanguageID + "&ServerMethod=" + ServerMethod + "&Arguments=" + encodeURIComponent(Arguments); Arguments = Base64.encode("Hidden"); Request.open("POST", "/ajax.php?LanguageID=" + LanguageID + "&ServerMethod=" + ServerMethod + "&Arguments=" + encodeURIComponent(Arguments), true); Request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); Request.send(parameters); }/** * * Base64 encode / decode * http://www.webtoolkit.info/ * **/var Base64 = {// private property _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",// public method for encoding encode : function (input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0;input = Base64._utf8_encode(input);while (i < input.length) {chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++);enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63;if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; }output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);}return output; },// public method for decoding decode : function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0;input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");while (i < input.length) {enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++));chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4;output = output + String.fromCharCode(chr1);if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); }}output = Base64._utf8_decode(output);return output;},// private method for UTF-8 encoding _utf8_encode : function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = "";for (var n = 0; n < string.length; n++) {var c = string.charCodeAt(n);if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); }}return utftext; },// private method for UTF-8 decoding _utf8_decode : function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0;while ( i < utftext.length ) {c = utftext.charCodeAt(i);if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; }}return string; }}