﻿function getElementByID(id) { var theDoc = document; if (theDoc.getElementById) box = theDoc.getElementById(id); else if (theDoc.all) box = theDoc.all[id].value; else if (theDoc.layers) box = theDoc.layers; else box = null; return box } function AllTrim(boxValue) { var boxValue = new String(boxValue); boxValue = boxValue.replace(/^[\s]+/g, ""); boxValue = boxValue.replace(/[\s]+$/g, ""); return boxValue } function openWindow(url, name, width, height) { var h, w; var l, t; if (width == 0) width = 750; if (height == 0) height = 550; h = screen.height; w = screen.width; l = parseInt((w - width) / 2); t = parseInt((h - height) / 2); popupWin = window.open(url, name, 'dependent=yes,toolbar=no, resizable=yes,scrollbars=yes, width=' + width + ',height=' + height + ',left=' + l + ',top=' + t) } function popup(obj, l, t) { with (obj.style) { display = "block"; position = "absolute"; left = l; top = t } } function unpop(obj) { obj.style.display = "none" } function SelectInDropdown(ddl, valueToSelect) { var options = ddl.getElementsByTagName('option'); var len = options.length; for (var i = 0; i < len; i++) { var val = options[i].getAttribute('value'); if (val == AllTrim(valueToSelect)) { ddl.selectedIndex = i; break } } } function getDropDownValue(eleID) { var dd = getElementByID(eleID); if (dd.selectedIndex >= 0) return dd.options[dd.selectedIndex].value; return "" } function setDropDownValue(eleID, value) { var dd = getElementByID(eleID); dd.selectedIndex = value } function isDropDownValueSelected(eleID, defaultValue) { var dd = getElementByID(eleID); if (dd.selectedIndex >= 0) { var s = dd.options[dd.selectedIndex].value; return (s != defaultValue ? true : false) } return false } function visible(id, show) { if (document.layers) { vista = show ? 'show' : 'hide'; document.layers[id].visibility = vista } else if (document.all) { vista = show ? 'visible' : 'hidden'; document.all[id].style.visibility = vista } else if (document.getElementById) { vista = show ? 'visible' : 'hidden'; document.getElementById(id).style.visibility = vista } } var g_SAFECHARS = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "'&-_.+ "; function findUnsafeChars(str) { var unsafeChars = ""; for (i = 0; i < str.length; i++) { if (g_SAFECHARS.indexOf(str.charAt(i)) == -1) { if (unsafeChars.indexOf(str.charAt(i)) == -1) unsafeChars += " " + str.charAt(i) + " " } } return unsafeChars } function stripNoneAlphaNumChar(str) { var res = ""; for (i = 0; i < str.length; i++) { if (g_SAFECHARS.indexOf(str.charAt(i)) >= 0) res += str.charAt(i) } return res } function URLEncode(plaintext) { var SAFECHARS = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "-_.!~*'()"; var HEX = "0123456789ABCDEF"; var encoded = ""; for (var i = 0; i < plaintext.length; i++) { var ch = plaintext.charAt(i); if (ch == " ") { encoded += "+" } else if (SAFECHARS.indexOf(ch) != -1) { encoded += ch } else { var charCode = ch.charCodeAt(0); if (charCode > 255) { } else { encoded += "%"; encoded += HEX.charAt((charCode >> 4) & 0xF); encoded += HEX.charAt(charCode & 0xF) } } } return encoded } function URLDecode(utftext) { utftext = unescape(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 } function extractFromUrl(_var, str) { var val; var url = !str ? document.location.href : str; var UNSAFECHARS = "#"; if (url != undefined) { var tmp = ''; for (i = 0; i < url.length; i++) if (UNSAFECHARS.indexOf(url.charAt(i)) < 0) tmp += url.charAt(i); url = tmp } var firstIndex = url.indexOf(_var + "=", 0); var secondIndex = url.indexOf("&", firstIndex + 1); if (url.indexOf(_var) != -1) { if (secondIndex != -1) { val = url.slice(firstIndex, secondIndex) } else { val = url.slice(firstIndex) } val = val.slice(val.indexOf('=') + 1) } else { val = null } var splitter = "&" + _var + "=" + val; var urlRunoff = url.split(splitter); var _replaceUrl = urlRunoff[0] + urlRunoff[1]; return { value: val, replaceUrl: _replaceUrl} } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] } else { return document[movieName] } } function doFunction(id) { var targetUrl = document.getElementById(id).href; var rawString = targetUrl.indexOf("javascript:") != -1 ? targetUrl.split("javascript:")[1] : targetUrl; var method = rawString.split("(")[0]; var params = rawString.split("(")[1].split(","); params[params.length - 1] = params[params.length - 1].substr(0, params[params.length - 1].length - 1); eval(method + "(" + params.toString() + ")") } function noenter(e, handler) { var enterPressed; if (e.keyCode == 13) { if (handler) handler(); enterPressed = true } else { enterPressed = false } return !enterPressed } function clearForm(id) { var inputArray = document.getElementsByTagName("input"); for (var i = 0; i < inputArray.length; i++) { if (inputArray[i].getAttribute("type") == "text"); inputArray[i].value = null } if (id) doFunction(id) } function noenter(e, handler) { var enterPressed; if (e.keyCode == 13) { if (handler) handler(); enterPressed = true } else { enterPressed = false } return !enterPressed } function getFlashVarsFromObj(obj) { var result = ""; var params = []; for (var i in obj) { params.push(i) } for (var i = 0; i < params.length; i++) { result += params[i] + "=" + obj[params[i]]; if (params[i + 1]) result += "&" } return result }