function HnlCheckEnterAndExecute(executeFunction, eventObj) { if (!eventObj) eventObj = event; if (!eventObj) return; if (eventObj.keyCode == 13) executeFunction(); } function HnlCmsFormColumnExternalDelete(obj) { var baseName = obj.id.replace(/_HnlDelete/, ""); var objPre = document.getElementById(baseName + "_HnlPre"); var objId = document.getElementById(baseName); obj.style.display = "none"; objPre.innerHTML = ""; objId.value = ""; } function HnlCmsFormColumnExternalOpen(obj, externalTable, title, hiddenFilters) { title = HnlUnescape(title); window.open("/_hnl/Bridge.aspx?Resource=PanelPage.aspx&Url=/_hnl/Bridge.aspx?Resource=Cms.CmsList.aspx&HnlCmsExternalItem=" + obj.id + "&HnlCmsFiltersShow=1&HnlCmsTable=" + externalTable + "&HnlCmsHiddenFilters=" + hiddenFilters + "&Title1=" + HnlLanguageExternalItem + "&Title2=" + title); } function HnlDivEditable_OnBeforePaste() { event.returnValue = false; } function HnlDivEditable_OnPaste() { event.returnValue = false; var data = clipboardData.getData("Text"); data = data.replace(/\r\n/g, "\n"); data = data.replace(/\n/g, "

"); var tr = document.selection.createRange(); if (!tr) return; tr.collapse(); tr.pasteHTML(data); } function HnlDivEditableApplyCommand(div, command, dialog) { var obj = document.getElementById(div); switch (command) { case "Line": obj.focus(); var textRange = document.selection.createRange(); if (!textRange) return; textRange.collapse(); textRange.pasteHTML("


"); break; case "LinkItem": alert("No disponible."); break; default: if (!dialog) dialog = false; obj.focus(); document.execCommand(command, dialog); break; } } function HnlDivEditableFitLinks(html) { var htmlNew = ""; do { var tagStart = -1; var tagLowCaseStart = html.indexOf(""); tag = tag.substr(0, tagEnd + 1); htmlNew += html.substr(0, tagStart); html = html.substr(tagStart + tagEnd + 1); tag = tag.replace(/target=_blank/ig, "target=\"_blank\""); if (tag.indexOf("target=\"_blank\"") == -1) tag = tag.substr(0, tag.length - 1) + " target=\"_blank\">"; htmlNew += tag; } else htmlNew += html } while (tagStart != -1); return(htmlNew); } function HnlEmbed(code) { document.write(code); } function HnlEscape(data) { if (data == null) return "%00"; var dataNew = data.replace(/%/g, "%25"); dataNew = dataNew.replace(/\r/g, "%0D"); dataNew = dataNew.replace(/\n/g, "%0A"); dataNew = dataNew.replace(/\t/g, "%09"); dataNew = dataNew.replace(/&/g, "%26"); dataNew = dataNew.replace(/ /g, "%20"); dataNew = dataNew.replace(/\"/g, "%22"); dataNew = dataNew.replace(/\'/g, "%27"); dataNew = dataNew.replace(/\\/g, "%5C"); return dataNew; } function HnlFormFieldEnable(obj, enabled, onClass, offClass) { if (typeof(obj) == "string") obj = document.getElementById(obj); obj.disabled = !enabled; obj.className = (enabled ? onClass : offClass); } function HnlFormSelectAddOption(obj, value, title) { if (typeof(obj) == "string") obj = document.getElementById(obj); var option = document.createElement("OPTION"); obj.options.add(option); if (option.innerText) option.innerText = title; else option.text = title; option.value = value; } function HnlFormSelectClearOptions(obj) { if (typeof(obj) == "string") obj = document.getElementById(obj); for(var i = obj.options.length - 1; i >= 0; i--) obj.removeChild(obj.options[i]); } function HnlFormSubmitOnEnter(obj) { if (event.keyCode == 13) obj.form.submit(); } function HnlGetCookie(name) { var items; var pairs; items = document.cookie.split("; "); for(var i = 0; i < items.length; i++) { pairs = items[i].split("="); if (pairs.length != 2) continue; if (name == pairs[0]) return(unescape(pairs[1])); } return(""); } function HnlGetUrlDropParam(param, url) { if (!url) url = window.location.href; var start = url.indexOf("?" + param + "="); if (start == -1) start = url.indexOf("&" + param + "="); if (start == -1) return url; var end = url.indexOf("&", start + 1); if (end == -1) url = url.substr(0, start); else url = url.substr(0, start) + url.substr(end); return url; } function HnlGetUrlDropParams(params, url) { if (!url) url = window.location.href; var params = params.split(","); for(var i = 0; i < params.length; i++) url = HnlGetUrlDropParam(params[i], url); return url; } function HnlGetUrlParam(param, url) { if (!url) url = window.location.href; var start = url.indexOf("?" + param + "="); if (start == -1) start = url.indexOf("&" + param + "="); if (start == -1) return null; var param; var end = url.indexOf("&", start + 1); if (end == -1) param = url.substr(start + param.length + 2); else param = url.substring(start + param.length + 2, end); return param; } function HnlPreloadImages(imagesString) { var imagesPaths = imagesString.split(","); var images = new Array(); for(var i = 0; i < imagesPaths.length; i++) { var image = new Image(); image.src = imagesPaths[i]; images[images.length] = image; } } function HnlSetCookie(name, value, expires) { var cookie; cookie = name + "=" + escape(value) + "; path=/;"; if (expires) cookie += " expires=" + expires.toUTCString() + ";"; document.cookie = cookie; } function HnlSetLanguageItem(id, value) { var obj = document.getElementById(id); if (obj) { obj.innerHTML = value; return; } eval("HnlLanguage" + id + "=\"" + value + "\""); } function HnlTextChangeSize(obj, value, min, max) { if (typeof(obj) == "string") obj = document.getElementById(obj); var currentSize = parseInt(obj.style.fontSize); if (isNaN(currentSize)) currentSize = HnlTextSize; currentSize += value; currentSize = Math.max(min, Math.min(max, currentSize)); obj.style.fontSize = currentSize + "px"; HnlSetCookie("HnlTextSize", currentSize, new Date(2010, 1, 1)); } function HnlTextChangeInitialSize(defaultSize) { HnlTextSize = parseInt(HnlGetCookie("HnlTextSize")); if (isNaN(HnlTextSize)) HnlTextSize = defaultSize; var heads = document.getElementsByTagName('head'); var css = heads[0].appendChild(document.createElement('style')); if (document.styleSheets[0].addRule) document.styleSheets[0].addRule(".HnlTextSize", "font-size:" + HnlTextSize + "px;"); else document.styleSheets[0].insertRule(".HnlTextSize {font-size:" + HnlTextSize + "px;}", 0); } function HnlUnescape(data) { if (data == null || data == "%00") return null; var dataNew = data.replace(/%27/g, "'"); dataNew = dataNew.replace(/%22/g, "\""); dataNew = dataNew.replace(/%20/g, " "); dataNew = dataNew.replace(/%26/g, "&"); dataNew = dataNew.replace(/%09/g, "\t"); dataNew = dataNew.replace(/%0A/g, "\n"); dataNew = dataNew.replace(/%0D/g, "\r"); dataNew = dataNew.replace(/%25/g, "%"); dataNew = dataNew.replace(/%5C/g, "\\"); return dataNew; } function HnlUploadCreateButton(id, maxFiles, url, maxBytes, skin, skinWidth, skinHeight, language) { var parsedUrl = url.replace("&", "%26"); var params = "Id=" + id + "&" + "MaxFiles=" + maxFiles + "&" + "Url=" + parsedUrl; if (maxBytes) params += "&MaxBytes=" + maxBytes; if (skin) { params += "&Skin=" + skin + "&" + "SkinWidth=" + skinWidth + "&" + "SkinHeight=" + skinHeight; } else { skinWidth = 260; skinHeight = 22; } if (language) params += "&Language=" + language; var eventFunction = null; try { eventFunction = window.eval(id + "Events"); if (eventFunction) params += "&EventFunction=" + id + "Events"; } catch (e) { } if (!eventFunction) params += "&EventFunction=HnlUploadDefaultEventProcess"; HnlEmbed( '' + '' + '' + '' + '' + '' + '' + '' + '' + ''); } function HnlUploadDefaultEventProcess(id, event, info, message) { switch (event) { case "Complete": var statusField = document.getElementById(id + "Files"); if (statusField) statusField.value = info; alert(message); return; case "Error": alert(message); return; case "Validation": alert(message); return; } alert("ERROR: HnlUpload unknown command."); }