// SDK var browserStr = new String(navigator.userAgent.toLowerCase()); // var opera = browserStr.indexOf('opera'); // var netscape = navigator.appName=='Netscape'; var hasDOM = document.getElementById?true:false; function getElementById(id, objContainer) { var ie = browserStr.indexOf('msie'); if (!objContainer) objContainer = document; if (hasDOM) return objContainer.getElementById(id); else if (ie) return objContainer.all[id]; } function _getElementById(id, objContainer) { var ie = browserStr.indexOf('msie'); if (!objContainer) objContainer = document; if (hasDOM) return objContainer.getElementById(id); else if (ie) return objContainer.all[id]; } function getFrame(frameName) { if (document.frames) return eval('document.frames.' + frameName); if (window.frames) return eval('window.frames.' + frameName); } function toggleDisplay(elementId) { if (_getElementById(elementId)) { element = _getElementById(elementId); if (element.style.display == 'none') element.style.display = ''; else element.style.display = 'none' return element.style.display; } } function toggleDisplayValue(elementId, toggleValue) { if (_getElementById(elementId)) { element = _getElementById(elementId); element.style.display = toggleValue; } } function bindEvent(obj, eventName, func) { if (document.attachEvent) obj.attachEvent("on"+eventName, func); else if (document.addEventListener) { obj.addEventListener(eventName, func, 0); } } function eventElement(e) { evt = e; switch (evt.type) { case "keyup": case "keydown": case "keypress": case "click": { return evt.srcElement?evt.srcElement:evt.target; } break; case "mouseover": { return evt.toElement?evt.toElement:evt.target; } break; case "mouseout": { return evt.fromElement?evt.fromElement:evt.target; } break; } } function cancelBubble(e) { evt = e; if (evt.stopPropagation) evt.stopPropagation(); else evt.cancelBubble = true; } function isElementVisible(el) { var parentEl = el; do { if (parentEl.style && parentEl.style.display == 'none') { return false; } } while (parentEl = getParentElement(parentEl)); return true; } function getParentElement(el) { if (el.parentElement) return el.parentElement; if (el.parentNode) return el.parentNode; if (el.offsetParent) return el.offsetParent; } // ************************************************************************************************* var floatTextbox = null; if(document.addEventListener) { document.addEventListener('focus', function(event) { var focusedElement = event.target; if ((floatTextbox) && (focusedElement.id != 'floatInt') && (focusedElement.id != 'floatFrac') && (focusedElement.id != 'floatSign')) { floatValueBuild(); } }, true); } function IEFocusCheck() { var isIE = document.all; if(isIE) { var activeElementID = document.activeElement.id; if ((activeElementID != 'floatInt') && (activeElementID != 'floatFrac') && (activeElementID != 'floatSign')) { floatValueBuild(); } } } function digitsCheck(event) { event = event || window.event; var target = event.target || event.srcElement; var isIE = document.all; var code = isIE ? event.keyCode : event.which; var char = String.fromCharCode(code); if (code < 32) { return true; } else { return ((code >= 48) && (code <= 57)); } } function onlyDigitsCheck(event) { event = event || window.event; var target = event.target || event.srcElement; var isIE = document.all; var code = isIE ? event.keyCode : event.which; var char = String.fromCharCode(code); if ((target.id == 'floatInt') && ((char == ',') || (char == '.'))) { document.getElementById('floatFrac').focus(); return false; } if(code == 13) { floatValueBuild(); } else if (code < 32) { return true; } else { return ((code >= 48) && (code <= 57)); } } function floatFormCloseByESC(event) { event = event || window.event; var isIE = document.all; var code = isIE ? event.keyCode : event.which; if (code == 27) { floatFormClose(); } } function floatValueBuild() { var floatSign = document.getElementById('floatSign').value; var floatInt = document.getElementById('floatInt').value; var floatFrac = document.getElementById('floatFrac').value; if (floatInt.indexOf('0') == 0) { floatInt = '0'; } var value = ''; if (!floatInt && !floatFrac) { value = ''; } else if (!floatInt) { value = '0.' + floatFrac; } else if(!floatFrac) { value = floatInt; } else { value = floatInt + '.' + floatFrac; } if (value) { value = (floatSign == '+') ? value : '-' + value; } floatTextbox.value = value; floatFormClose(); } function floatValueRetrieve() { var valueString = floatTextbox.value; var valueArray = []; if (!valueString) { return ['', '', '']; } if (valueString.indexOf('-') != -1) { valueArray[0] = '-'; valueString = valueString.substr(1, valueString.length - 1); } var dotPos = valueString.indexOf('.'); if (dotPos != -1) { var parts = valueString.split('.'); valueArray[1] = parts[0]; valueArray[2] = parts[1]; } else { valueArray[1] = valueString; valueArray[2] = ''; } return valueArray; } function floatFormCreate() { var form = document.createElement('div'); form.id = 'floatForm'; var value = floatValueRetrieve(floatTextbox); if (value[0] == '-') { var signOptions = ''; } else { var signOptions = ''; } var floatInt = ''; var floatFrac = ''; //form.innerHTML = '
 ' + floatInt + ' . ' + floatFrac + '  
