﻿function FindPosition(ctrl) { var curleft = 0; var curtop = 0; if (ctrl.offsetParent) { curleft = ctrl.offsetLeft; curtop = ctrl.offsetTop; while (ctrl = ctrl.offsetParent) { curleft += ctrl.offsetLeft; curtop += ctrl.offsetTop } } return [curleft, curtop] } function ClickButton(btnId) { var btn = document.getElementById(btnId); if (btn) { btn.click() } } function GoToRegistrationPage(btnId) { ClickButton(btnId) } function CloseModalPopup(popupId) { var mpu = $find(popupId); if (mpu) { mpu.hide() } } function ShowHideControl(controlId, show) { var control = document.getElementById(controlId); if (control) { if (show) { control.style.display = '' } else { control.style.display = 'none' } } } function onKeyDown(evt) { var keyCode = document.all ? evt.keyCode : evt.which ? evt.which : evt.keyCode ? evt.keyCode : evt.charcode; if (keyCode == 13) { return true } else { return false } } function clickButton(e, buttonId) { var bt = document.getElementById(buttonId); if (bt) { if (onKeyDown(e)) { bt.click(); return false } } } function EnableControls(chkID, txtBox1ID, txtBox2ID, disableCss, confirmMsg) { var checkBox = document.getElementById(chkID); var textBox1 = document.getElementById(txtBox1ID); var textBox2 = document.getElementById(txtBox2ID); if (checkBox && textBox1 && textBox2) { if (checkBox.checked) { var confirm = window.confirm(confirmMsg); if (confirm) { textBox1.className = disableCss; textBox2.className = disableCss } else { textBox1.className = ""; textBox2.className = ""; checkBox.checked = false } } else { textBox1.className = ""; textBox2.className = "" } textBox1.disabled = checkBox.checked; textBox2.disabled = checkBox.checked } } function EnableControl(chkID, txtBoxID, disableCss, confirmMsg) { var checkBox = document.getElementById(chkID); var textBox = document.getElementById(txtBoxID); if (checkBox && textBox) { if (checkBox.checked) { var confirm = window.confirm(confirmMsg); if (confirm) { textBox.className = disableCss } else { textBox.className = ""; checkBox.checked = false } } else { textBox.className = "" } textBox.disabled = checkBox.checked } } function DisableControl(chkID, txtBoxID, disableCss) { var checkBox = document.getElementById(chkID); var textBox = document.getElementById(txtBoxID); if (checkBox && textBox) { if (checkBox.checked == false) { textBox.className = disableCss; textBox.disabled = true } else { textBox.className = ""; textBox.disabled = false } } } function ShowPanels(chkID, panelID) { var checkBox = document.getElementById(chkID); var panel = document.getElementById(panelID); if (checkBox && panel) { if (!checkBox.checked) { panel.style.display = 'none' } else { panel.style.display = '' } } } function ShowAnimationDivCenter(divName, imgSrc, myAnimatedImage) { var span = document.getElementById(divName); if (span) { span.style.display = ""; span.style.top = getScreenCenterY() + "px"; span.style.left = getScreenCenterX() + "px"; setTimeout('document.images[' + '"' + myAnimatedImage + '"' + '"].src = ' + '"' + imgSrc + '"', 200) } } function getScrollOffset() { var y; if (self.pageYOffset) { y = self.pageYOffset } else if (document.documentElement && document.documentElement.scrollTop) { y = document.documentElement.scrollTop } else if (document.body) { y = document.body.scrollTop } return (y) } function getInnerHeight() { var browserHeight = 0; if (typeof (window.innerWidth) == 'number') { browserHeight = window.innerHeight } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { browserHeight = document.documentElement.clientHeight } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { browserHeight = document.body.clientHeight } return (browserHeight) } function getScreenCenterY() { var y = 0; y = getScrollOffset() + (getInnerHeight() / 2); return (y) } function getScreenCenterX() { return (getInnerWidth() / 2) } function getInnerWidth() { var browserWidth = 0; if (typeof (window.innerWidth) == 'number') { browserWidth = window.innerWidth } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { browserWidth = document.documentElement.clientWidth } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { browserWidth = document.body.clientWidth } return (browserWidth) } var windowWidth, windowHeight; function getWindowSize() { if (typeof (window.innerWidth) == 'number') { windowWidth = window.innerWidth; windowHeight = window.innerHeight } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight } } function ShowAnimationDiv(e, divName, imgSrc, myAnimatedImage) { var browser = navigator.appName; if (browser == "Microsoft Internet Explorer") { return } var posx = 0; var posy = 0; if (!e) { e = window.event } if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY } else if (e.clientX || e.clientY) { posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop } if (posx == 0 && posy == 0) { ShowAnimationDivCenter(divName, imgSrc, myAnimatedImage) } else { var span = document.getElementById(divName); if (span) { span.style.display = ""; if (posy > 60) { span.style.top = (posy - 60) + "px" } else { span.style.top = posy + "px" } span.style.left = (posx + 20) + "px"; setTimeout('document.images[' + '"' + myAnimatedImage + '"' + '"].src = ' + '"' + imgSrc + '"', 500) } } } function hasClass(ele, cls) { return (ele.className.search(new RegExp(cls)) != -1); } function addClass(ele, cls) { if (!this.hasClass(ele, cls)) ele.className += " " + cls; } function removeClass(ele, cls) { if (hasClass(ele, cls)) { var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); ele.className = ele.className.replace(reg, ' '); } } function IsRadioButtonChecked(radionButtonId) { var radionButton = document.getElementById(radionButtonId); if (radionButton) { return radionButton.checked } return false } function UnCheckRadioButton(radionButtonId) { var radionButton = document.getElementById(radionButtonId); if (radionButton) { radionButton.checked = false } } function ValidateVaccinesInput(textBoxId) { var validate = false; var textBox = document.getElementById(textBoxId); if (textBox) { if (textBox.value != '' && textBox.value != 'בחר חיסון') { validate = true; removeClass(textBox, "CountriesTextBoxBad") } else { validate = false; textBox.value = "בחר חיסון"; addClass(textBox, "CountriesTextBoxBad") } } return validate } function ValidateCountriesInput(radionButtonId1, radionButtonId2, radionButtonId3, textBoxId) { var validate = false; if (IsRadioButtonChecked(radionButtonId1) || IsRadioButtonChecked(radionButtonId2) || IsRadioButtonChecked(radionButtonId3)) { validate = true } var legend = document.getElementById('travel_type_legend'); if (legend) { if (validate) { legend.style.color = 'black' } else { legend.style.color = '#ffc360' } } var fieldset = document.getElementById('travel_type_fieldset'); if (fieldset) { if (validate) { fieldset.style.borderColor = 'white' } else { fieldset.style.borderColor = '#ffc360' } } if (validate) { var textBox = document.getElementById(textBoxId); if (textBox) { if (textBox.value != '' && textBox.value != 'בחר יעד') { validate = true; removeClass(textBox, "CountriesTextBoxBad") } else { validate = false; textBox.value = "בחר יעד"; addClass(textBox, "CountriesTextBoxBad") } } } return validate } function OnPaymentYearChanged(drpDownList, labelId, firstPrice, secondPrice) { var drp = document.getElementById(drpDownList); if (drp) { var lbl = document.getElementById(labelId); if (lbl) { var year = drp.options[drp.selectedIndex].value; if (year == 2) { lbl.innerHTML = secondPrice } else if (year == 1) { lbl.innerHTML = firstPrice } else { lbl.innerHTML = '' } } } } function startCheckRegistrationControl(controlId, controlLocation) { setInterval("CheckRegistrationControl('" + controlId + "','" + controlLocation + "')", 500); } function CheckRegistrationControl(controlId, controlLocation) { var control = document.getElementById(controlId); var position = document.getElementById(controlLocation); if (control && position) { var pos = FindPosition(position); if (getScrollOffset() > 280) { control.style.display = ''; control.style.left = (pos[0] + 5) + "px" } else { control.style.display = 'none' } } }

