Myshape Consumer <![CDATA[ // <![CDATA[ document.onkeydown = function (e) { var event = window.event || e; if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) { if((e.which || e.keyCode) == 116) e.preventDefault(); }else{ if (event.keyCode == 116 || (event.ctrlKey && event.keyCode == 82)) { event.keyCode = 0; return false; } } }; // functions and variable to control status message var currentStatus=''; function ShowStatus(newStatus) { window.status = newStatus; } function SetStatus(newStatus) { currentStatus=newStatus; ShowStatus(newStatus); } function ShowPreviousStatus() { ShowStatus(currentStatus); } /* * Prevents an event to bubble to the parent elements. * Special tricks for IE added. */ function cancelBubble(e) { if (!e) { e = window.event; } e.cancelBubble = true; if (e.stopPropagation) { e.stopPropagation(); } return true; } /* * manage the sub parameter's input of choice items following the state of the parameter's checkbox */ function toggleChoiceItemState(checkbox) { subInputs = document.form_MODIFY_SERVICE.elements[checkbox.value]; if (checkbox.checked) { if (subInputs) { if (subInputs.length) { for (i=0; i<subInputs.length; i++) { subInputs[i].disabled = false; } } else { subInputs.disabled = false; } } } else { if (subInputs) { if (subInputs.length) { for (i=0; i<subInputs.length; i++) { if (subInputs[i].type == "checkbox" || subInputs[i].type == "radio") { subInputs[i].checked = false; } else if (subInputs[i].type == "text" || subInputs[i].type == "password") { subInputs[i].value = ""; } subInputs[i].disabled = true; } } else { if (subInputs.type == "checkbox" || subInputs.type == "radio") { subInputs.checked = false; } else if (subInputs.type == "text" || subInputs.type == "password") { subInputs.value = ""; } subInputs.disabled = true; } } } } // clears all visible form elements function clear_form_elements(form) { tags = form.getElementsByTagName('input'); for(i = 0; i < tags.length; i++) { switch(tags[i].type) { case 'password': case 'text': tags[i].value = ''; break; case 'checkbox': case 'radio': tags[i].checked = false; break; } } tags = form.getElementsByTagName('select'); for(i = 0; i < tags.length; i++) { if(tags[i].type == 'select-one') { tags[i].selectedIndex = 0; } else { for(j = 0; j < tags[i].options.length; j++) { tags[i].options[j].selected = false; } } } tags = form.getElementsByTagName('textarea'); for(i = 0; i < tags.length; i++) { tags[i].value = ''; } } function checkAll(element) { var celts = document.getElementById(element).getElementsByTagName('input'); for (i=0; i<celts.length ; i++) { celts[i].checked = true; } } function uncheckAll(element) { var celts = document.getElementById(element).getElementsByTagName('input'); for (i=0; i 0) { var dialogBody = “

“; for (input in inputWithError) { dialogBody += inputWithError[input].errorMessage + “
“; } displayErrorBox(dialogBody); return false; } return true; } /* * Defines this function for IE which doesn’t have the function Array.indexOf(). * Don’t add anything dynamically on the Array object because it will make the for (in) loops fail in IE! */ function indexOfInArray(arr, elem) { if (arr.indexOf) {// for other browsers return arr.indexOf(elem); } else {// for IE for (var i=0; i 0) { valid = validationRegExp.test(valueToValidate); if (valid) { currentInputIndex = indexOfInArray(inputWithError, inputElem); if (currentInputIndex != -1) { inputWithError.splice(currentInputIndex, 1); } if (invalidClassIndex != -1) { inputElem.className = inputElem.className.replace(“invalid”, “”); } } else { currentInputIndex = indexOfInArray(inputWithError, inputElem); if (currentInputIndex == -1) { inputElem.errorMessage = errorMessage; inputWithError.push(inputElem); } if (invalidClassIndex == -1) { inputElem.className += ” invalid”; } inputElem.form.onsubmit = allowSubmission; } } else { currentInputIndex = indexOfInArray(inputWithError, inputElem); if (currentInputIndex != -1) { inputWithError.splice(currentInputIndex, 1); } if (invalidClassIndex != -1) { inputElem.className = inputElem.className.replace(“invalid”, “”); } } } var localizedStrings = new Array(); localizedStrings[“infoTitle”] = “information”; localizedStrings[“errorTitle”] = “Error”; localizedStrings[“completeMsg”] = “The language has been set. The texts will be translated on the next step.”; localizedStrings[“errorMsg”] = “An error occurred when changing the language.”; localizedStrings[“ok”] = “OK”; localizedStrings[“close”] = “Close”; localizedStrings[“cancel”] = “Cancel”; localizedStrings[“confirm”] = “Confirm”; localizedStrings[“table_export_csv”] = “Export current table view to Excel”; localizedStrings[“no_records_found”] = “No records found.”; localizedStrings[“sort_ascending”] = “Click to sort ascending”; localizedStrings[“sort_descending”] = “Click to sort descending”; function getTranslation(key) { // localized strings that can be used in the Javascript code (ex: lightbox’s button labels): if (localizedStrings[key]) { return localizedStrings[key]; } return ‘#’+key+’#’; } if (typeof String.prototype.startsWith != ‘function’) { // see below for better implementation! String.prototype.startsWith = function (str){ return this.indexOf(str) == 0; }; } function restrictMultiTabOnSingleSession() { var value = YAHOO.util.Cookie.get(“forceActiveTab”); //alert(value + ” – “); if (value && window.name) { // && window.name.startsWith(“CurrentTab”) // alert(‘force active restrictMultiTabOnSingleSession ‘+window.name); YAHOO.util.Cookie.remove(“forceActiveTab”); //YAHOO.util.Cookie.remove(“deactivatedTabs”); removeFromDeactivatedTabs(window.name); } else if (isADeactivatedTab(window.name)) { return false; } if (!window.name) { var date = new Date(); window.name = ‘CurrentTab’ + date.getTime(); } YAHOO.util.Cookie.set(“CurrentActiveTab”, window.name); return false; } var mySimpleDialog = new YAHOO.widget.SimpleDialog(“simpleWarningDialog”, { width: “20em”, modal: true, visible: false, draggable: true, close: false, hideaftersubmit: false }); mySimpleDialog.setHeader(“Warning!”); mySimpleDialog.setBody(“This window is no more valid. Please close this window and use the current active application window”); mySimpleDialog.render(“multiTabContainer”); var deactivatedTab=false; function testCurrentTab() { var value = YAHOO.util.Cookie.get(“CurrentActiveTab”); // !!!!!!!!!!!!!!!!!!!!!!!!!!! // document.getElementById(‘tablogs’).innerHTML = window.name + ” – deactivated Tabs: ” + YAHOO.util.Cookie.get(“deactivatedTabs”) + ” – force active: ” + YAHOO.util.Cookie.get(“forceActiveTab”); // !!!!!!!!!!!!!!!!!!!!!!!!!!! var forceValue = YAHOO.util.Cookie.get(“forceActiveTab”); if (forceValue && window.name) { // alert(‘force active testCurrentTab ‘+window.name); return false; } if (!window.name || window.name.valueOf() === value) { // good to go } else { // deactivate tab addToDeactivatedTabs(window.name); deactivatedTab=true; mySimpleDialog.show(); // window.location=’GLOBAL.MULTITABERROR;jsessionid=AMbScWEctdVFuYztLBnPrXyLdAC0SJ35nuAjVXCuYmikXQ2WHiiq!-1811789563?jfnRC=1’; } return false; } function removeFromDeactivatedTabs(windowName) { var value = window.parent.deactivatedTabs; if (!value) { return false; } var tabIndex = value.valueOf().indexOf(name); if (tabIndex != -1) { value = value.substring(0, tabIndex) + value.substring(tabIndex + windowName.length); YAHOO.util.Cookie.set(“deactivatedTabs”, value); return true; } return false; } function addToDeactivatedTabs(windowName) { if (isADeactivatedTab(windowName)) { return false; } var value = YAHOO.util.Cookie.get(“deactivatedTabs”); if (!value) { value = “”; } value = windowName + value; YAHOO.util.Cookie.set(“deactivatedTabs”, value); return false; } function isADeactivatedTab(name) { var value = YAHOO.util.Cookie.get(“deactivatedTabs”); if (!name || !value) { return false; } var tabIndx = (value.valueOf().indexOf(name) != -1); return tabIndx; } YAHOO.util.Event.addListener(window, “load”, restrictMultiTabOnSingleSession); YAHOO.util.Event.addListener(window, “focusin”, testCurrentTab); YAHOO.util.Event.addListener(window, “close”, removeFromDeactivatedTabs(window.name)); if (“onfocusin” in document){ document.onfocusin = testCurrentTab; } YAHOO.util.Event.on(“mainLayoutTable”, “click”, function (e) { YAHOO.util.Cookie.set(“currentTab”, window.name); }); // ]]]]> ]]>