 var newWindow = null; function closeWin(){if (newWindow != null){if(!newWindow.closed) newWindow.close();}}function popWin(url, type, strWidth, strHeight){closeWin(); var tools=""; if (type == "standard") tools = "resizable,toolbar=yes,location=no,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",left=60,top=80"; if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",left=60,top=80"; newWindow = window.open(url, 'newWin', tools); newWindow.focus();}function popFull(url){closeWin(); strWidth = screen.availWidth - 30; strHeight = screen.availHeight - 120; var tools=""; tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,status=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0"; newWindow = window.open(url, 'newWin', tools); newWindow.focus();}function popNew(url){closeWin(); newWindow = window.open(url, 'newWin'); newWindow.focus();}function goTo(url){location.href = (url);}function isInteger(s){var i; for (i = 0; i < s.length; i++){var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false;}return true;}function stripCharsInBag(s, bag){var i; var returnString = ""; for (i = 0; i < s.length; i++){var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c;}return returnString;}function checkInternationalPhone(strPhone){var phoneNumberDelimiters = "()- "; var validWorldPhoneChars = phoneNumberDelimiters + "+"; var minDigitsInIPhoneNumber = 10; s=stripCharsInBag(strPhone,validWorldPhoneChars); return (isInteger(s) && s.length == minDigitsInIPhoneNumber);}function checkContactForm(TheForm){if (TheForm.name != null){if (TheForm.name.value == ""){alert("Your name is required"); TheForm.name.focus(); return false;}}if (TheForm.email != null){if (TheForm.email.value == "" ){alert("Your email is required"); TheForm.email.focus(); return false;}var emailFilter = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/; if (!(emailFilter.test(TheForm.email.value))){alert("Please enter a valid email address"); TheForm.email.focus(); return false;}}if (TheForm.phone != null){if(TheForm.phone.value == ""){alert("Please enter your phone number"); TheForm.phone.focus(); return false;}if (checkInternationalPhone(TheForm.phone.value) == false){alert("US phone numbers contain 10 digits.\n" + "Make sure to include your area code.\n" + "eg: 212 555 1212"); TheForm.phone.focus(); return false;}}if (TheForm.url != null){var urlFilter = /^(http:\/\/www\.|http:\/\/)?[A-Za-z0-9-]+\.[A-Za-z0-9-_%&\?\/.=]+$/; if (!(urlFilter.test(TheForm.url.value))){alert("Please enter a valid domain"); TheForm.url.focus(); return false;}}if (TheForm.reason.options.selectedIndex != null){if (TheForm.reason.options.selectedIndex == ""){alert("Please choose a contact reason"); TheForm.reason.focus(); return false;}}if (TheForm.message != null){if (TheForm.message.value == ""){alert("Please add a message"); TheForm.message.focus(); return false;}}if (TheForm.spamq != null){if (TheForm.spamq.value == ""){alert("Please answer the anti-spam question"); TheForm.spamq.focus(); return false;}}return true;}var Class ={create: function(){return function(){this.initialize.apply(this, arguments);}}}; var Abstract = new Object(); Object.extend = function(destination, source){for (var property in source){destination[property] = source[property];}return destination;}; Object.inspect = function(object){try{if (object == undefined) return 'undefined'; if (object == null) return 'null'; return object.inspect ? object.inspect() : object.toString();}catch (e){if (e instanceof RangeError) return '...'; throw e;}}; Function.prototype.bind = function(){var __method = this, args = $A(arguments), object = args.shift(); return function(){return __method.apply(object, args.concat($A(arguments)));}}; Function.prototype.bindAsEventListener = function(object){var __method = this; return function(event){return __method.call(object, event || window.event);}}; Object.extend(Number.prototype,{toColorPart: function(){var digits = this.toString(16); if (this < 16) return '0' + digits; return digits;}, succ: function(){return this + 1;}, times: function(iterator){$R(0, this, true).each(iterator); return this;}}); var Try ={these: function(){var returnValue; for (var i = 0; i < arguments.length; i++){var lambda = arguments[i]; try{returnValue = lambda(); break;}catch (e){}}return returnValue;}}; var PeriodicalExecuter = Class.create();