'; form.innerHTML = '
 ' + floatInt + ' . ' + floatFrac + '
'; var parent = floatTextbox.parentNode; parent.insertBefore(form, floatTextbox); floatTextbox.style.display = 'none'; document.getElementById('floatInt').focus(); } function floatFormClose() { var form = document.getElementById('floatForm'); var parent = floatTextbox.parentNode; parent.removeChild(form); floatTextbox.style.display = ''; floatTextbox = null; } function floatForm(object) { if (!window.floatTextbox) { floatTextbox = object; floatFormCreate(); } else if(floatTextbox !== object) { floatFormClose(); floatTextbox = object; floatFormCreate(); } } function correctFloat() { if (window.event.keyCode==44) window.event.keyCode=46; } function checkUnsignedFloat() { if ((window.event.keyCode>=48) && (window.event.keyCode<=57) || (window.event.keyCode==8) || (window.event.keyCode==9) || (window.event.keyCode==36) || (window.event.keyCode==35) || (window.event.keyCode==46) || (window.event.keyCode>=37) && (window.event.keyCode<=40) || (window.event.keyCode>=96) && (window.event.keyCode<=105) || (window.event.keyCode==190) || (window.event.keyCode==110)) return true; return false; } function checkUnsignedInt() { if ((window.event.keyCode>=48) && (window.event.keyCode<=57) || (window.event.keyCode==8) || (window.event.keyCode==9) || (window.event.keyCode==36) || (window.event.keyCode==35) || (window.event.keyCode==46) || (window.event.keyCode>=37) && (window.event.keyCode<=40) || (window.event.keyCode>=96) && (window.event.keyCode<=105)) return true; return false; } function checkDate(str) { var dateStr=new String(str); var dateArray=dateStr.split('-'); today=new Date(); day=parseInt(dateArray[0]); month=parseInt(dateArray[1]); year=parseInt(dateArray[2]); if ((day>0 && day<32) && (month>0 && month<13) && (year>=today.getYear())) { return true; } return false; } function toggleDisableInput(obj) { isDisabled = obj.getAttribute("disabled"); if (!isDisabled) obj.setAttribute("disabled",true); else obj.setAttribute("disabled",false); /* var text=new String(); text=obj.outerHTML; findDisabled=text.search('disabled'); if (findDisabled>0) { text=text.substr(0,findDisabled)+text.substr(findDisabled+8); } else { text=text.substr(0,text.length-2)+' disabled>'; } obj.outerHTML=text;*/ } function checkFloat() { //alert(window.event.keyCode); //event.keyCode = 110; if ((window.event.keyCode>=48) && (window.event.keyCode<=57) || (window.event.keyCode==8) || (window.event.keyCode==9) || (window.event.keyCode==36) || (window.event.keyCode==35) || (window.event.keyCode==46) || (window.event.keyCode>=37) && (window.event.keyCode<=40) || (window.event.keyCode>=96) && (window.event.keyCode<=105) || (window.event.keyCode==190) || (window.event.keyCode==189) || (window.event.keyCode==109) || (window.event.keyCode==110)) return true; return false; } function setDisableInput(obj, disabled) { obj.setAttribute("disabled", disabled); } function radioButtonValue(obj) { if (!isNaN(obj.length)) { for (i=0; i window.screen.width + 100) newWidth = window.screen.width - 100; if (newHeight > window.screen.height + 100) newHeight = window.screen.height - 100; newX = (window.screen.width - newWidth)/2; newY = (window.screen.height - newHeight)/2 - 10; window.resizeTo(newWidth, newHeight); window.moveTo(newX, newY); } function setCookie(cookieName, value, time, path) { if (!time) time = 977616000; if (!path) path = "./"; var exp = new Date(); var newexp = exp.getTime() + time; exp.setTime(newexp); document.cookie = cookieName+"="+value+"; expires="+exp.toGMTString()+"; path="+path; } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function changeImg(img_c,el_id_or_obj){ if(el_id_or_obj){ el_id = document.getElementById(el_id_or_obj); if(el_id){ el_id.src=img_c; }else{ el_id_or_obj.src=img_c; } } return ""; } function trim(str) { return str.replace(/^\s+|\s+$/g, ""); }