// Copyright 2001-2005 Interakt Online. All rights reserved. var $WDG_FORM_SUBMIT_PRIORITY = 20;//after tng form validation var di_UP = 38; var di_DOWN = 40; var di_LEFT = 37; var di_RIGHT = 39; var di_PgUP = 33; var di_PgDOWN = 34; var di_HOME = 36; var di_END = 35; var di_ENTER = 13; var di_DELETE = 46; var di_BACKSPACE = 8; var di_TAB = 9; var di_ESC = 27; var KT_NAMESPACE_URI = 'http://www.interaktonline.com/MXWidgets'; function WDG_getAttributeNS(o, a) { var value = null; if (is.opera && is.v<9) { value = o.getAttribute(a); } else { if (o.getAttributeNS) { value = o.getAttributeNS(KT_NAMESPACE_URI, a); } if (value == '' || value == null) { value = o.getAttribute('wdg:' + a); } } return value; } function WDG_setAttributeNS(o, a, v) { if (is.opera && is.v<9) { o.setAttribute(a, v); o[a] = v; } else { if (o.setAttributeNS) { o.setAttributeNS(KT_NAMESPACE_URI, a, v); } else { o.setAttribute('wdg:' + a, v); } } } function MXWidgets_init() { is = new BrowserCheck(); if (is.ie && is.mac) { return; } if (! (is.ie || is.opera || is.mozilla || is.safari)) { //could not recognize browser return; } var tmpwidget = {}; if (typeof $MXW_relPath=="undefined") { $MXW_relPath = ''; } if (!$MXW_relPath.match(/^\.\//) && $MXW_relPath.indexOf('http') != 0) { $MXW_relPath = "./" + $MXW_relPath; } widgetized_els = []; var widgets = document.getElementsByTagName("SELECT"); for (var i=0; i obj.spinner.ticker[i][0]) { //use last tick setting, for the biggest elapsed time step = obj.spinner.ticker[i][1]; timestep = obj.spinner.ticker[i][2]; } } obj.spin(direction, step); //window.status = 'Changing: ' + elapsed + ', ' + (direction * step); window[$SPN_GLOBALOBJECT]['timeout'] = window.setTimeout('spin_tick('+direction+')', timestep); } function MXW_Spin_buttondown(i){ document.getElementById(i).className = "MXW_Spin_div_down"; } function MXW_Spin_buttonup(i) { document.getElementById(i).className = "MXW_Spin_div_up"; } MXW_Spin.prototype.render = function() { //the widget is replaced by its container //the class widget_container is used in validation this.container = utility.dom.createElement('span', { className:"widget_container" }); this.container = utility.dom.insertAfter(this.container, this.obj.input); this.container.innerHTML = '
'; this.obj.input.style.margin="-1px 0px"; this.container.firstChild.rows[0].firstChild.appendChild(this.obj.input); this.div = this.container.firstChild.rows[0].lastChild.firstChild; // create the buttons if (this.height) { var tmp_height = Math.floor((this.height - 4) / 2); //padding } else { var tmp_height = Math.floor((20 - 4) / 2); } style_string = 'height: ' + tmp_height + 'px; line-height: ' + tmp_height + 'px'; this.div.innerHTML = '
'; this.incbutton = this.div.firstChild.rows[0].firstChild; this.decbutton = this.div.lastChild.rows[0].lastChild; this.disabled = false; var spn = this; utility.dom.attachEvent_base(this.decbutton, "click", function (e){ if (spn.disabled)return; MXW_Spin_buttondown(spn.obj.input.id+'_decbutton'); window.setTimeout("MXW_Spin_buttonup('"+spn.obj.input.id+"_decbutton')", 50); spn.obj.spin(-1); }, 1, false, false); utility.dom.attachEvent_base(this.decbutton, "dblclick", function (e){ if (spn.disabled)return; MXW_Spin_buttondown(spn.obj.input.id+'_decbutton'); window.setTimeout("MXW_Spin_buttonup('"+spn.obj.input.id+"_decbutton')", 50); spn.obj.spin(-1); }, 1, false, false); utility.dom.attachEvent_base(this.decbutton, "mousedown", function (e){ if (spn.disabled)return; utility.dom.stopEvent(e); spn.obj.mousedown = true; MXW_Spin_buttondown(spn.obj.input.id+'_decbutton'); spin_start(spn.obj, -1); }, 1, false, false); utility.dom.attachEvent_base(this.decbutton, "mouseup", function (e){ if (spn.disabled)return; MXW_Spin_buttonup(spn.obj.input.id+'_decbutton'); spin_stop(e); }, 1, false, false); utility.dom.attachEvent_base(this.decbutton, "mouseout", function (e){ if (spn.disabled)return; MXW_Spin_buttonup(spn.obj.input.id+'_decbutton'); spin_stop(e); }, 1, false, false); this.decbutton.onselect = this.decbutton.onselectstart = this.decbutton.ondrag = this.decbutton.ondragstart = rf; utility.dom.attachEvent_base(this.incbutton, "click", function (e){ if (spn.disabled)return; MXW_Spin_buttondown(spn.obj.input.id+'_incbutton'); window.setTimeout("MXW_Spin_buttonup('"+spn.obj.input.id+"_incbutton')", 50); spn.obj.spin(1); }, 1, false, false); utility.dom.attachEvent(this.incbutton, "dblclick", function (e){ if (spn.disabled)return; MXW_Spin_buttondown(spn.obj.input.id+'_incbutton'); window.setTimeout("MXW_Spin_buttonup('"+spn.obj.input.id+"_incbutton')", 50); spn.obj.spin(1); }, 1, false, false); utility.dom.attachEvent_base(this.incbutton, "mousedown", function (e){ if (spn.disabled)return; utility.dom.stopEvent(e); spn.obj.mousedown = true; MXW_Spin_buttondown(spn.obj.input.id+'_incbutton'); spin_start(spn.obj, 1); }, 1, false, false); utility.dom.attachEvent_base(this.incbutton, "mouseup", function (e){ if (spn.disabled)return; MXW_Spin_buttonup(spn.obj.input.id+'_incbutton'); spin_stop(e); }, 1, false, false); utility.dom.attachEvent_base(this.incbutton, "mouseout", function (e){ if (spn.disabled)return; MXW_Spin_buttonup(spn.obj.input.id+'_incbutton'); spin_stop(e); }, 1, false, false); this.incbutton.onselect = this.incbutton.onselectstart = this.incbutton.ondrag = this.incbutton.ondragstart = rf; // this.obj.input.style.margin = '0px'; //this.div.style.margin = '0px'; } function MXW_Spin_setEnabled(state) { this.disabled = !state; if (!this.renderButtons) { return; } if (!state) { utility.dom.classNameAdd(this.div, 'MXW_disabled') } else { utility.dom.classNameRemove(this.div, 'MXW_disabled') } this.incbutton.disabled = !state; this.decbutton.disabled = !state; } MXW_Spin.prototype.setEnabled = MXW_Spin_setEnabled; function MXW_visualAlert(obj, toggle, prefix, x, y) { var classname = window['$'+prefix+'_VISUAL_ALERT_INPUT_CLASSNAME'] var divname = window['$'+prefix+'_DIVPREFIX'] + obj.name; var hasspinner = (typeof obj.spinner != 'undefined' && obj.spinner.renderButtons) ? 19 : 0; var helper = document.getElementById(divname); if (toggle) { utility.dom.classNameAdd(obj.input, classname); utility.dom.showElem(helper); var ppos = utility.dom.getAbsolutePos(obj.input); if (typeof x == 'undefined') { helper.style.left = (ppos.x + obj.input.offsetWidth + 1 + hasspinner) + "px"; } else { helper.style.left = x + "px"; } if (typeof y == 'undefined') { helper.style.top = (ppos.y + parseInt((obj.input.offsetHeight-helper.offsetHeight)/2, 10)) + "px"; } else { helper.style.top = y + "px"; } utility.dom.toggleSpecialTags(helper, false, 1); } else { utility.dom.classNameRemove(obj.input, classname); utility.dom.hideElem(helper); utility.dom.toggleSpecialTags(helper, false, 0); } } function MXW_getSelectionStart(input) { if (input.setSelectionRange) { return input.selectionStart; } else if(input.createTextRange) { var selText = input.ownerDocument.selection.createRange().duplicate(); return -selText.moveStart("character", -1000); } } function MXW_getSelectionEnd(input) { if (input.setSelectionRange) { return input.selectionEnd; } else if(input.createTextRange) { var selText = input.ownerDocument.selection.createRange().duplicate(); selText.collapse(false); return -selText.moveStart("character", -1000); } } function MXW_setSelectionRange(input, selectionStart, selectionEnd) { if (input.setSelectionRange) { input.setSelectionRange(selectionStart, selectionEnd); } else if (input.createTextRange) { var range = input.createTextRange(); range.collapse(true); range.moveStart("character", -1000); range.moveStart('character', selectionStart); range.moveEnd('character', selectionEnd - selectionStart); range.select(); } } function rf(e) { return false; } function addDebugger() { if (document.getElementById("thedebugger")) { return; } var dbg = document.createElement("TEXTAREA"); dbg.id="thedebugger"; document.body.appendChild(dbg); dbg.style.width = "600px"; dbg.style.height = "300px"; dbg.style.fontSize = "11px"; theDebuggerContainer = document.getElementById("thedebugger"); } function _t(t) { //return; addDebugger(); theDebuggerContainer.value += t + "\r\n"; theDebuggerContainer.scrollTop = 100000; } function testclickhandler() { //_t("onclick handler original"); } function testchangehandler() { //_t("onchange handler original"); } function WDG_registerWidgetForFormSubmit(widget_class, input_id) { if (typeof window[widget_class + 's'] == 'undefined') { return; } var obj = window[widget_class + 's'][input_id]; var form_handler_function_name = 'MXW_' + widget_class + '_formhandler'; var form_handler_function_name_test = 'try{' + form_handler_function_name + '}catch(e){}'; var form_handler_function = eval(form_handler_function_name_test); if (typeof(form_handler_function) != 'function') { return; } if (obj.input.form) { var frm = obj.input.form; if (typeof frm != 'undefined') { //check if is already defined, do not overwrite if (typeof(frm['onsubmit_callbacks_array']) == 'undefined') { frm.onsubmit_callbacks_array = []; } Array_push(frm['onsubmit_callbacks_array'], [input_id, form_handler_function_name]); } } } function WDG_formSubmittalHandler(e) { var o = utility.dom.setEventVars(e); var frm = o.targ; frm = utility.dom.getParentByTagName(frm, 'form'); var returnHandler = true; if (typeof(frm.onsubmit_callbacks_array) != 'undefined') { for(var i=0; i