var browserType; if (document.layers) {browserType = "nn4"} if (document.all) {browserType = "ie"} if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"} function enterKeyPressHidePopup(e) { var key = e.key(); if ( key.code == 13 && isPopupVisible()) { hidePopupDialog(); e.stop(); return false; } } function registerEnterToHidePopup() { MochiKit.Signal.connect(document, "onkeydown", this, "enterKeyPressHidePopup"); } function isPopupVisible() { if (browserType == "gecko" ) document.poppedLayer = eval('document.getElementById(\'popup2\')'); else if (browserType == "ie") document.poppedLayer = eval('document.all[\'popup2\']'); else document.poppedLayer = eval('document.layers[\'`popup2\']'); return (document.poppedLayer.style.visibility == "visible"); } function hidePopupDialog() { hidePopupDialogWithId('popup2'); } function hidePopupDialogWithId(id) { unhideAllVisibleSelectsInIE6(); if (browserType == "gecko" ) document.poppedLayer = eval('document.getElementById(\''+id+'\')'); else if (browserType == "ie") document.poppedLayer = eval('document.all[\''+id+'\']'); else document.poppedLayer = eval('document.layers[\'`'+id+'\']'); document.poppedLayer.style.visibility = "hidden"; } function showPopupDialogWithProductText(title,token,productID,buttonText) { var url = "servlet/com.lensway.controllers.TextLookupController"; var baseURL = ( window.baseURL ) ? window.baseURL : ''; url = baseURL + '/' + url; var d = postJSONDoc(url, {token:token,productID:productID}); d.addCallback(function (result) { if(!trim(result.responseText) == "") { showPopupDialog(result.responseText,title,buttonText); } }); d.addErrback(function (result) { log(result); }); } function showPopupDialog(messageText, captionText, buttonText){ hideAllVisibleSelectsInIE6(); if(buttonText) { var popupDialogCloseButtonText = document.getElementById('popupDialogCloseButtonText'); popupDialogCloseButtonText.innerHTML = buttonText; } var captionElem = document.getElementById('popupCaption'); captionElem.innerHTML = "