/** For purposes of starting to impose a little order, below is a list of DOM modifications: All form elements with labels link back to them. All form labels gain an extra empty text node for error text. window.onload is overridden All text areas with a maximum length must set it in the variable textLengthLimit (name picked to avoid collisions) textarea onchange is currently set to inputCount function if textLengthLimit is set. **/ if (window.IE===undefined) IE = false; function _ID(id) {return document.getElementById(id);} function _NODE(s) {return document.createElement(s); } var TRIM = new RegExp('^\\s*|\\s*$','g'); var LINNL = new RegExp('([^\r])\n','g'); var LINNL2 = new RegExp('\n\n','g'); var LINNL3 = new RegExp('^\n'); var MACNL = new RegExp('\r([^\n])','g'); var MACNL2 = new RegExp('\r\r','g'); var MACNL3 = new RegExp('\r$'); // this deliberately does not play nice with any existing onload. window.onload = function() // global window onload { var a = document.getElementsByTagName("a"); for(var i=0;i 1000000) // IE is kind of an idiot about this, looks like it sets it to some maxint value, but not going to take its word for it if (e.textLengthLimit > 1000000) e.textLengthLimit = null; t = document.createTextNode(""); e.errorText = l[i].appendChild(t); e.labelRef = l[i]; if (e.textLengthLimit!==undefined) if (e.nodeName.toLowerCase()=='textarea') e.onkeyup = inputCount; // used to start lines with * to require them - could possibly handle both if (l[i].firstChild.data.charAt(0)=="*" && e.isRequired===undefined) e.isRequired = true; else if (l[i].firstChild.data.indexOf("(required)")!=-1 && e.isRequired===undefined) { l[i].firstChild.data = l[i].firstChild.data.replace(/\s*\(required\)/,''); e.isRequired = true; } if (e.isRequired) // set HTML5 required based on form validation required { e.required = true; e.mozErrorMessage = "This field is required"; } setErrorDefault(e); } } } function getXHR() { var xhr; try { xhr=new XMLHttpRequest(); } // necessary due to IE7 not responding properly to an XMLHttpRequest defined check catch (e) { try { xhr=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xhr = false; } } } return xhr; } function removeClass(e,c) { if(!e) return; if (e.classList) e.classList.remove(c); else { if (!e.className) return; e.className = e.className.replace(new RegExp("(^|\\s+)"+c),''); } } function addClass(e,c) { if(!e) return; if (e.classList) e.classList.add(c); else { if (!e.className) e.className = c; else if (!hasClass(e,c)) e.className += " "+c; } } function hasClass(e,c) { if(!e) return; if (e.classList) return e.classList.contains(c); if (!e.className) return false; if (e.className==c) return true; return (new RegExp("(^|\\s+)"+c+"(\\s+|$)")).test(e.className); //return (new RegExp("(^|\\s+)"+(c.replace(/([.?*+^$[\]\\(){}-])/g, "\\$1"))+"(\\s+|$)")).test(e.className); } function toggleClass(e,c) { if(!e) return; if (e.classList) e.classList.toggle(c); else { if (hasClass(e,c)) removeClass(e,c); else addClass(e,c); } } // does not concatenate child text nodes. // might be a good idea. function highlight(n,txt,matchCase) // parent. assumed to be all text node children. { var a = []; var str; var pos; if (!matchCase) txt = txt.toUpperCase(); for(var i=0;ithis.textLengthLimit) this.errorText.data+='!!!'; } // can't do as a prototype due to a flaw in IE function formValue(e) { if(!e) return null; if (e.options) { if (e.selectedIndex==-1) return null; else return e.options[e.selectedIndex].value; } else if (e.length) { for(var i=0;iloading
'); printPopup.document.close(); // This is probably no longer needed now that it is written in JS printPopup.chkLoad = setInterval(function() { checkLoaded('blank', applyPrint) },50); } /***************************** End Print Preview **************************/