PeriodicalExecuter.prototype ={initialize: function(callback, frequency){this.callback = callback; this.frequency = frequency; this.currentlyExecuting = false; this.registerCallback();}, registerCallback: function(){setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);}, onTimerEvent: function(){if (!this.currentlyExecuting){try{this.currentlyExecuting = true; this.callback();}finally{this.currentlyExecuting = false;}}}}; function $(){var results = [], element; for (var i = 0; i < arguments.length; i++){element = arguments[i]; if (typeof element == 'string') element = document.getElementById(element); results.push(Element.extend(element));}return results.length < 2 ? results[0] : results;}; document.getElementsByClassName = function(className, parentElement){var children = ($(parentElement) || document.body).getElementsByTagName('*'); return $A(children).inject([], function(elements, child){if (child.className.match(new RegExp("(^|\s)" + className + "(\s|$)"))) elements.push(Element.extend(child)); return elements;});}; if (!window.Element) var Element = new Object(); Element.extend = function(element){if (!element) return; if (_nativeExtensions) return element; if (!element._extended && element.tagName && element != window){var methods = Element.Methods, cache = Element.extend.cache; for (property in methods){var value = methods[property]; if (typeof value == 'function') element[property] = cache.findOrStore(value);}}element._extended = true; return element;}; Element.extend.cache ={findOrStore: function(value){return this[value] = this[value] || function(){return value.apply(null, [this].concat($A(arguments)));}}}; Element.Methods ={visible: function(element){return $(element).style.display != 'none';}, toggle: function(){for (var i = 0; i < arguments.length; i++){var element = $(arguments[i]); Element[Element.visible(element) ? 'hide' : 'show'](element);}}, hide: function(){for (var i = 0; i < arguments.length; i++){var element = $(arguments[i]); element.style.display = 'none';}}, show: function(){for (var i = 0; i < arguments.length; i++){var element = $(arguments[i]); element.style.display = '';}}, remove: function(element){element = $(element); element.parentNode.removeChild(element);}, update: function(element, html){$(element).innerHTML = html.stripScripts(); setTimeout(function(){html.evalScripts()}, 10);}, replace: function(element, html){element = $(element); if (element.outerHTML){element.outerHTML = html.stripScripts();}else{var range = element.ownerDocument.createRange(); range.selectNodeContents(element); element.parentNode.replaceChild( range.createContextualFragment(html.stripScripts()), element);}setTimeout(function(){html.evalScripts()}, 10);}, getHeight: function(element){element = $(element); return element.offsetHeight;}, classNames: function(element){return new Element.ClassNames(element);}, hasClassName: function(element, className){if (!(element = $(element))) return; return Element.classNames(element).include(className);}, addClassName: function(element, className){if (!(element = $(element))) return; return Element.classNames(element).add(className);}, removeClassName: function(element, className){if (!(element = $(element))) return; return Element.classNames(element).remove(className);}, cleanWhitespace: function(element){element = $(element); for (var i = 0; i < element.childNodes.length; i++){var node = element.childNodes[i]; if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);}}, empty: function(element){return $(element).innerHTML.match(/^\s*$/);}, childOf: function(element, ancestor){element = $(element), ancestor = $(ancestor); while (element = element.parentNode) if (element == ancestor) return true; return false;}, scrollTo: function(element){element = $(element); var x = element.x ? element.x : element.offsetLeft, y = element.y ? element.y : element.offsetTop; window.scrollTo(x, y);}, getStyle: function(element, style){element = $(element); var value = element.style[style.camelize()]; if (!value){if (document.defaultView && document.defaultView.getComputedStyle){var css = document.defaultView.getComputedStyle(element, null); value = css ? css.getPropertyValue(style) : null;}else if (element.currentStyle){value = element.currentStyle[style.camelize()];}}if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) if (Element.getStyle(element, 'position') == 'static') value = 'auto'; return value == 'auto' ? null : value;}, setStyle: function(element, style){element = $(element); for (var name in style) element.style[name.camelize()] = style[name];}, getDimensions: function(element){element = $(element); if (Element.getStyle(element, 'display') != 'none') return{width: element.offsetWidth, height: element.offsetHeight}; var els = element.style; var originalVisibility = els.visibility; var originalPosition = els.position; els.visibility = 'hidden'; els.position = 'absolute'; els.display = ''; var originalWidth = element.clientWidth; var originalHeight = element.clientHeight; els.display = 'none'; els.position = originalPosition; els.visibility = originalVisibility; return{width: originalWidth, height: originalHeight};}, makePositioned: function(element){element = $(element); var pos = Element.getStyle(element, 'position'); if (pos == 'static' || !pos){element._madePositioned = true; element.style.position = 'relative'; if (window.opera){element.style.top = 0; element.style.left = 0;}}}, undoPositioned: function(element){element = $(element); if (element._madePositioned){element._madePositioned = undefined; element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = '';}}, makeClipping: function(element){element = $(element); if (element._overflow) return; element._overflow = element.style.overflow; if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') element.style.overflow = 'hidden';}, undoClipping: function(element){element = $(element); if (element._overflow) return; element.style.overflow = element._overflow; element._overflow = undefined;}}; Object.extend(Element, Element.Methods); var _nativeExtensions = false; if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)){var HTMLElement ={}; HTMLElement.prototype = document.createElement('div').__proto__;}; Element.addMethods = function(methods){Object.extend(Element.Methods, methods ||{}); if(typeof HTMLElement != 'undefined'){var methods = Element.Methods, cache = Element.extend.cache; for (property in methods){var value = methods[property]; if (typeof value == 'function') HTMLElement.prototype[property] = cache.findOrStore(value);}_nativeExtensions = true;}}; Element.addMethods(); var Toggle = new Object();
Toggle.display = Element.toggle; Abstract.Insertion = function(adjacency){this.adjacency = adjacency;}; Abstract.Insertion.prototype ={initialize: function(element, content){this.element = $(element); this.content = content.stripScripts(); if (this.adjacency && this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency, this.content);}catch (e){var tagName = this.element.tagName.toLowerCase(); if (tagName == 'tbody' || tagName == 'tr'){this.insertContent(this.contentFromAnonymousTable());}else{throw e;}}}else{this.range = this.element.ownerDocument.createRange(); if (this.initializeRange) this.initializeRange(); this.insertContent([this.range.createContextualFragment(this.content)]);}setTimeout(function(){content.evalScripts()}, 10);}, contentFromAnonymousTable: function(){var div = document.createElement('div'); div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>'; return $A(div.childNodes[0].childNodes[0].childNodes);}}; var Insertion = new Object(); Insertion.Before = Class.create();
Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'),{initializeRange: function(){this.range.setStartBefore(this.element);}, insertContent: function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment, this.element);}).bind(this));}}); Insertion.Top = Class.create();
Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'),{initializeRange: function(){this.range.selectNodeContents(this.element); this.range.collapse(true);}, insertContent: function(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment, this.element.firstChild);}).bind(this));}}); Insertion.Bottom = Class.create();
Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'),{initializeRange: function(){this.range.selectNodeContents(this.element); this.range.collapse(this.element);}, insertContent: function(fragments){fragments.each((function(fragment){this.element.appendChild(fragment);}).bind(this));}}); Insertion.After = Class.create();
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange: function(){this.range.setStartAfter(this.element);}, insertContent: function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment, this.element.nextSibling);}).bind(this));}}); Element.ClassNames = Class.create();
Element.ClassNames.prototype ={initialize: function(element){this.element = $(element);}, _each: function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length > 0;})._each(iterator);}, set: function(className){this.element.className = className;}, add: function(classNameToAdd){if (this.include(classNameToAdd)) return; this.set(this.toArray().concat(classNameToAdd).join(' '));}, remove: function(classNameToRemove){if (!this.include(classNameToRemove)) return; this.set(this.select(function(className){return className != classNameToRemove;}).join(' '));}, toString: function(){return this.toArray().join(' ');}}; 