From: Subject: =?iso-2022-jp?B?TG9uZy10ZXJtIGNhcmUgdGhyZWF0ZW5zIHRvIHNhcCBzZW5pb3JzJyBzYXZpbmdzIHwgTmV3cyBmb3IgRGFsbGFzLCBUZXhhcyB8IERhbGxhcyBNb3JuaW5nIE5ld3MgfCBEYWxsYXMgQnVzaW5lc3MgTmV3cw==?= Date: Tue, Jun 23 2009 11:48:01 GMT-0500 MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_0000_65AC10C6.1587EAD1"; type="text/html" ------=_NextPart_000_0000_65AC10C6.1587EAD1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Location: http://www.dallasnews.com/sharedcontent/dws/bus/stories/061709dnbuslongtermcare.3f7878b.html =EF=BB=BF Long-term care threatens to sap seniors' savings |= =20 News for Dallas, Texas | Dallas Morning News | Dallas Business News= =20
= =09
3D""
3D""
Tuesday, June 23, 2009
3D""
3D""
3D""
  • Log In
  •   |  
  • Become a Member
  •   |  
  • Get the Newspaper
   Traffic   Weather= : Clear, 92=C2=B0 &= nbsp; 
= =20
3D""
3D""
3D""
3D""
3D""
3D""
3D""
3D""
3D""
3D""
3D""
3D""
= =09
= =20

<= param value=3D"clickTag=3Dhttp%3A//ad.doubleclick.net/click%253Bh%3Dv8/3855= /7/106/%252a/r%253B215545319%253B0-0%253B0%253B36823187%253B2321-160/600%25= 3B31799143/31817019/1%253B%253B%257Esscs%253D%253fhttp%3A//us.ard.yahoo.com= /SIG%3D161hnaitc/M%3D600187013.600190784.403454633.403454633/D%3Dncbz/S%3D2= 022775705%3AAP34/Y%3DPARTNER_US/L%3D89ae1f58-6015-11de-bee6-c30c984aece9/B%= 3DY7IVAUwNj2Q-/J%3D1245775648825491/K%3DQshgBqu7lTUnb4KRylAm6w/EXP%3D124578= 2848/A%3D1732824454554846473/R%3D1/X%3D2/*http%3A//www.ritzcarlton.com/en/P= romotions/Business/Default.htm%3Fdfaid%3D1&clickTAG=3Dhttp%3A//ad.doubl= eclick.net/click%253Bh%3Dv8/3855/7/106/%252a/r%253B215545319%253B0-0%253B0%= 253B36823187%253B2321-160/600%253B31799143/31817019/1%253B%253B%257Esscs%25= 3D%253fhttp%3A//us.ard.yahoo.com/SIG%3D161hnaitc/M%3D600187013.600190784.40= 3454633.403454633/D%3Dncbz/S%3D2022775705%3AAP34/Y%3DPARTNER_US/L%3D89ae1f5= 8-6015-11de-bee6-c30c984aece9/B%3DY7IVAUwNj2Q-/J%3D1245775648825491/K%3DQsh= gBqu7lTUnb4KRylAm6w/EXP%3D1245782848/A%3D1732824454554846473/R%3D1/X%3D2/*h= ttp%3A//www.ritzcarlton.com/en/Promotions/Business/Default.htm%3Fdfaid%3D1&= amp;clicktag=3Dhttp%3A//ad.doubleclick.net/click%253Bh%3Dv8/3855/7/106/%252= a/r%253B215545319%253B0-0%253B0%253B36823187%253B2321-160/600%253B31799143/= 31817019/1%253B%253B%257Esscs%253D%253fhttp%3A//us.ard.yahoo.com/SIG%3D161h= naitc/M%3D600187013.600190784.403454633.403454633/D%3Dncbz/S%3D2022775705%3= AAP34/Y%3DPARTNER_US/L%3D89ae1f58-6015-11de-bee6-c30c984aece9/B%3DY7IVAUwNj= 2Q-/J%3D1245775648825491/K%3DQshgBqu7lTUnb4KRylAm6w/EXP%3D1245782848/A%3D17= 32824454554846473/R%3D1/X%3D2/*http%3A//www.ritzcarlton.com/en/Promotions/B= usiness/Default.htm%3Fdfaid%3D1&moviePath=3Dhttp://m1.2mdn.net/1631137/= &moviepath=3Dhttp://m1.2mdn.net/1631137/&submovie1=3Dhttp%3A//m1.2m= dn.net/1631137/3-09_TRC_Western_Business_160x600.swf" name=3D"flashvars"> 3D""

3D"DallasNews.com"

BUS= INESS

3D""
Email
Print
R= SS
= =09 Yahoo! Buzz= =20
3D=
3D= = =09
= =20 = =20 = =20

Long-term care threatens to sap seniors' savings

=

07:40 AM CDT on Wednesday, June 17, 2009

By BOB MOOS / The Dal= las Morning News
bmoos@dallasn= ews.com

Kay Paggi has been the bearer of bad news more times than sh= e cares to remember.

The senior-care coordina= tor has helped hundreds of Dallas families find long-term care for f= rail parents. Almost always, they think Medicare will pick up most o= f the tab, the same as it does for hospital stays and doctor visits.= "They're shocked when I tell them that Medicare doesn't = pay for long nursing home stays," she said. "All of a sudden, = they have this look of horror as they realize their parents will hav= e to foot the bill. Those retirement nest eggs go poof."

Over 20 years, Paggi has seen many seniors spend almost th= eir last dollar on personal care at home or an assisted-living commu= nity before turning to a nursing home and ultimately relying on Medi= caid, the health care program for the poor.

&= quot;Our system of paying for long-term care in this country is broken,&quo= t; she said. "Unless you have a big family or thick wallet, you= 'll run into trouble in old age."

A= s lawmakers debate how to pay for acute care for 46 million uninsured = Americans, advocates for older or disabled adults are urging the Obama = administration and Congress to discuss long-term care's financing= problems, too.

Possible reforms range from p= roviding more federal money for home care to creating a national ins= urance pool that would protect people against long-term care expense= s.

"It doesn't make sense to figure out ho= w to pay for the hospital care of a heart attack victim but overlook= the day-to-day problems of someone living with congestive heart fai= lure," said Howard Gleckman, a senior research associate at the= Urban Institute and author of Caring for Our Parents.

Long-term care includes everything from help with bathing,= dressing and household tasks to assistance with taking medications.= It may be provided by family members or paid caregivers in the home= or at a facility like an adult day care center or nursing home. =

Ten million Americans require long-term care. But by 20= 30, 37 million boomers will be living with more than one chronic con= dition such as arthritis or diabetes, said Larry Minnix, president o= f the American Association of Homes and Services for the Aging. =

Health care and long-term care go hand in hand, experts = say.

"If the chronically ill forget to take the= ir medications or they can't get to their doctors' offices= , their health will deteriorate, and they'll wind up back in th= e hospital," said James Swan, professor of applied gerontology = at the University of North Texas.

Lawmakers won'= ;t wring savings out of the health care system without managing chro= nic illnesses effectively, and that will mean making long-term care = more accessible and affordable, he said.

=
Boomers coming

=

The nation's long-term care system is = at risk of collapsing when aging boomers need help in a decade or tw= o, experts warn.

Medicare covers short nursing home = stays and some home health care, but those services are intended mai= nly for patients recovering from illnesses or injuries. The federal = health care program isn't set up to meet the day-to-day needs o= f the chronically ill.

Nor is private insurance expe= cted to become the primary means for financing long-term care, thoug= h its role will grow. High premiums will remain a big hurdle for man= y, said Diane Rowland, executive vice president of the Kaiser Family= Foundation.

For a 60-year-old individual, annual pr= emiums for a typical policy average $2,329, according to Kaiser and = the Avalere Health consulting firm.

For a cou= ple the same age, premiums average $3,096 a year.

Mo= st long-term care is provided by unpaid family members who often make = personal sacrifices. The typical caregiver is a middle-age daughter who = must quit her job or scale back her hours to look after a parent at h= ome.

Paid care can quickly exhaust life savings. The= median cost of a private room at a Dallas nursing home is $54,750 a= year, while the median charge for an assisted-living community is $= 33,456, according to Genworth Financial.

As o= lder or disabled adults have spent their way into poverty, Medicaid = has become the anchor of long-term care and now accounts for almost half = of the $200 billion that the government, private insurers and i= ndividuals pay for such help each year.

"Medica= id was supposed to act only as a safety net for the poorest, but it = has become the single largest source of financing for long-term care= ," said Doni Van Ryswyk, manager of the North Central Texas Area = Agency on Aging.

Medicaid could stretch its dollar= s by caring for more people at home instead of in nursing homes, sai= d Elaine Ryan, vice president of government relations for AARP. =

"It would be a win-win for Medicaid and its benefic= iaries," she said.

Medicaid could care for thr= ee people with home and community-based services for what it spends = on one nursing home resident, according to the AARP Public Institute= .

"And nine of 10 older adults prefer to remain= in their homes anyway," Ryan said.

=

In Texas . . .

=

Texas has done better than other sta= tes in shifting to home and community-based programs, but many peopl= e still must wait one to two years for the care because of state bud= getary pressures, said Lue Taff, director of the elder support progr= am at the Senior Source in Dallas.

Though Texas and = other states are required by law to provide nursing home beds to eli= gible Medicaid recipients, they have the discretion to limit their h= ome and community-based services.

As part of health = care reform, advocates are pressing Congress to give states a bigger= federal match so that they can afford to expand in-home programs an= d lessen the need for more expensive nursing home care.

= The American Association of Homes and Services for the Aging, a trade = group, is also urging lawmakers to create a national insurance pool t= hat would pay for itself. Workers would contribute to the fund throu= gh payroll deductions and receive a cash benefit if they became disa= bled.

"For essentially the price of a cup of co= ffee each day, people could have an average long-term care benefit o= f $75 a day," Minnix said. "If such an insurance program w= ere in place and everyone participated, Medicaid's costs would = be cut in half."

The national pool's succe= ss would depend on how many workers participated, experts say. <= /p>

"You've got to make any such insurance pool man= datory for it to be affordable," said Joshua Wiener, director o= f aging research for the RTI International think tank. "Otherwi= se, only the people who know they'll need the coverage will buy= it, and the premiums will be too high."

Suppor= ters say workers would be automatically enrolled in the fund, though= anyone could opt out. That would spread the risk across a broad pop= ulation and keep premiums low.

Minnix said the disab= led could use the cash benefit to pay for any services they needed. = Workers who wanted additional coverage could buy private insurance. =

Past debates over long-term care have been stymied b= y disagreements over whether it should be financed with public or pr= ivate money, said Judith Feder, professor of public policy at George= town University.

"That rhetoric obscures the fa= cts," she said. "We already have a mixed public-private sy= stem, and we always will. The real choice is whether to keep today&#= x27;s dysfunctional system or create something that won't buckle = under millions of aging boomers."

Email | Print | | 3D""
Sponsored links
= =09
Advertisement
3D""3D""
FIND IT
= =09
 Shop
= =09
 Autos
= =09 = =09 = =09 = =09
Used Cars
Make:
Model:
Your ZIP:
= = =09
= =09
 
= =20 = =09
New Cars
Make:
= =09 = =09
Model:
= =09
Your ZIP:
= =09
= =09
= =20 = =09
= =09
 Homes
= =09
Type in city, ne= ighborhood or zip
= =09
= =09
 Jobs
= =09 = =09 = =09
Keywords:
Location:
Job Categories:
= =09
 Advanced Search
= =09
 Classifieds/Place Ad
<= /a>
= =09
 Find a Business
<= /div>

Spotlight

Data: See how Dallas-area companies stack up
=E2=80=A2 Top D-FW public firms
=E2=80=A2 Top private firms
=E2=80=A2 Top corporate employers
=E2=80=A2 Executive pay at top D-FW firms

Graphi= c: How to read your electricity meter and monitor your usage
Don't get jolted by rate changes= =20
Blog: Texa= s energy and environment= =20

= =20 3D"Area= =20
= =20
= =20

= =20 Area Home Sales Maps= =20

= =20
= =20 2009: 1Q= =20
= =20 2008: 4Q | 3Q | 2Q | 1Q= =20
= =20 2007: 4Q | 3Q | 2Q | 1Q= =20
= =20 = =20
= =20 = =20 = =20


MOST POPULAR
<= /div>
3D""

3D""3D""

 

 

3D""
 
3D""
3D""

Home |= =20 Contact = Us |= =20 HelpCenter |= =20 Advertising |= =20 Site Map |= =20 A= bout Us |= =20 Careers |= =20 News Feeds
Terms of Service |= =20 Privacy |= =20 Subscriber Services |= =20 Get the Newspaper |= =20 Special Offers |= =20 Contests & Events= =20

=C2=A9 2009, The Dallas Morning News, Inc. All Rights Reserved.


3D""

=

Bookmark & Share

X
Select from these web-based feed r= eaders:
AIM
Ask
Bac= kflip
BallHype
Bebo
Blogger
Blogmarks=
Buzz
Delicious
Digg<= /span>
Diigo
Email
Faceb= ook
Fark
Faves
Fa= vorites
FriendFeed<= /span>
Google
Hatena
kIRTSY
<= div onclick=3D"return addthis_sendto('linkagogo');" onmouseout=3D"_atw.hov(= this)" onmouseover=3D"_atw.hov(this)" class=3D"at_item" id=3D"ati_linkagogo= ">Link-a-Gogo
LinkedIn
L= ive
Men=C3=A9ame
Mister Wong
Mixx
myAOL
MySpace
Netvibes
Netvou= z
Newsvine
Nujij
P= laxo
Print
Propeller
Reddit
Segnalo
Simpy
Slashdot
Spurl=
StumbleUpon
Stylehive
=
Technorati
ThisNext
Tumblr
Twitter
TypePad
WordPress
Y! Bookmarks
Yardbarker
M= essage sent! Share again.

AddThis for Firefox= NEW

Bookmark, email or share any page, anytime.=
=
Bookmark & Shar= e
<= /input>
<= textarea style=3D"width: 150px;" rows=3D"3" cols=3D"30" name=3D"" id=3D"at_= msg">
Email
Favorites
Pr= int
Delicious
Digg
Google
MySpace
Live
Facebook
= StumbleUpon
Twitter
More... (53)
------=_NextPart_000_0000_65AC10C6.1587EAD1 Content-Type: text/css Content-Transfer-Encoding: quoted-printable Content-Location: http://www.dallasnews.com/sharedcontent/cgm/ver1.0/assets/styles/slcgm_global.css .slcgm_announcement { border-width:1px; border-style:dotted; padding:10px; margin:0px !important; text-align:justify; font-size: 10pt; font-family: Arial,Verdana,"sans serif"; } .slcgm_red { border-color:#FFCFD1 !important; color:#7F0900 !important; background-color:#FFF0EF !important; } .slcgm_green { border-color:#BFFFC8 !important; color:#009900 !important; background-color:#DFFFDF !important; } .slcgm_blue { border-color:#CBD5DC !important; color:#0D2068 !important; background-color:#DFF5FF !important; } .PersonaHeader_PrivateContent { display:none; } h3.cgmheader { min-height:50px; } /* header login */ div.p_login{ float:right; margin:1px 2px 0 20px;} div.p_links {float:left; display:inline; text-align:right; font-family:Aria= l, Helvetica, sans-serif; font-size:10px; color:#333; line-height:12px; mar= gin:0; padding:0;} div.p_links a:link, div.p_links a:visited{text-decoration:none; color:#0A45= 6F;} div.p_links a:hover{text-decoration:underline; color:#1070B6;} div.p_icon {float:left; display:inline; text-align:right; margin:0 0 0 5px;= } div.p_icon img {border:none;width:24px;height:24px;} ------=_NextPart_000_0000_65AC10C6.1587EAD1 Content-Type: text/javascript Content-Transfer-Encoding: quoted-printable Content-Location: http://www.dallasnews.com/sharedcontent/cgm/ver1.0/js/slcgmconfig.js var SLCGMOMNITUREPRODUCT =3D "SiteLifeCGMAction | "; /* This object needs be initialized on every page that receives pluck data = */ var _QUERY =3D new Object(); /* PARSE QUERY STRING INTO GLOBAL _QUERY OBJECT */ var _QSPARTS =3D unescape(window.location.search.substring(1)).split('&'); var _QSPARTSLENGTH =3D _QSPARTS.length; var _PARAMS; if (_QSPARTSLENGTH)for(var i=3D0;i< _QSPARTSLENGTH;i++){_PARAMS=3D_QSPARTS= [i].split("=3D");if(_PARAMS.length>1){ _QUERY[_PARAMS[0].toString()]=3Dunes= cape(_PARAMS[1].toString());}} /* SLCGMCONFIG is used to initiate articles */ var SLCGMCONFIG =3D new Object(); SLCGMCONFIG.Contents =3D new Array(); /* SET UP A ITERATOR INT */ var SLCGMCNTR =3D 0; var SLCGMSITEHREF =3D this.location.href; if (SLCGMSITEHREF.indexOf('/profile.html')<0) { //if (window !=3D top) top.location.href =3D location.href; } _QSPARTSLENGTH,i,_QSPARTS,_PARAMS=3Dnull; /* addLoadEvent for adding window.onload */ function addLoadEvent(func) { var oldonload =3D window.onload; if (typeof window.onload !=3D 'function') { window.onload =3D func; } else { window.onload =3D function() { try{ func(); }catch(e){ } if (oldonload) try{ oldonload(); }catch(e){ } }; } } ------=_NextPart_000_0000_65AC10C6.1587EAD1 Content-Type: text/javascript Content-Transfer-Encoding: quoted-printable Content-Location: http://www.dallasnews.com/sharedcontent/javascript/prototype-1.6.0.2.js /* Prototype JavaScript framework, version 1.6.0.2 * (c) 2005-2008 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style licen= se. * For details, see the Prototype web site: http://www.prototypejs.org/ * *-------------------------------------------------------------------------= -*/ var Prototype =3D { Version: '1.6.0.2', Browser: { IE: !!(window.attachEvent && !window.opera), Opera: !!window.opera, WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgen= t.indexOf('KHTML') =3D=3D -1, MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) }, BrowserFeatures: { XPath: !!document.evaluate, ElementExtensions: !!window.HTMLElement, SpecificElementExtensions: document.createElement('div').__proto__ && document.createElement('div').__proto__ !=3D=3D document.createElement('form').__proto__ }, ScriptFragment: ']*>([\\S\\s]*?)<\/script>', JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, emptyFunction: function() { }, K: function(x) { return x } }; if (Prototype.Browser.MobileSafari) Prototype.BrowserFeatures.SpecificElementExtensions =3D false; /* Based on Alex Arnell's inheritance implementation. */ var Class =3D { create: function() { var parent =3D null, properties =3D $A(arguments); if (Object.isFunction(properties[0])) parent =3D properties.shift(); function klass() { this.initialize.apply(this, arguments); } Object.extend(klass, Class.Methods); klass.superclass =3D parent; klass.subclasses =3D []; if (parent) { var subclass =3D function() { }; subclass.prototype =3D parent.prototype; klass.prototype =3D new subclass; parent.subclasses.push(klass); } for (var i =3D 0; i < properties.length; i++) klass.addMethods(properties[i]); if (!klass.prototype.initialize) klass.prototype.initialize =3D Prototype.emptyFunction; klass.prototype.constructor =3D klass; return klass; } }; Class.Methods =3D { addMethods: function(source) { var ancestor =3D this.superclass && this.superclass.prototype; var properties =3D Object.keys(source); if (!Object.keys({ toString: true }).length) properties.push("toString", "valueOf"); for (var i =3D 0, length =3D properties.length; i < length; i++) { var property =3D properties[i], value =3D source[property]; if (ancestor && Object.isFunction(value) && value.argumentNames().first() =3D=3D "$super") { var method =3D value, value =3D Object.extend((function(m) { return function() { return ancestor[m].apply(this, arguments) }; })(property).wrap(method), { valueOf: function() { return method }, toString: function() { return method.toString() } }); } this.prototype[property] =3D value; } return this; } }; var Abstract =3D { }; Object.extend =3D function(destination, source) { for (var property in source) destination[property] =3D source[property]; return destination; }; Object.extend(Object, { inspect: function(object) { try { if (Object.isUndefined(object)) return 'undefined'; if (object =3D=3D=3D null) return 'null'; return object.inspect ? object.inspect() : String(object); } catch (e) { if (e instanceof RangeError) return '...'; throw e; } }, toJSON: function(object) { var type =3D typeof object; switch (type) { case 'undefined': case 'function': case 'unknown': return; case 'boolean': return object.toString(); } if (object =3D=3D=3D null) return 'null'; if (object.toJSON) return object.toJSON(); if (Object.isElement(object)) return; var results =3D []; for (var property in object) { var value =3D Object.toJSON(object[property]); if (!Object.isUndefined(value)) results.push(property.toJSON() + ': ' + value); } return '{' + results.join(', ') + '}'; }, toQueryString: function(object) { return $H(object).toQueryString(); }, toHTML: function(object) { return object && object.toHTML ? object.toHTML() : String.interpret(obj= ect); }, keys: function(object) { var keys =3D []; for (var property in object) keys.push(property); return keys; }, values: function(object) { var values =3D []; for (var property in object) values.push(object[property]); return values; }, clone: function(object) { return Object.extend({ }, object); }, isElement: function(object) { return object && object.nodeType =3D=3D 1; }, isArray: function(object) { return object !=3D null && typeof object =3D=3D "object" && 'splice' in object && 'join' in object; }, isHash: function(object) { return object instanceof Hash; }, isFunction: function(object) { return typeof object =3D=3D "function"; }, isString: function(object) { return typeof object =3D=3D "string"; }, isNumber: function(object) { return typeof object =3D=3D "number"; }, isUndefined: function(object) { return typeof object =3D=3D "undefined"; } }); Object.extend(Function.prototype, { argumentNames: function() { var names =3D this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1= ].split(",").invoke("strip"); return names.length =3D=3D 1 && !names[0] ? [] : names; }, bind: function() { if (arguments.length < 2 && Object.isUndefined(arguments[0])) return th= is; var __method =3D this, args =3D $A(arguments), object =3D args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); } }, bindAsEventListener: function() { var __method =3D this, args =3D $A(arguments), object =3D args.shift(); return function(event) { return __method.apply(object, [event || window.event].concat(args)); } }, curry: function() { if (!arguments.length) return this; var __method =3D this, args =3D $A(arguments); return function() { return __method.apply(this, args.concat($A(arguments))); } }, delay: function() { var __method =3D this, args =3D $A(arguments), timeout =3D args.shift()= * 1000; return window.setTimeout(function() { return __method.apply(__method, args); }, timeout); }, wrap: function(wrapper) { var __method =3D this; return function() { return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)= )); } }, methodize: function() { if (this._methodized) return this._methodized; var __method =3D this; return this._methodized =3D function() { return __method.apply(null, [this].concat($A(arguments))); }; } }); Function.prototype.defer =3D Function.prototype.delay.curry(0.01); Date.prototype.toJSON =3D function() { return '"' + this.getUTCFullYear() + '-' + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + this.getUTCDate().toPaddedString(2) + 'T' + this.getUTCHours().toPaddedString(2) + ':' + this.getUTCMinutes().toPaddedString(2) + ':' + this.getUTCSeconds().toPaddedString(2) + 'Z"'; }; var Try =3D { these: function() { var returnValue; for (var i =3D 0, length =3D arguments.length; i < length; i++) { var lambda =3D arguments[i]; try { returnValue =3D lambda(); break; } catch (e) { } } return returnValue; } }; RegExp.prototype.match =3D RegExp.prototype.test; RegExp.escape =3D function(str) { return String(str).replace(/([.*+?^=3D!:${}()|[\]\/\\])/g, '\\$1'); }; /*-------------------------------------------------------------------------= -*/ var PeriodicalExecuter =3D Class.create({ initialize: function(callback, frequency) { this.callback =3D callback; this.frequency =3D frequency; this.currentlyExecuting =3D false; this.registerCallback(); }, registerCallback: function() { this.timer =3D setInterval(this.onTimerEvent.bind(this), this.frequency= * 1000); }, execute: function() { this.callback(this); }, stop: function() { if (!this.timer) return; clearInterval(this.timer); this.timer =3D null; }, onTimerEvent: function() { if (!this.currentlyExecuting) { try { this.currentlyExecuting =3D true; this.execute(); } finally { this.currentlyExecuting =3D false; } } } }); Object.extend(String, { interpret: function(value) { return value =3D=3D null ? '' : String(value); }, specialChar: { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '\\': '\\\\' } }); Object.extend(String.prototype, { gsub: function(pattern, replacement) { var result =3D '', source =3D this, match; replacement =3D arguments.callee.prepareReplacement(replacement); while (source.length > 0) { if (match =3D source.match(pattern)) { result +=3D source.slice(0, match.index); result +=3D String.interpret(replacement(match)); source =3D source.slice(match.index + match[0].length); } else { result +=3D source, source =3D ''; } } return result; }, sub: function(pattern, replacement, count) { replacement =3D this.gsub.prepareReplacement(replacement); count =3D Object.isUndefined(count) ? 1 : count; return this.gsub(pattern, function(match) { if (--count < 0) return match[0]; return replacement(match); }); }, scan: function(pattern, iterator) { this.gsub(pattern, iterator); return String(this); }, truncate: function(length, truncation) { length =3D length || 30; truncation =3D Object.isUndefined(truncation) ? '...' : truncation; return this.length > length ? this.slice(0, length - truncation.length) + truncation : String(this)= ; }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, stripTags: function() { return this.replace(/<\/?[^>]+>/gi, ''); }, stripScripts: function() { return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); }, extractScripts: function() { var matchAll =3D new RegExp(Prototype.ScriptFragment, 'img'); var matchOne =3D new RegExp(Prototype.ScriptFragment, 'im'); return (this.match(matchAll) || []).map(function(scriptTag) { return (scriptTag.match(matchOne) || ['', ''])[1]; }); }, evalScripts: function() { return this.extractScripts().map(function(script) { return eval(script)= }); }, escapeHTML: function() { var self =3D arguments.callee; self.text.data =3D this; return self.div.innerHTML; }, unescapeHTML: function() { var div =3D new Element('div'); div.innerHTML =3D this.stripTags(); return div.childNodes[0] ? (div.childNodes.length > 1 ? $A(div.childNodes).inject('', function(memo, node) { return memo+node= .nodeValue }) : div.childNodes[0].nodeValue) : ''; }, toQueryParams: function(separator) { var match =3D this.strip().match(/([^?#]*)(#.*)?$/); if (!match) return { }; return match[1].split(separator || '&').inject({ }, function(hash, pair= ) { if ((pair =3D pair.split('=3D'))[0]) { var key =3D decodeURIComponent(pair.shift()); var value =3D pair.length > 1 ? pair.join('=3D') : pair[0]; if (value !=3D undefined) value =3D decodeURIComponent(value); if (key in hash) { if (!Object.isArray(hash[key])) hash[key] =3D [hash[key]]; hash[key].push(value); } else hash[key] =3D value; } return hash; }); }, toArray: function() { return this.split(''); }, succ: function() { return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); }, times: function(count) { return count < 1 ? '' : new Array(count + 1).join(this); }, camelize: function() { var parts =3D this.split('-'), len =3D parts.length; if (len =3D=3D 1) return parts[0]; var camelized =3D this.charAt(0) =3D=3D '-' ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0]; for (var i =3D 1; i < len; i++) camelized +=3D parts[i].charAt(0).toUpperCase() + parts[i].substring(= 1); return camelized; }, capitalize: function() { return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }, underscore: function() { return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gs= ub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); }, dasherize: function() { return this.gsub(/_/,'-'); }, inspect: function(useDoubleQuotes) { var escapedString =3D this.gsub(/[\x00-\x1f\\]/, function(match) { var character =3D String.specialChar[match[0]]; return character ? character : '\\u00' + match[0].charCodeAt().toPadd= edString(2, 16); }); if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + = '"'; return "'" + escapedString.replace(/'/g, '\\\'') + "'"; }, toJSON: function() { return this.inspect(true); }, unfilterJSON: function(filter) { return this.sub(filter || Prototype.JSONFilter, '#{1}'); }, isJSON: function() { var str =3D this; if (str.blank()) return false; str =3D this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); }, evalJSON: function(sanitize) { var json =3D this.unfilterJSON(); try { if (!sanitize || json.isJSON()) return eval('(' + json + ')'); } catch (e) { } throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); }, include: function(pattern) { return this.indexOf(pattern) > -1; }, startsWith: function(pattern) { return this.indexOf(pattern) =3D=3D=3D 0; }, endsWith: function(pattern) { var d =3D this.length - pattern.length; return d >=3D 0 && this.lastIndexOf(pattern) =3D=3D=3D d; }, empty: function() { return this =3D=3D ''; }, blank: function() { return /^\s*$/.test(this); }, interpolate: function(object, pattern) { return new Template(this, pattern).evaluate(object); } }); if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.= prototype, { escapeHTML: function() { return this.replace(/&/g,'&').replace(//g,'&g= t;'); }, unescapeHTML: function() { return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,= '>'); } }); String.prototype.gsub.prepareReplacement =3D function(replacement) { if (Object.isFunction(replacement)) return replacement; var template =3D new Template(replacement); return function(match) { return template.evaluate(match) }; }; String.prototype.parseQuery =3D String.prototype.toQueryParams; Object.extend(String.prototype.escapeHTML, { div: document.createElement('div'), text: document.createTextNode('') }); with (String.prototype.escapeHTML) div.appendChild(text); var Template =3D Class.create({ initialize: function(template, pattern) { this.template =3D template.toString(); this.pattern =3D pattern || Template.Pattern; }, evaluate: function(object) { if (Object.isFunction(object.toTemplateReplacements)) object =3D object.toTemplateReplacements(); return this.template.gsub(this.pattern, function(match) { if (object =3D=3D null) return ''; var before =3D match[1] || ''; if (before =3D=3D '\\') return match[2]; var ctx =3D object, expr =3D match[3]; var pattern =3D /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; match =3D pattern.exec(expr); if (match =3D=3D null) return before; while (match !=3D null) { var comp =3D match[1].startsWith('[') ? match[2].gsub('\\\\]', ']')= : match[1]; ctx =3D ctx[comp]; if (null =3D=3D ctx || '' =3D=3D match[3]) break; expr =3D expr.substring('[' =3D=3D match[3] ? match[1].length : mat= ch[0].length); match =3D pattern.exec(expr); } return before + String.interpret(ctx); }); } }); Template.Pattern =3D /(^|.|\r|\n)(#\{(.*?)\})/; var $break =3D { }; var Enumerable =3D { each: function(iterator, context) { var index =3D 0; iterator =3D iterator.bind(context); try { this._each(function(value) { iterator(value, index++); }); } catch (e) { if (e !=3D $break) throw e; } return this; }, eachSlice: function(number, iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var index =3D -number, slices =3D [], array =3D this.toArray(); while ((index +=3D number) < array.length) slices.push(array.slice(index, index+number)); return slices.collect(iterator, context); }, all: function(iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var result =3D true; this.each(function(value, index) { result =3D result && !!iterator(value, index); if (!result) throw $break; }); return result; }, any: function(iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var result =3D false; this.each(function(value, index) { if (result =3D !!iterator(value, index)) throw $break; }); return result; }, collect: function(iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var results =3D []; this.each(function(value, index) { results.push(iterator(value, index)); }); return results; }, detect: function(iterator, context) { iterator =3D iterator.bind(context); var result; this.each(function(value, index) { if (iterator(value, index)) { result =3D value; throw $break; } }); return result; }, findAll: function(iterator, context) { iterator =3D iterator.bind(context); var results =3D []; this.each(function(value, index) { if (iterator(value, index)) results.push(value); }); return results; }, grep: function(filter, iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var results =3D []; if (Object.isString(filter)) filter =3D new RegExp(filter); this.each(function(value, index) { if (filter.match(value)) results.push(iterator(value, index)); }); return results; }, include: function(object) { if (Object.isFunction(this.indexOf)) if (this.indexOf(object) !=3D -1) return true; var found =3D false; this.each(function(value) { if (value =3D=3D object) { found =3D true; throw $break; } }); return found; }, inGroupsOf: function(number, fillWith) { fillWith =3D Object.isUndefined(fillWith) ? null : fillWith; return this.eachSlice(number, function(slice) { while(slice.length < number) slice.push(fillWith); return slice; }); }, inject: function(memo, iterator, context) { iterator =3D iterator.bind(context); this.each(function(value, index) { memo =3D iterator(memo, value, index); }); return memo; }, invoke: function(method) { var args =3D $A(arguments).slice(1); return this.map(function(value) { return value[method].apply(value, args); }); }, max: function(iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var result; this.each(function(value, index) { value =3D iterator(value, index); if (result =3D=3D null || value >=3D result) result =3D value; }); return result; }, min: function(iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var result; this.each(function(value, index) { value =3D iterator(value, index); if (result =3D=3D null || value < result) result =3D value; }); return result; }, partition: function(iterator, context) { iterator =3D iterator ? iterator.bind(context) : Prototype.K; var trues =3D [], falses =3D []; this.each(function(value, index) { (iterator(value, index) ? trues : falses).push(value); }); return [trues, falses]; }, pluck: function(property) { var results =3D []; this.each(function(value) { results.push(value[property]); }); return results; }, reject: function(iterator, context) { iterator =3D iterator.bind(context); var results =3D []; this.each(function(value, index) { if (!iterator(value, index)) results.push(value); }); return results; }, sortBy: function(iterator, context) { iterator =3D iterator.bind(context); return this.map(function(value, index) { return {value: value, criteria: iterator(value, index)}; }).sort(function(left, right) { var a =3D left.criteria, b =3D right.criteria; return a < b ? -1 : a > b ? 1 : 0; }).pluck('value'); }, toArray: function() { return this.map(); }, zip: function() { var iterator =3D Prototype.K, args =3D $A(arguments); if (Object.isFunction(args.last())) iterator =3D args.pop(); var collections =3D [this].concat(args).map($A); return this.map(function(value, index) { return iterator(collections.pluck(index)); }); }, size: function() { return this.toArray().length; }, inspect: function() { return '#'; } }; Object.extend(Enumerable, { map: Enumerable.collect, find: Enumerable.detect, select: Enumerable.findAll, filter: Enumerable.findAll, member: Enumerable.include, entries: Enumerable.toArray, every: Enumerable.all, some: Enumerable.any }); function $A(iterable) { if (!iterable) return []; if (iterable.toArray) return iterable.toArray(); var length =3D iterable.length || 0, results =3D new Array(length); while (length--) results[length] =3D iterable[length]; return results; } if (Prototype.Browser.WebKit) { $A =3D function(iterable) { if (!iterable) return []; if (!(Object.isFunction(iterable) && iterable =3D=3D '[object NodeList]= ') && iterable.toArray) return iterable.toArray(); var length =3D iterable.length || 0, results =3D new Array(length); while (length--) results[length] =3D iterable[length]; return results; }; } Array.from =3D $A; Object.extend(Array.prototype, Enumerable); if (!Array.prototype._reverse) Array.prototype._reverse =3D Array.prototype= .reverse; Object.extend(Array.prototype, { _each: function(iterator) { for (var i =3D 0, length =3D this.length; i < length; i++) iterator(this[i]); }, clear: function() { this.length =3D 0; return this; }, first: function() { return this[0]; }, last: function() { return this[this.length - 1]; }, compact: function() { return this.select(function(value) { return value !=3D null; }); }, flatten: function() { return this.inject([], function(array, value) { return array.concat(Object.isArray(value) ? value.flatten() : [value]); }); }, without: function() { var values =3D $A(arguments); return this.select(function(value) { return !values.include(value); }); }, reverse: function(inline) { return (inline !=3D=3D false ? this : this.toArray())._reverse(); }, reduce: function() { return this.length > 1 ? this : this[0]; }, uniq: function(sorted) { return this.inject([], function(array, value, index) { if (0 =3D=3D index || (sorted ? array.last() !=3D value : !array.incl= ude(value))) array.push(value); return array; }); }, intersect: function(array) { return this.uniq().findAll(function(item) { return array.detect(function(value) { return item =3D=3D=3D value }); }); }, clone: function() { return [].concat(this); }, size: function() { return this.length; }, inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; }, toJSON: function() { var results =3D []; this.each(function(object) { var value =3D Object.toJSON(object); if (!Object.isUndefined(value)) results.push(value); }); return '[' + results.join(', ') + ']'; } }); // use native browser JS 1.6 implementation if available if (Object.isFunction(Array.prototype.forEach)) Array.prototype._each =3D Array.prototype.forEach; if (!Array.prototype.indexOf) Array.prototype.indexOf =3D function(item, i)= { i || (i =3D 0); var length =3D this.length; if (i < 0) i =3D length + i; for (; i < length; i++) if (this[i] =3D=3D=3D item) return i; return -1; }; if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf =3D function(= item, i) { i =3D isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; var n =3D this.slice(0, i).reverse().indexOf(item); return (n < 0) ? n : i - n - 1; }; Array.prototype.toArray =3D Array.prototype.clone; function $w(string) { if (!Object.isString(string)) return []; string =3D string.strip(); return string ? string.split(/\s+/) : []; } if (Prototype.Browser.Opera){ Array.prototype.concat =3D function() { var array =3D []; for (var i =3D 0, length =3D this.length; i < length; i++) array.push(t= his[i]); for (var i =3D 0, length =3D arguments.length; i < length; i++) { if (Object.isArray(arguments[i])) { for (var j =3D 0, arrayLength =3D arguments[i].length; j < arrayLen= gth; j++) array.push(arguments[i][j]); } else { array.push(arguments[i]); } } return array; }; } Object.extend(Number.prototype, { toColorPart: function() { return this.toPaddedString(2, 16); }, succ: function() { return this + 1; }, times: function(iterator) { $R(0, this, true).each(iterator); return this; }, toPaddedString: function(length, radix) { var string =3D this.toString(radix || 10); return '0'.times(length - string.length) + string; }, toJSON: function() { return isFinite(this) ? this.toString() : 'null'; } }); $w('abs round ceil floor').each(function(method){ Number.prototype[method] =3D Math[method].methodize(); }); function $H(object) { return new Hash(object); }; var Hash =3D Class.create(Enumerable, (function() { function toQueryPair(key, value) { if (Object.isUndefined(value)) return key; return key + '=3D' + encodeURIComponent(String.interpret(value)); } return { initialize: function(object) { this._object =3D Object.isHash(object) ? object.toObject() : Object.c= lone(object); }, _each: function(iterator) { for (var key in this._object) { var value =3D this._object[key], pair =3D [key, value]; pair.key =3D key; pair.value =3D value; iterator(pair); } }, set: function(key, value) { return this._object[key] =3D value; }, get: function(key) { return this._object[key]; }, unset: function(key) { var value =3D this._object[key]; delete this._object[key]; return value; }, toObject: function() { return Object.clone(this._object); }, keys: function() { return this.pluck('key'); }, values: function() { return this.pluck('value'); }, index: function(value) { var match =3D this.detect(function(pair) { return pair.value =3D=3D=3D value; }); return match && match.key; }, merge: function(object) { return this.clone().update(object); }, update: function(object) { return new Hash(object).inject(this, function(result, pair) { result.set(pair.key, pair.value); return result; }); }, toQueryString: function() { return this.map(function(pair) { var key =3D encodeURIComponent(pair.key), values =3D pair.value; if (values && typeof values =3D=3D 'object') { if (Object.isArray(values)) return values.map(toQueryPair.curry(key)).join('&'); } return toQueryPair(key, values); }).join('&'); }, inspect: function() { return '#'; }, toJSON: function() { return Object.toJSON(this.toObject()); }, clone: function() { return new Hash(this); } } })()); Hash.prototype.toTemplateReplacements =3D Hash.prototype.toObject; Hash.from =3D $H; var ObjectRange =3D Class.create(Enumerable, { initialize: function(start, end, exclusive) { this.start =3D start; this.end =3D end; this.exclusive =3D exclusive; }, _each: function(iterator) { var value =3D this.start; while (this.include(value)) { iterator(value); value =3D value.succ(); } }, include: function(value) { if (value < this.start) return false; if (this.exclusive) return value < this.end; return value <=3D this.end; } }); var $R =3D function(start, end, exclusive) { return new ObjectRange(start, end, exclusive); }; var Ajax =3D { getTransport: function() { return Try.these( function() {return new XMLHttpRequest()}, function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false; }, activeRequestCount: 0 }; Ajax.Responders =3D { responders: [], _each: function(iterator) { this.responders._each(iterator); }, register: function(responder) { if (!this.include(responder)) this.responders.push(responder); }, unregister: function(responder) { this.responders =3D this.responders.without(responder); }, dispatch: function(callback, request, transport, json) { this.each(function(responder) { if (Object.isFunction(responder[callback])) { try { responder[callback].apply(responder, [request, transport, json]); } catch (e) { } } }); } }; Object.extend(Ajax.Responders, Enumerable); Ajax.Responders.register({ onCreate: function() { Ajax.activeRequestCount++ }, onComplete: function() { Ajax.activeRequestCount-- } }); Ajax.Base =3D Class.create({ initialize: function(options) { this.options =3D { method: 'post', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', parameters: '', evalJSON: true, evalJS: true }; Object.extend(this.options, options || { }); this.options.method =3D this.options.method.toLowerCase(); if (Object.isString(this.options.parameters)) this.options.parameters =3D this.options.parameters.toQueryParams(); else if (Object.isHash(this.options.parameters)) this.options.parameters =3D this.options.parameters.toObject(); } }); Ajax.Request =3D Class.create(Ajax.Base, { _complete: false, initialize: function($super, url, options) { $super(options); this.transport =3D Ajax.getTransport(); this.request(url); }, request: function(url) { this.url =3D url; this.method =3D this.options.method; var params =3D Object.clone(this.options.parameters); if (!['get', 'post'].include(this.method)) { // simulate other verbs over post params['_method'] =3D this.method; this.method =3D 'post'; } this.parameters =3D params; if (params =3D Object.toQueryString(params)) { // when GET, append parameters to URL if (this.method =3D=3D 'get') this.url +=3D (this.url.include('?') ? '&' : '?') + params; else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) params +=3D '&_=3D'; } try { var response =3D new Ajax.Response(this); if (this.options.onCreate) this.options.onCreate(response); Ajax.Responders.dispatch('onCreate', this, response); this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous); if (this.options.asynchronous) this.respondToReadyState.bind(this).de= fer(1); this.transport.onreadystatechange =3D this.onStateChange.bind(this); this.setRequestHeaders(); this.body =3D this.method =3D=3D 'post' ? (this.options.postBody || p= arams) : null; this.transport.send(this.body); /* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange(); } catch (e) { this.dispatchException(e); } }, onStateChange: function() { var readyState =3D this.transport.readyState; if (readyState > 1 && !((readyState =3D=3D 4) && this._complete)) this.respondToReadyState(this.transport.readyState); }, setRequestHeaders: function() { var headers =3D { 'X-Requested-With': 'XMLHttpRequest', 'X-Prototype-Version': Prototype.Version, 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*= ' }; if (this.method =3D=3D 'post') { headers['Content-type'] =3D this.options.contentType + (this.options.encoding ? '; charset=3D' + this.options.encoding : '= '); /* Force "Connection: close" for older Mozilla browsers to work * around a bug where XMLHttpRequest sends an incorrect * Content-length header. See Mozilla Bugzilla #246651. */ if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 20= 05) headers['Connection'] =3D 'close'; } // user-defined headers if (typeof this.options.requestHeaders =3D=3D 'object') { var extras =3D this.options.requestHeaders; if (Object.isFunction(extras.push)) for (var i =3D 0, length =3D extras.length; i < length; i +=3D 2) headers[extras[i]] =3D extras[i+1]; else $H(extras).each(function(pair) { headers[pair.key] =3D pair.value }= ); } for (var name in headers) this.transport.setRequestHeader(name, headers[name]); }, success: function() { var status =3D this.getStatus(); return !status || (status >=3D 200 && status < 300); }, getStatus: function() { try { return this.transport.status || 0; } catch (e) { return 0 } }, respondToReadyState: function(readyState) { var state =3D Ajax.Request.Events[readyState], response =3D new Ajax.Re= sponse(this); if (state =3D=3D 'Complete') { try { this._complete =3D true; (this.options['on' + response.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(response, response.headerJSON); } catch (e) { this.dispatchException(e); } var contentType =3D response.getHeader('Content-type'); if (this.options.evalJS =3D=3D 'force' || (this.options.evalJS && this.isSameOrigin() && contentType && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)scr= ipt(;.*)?\s*$/i))) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(response, res= ponse.headerJSON); Ajax.Responders.dispatch('on' + state, this, response, response.heade= rJSON); } catch (e) { this.dispatchException(e); } if (state =3D=3D 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange =3D Prototype.emptyFunction; } }, isSameOrigin: function() { var m =3D this.url.match(/^\s*https?:\/\/[^\/]*/); return !m || (m[0] =3D=3D '#{protocol}//#{domain}#{port}'.interpolate({ protocol: location.protocol, domain: document.domain, port: location.port ? ':' + location.port : '' })); }, getHeader: function(name) { try { return this.transport.getResponseHeader(name) || null; } catch (e) { return null } }, evalResponse: function() { try { return eval((this.transport.responseText || '').unfilterJSON()); } catch (e) { this.dispatchException(e); } }, dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception); } }); Ajax.Request.Events =3D ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; Ajax.Response =3D Class.create({ initialize: function(request){ this.request =3D request; var transport =3D this.transport =3D request.transport, readyState =3D this.readyState =3D transport.readyState; if((readyState > 2 && !Prototype.Browser.IE) || readyState =3D=3D 4) { this.status =3D this.getStatus(); this.statusText =3D this.getStatusText(); this.responseText =3D String.interpret(transport.responseText); this.headerJSON =3D this._getHeaderJSON(); } if(readyState =3D=3D 4) { var xml =3D transport.responseXML; this.responseXML =3D Object.isUndefined(xml) ? null : xml; this.responseJSON =3D this._getResponseJSON(); } }, status: 0, statusText: '', getStatus: Ajax.Request.prototype.getStatus, getStatusText: function() { try { return this.transport.statusText || ''; } catch (e) { return '' } }, getHeader: Ajax.Request.prototype.getHeader, getAllHeaders: function() { try { return this.getAllResponseHeaders(); } catch (e) { return null } }, getResponseHeader: function(name) { return this.transport.getResponseHeader(name); }, getAllResponseHeaders: function() { return this.transport.getAllResponseHeaders(); }, _getHeaderJSON: function() { var json =3D this.getHeader('X-JSON'); if (!json) return null; json =3D decodeURIComponent(escape(json)); try { return json.evalJSON(this.request.options.sanitizeJSON || !this.request.isSameOrigin()); } catch (e) { this.request.dispatchException(e); } }, _getResponseJSON: function() { var options =3D this.request.options; if (!options.evalJSON || (options.evalJSON !=3D 'force' && !(this.getHeader('Content-type') || '').include('application/json')) = || this.responseText.blank()) return null; try { return this.responseText.evalJSON(options.sanitizeJSON || !this.request.isSameOrigin()); } catch (e) { this.request.dispatchException(e); } } }); Ajax.Updater =3D Class.create(Ajax.Request, { initialize: function($super, container, url, options) { this.container =3D { success: (container.success || container), failure: (container.failure || (container.success ? null : container)= ) }; options =3D Object.clone(options); var onComplete =3D options.onComplete; options.onComplete =3D (function(response, json) { this.updateContent(response.responseText); if (Object.isFunction(onComplete)) onComplete(response, json); }).bind(this); $super(url, options); }, updateContent: function(responseText) { var receiver =3D this.container[this.success() ? 'success' : 'failure']= , options =3D this.options; if (!options.evalScripts) responseText =3D responseText.stripScripts(); if (receiver =3D $(receiver)) { if (options.insertion) { if (Object.isString(options.insertion)) { var insertion =3D { }; insertion[options.insertion] =3D responseT= ext; receiver.insert(insertion); } else options.insertion(receiver, responseText); } else receiver.update(responseText); } } }); Ajax.PeriodicalUpdater =3D Class.create(Ajax.Base, { initialize: function($super, container, url, options) { $super(options); this.onComplete =3D this.options.onComplete; this.frequency =3D (this.options.frequency || 2); this.decay =3D (this.options.decay || 1); this.updater =3D { }; this.container =3D container; this.url =3D url; this.start(); }, start: function() { this.options.onComplete =3D this.updateComplete.bind(this); this.onTimerEvent(); }, stop: function() { this.updater.options.onComplete =3D undefined; clearTimeout(this.timer); (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, updateComplete: function(response) { if (this.options.decay) { this.decay =3D (response.responseText =3D=3D this.lastText ? this.decay * this.options.decay : 1); this.lastText =3D response.responseText; } this.timer =3D this.onTimerEvent.bind(this).delay(this.decay * this.fre= quency); }, onTimerEvent: function() { this.updater =3D new Ajax.Updater(this.container, this.url, this.option= s); } }); function $(element) { if (arguments.length > 1) { for (var i =3D 0, elements =3D [], length =3D arguments.length; i < len= gth; i++) elements.push($(arguments[i])); return elements; } if (Object.isString(element)) element =3D document.getElementById(element); return Element.extend(element); } if (Prototype.BrowserFeatures.XPath) { document._getElementsByXPath =3D function(expression, parentElement) { var results =3D []; var query =3D document.evaluate(expression, $(parentElement) || documen= t, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i =3D 0, length =3D query.snapshotLength; i < length; i++) results.push(Element.extend(query.snapshotItem(i))); return results; }; } /*-------------------------------------------------------------------------= -*/ if (!window.Node) var Node =3D { }; if (!Node.ELEMENT_NODE) { // DOM level 2 ECMAScript Language Binding Object.extend(Node, { ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12 }); } (function() { var element =3D this.Element; this.Element =3D function(tagName, attributes) { attributes =3D attributes || { }; tagName =3D tagName.toLowerCase(); var cache =3D Element.cache; if (Prototype.Browser.IE && attributes.name) { tagName =3D '<' + tagName + ' name=3D"' + attributes.name + '">'; delete attributes.name; return Element.writeAttribute(document.createElement(tagName), attrib= utes); } if (!cache[tagName]) cache[tagName] =3D Element.extend(document.createE= lement(tagName)); return Element.writeAttribute(cache[tagName].cloneNode(false), attribut= es); }; Object.extend(this.Element, element || { }); }).call(window); Element.cache =3D { }; Element.Methods =3D { visible: function(element) { return $(element).style.display !=3D 'none'; }, toggle: function(element) { element =3D $(element); Element[Element.visible(element) ? 'hide' : 'show'](element); return element; }, hide: function(element) { $(element).style.display =3D 'none'; return element; }, show: function(element) { $(element).style.display =3D ''; return element; }, remove: function(element) { element =3D $(element); element.parentNode.removeChild(element); return element; }, update: function(element, content) { element =3D $(element); if (content && content.toElement) content =3D content.toElement(); if (Object.isElement(content)) return element.update().insert(content); content =3D Object.toHTML(content); element.innerHTML =3D content.stripScripts(); content.evalScripts.bind(content).defer(); return element; }, replace: function(element, content) { element =3D $(element); if (content && content.toElement) content =3D content.toElement(); else if (!Object.isElement(content)) { content =3D Object.toHTML(content); var range =3D element.ownerDocument.createRange(); range.selectNode(element); content.evalScripts.bind(content).defer(); content =3D range.createContextualFragment(content.stripScripts()); } element.parentNode.replaceChild(content, element); return element; }, insert: function(element, insertions) { element =3D $(element); if (Object.isString(insertions) || Object.isNumber(insertions) || Object.isElement(insertions) || (insertions && (insertions.toElemen= t || insertions.toHTML))) insertions =3D {bottom:insertions}; var content, insert, tagName, childNodes; for (var position in insertions) { content =3D insertions[position]; position =3D position.toLowerCase(); insert =3D Element._insertionTranslations[position]; if (content && content.toElement) content =3D content.toElement(); if (Object.isElement(content)) { insert(element, content); continue; } content =3D Object.toHTML(content); tagName =3D ((position =3D=3D 'before' || position =3D=3D 'after') ? element.parentNode : element).tagName.toUpperCase(); childNodes =3D Element._getContentFromAnonymousElement(tagName, conte= nt.stripScripts()); if (position =3D=3D 'top' || position =3D=3D 'after') childNodes.reve= rse(); childNodes.each(insert.curry(element)); content.evalScripts.bind(content).defer(); } return element; }, wrap: function(element, wrapper, attributes) { element =3D $(element); if (Object.isElement(wrapper)) $(wrapper).writeAttribute(attributes || { }); else if (Object.isString(wrapper)) wrapper =3D new Element(wrapper, att= ributes); else wrapper =3D new Element('div', wrapper); if (element.parentNode) element.parentNode.replaceChild(wrapper, element); wrapper.appendChild(element); return wrapper; }, inspect: function(element) { element =3D $(element); var result =3D '<' + element.tagName.toLowerCase(); $H({'id': 'id', 'className': 'class'}).each(function(pair) { var property =3D pair.first(), attribute =3D pair.last(); var value =3D (element[property] || '').toString(); if (value) result +=3D ' ' + attribute + '=3D' + value.inspect(true); }); return result + '>'; }, recursivelyCollect: function(element, property) { element =3D $(element); var elements =3D []; while (element =3D element[property]) if (element.nodeType =3D=3D 1) elements.push(Element.extend(element)); return elements; }, ancestors: function(element) { return $(element).recursivelyCollect('parentNode'); }, descendants: function(element) { return $(element).select("*"); }, firstDescendant: function(element) { element =3D $(element).firstChild; while (element && element.nodeType !=3D 1) element =3D element.nextSibl= ing; return $(element); }, immediateDescendants: function(element) { if (!(element =3D $(element).firstChild)) return []; while (element && element.nodeType !=3D 1) element =3D element.nextSibl= ing; if (element) return [element].concat($(element).nextSiblings()); return []; }, previousSiblings: function(element) { return $(element).recursivelyCollect('previousSibling'); }, nextSiblings: function(element) { return $(element).recursivelyCollect('nextSibling'); }, siblings: function(element) { element =3D $(element); return element.previousSiblings().reverse().concat(element.nextSiblings= ()); }, match: function(element, selector) { if (Object.isString(selector)) selector =3D new Selector(selector); return selector.match($(element)); }, up: function(element, expression, index) { element =3D $(element); if (arguments.length =3D=3D 1) return $(element.parentNode); var ancestors =3D element.ancestors(); return Object.isNumber(expression) ? ancestors[expression] : Selector.findElement(ancestors, expression, index); }, down: function(element, expression, index) { element =3D $(element); if (arguments.length =3D=3D 1) return element.firstDescendant(); return Object.isNumber(expression) ? element.descendants()[expression] = : element.select(expression)[index || 0]; }, previous: function(element, expression, index) { element =3D $(element); if (arguments.length =3D=3D 1) return $(Selector.handlers.previousEleme= ntSibling(element)); var previousSiblings =3D element.previousSiblings(); return Object.isNumber(expression) ? previousSiblings[expression] : Selector.findElement(previousSiblings, expression, index); }, next: function(element, expression, index) { element =3D $(element); if (arguments.length =3D=3D 1) return $(Selector.handlers.nextElementSi= bling(element)); var nextSiblings =3D element.nextSiblings(); return Object.isNumber(expression) ? nextSiblings[expression] : Selector.findElement(nextSiblings, expression, index); }, select: function() { var args =3D $A(arguments), element =3D $(args.shift()); return Selector.findChildElements(element, args); }, adjacent: function() { var args =3D $A(arguments), element =3D $(args.shift()); return Selector.findChildElements(element.parentNode, args).without(ele= ment); }, identify: function(element) { element =3D $(element); var id =3D element.readAttribute('id'), self =3D arguments.callee; if (id) return id; do { id =3D 'anonymous_element_' + self.counter++ } while ($(id)); element.writeAttribute('id', id); return id; }, readAttribute: function(element, name) { element =3D $(element); if (Prototype.Browser.IE) { var t =3D Element._attributeTranslations.read; if (t.values[name]) return t.values[name](element, name); if (t.names[name]) name =3D t.names[name]; if (name.include(':')) { return (!element.attributes || !element.attributes[name]) ? null : element.attributes[name].value; } } return element.getAttribute(name); }, writeAttribute: function(element, name, value) { element =3D $(element); var attributes =3D { }, t =3D Element._attributeTranslations.write; if (typeof name =3D=3D 'object') attributes =3D name; else attributes[name] =3D Object.isUndefined(value) ? true : value; for (var attr in attributes) { name =3D t.names[attr] || attr; value =3D attributes[attr]; if (t.values[attr]) name =3D t.values[attr](element, value); if (value =3D=3D=3D false || value =3D=3D=3D null) element.removeAttribute(name); else if (value =3D=3D=3D true) element.setAttribute(name, name); else element.setAttribute(name, value); } return element; }, getHeight: function(element) { return $(element).getDimensions().height; }, getWidth: function(element) { return $(element).getDimensions().width; }, classNames: function(element) { return new Element.ClassNames(element); }, hasClassName: function(element, className) { if (!(element =3D $(element))) return; var elementClassName =3D element.className; return (elementClassName.length > 0 && (elementClassName =3D=3D classNa= me || new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))= ); }, addClassName: function(element, className) { if (!(element =3D $(element))) return; if (!element.hasClassName(className)) element.className +=3D (element.className ? ' ' : '') + className; return element; }, removeClassName: function(element, className) { if (!(element =3D $(element))) return; element.className =3D element.className.replace( new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); return element; }, toggleClassName: function(element, className) { if (!(element =3D $(element))) return; return element[element.hasClassName(className) ? 'removeClassName' : 'addClassName'](className); }, // removes whitespace-only text node children cleanWhitespace: function(element) { element =3D $(element); var node =3D element.firstChild; while (node) { var nextNode =3D node.nextSibling; if (node.nodeType =3D=3D 3 && !/\S/.test(node.nodeValue)) element.removeChild(node); node =3D nextNode; } return element; }, empty: function(element) { return $(element).innerHTML.blank(); }, descendantOf: function(element, ancestor) { element =3D $(element), ancestor =3D $(ancestor); var originalAncestor =3D ancestor; if (element.compareDocumentPosition) return (element.compareDocumentPosition(ancestor) & 8) =3D=3D=3D 8; if (element.sourceIndex && !Prototype.Browser.Opera) { var e =3D element.sourceIndex, a =3D ancestor.sourceIndex, nextAncestor =3D ancestor.nextSibling; if (!nextAncestor) { do { ancestor =3D ancestor.parentNode; } while (!(nextAncestor =3D ancestor.nextSibling) && ancestor.parentN= ode); } if (nextAncestor && nextAncestor.sourceIndex) return (e > a && e < nextAncestor.sourceIndex); } while (element =3D element.parentNode) if (element =3D=3D originalAncestor) return true; return false; }, scrollTo: function(element) { element =3D $(element); var pos =3D element.cumulativeOffset(); window.scrollTo(pos[0], pos[1]); return element; }, getStyle: function(element, style) { element =3D $(element); style =3D style =3D=3D 'float' ? 'cssFloat' : style.camelize(); var value =3D element.style[style]; if (!value) { var css =3D document.defaultView.getComputedStyle(element, null); value =3D css ? css[style] : null; } if (style =3D=3D 'opacity') return value ? parseFloat(value) : 1.0; return value =3D=3D 'auto' ? null : value; }, getOpacity: function(element) { return $(element).getStyle('opacity'); }, setStyle: function(element, styles) { element =3D $(element); var elementStyle =3D element.style, match; if (Object.isString(styles)) { element.style.cssText +=3D ';' + styles; return styles.include('opacity') ? element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : ele= ment; } for (var property in styles) if (property =3D=3D 'opacity') element.setOpacity(styles[property]); else elementStyle[(property =3D=3D 'float' || property =3D=3D 'cssFloat'= ) ? (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styl= eFloat') : property] =3D styles[property]; return element; }, setOpacity: function(element, value) { element =3D $(element); element.style.opacity =3D (value =3D=3D 1 || value =3D=3D=3D '') ? '' : (value < 0.00001) ? 0 : value; return element; }, getDimensions: function(element) { element =3D $(element); var display =3D $(element).getStyle('display'); if (display !=3D 'none' && display !=3D null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display no= ne, // so enable the element temporarily var els =3D element.style; var originalVisibility =3D els.visibility; var originalPosition =3D els.position; var originalDisplay =3D els.display; els.visibility =3D 'hidden'; els.position =3D 'absolute'; els.display =3D 'block'; var originalWidth =3D element.clientWidth; var originalHeight =3D element.clientHeight; els.display =3D originalDisplay; els.position =3D originalPosition; els.visibility =3D originalVisibility; return {width: originalWidth, height: originalHeight}; }, makePositioned: function(element) { element =3D $(element); var pos =3D Element.getStyle(element, 'position'); if (pos =3D=3D 'static' || !pos) { element._madePositioned =3D true; element.style.position =3D 'relative'; // Opera returns the offset relative to the positioning context, when= an // element is position relative but top and left have not been define= d if (window.opera) { element.style.top =3D 0; element.style.left =3D 0; } } return element; }, undoPositioned: function(element) { element =3D $(element); if (element._madePositioned) { element._madePositioned =3D undefined; element.style.position =3D element.style.top =3D element.style.left =3D element.style.bottom =3D element.style.right =3D ''; } return element; }, makeClipping: function(element) { element =3D $(element); if (element._overflow) return element; element._overflow =3D Element.getStyle(element, 'overflow') || 'auto'; if (element._overflow !=3D=3D 'hidden') element.style.overflow =3D 'hidden'; return element; }, undoClipping: function(element) { element =3D $(element); if (!element._overflow) return element; element.style.overflow =3D element._overflow =3D=3D 'auto' ? '' : eleme= nt._overflow; element._overflow =3D null; return element; }, cumulativeOffset: function(element) { var valueT =3D 0, valueL =3D 0; do { valueT +=3D element.offsetTop || 0; valueL +=3D element.offsetLeft || 0; element =3D element.offsetParent; } while (element); return Element._returnOffset(valueL, valueT); }, positionedOffset: function(element) { var valueT =3D 0, valueL =3D 0; do { valueT +=3D element.offsetTop || 0; valueL +=3D element.offsetLeft || 0; element =3D element.offsetParent; if (element) { if (element.tagName =3D=3D 'BODY') break; var p =3D Element.getStyle(element, 'position'); if (p !=3D=3D 'static') break; } } while (element); return Element._returnOffset(valueL, valueT); }, absolutize: function(element) { element =3D $(element); if (element.getStyle('position') =3D=3D 'absolute') return; // Position.prepare(); // To be done manually by Scripty when it needs = it. var offsets =3D element.positionedOffset(); var top =3D offsets[1]; var left =3D offsets[0]; var width =3D element.clientWidth; var height =3D element.clientHeight; element._originalLeft =3D left - parseFloat(element.style.left || 0)= ; element._originalTop =3D top - parseFloat(element.style.top || 0); element._originalWidth =3D element.style.width; element._originalHeight =3D element.style.height; element.style.position =3D 'absolute'; element.style.top =3D top + 'px'; element.style.left =3D left + 'px'; element.style.width =3D width + 'px'; element.style.height =3D height + 'px'; return element; }, relativize: function(element) { element =3D $(element); if (element.getStyle('position') =3D=3D 'relative') return; // Position.prepare(); // To be done manually by Scripty when it needs = it. element.style.position =3D 'relative'; var top =3D parseFloat(element.style.top || 0) - (element._originalTo= p || 0); var left =3D parseFloat(element.style.left || 0) - (element._originalLe= ft || 0); element.style.top =3D top + 'px'; element.style.left =3D left + 'px'; element.style.height =3D element._originalHeight; element.style.width =3D element._originalWidth; return element; }, cumulativeScrollOffset: function(element) { var valueT =3D 0, valueL =3D 0; do { valueT +=3D element.scrollTop || 0; valueL +=3D element.scrollLeft || 0; element =3D element.parentNode; } while (element); return Element._returnOffset(valueL, valueT); }, getOffsetParent: function(element) { if (element.offsetParent) return $(element.offsetParent); if (element =3D=3D document.body) return $(element); while ((element =3D element.parentNode) && element !=3D document.body) if (Element.getStyle(element, 'position') !=3D 'static') return $(element); return $(document.body); }, viewportOffset: function(forElement) { var valueT =3D 0, valueL =3D 0; var element =3D forElement; do { valueT +=3D element.offsetTop || 0; valueL +=3D element.offsetLeft || 0; // Safari fix if (element.offsetParent =3D=3D document.body && Element.getStyle(element, 'position') =3D=3D 'absolute') break; } while (element =3D element.offsetParent); element =3D forElement; do { if (!Prototype.Browser.Opera || element.tagName =3D=3D 'BODY') { valueT -=3D element.scrollTop || 0; valueL -=3D element.scrollLeft || 0; } } while (element =3D element.parentNode); return Element._returnOffset(valueL, valueT); }, clonePosition: function(element, source) { var options =3D Object.extend({ setLeft: true, setTop: true, setWidth: true, setHeight: true, offsetTop: 0, offsetLeft: 0 }, arguments[2] || { }); // find page position of source source =3D $(source); var p =3D source.viewportOffset(); // find coordinate system to use element =3D $(element); var delta =3D [0, 0]; var parent =3D null; // delta [0,0] will do fine with position: fixed elements, // position:absolute needs offsetParent deltas if (Element.getStyle(element, 'position') =3D=3D 'absolute') { parent =3D element.getOffsetParent(); delta =3D parent.viewportOffset(); } // correct by body offsets (fixes Safari) if (parent =3D=3D document.body) { delta[0] -=3D document.body.offsetLeft; delta[1] -=3D document.body.offsetTop; } // set position if (options.setLeft) element.style.left =3D (p[0] - delta[0] + optio= ns.offsetLeft) + 'px'; if (options.setTop) element.style.top =3D (p[1] - delta[1] + optio= ns.offsetTop) + 'px'; if (options.setWidth) element.style.width =3D source.offsetWidth + 'px= '; if (options.setHeight) element.style.height =3D source.offsetHeight + '= px'; return element; } }; Element.Methods.identify.counter =3D 1; Object.extend(Element.Methods, { getElementsBySelector: Element.Methods.select, childElements: Element.Methods.immediateDescendants }); Element._attributeTranslations =3D { write: { names: { className: 'class', htmlFor: 'for' }, values: { } } }; if (Prototype.Browser.Opera) { Element.Methods.getStyle =3D Element.Methods.getStyle.wrap( function(proceed, element, style) { switch (style) { case 'left': case 'top': case 'right': case 'bottom': if (proceed(element, 'position') =3D=3D=3D 'static') return null; case 'height': case 'width': // returns '0px' for hidden elements; we want it to return null if (!Element.visible(element)) return null; // returns the border-box dimensions rather than the content-box // dimensions, so we subtract padding and borders from the value var dim =3D parseInt(proceed(element, style), 10); if (dim !=3D=3D element['offset' + style.capitalize()]) return dim + 'px'; var properties; if (style =3D=3D=3D 'height') { properties =3D ['border-top-width', 'padding-top', 'padding-bottom', 'border-bottom-width']; } else { properties =3D ['border-left-width', 'padding-left', 'padding-right', 'border-right-width']; } return properties.inject(dim, function(memo, property) { var val =3D proceed(element, property); return val =3D=3D=3D null ? memo : memo - parseInt(val, 10); }) + 'px'; default: return proceed(element, style); } } ); Element.Methods.readAttribute =3D Element.Methods.readAttribute.wrap( function(proceed, element, attribute) { if (attribute =3D=3D=3D 'title') return element.title; return proceed(element, attribute); } ); } else if (Prototype.Browser.IE) { // IE doesn't report offsets correctly for static elements, so we change = them // to "relative" to get the values, then change them back. Element.Methods.getOffsetParent =3D Element.Methods.getOffsetParent.wrap( function(proceed, element) { element =3D $(element); var position =3D element.getStyle('position'); if (position !=3D=3D 'static') return proceed(element); element.setStyle({ position: 'relative' }); var value =3D proceed(element); element.setStyle({ position: position }); return value; } ); $w('positionedOffset viewportOffset').each(function(method) { Element.Methods[method] =3D Element.Methods[method].wrap( function(proceed, element) { element =3D $(element); var position =3D element.getStyle('position'); if (position !=3D=3D 'static') return proceed(element); // Trigger hasLayout on the offset parent so that IE6 reports // accurate offsetTop and offsetLeft values for position: fixed. var offsetParent =3D element.getOffsetParent(); if (offsetParent && offsetParent.getStyle('position') =3D=3D=3D 'fi= xed') offsetParent.setStyle({ zoom: 1 }); element.setStyle({ position: 'relative' }); var value =3D proceed(element); element.setStyle({ position: position }); return value; } ); }); Element.Methods.getStyle =3D function(element, style) { element =3D $(element); style =3D (style =3D=3D 'float' || style =3D=3D 'cssFloat') ? 'styleFlo= at' : style.camelize(); var value =3D element.style[style]; if (!value && element.currentStyle) value =3D element.currentStyle[styl= e]; if (style =3D=3D 'opacity') { if (value =3D (element.getStyle('filter') || '').match(/alpha\(opacit= y=3D(.*)\)/)) if (value[1]) return parseFloat(value[1]) / 100; return 1.0; } if (value =3D=3D 'auto') { if ((style =3D=3D 'width' || style =3D=3D 'height') && (element.getSt= yle('display') !=3D 'none')) return element['offset' + style.capitalize()] + 'px'; return null; } return value; }; Element.Methods.setOpacity =3D function(element, value) { function stripAlpha(filter){ return filter.replace(/alpha\([^\)]*\)/gi,''); } element =3D $(element); var currentStyle =3D element.currentStyle; if ((currentStyle && !currentStyle.hasLayout) || (!currentStyle && element.style.zoom =3D=3D 'normal')) element.style.zoom =3D 1; var filter =3D element.getStyle('filter'), style =3D element.style; if (value =3D=3D 1 || value =3D=3D=3D '') { (filter =3D stripAlpha(filter)) ? style.filter =3D filter : style.removeAttribute('filter'); return element; } else if (value < 0.00001) value =3D 0; style.filter =3D stripAlpha(filter) + 'alpha(opacity=3D' + (value * 100) + ')'; return element; }; Element._attributeTranslations =3D { read: { names: { 'class': 'className', 'for': 'htmlFor' }, values: { _getAttr: function(element, attribute) { return element.getAttribute(attribute, 2); }, _getAttrNode: function(element, attribute) { var node =3D element.getAttributeNode(attribute); return node ? node.value : ""; }, _getEv: function(element, attribute) { attribute =3D element.getAttribute(attribute); return attribute ? attribute.toString().slice(23, -2) : null; }, _flag: function(element, attribute) { return $(element).hasAttribute(attribute) ? attribute : null; }, style: function(element) { return element.style.cssText.toLowerCase(); }, title: function(element) { return element.title; } } } }; Element._attributeTranslations.write =3D { names: Object.extend({ cellpadding: 'cellPadding', cellspacing: 'cellSpacing' }, Element._attributeTranslations.read.names), values: { checked: function(element, value) { element.checked =3D !!value; }, style: function(element, value) { element.style.cssText =3D value ? value : ''; } } }; Element._attributeTranslations.has =3D {}; $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + 'encType maxLength readOnly longDesc').each(function(attr) { Element._attributeTranslations.write.names[attr.toLowerCase()] =3D attr= ; Element._attributeTranslations.has[attr.toLowerCase()] =3D attr; }); (function(v) { Object.extend(v, { href: v._getAttr, src: v._getAttr, type: v._getAttr, action: v._getAttrNode, disabled: v._flag, checked: v._flag, readonly: v._flag, multiple: v._flag, onload: v._getEv, onunload: v._getEv, onclick: v._getEv, ondblclick: v._getEv, onmousedown: v._getEv, onmouseup: v._getEv, onmouseover: v._getEv, onmousemove: v._getEv, onmouseout: v._getEv, onfocus: v._getEv, onblur: v._getEv, onkeypress: v._getEv, onkeydown: v._getEv, onkeyup: v._getEv, onsubmit: v._getEv, onreset: v._getEv, onselect: v._getEv, onchange: v._getEv }); })(Element._attributeTranslations.read.values); } else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent))= { Element.Methods.setOpacity =3D function(element, value) { element =3D $(element); element.style.opacity =3D (value =3D=3D 1) ? 0.999999 : (value =3D=3D=3D '') ? '' : (value < 0.00001) ? 0 : value; return element; }; } else if (Prototype.Browser.WebKit) { Element.Methods.setOpacity =3D function(element, value) { element =3D $(element); element.style.opacity =3D (value =3D=3D 1 || value =3D=3D=3D '') ? '' : (value < 0.00001) ? 0 : value; if (value =3D=3D 1) if(element.tagName =3D=3D 'IMG' && element.width) { element.width++; element.width--; } else try { var n =3D document.createTextNode(' '); element.appendChild(n); element.removeChild(n); } catch (e) { } return element; }; // Safari returns margins on body which is incorrect if the child is abso= lutely // positioned. For performance reasons, redefine Element#cumulativeOffse= t for // KHTML/WebKit only. Element.Methods.cumulativeOffset =3D function(element) { var valueT =3D 0, valueL =3D 0; do { valueT +=3D element.offsetTop || 0; valueL +=3D element.offsetLeft || 0; if (element.offsetParent =3D=3D document.body) if (Element.getStyle(element, 'position') =3D=3D 'absolute') break; element =3D element.offsetParent; } while (element); return Element._returnOffset(valueL, valueT); }; } if (Prototype.Browser.IE || Prototype.Browser.Opera) { // IE and Opera are missing .innerHTML support for TABLE-related and SELE= CT elements Element.Methods.update =3D function(element, content) { element =3D $(element); if (content && content.toElement) content =3D content.toElement(); if (Object.isElement(content)) return element.update().insert(content); content =3D Object.toHTML(content); var tagName =3D element.tagName.toUpperCase(); if (tagName in Element._insertionTranslations.tags) { $A(element.childNodes).each(function(node) { element.removeChild(node= ) }); Element._getContentFromAnonymousElement(tagName, content.stripScripts= ()) .each(function(node) { element.appendChild(node) }); } else element.innerHTML =3D content.stripScripts(); content.evalScripts.bind(content).defer(); return element; }; } if ('outerHTML' in document.createElement('div')) { Element.Methods.replace =3D function(element, content) { element =3D $(element); if (content && content.toElement) content =3D content.toElement(); if (Object.isElement(content)) { element.parentNode.replaceChild(content, element); return element; } content =3D Object.toHTML(content); var parent =3D element.parentNode, tagName =3D parent.tagName.toUpperCa= se(); if (Element._insertionTranslations.tags[tagName]) { var nextSibling =3D element.next(); var fragments =3D Element._getContentFromAnonymousElement(tagName, co= ntent.stripScripts()); parent.removeChild(element); if (nextSibling) fragments.each(function(node) { parent.insertBefore(node, nextSibli= ng) }); else fragments.each(function(node) { parent.appendChild(node) }); } else element.outerHTML =3D content.stripScripts(); content.evalScripts.bind(content).defer(); return element; }; } Element._returnOffset =3D function(l, t) { var result =3D [l, t]; result.left =3D l; result.top =3D t; return result; }; Element._getContentFromAnonymousElement =3D function(tagName, html) { var div =3D new Element('div'), t =3D Element._insertionTranslations.tags= [tagName]; if (t) { div.innerHTML =3D t[0] + html + t[1]; t[2].times(function() { div =3D div.firstChild }); } else div.innerHTML =3D html; return $A(div.childNodes); }; Element._insertionTranslations =3D { before: function(element, node) { element.parentNode.insertBefore(node, element); }, top: function(element, node) { element.insertBefore(node, element.firstChild); }, bottom: function(element, node) { element.appendChild(node); }, after: function(element, node) { element.parentNode.insertBefore(node, element.nextSibling); }, tags: { TABLE: ['', '
', 1], TBODY: ['', '
', 2], TR: ['', '
', 3], TD: ['
', '
', 4], SELECT: ['', 1] } }; (function() { Object.extend(this.tags, { THEAD: this.tags.TBODY, TFOOT: this.tags.TBODY, TH: this.tags.TD }); }).call(Element._insertionTranslations); Element.Methods.Simulated =3D { hasAttribute: function(element, attribute) { attribute =3D Element._attributeTranslations.has[attribute] || attribut= e; var node =3D $(element).getAttributeNode(attribute); return node && node.specified; } }; Element.Methods.ByTag =3D { }; Object.extend(Element, Element.Methods); if (!Prototype.BrowserFeatures.ElementExtensions && document.createElement('div').__proto__) { window.HTMLElement =3D { }; window.HTMLElement.prototype =3D document.createElement('div').__proto__; Prototype.BrowserFeatures.ElementExtensions =3D true; } Element.extend =3D (function() { if (Prototype.BrowserFeatures.SpecificElementExtensions) return Prototype.K; var Methods =3D { }, ByTag =3D Element.Methods.ByTag; var extend =3D Object.extend(function(element) { if (!element || element._extendedByPrototype || element.nodeType !=3D 1 || element =3D=3D window) return element; var methods =3D Object.clone(Methods), tagName =3D element.tagName, property, value; // extend methods for specific tags if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); for (property in methods) { value =3D methods[property]; if (Object.isFunction(value) && !(property in element)) element[property] =3D value.methodize(); } element._extendedByPrototype =3D Prototype.emptyFunction; return element; }, { refresh: function() { // extend methods for all tags (Safari doesn't need this) if (!Prototype.BrowserFeatures.ElementExtensions) { Object.extend(Methods, Element.Methods); Object.extend(Methods, Element.Methods.Simulated); } } }); extend.refresh(); return extend; })(); Element.hasAttribute =3D function(element, attribute) { if (element.hasAttribute) return element.hasAttribute(attribute); return Element.Methods.Simulated.hasAttribute(element, attribute); }; Element.addMethods =3D function(methods) { var F =3D Prototype.BrowserFeatures, T =3D Element.Methods.ByTag; if (!methods) { Object.extend(Form, Form.Methods); Object.extend(Form.Element, Form.Element.Methods); Object.extend(Element.Methods.ByTag, { "FORM": Object.clone(Form.Methods), "INPUT": Object.clone(Form.Element.Methods), "SELECT": Object.clone(Form.Element.Methods), "TEXTAREA": Object.clone(Form.Element.Methods) }); } if (arguments.length =3D=3D 2) { var tagName =3D methods; methods =3D arguments[1]; } if (!tagName) Object.extend(Element.Methods, methods || { }); else { if (Object.isArray(tagName)) tagName.each(extend); else extend(tagName); } function extend(tagName) { tagName =3D tagName.toUpperCase(); if (!Element.Methods.ByTag[tagName]) Element.Methods.ByTag[tagName] =3D { }; Object.extend(Element.Methods.ByTag[tagName], methods); } function copy(methods, destination, onlyIfAbsent) { onlyIfAbsent =3D onlyIfAbsent || false; for (var property in methods) { var value =3D methods[property]; if (!Object.isFunction(value)) continue; if (!onlyIfAbsent || !(property in destination)) destination[property] =3D value.methodize(); } } function findDOMClass(tagName) { var klass; var trans =3D { "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading"= , "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR= ": "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": "FrameSet", "IFRAME": "IFrame" }; if (trans[tagName]) klass =3D 'HTML' + trans[tagName] + 'Element'; if (window[klass]) return window[klass]; klass =3D 'HTML' + tagName + 'Element'; if (window[klass]) return window[klass]; klass =3D 'HTML' + tagName.capitalize() + 'Element'; if (window[klass]) return window[klass]; window[klass] =3D { }; window[klass].prototype =3D document.createElement(tagName).__proto__; return window[klass]; } if (F.ElementExtensions) { copy(Element.Methods, HTMLElement.prototype); copy(Element.Methods.Simulated, HTMLElement.prototype, true); } if (F.SpecificElementExtensions) { for (var tag in Element.Methods.ByTag) { var klass =3D findDOMClass(tag); if (Object.isUndefined(klass)) continue; copy(T[tag], klass.prototype); } } Object.extend(Element, Element.Methods); delete Element.ByTag; if (Element.extend.refresh) Element.extend.refresh(); Element.cache =3D { }; }; document.viewport =3D { getDimensions: function() { var dimensions =3D { }; var B =3D Prototype.Browser; $w('width height').each(function(d) { var D =3D d.capitalize(); dimensions[d] =3D (B.WebKit && !document.evaluate) ? self['inner' + D= ] : (B.Opera) ? document.body['client' + D] : document.documentElement[= 'client' + D]; }); return dimensions; }, getWidth: function() { return this.getDimensions().width; }, getHeight: function() { return this.getDimensions().height; }, getScrollOffsets: function() { return Element._returnOffset( window.pageXOffset || document.documentElement.scrollLeft || document= .body.scrollLeft, window.pageYOffset || document.documentElement.scrollTop || document.= body.scrollTop); } }; /* Portions of the Selector class are derived from Jack Slocum=E2=80=99s Do= mQuery, * part of YUI-Ext version 0.40, distributed under the terms of an MIT-styl= e * license. Please see http://www.yui-ext.com/ for more information. */ var Selector =3D Class.create({ initialize: function(expression) { this.expression =3D expression.strip(); this.compileMatcher(); }, shouldUseXPath: function() { if (!Prototype.BrowserFeatures.XPath) return false; var e =3D this.expression; // Safari 3 chokes on :*-of-type and :empty if (Prototype.Browser.WebKit && (e.include("-of-type") || e.include(":empty"))) return false; // XPath can't do namespaced attributes, nor can it read // the "checked" property from DOM nodes if ((/(\[[\w-]*?:|:checked)/).test(this.expression)) return false; return true; }, compileMatcher: function() { if (this.shouldUseXPath()) return this.compileXPathMatcher(); var e =3D this.expression, ps =3D Selector.patterns, h =3D Selector.han= dlers, c =3D Selector.criteria, le, p, m; if (Selector._cache[e]) { this.matcher =3D Selector._cache[e]; return; } this.matcher =3D ["this.matcher =3D function(root) {", "var r =3D root, h =3D Selector.handlers, c =3D false, = n;"]; while (e && le !=3D e && (/\S/).test(e)) { le =3D e; for (var i in ps) { p =3D ps[i]; if (m =3D e.match(p)) { this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : new Template(c[i]).evaluate(m)); e =3D e.replace(m[0], ''); break; } } } this.matcher.push("return h.unique(n);\n}"); eval(this.matcher.join('\n')); Selector._cache[this.expression] =3D this.matcher; }, compileXPathMatcher: function() { var e =3D this.expression, ps =3D Selector.patterns, x =3D Selector.xpath, le, m; if (Selector._cache[e]) { this.xpath =3D Selector._cache[e]; return; } this.matcher =3D ['.//*']; while (e && le !=3D e && (/\S/).test(e)) { le =3D e; for (var i in ps) { if (m =3D e.match(ps[i])) { this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m)); e =3D e.replace(m[0], ''); break; } } } this.xpath =3D this.matcher.join(''); Selector._cache[this.expression] =3D this.xpath; }, findElements: function(root) { root =3D root || document; if (this.xpath) return document._getElementsByXPath(this.xpath, root); return this.matcher(root); }, match: function(element) { this.tokens =3D []; var e =3D this.expression, ps =3D Selector.patterns, as =3D Selector.as= sertions; var le, p, m; while (e && le !=3D=3D e && (/\S/).test(e)) { le =3D e; for (var i in ps) { p =3D ps[i]; if (m =3D e.match(p)) { // use the Selector.assertions methods unless the selector // is too complex. if (as[i]) { this.tokens.push([i, Object.clone(m)]); e =3D e.replace(m[0], ''); } else { // reluctantly do a document-wide search // and look for a match in the array return this.findElements(document).include(element); } } } } var match =3D true, name, matches; for (var i =3D 0, token; token =3D this.tokens[i]; i++) { name =3D token[0], matches =3D token[1]; if (!Selector.assertions[name](element, matches)) { match =3D false; break; } } return match; }, toString: function() { return this.expression; }, inspect: function() { return "#"; } }); Object.extend(Selector, { _cache: { }, xpath: { descendant: "//*", child: "/*", adjacent: "/following-sibling::*[1]", laterSibling: '/following-sibling::*', tagName: function(m) { if (m[1] =3D=3D '*') return ''; return "[local-name()=3D'" + m[1].toLowerCase() + "' or local-name()=3D'" + m[1].toUpperCase() + "']"; }, className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", id: "[@id=3D'#{1}']", attrPresence: function(m) { m[1] =3D m[1].toLowerCase(); return new Template("[@#{1}]").evaluate(m); }, attr: function(m) { m[1] =3D m[1].toLowerCase(); m[3] =3D m[5] || m[6]; return new Template(Selector.xpath.operators[m[2]]).evaluate(m); }, pseudo: function(m) { var h =3D Selector.xpath.pseudos[m[1]]; if (!h) return ''; if (Object.isFunction(h)) return h(m); return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); }, operators: { '=3D': "[@#{1}=3D'#{3}']", '!=3D': "[@#{1}!=3D'#{3}']", '^=3D': "[starts-with(@#{1}, '#{3}')]", '$=3D': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3= }') + 1))=3D'#{3}']", '*=3D': "[contains(@#{1}, '#{3}')]", '~=3D': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", '|=3D': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" }, pseudos: { 'first-child': '[not(preceding-sibling::*)]', 'last-child': '[not(following-sibling::*)]', 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', 'empty': "[count(*) =3D 0 and (count(text()) =3D 0 or translate= (text(), ' \t\r\n', '') =3D '')]", 'checked': "[@checked]", 'disabled': "[@disabled]", 'enabled': "[not(@disabled)]", 'not': function(m) { var e =3D m[6], p =3D Selector.patterns, x =3D Selector.xpath, le, v; var exclusion =3D []; while (e && le !=3D e && (/\S/).test(e)) { le =3D e; for (var i in p) { if (m =3D e.match(p[i])) { v =3D Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).= evaluate(m); exclusion.push("(" + v.substring(1, v.length - 1) + ")"); e =3D e.replace(m[0], ''); break; } } } return "[not(" + exclusion.join(" and ") + ")]"; }, 'nth-child': function(m) { return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) += 1) ", m); }, 'nth-last-child': function(m) { return Selector.xpath.pseudos.nth("(count(./following-sibling::*) += 1) ", m); }, 'nth-of-type': function(m) { return Selector.xpath.pseudos.nth("position() ", m); }, 'nth-last-of-type': function(m) { return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); }, 'first-of-type': function(m) { m[6] =3D "1"; return Selector.xpath.pseudos['nth-of-type'](m); }, 'last-of-type': function(m) { m[6] =3D "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); }, 'only-of-type': function(m) { var p =3D Selector.xpath.pseudos; return p['first-of-type'](m) + p[= 'last-of-type'](m); }, nth: function(fragment, m) { var mm, formula =3D m[6], predicate; if (formula =3D=3D 'even') formula =3D '2n+0'; if (formula =3D=3D 'odd') formula =3D '2n+1'; if (mm =3D formula.match(/^(\d+)$/)) // digit only return '[' + fragment + "=3D " + mm[1] + ']'; if (mm =3D formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b if (mm[1] =3D=3D "-") mm[1] =3D -1; var a =3D mm[1] ? Number(mm[1]) : 1; var b =3D mm[2] ? Number(mm[2]) : 0; predicate =3D "[((#{fragment} - #{b}) mod #{a} =3D 0) and " + "((#{fragment} - #{b}) div #{a} >=3D 0)]"; return new Template(predicate).evaluate({ fragment: fragment, a: a, b: b }); } } } }, criteria: { tagName: 'n =3D h.tagName(n, r, "#{1}", c); c =3D false;', className: 'n =3D h.className(n, r, "#{1}", c); c =3D false;', id: 'n =3D h.id(n, r, "#{1}", c); c =3D false;', attrPresence: 'n =3D h.attrPresence(n, r, "#{1}", c); c =3D false;', attr: function(m) { m[3] =3D (m[5] || m[6]); return new Template('n =3D h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c= =3D false;').evaluate(m); }, pseudo: function(m) { if (m[6]) m[6] =3D m[6].replace(/"/g, '\\"'); return new Template('n =3D h.pseudo(n, "#{1}", "#{6}", r, c); c =3D f= alse;').evaluate(m); }, descendant: 'c =3D "descendant";', child: 'c =3D "child";', adjacent: 'c =3D "adjacent";', laterSibling: 'c =3D "laterSibling";' }, patterns: { // combinators must be listed first // (and descendant needs to be last combinator) laterSibling: /^\s*~\s*/, child: /^\s*>\s*/, adjacent: /^\s*\+\s*/, descendant: /^\s/, // selectors follow tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, id: /^#([\w\-\*]+)(\b|$)/, className: /^\.([\w\-\*]+)(\b|$)/, pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)a= bled|not)(\((.*?)\))?(\b|$|(?=3D\s|[:+~>]))/, attrPresence: /^\[([\w]+)\]/, attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=3D)\s*((['"])([^\= 4]*?)\4|([^'"][^\]]*?)))?\]/ }, // for Selector.match and Element#match assertions: { tagName: function(element, matches) { return matches[1].toUpperCase() =3D=3D element.tagName.toUpperCase(); }, className: function(element, matches) { return Element.hasClassName(element, matches[1]); }, id: function(element, matches) { return element.id =3D=3D=3D matches[1]; }, attrPresence: function(element, matches) { return Element.hasAttribute(element, matches[1]); }, attr: function(element, matches) { var nodeValue =3D Element.readAttribute(element, matches[1]); return nodeValue && Selector.operators[matches[2]](nodeValue, matches= [5] || matches[6]); } }, handlers: { // UTILITY FUNCTIONS // joins two collections concat: function(a, b) { for (var i =3D 0, node; node =3D b[i]; i++) a.push(node); return a; }, // marks an array of nodes for counting mark: function(nodes) { var _true =3D Prototype.emptyFunction; for (var i =3D 0, node; node =3D nodes[i]; i++) node._countedByPrototype =3D _true; return nodes; }, unmark: function(nodes) { for (var i =3D 0, node; node =3D nodes[i]; i++) node._countedByPrototype =3D undefined; return nodes; }, // mark each child node with its position (for nth calls) // "ofType" flag indicates whether we're indexing for nth-of-type // rather than nth-child index: function(parentNode, reverse, ofType) { parentNode._countedByPrototype =3D Prototype.emptyFunction; if (reverse) { for (var nodes =3D parentNode.childNodes, i =3D nodes.length - 1, j= =3D 1; i >=3D 0; i--) { var node =3D nodes[i]; if (node.nodeType =3D=3D 1 && (!ofType || node._countedByPrototyp= e)) node.nodeIndex =3D j++; } } else { for (var i =3D 0, j =3D 1, nodes =3D parentNode.childNodes; node = =3D nodes[i]; i++) if (node.nodeType =3D=3D 1 && (!ofType || node._countedByPrototyp= e)) node.nodeIndex =3D j++; } }, // filters out duplicates and extends all nodes unique: function(nodes) { if (nodes.length =3D=3D 0) return nodes; var results =3D [], n; for (var i =3D 0, l =3D nodes.length; i < l; i++) if (!(n =3D nodes[i])._countedByPrototype) { n._countedByPrototype =3D Prototype.emptyFunction; results.push(Element.extend(n)); } return Selector.handlers.unmark(results); }, // COMBINATOR FUNCTIONS descendant: function(nodes) { var h =3D Selector.handlers; for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) h.concat(results, node.getElementsByTagName('*')); return results; }, child: function(nodes) { var h =3D Selector.handlers; for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) { for (var j =3D 0, child; child =3D node.childNodes[j]; j++) if (child.nodeType =3D=3D 1 && child.tagName !=3D '!') results.pu= sh(child); } return results; }, adjacent: function(nodes) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) { var next =3D this.nextElementSibling(node); if (next) results.push(next); } return results; }, laterSibling: function(nodes) { var h =3D Selector.handlers; for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) h.concat(results, Element.nextSiblings(node)); return results; }, nextElementSibling: function(node) { while (node =3D node.nextSibling) if (node.nodeType =3D=3D 1) return node; return null; }, previousElementSibling: function(node) { while (node =3D node.previousSibling) if (node.nodeType =3D=3D 1) return node; return null; }, // TOKEN FUNCTIONS tagName: function(nodes, root, tagName, combinator) { var uTagName =3D tagName.toUpperCase(); var results =3D [], h =3D Selector.handlers; if (nodes) { if (combinator) { // fastlane for ordinary descendant combinators if (combinator =3D=3D "descendant") { for (var i =3D 0, node; node =3D nodes[i]; i++) h.concat(results, node.getElementsByTagName(tagName)); return results; } else nodes =3D this[combinator](nodes); if (tagName =3D=3D "*") return nodes; } for (var i =3D 0, node; node =3D nodes[i]; i++) if (node.tagName.toUpperCase() =3D=3D=3D uTagName) results.push(n= ode); return results; } else return root.getElementsByTagName(tagName); }, id: function(nodes, root, id, combinator) { var targetNode =3D $(id), h =3D Selector.handlers; if (!targetNode) return []; if (!nodes && root =3D=3D document) return [targetNode]; if (nodes) { if (combinator) { if (combinator =3D=3D 'child') { for (var i =3D 0, node; node =3D nodes[i]; i++) if (targetNode.parentNode =3D=3D node) return [targetNode]; } else if (combinator =3D=3D 'descendant') { for (var i =3D 0, node; node =3D nodes[i]; i++) if (Element.descendantOf(targetNode, node)) return [targetNod= e]; } else if (combinator =3D=3D 'adjacent') { for (var i =3D 0, node; node =3D nodes[i]; i++) if (Selector.handlers.previousElementSibling(targetNode) =3D= =3D node) return [targetNode]; } else nodes =3D h[combinator](nodes); } for (var i =3D 0, node; node =3D nodes[i]; i++) if (node =3D=3D targetNode) return [targetNode]; return []; } return (targetNode && Element.descendantOf(targetNode, root)) ? [targ= etNode] : []; }, className: function(nodes, root, className, combinator) { if (nodes && combinator) nodes =3D this[combinator](nodes); return Selector.handlers.byClassName(nodes, root, className); }, byClassName: function(nodes, root, className) { if (!nodes) nodes =3D Selector.handlers.descendant([root]); var needle =3D ' ' + className + ' '; for (var i =3D 0, results =3D [], node, nodeClassName; node =3D nodes= [i]; i++) { nodeClassName =3D node.className; if (nodeClassName.length =3D=3D 0) continue; if (nodeClassName =3D=3D className || (' ' + nodeClassName + ' ').i= nclude(needle)) results.push(node); } return results; }, attrPresence: function(nodes, root, attr, combinator) { if (!nodes) nodes =3D root.getElementsByTagName("*"); if (nodes && combinator) nodes =3D this[combinator](nodes); var results =3D []; for (var i =3D 0, node; node =3D nodes[i]; i++) if (Element.hasAttribute(node, attr)) results.push(node); return results; }, attr: function(nodes, root, attr, value, operator, combinator) { if (!nodes) nodes =3D root.getElementsByTagName("*"); if (nodes && combinator) nodes =3D this[combinator](nodes); var handler =3D Selector.operators[operator], results =3D []; for (var i =3D 0, node; node =3D nodes[i]; i++) { var nodeValue =3D Element.readAttribute(node, attr); if (nodeValue =3D=3D=3D null) continue; if (handler(nodeValue, value)) results.push(node); } return results; }, pseudo: function(nodes, name, value, root, combinator) { if (nodes && combinator) nodes =3D this[combinator](nodes); if (!nodes) nodes =3D root.getElementsByTagName("*"); return Selector.pseudos[name](nodes, value, root); } }, pseudos: { 'first-child': function(nodes, value, root) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) { if (Selector.handlers.previousElementSibling(node)) continue; results.push(node); } return results; }, 'last-child': function(nodes, value, root) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) { if (Selector.handlers.nextElementSibling(node)) continue; results.push(node); } return results; }, 'only-child': function(nodes, value, root) { var h =3D Selector.handlers; for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) results.push(node); return results; }, 'nth-child': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root); }, 'nth-last-child': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root, true); }, 'nth-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root, false, true); }, 'nth-last-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root, true, true); }, 'first-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, "1", root, false, true); }, 'last-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, "1", root, true, true); }, 'only-of-type': function(nodes, formula, root) { var p =3D Selector.pseudos; return p['last-of-type'](p['first-of-type'](nodes, formula, root), fo= rmula, root); }, // handles the an+b logic getIndices: function(a, b, total) { if (a =3D=3D 0) return b > 0 ? [b] : []; return $R(1, total).inject([], function(memo, i) { if (0 =3D=3D (i - b) % a && (i - b) / a >=3D 0) memo.push(i); return memo; }); }, // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-ty= pe nth: function(nodes, formula, root, reverse, ofType) { if (nodes.length =3D=3D 0) return []; if (formula =3D=3D 'even') formula =3D '2n+0'; if (formula =3D=3D 'odd') formula =3D '2n+1'; var h =3D Selector.handlers, results =3D [], indexed =3D [], m; h.mark(nodes); for (var i =3D 0, node; node =3D nodes[i]; i++) { if (!node.parentNode._countedByPrototype) { h.index(node.parentNode, reverse, ofType); indexed.push(node.parentNode); } } if (formula.match(/^\d+$/)) { // just a number formula =3D Number(formula); for (var i =3D 0, node; node =3D nodes[i]; i++) if (node.nodeIndex =3D=3D formula) results.push(node); } else if (m =3D formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b if (m[1] =3D=3D "-") m[1] =3D -1; var a =3D m[1] ? Number(m[1]) : 1; var b =3D m[2] ? Number(m[2]) : 0; var indices =3D Selector.pseudos.getIndices(a, b, nodes.length); for (var i =3D 0, node, l =3D indices.length; node =3D nodes[i]; i+= +) { for (var j =3D 0; j < l; j++) if (node.nodeIndex =3D=3D indices[j]) results.push(node); } } h.unmark(nodes); h.unmark(indexed); return results; }, 'empty': function(nodes, value, root) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) { // IE treats comments as element nodes if (node.tagName =3D=3D '!' || (node.firstChild && !node.innerHTML.= match(/^\s*$/))) continue; results.push(node); } return results; }, 'not': function(nodes, selector, root) { var h =3D Selector.handlers, selectorType, m; var exclusions =3D new Selector(selector).findElements(root); h.mark(exclusions); for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) if (!node._countedByPrototype) results.push(node); h.unmark(exclusions); return results; }, 'enabled': function(nodes, value, root) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) if (!node.disabled) results.push(node); return results; }, 'disabled': function(nodes, value, root) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) if (node.disabled) results.push(node); return results; }, 'checked': function(nodes, value, root) { for (var i =3D 0, results =3D [], node; node =3D nodes[i]; i++) if (node.checked) results.push(node); return results; } }, operators: { '=3D': function(nv, v) { return nv =3D=3D v; }, '!=3D': function(nv, v) { return nv !=3D v; }, '^=3D': function(nv, v) { return nv.startsWith(v); }, '$=3D': function(nv, v) { return nv.endsWith(v); }, '*=3D': function(nv, v) { return nv.include(v); }, '~=3D': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '= ); }, '|=3D': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include= ('-' + v.toUpperCase() + '-'); } }, split: function(expression) { var expressions =3D []; expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m)= { expressions.push(m[1].strip()); }); return expressions; }, matchElements: function(elements, expression) { var matches =3D $$(expression), h =3D Selector.handlers; h.mark(matches); for (var i =3D 0, results =3D [], element; element =3D elements[i]; i++= ) if (element._countedByPrototype) results.push(element); h.unmark(matches); return results; }, findElement: function(elements, expression, index) { if (Object.isNumber(expression)) { index =3D expression; expression =3D false; } return Selector.matchElements(elements, expression || '*')[index || 0]; }, findChildElements: function(element, expressions) { expressions =3D Selector.split(expressions.join(',')); var results =3D [], h =3D Selector.handlers; for (var i =3D 0, l =3D expressions.length, selector; i < l; i++) { selector =3D new Selector(expressions[i].strip()); h.concat(results, selector.findElements(element)); } return (l > 1) ? h.unique(results) : results; } }); if (Prototype.Browser.IE) { Object.extend(Selector.handlers, { // IE returns comment nodes on getElementsByTagName("*"). // Filter them out. concat: function(a, b) { for (var i =3D 0, node; node =3D b[i]; i++) if (node.tagName !=3D=3D "!") a.push(node); return a; }, // IE improperly serializes _countedByPrototype in (inner|outer)HTML. unmark: function(nodes) { for (var i =3D 0, node; node =3D nodes[i]; i++) node.removeAttribute('_countedByPrototype'); return nodes; } }); } function $$() { return Selector.findChildElements(document, $A(arguments)); } var Form =3D { reset: function(form) { $(form).reset(); return form; }, serializeElements: function(elements, options) { if (typeof options !=3D 'object') options =3D { hash: !!options }; else if (Object.isUndefined(options.hash)) options.hash =3D true; var key, value, submitted =3D false, submit =3D options.submit; var data =3D elements.inject({ }, function(result, element) { if (!element.disabled && element.name) { key =3D element.name; value =3D $(element).getValue(); if (value !=3D null && (element.type !=3D 'submit' || (!submitted &= & submit !=3D=3D false && (!submit || key =3D=3D submit) && (subm= itted =3D true)))) { if (key in result) { // a key is already present; construct an array of values if (!Object.isArray(result[key])) result[key] =3D [result[key]]= ; result[key].push(value); } else result[key] =3D value; } } return result; }); return options.hash ? data : Object.toQueryString(data); } }; Form.Methods =3D { serialize: function(form, options) { return Form.serializeElements(Form.getElements(form), options); }, getElements: function(form) { return $A($(form).getElementsByTagName('*')).inject([], function(elements, child) { if (Form.Element.Serializers[child.tagName.toLowerCase()]) elements.push(Element.extend(child)); return elements; } ); }, getInputs: function(form, typeName, name) { form =3D $(form); var inputs =3D form.getElementsByTagName('input'); if (!typeName && !name) return $A(inputs).map(Element.extend); for (var i =3D 0, matchingInputs =3D [], length =3D inputs.length; i < = length; i++) { var input =3D inputs[i]; if ((typeName && input.type !=3D typeName) || (name && input.name != =3D name)) continue; matchingInputs.push(Element.extend(input)); } return matchingInputs; }, disable: function(form) { form =3D $(form); Form.getElements(form).invoke('disable'); return form; }, enable: function(form) { form =3D $(form); Form.getElements(form).invoke('enable'); return form; }, findFirstElement: function(form) { var elements =3D $(form).getElements().findAll(function(element) { return 'hidden' !=3D element.type && !element.disabled; }); var firstByIndex =3D elements.findAll(function(element) { return element.hasAttribute('tabIndex') && element.tabIndex >=3D 0; }).sortBy(function(element) { return element.tabIndex }).first(); return firstByIndex ? firstByIndex : elements.find(function(element) { return ['input', 'select', 'textarea'].include(element.tagName.toLowe= rCase()); }); }, focusFirstElement: function(form) { form =3D $(form); form.findFirstElement().activate(); return form; }, request: function(form, options) { form =3D $(form), options =3D Object.clone(options || { }); var params =3D options.parameters, action =3D form.readAttribute('actio= n') || ''; if (action.blank()) action =3D window.location.href; options.parameters =3D form.serialize(true); if (params) { if (Object.isString(params)) params =3D params.toQueryParams(); Object.extend(options.parameters, params); } if (form.hasAttribute('method') && !options.method) options.method =3D form.method; return new Ajax.Request(action, options); } }; /*-------------------------------------------------------------------------= -*/ Form.Element =3D { focus: function(element) { $(element).focus(); return element; }, select: function(element) { $(element).select(); return element; } }; Form.Element.Methods =3D { serialize: function(element) { element =3D $(element); if (!element.disabled && element.name) { var value =3D element.getValue(); if (value !=3D undefined) { var pair =3D { }; pair[element.name] =3D value; return Object.toQueryString(pair); } } return ''; }, getValue: function(element) { element =3D $(element); var method =3D element.tagName.toLowerCase(); return Form.Element.Serializers[method](element); }, setValue: function(element, value) { element =3D $(element); var method =3D element.tagName.toLowerCase(); Form.Element.Serializers[method](element, value); return element; }, clear: function(element) { $(element).value =3D ''; return element; }, present: function(element) { return $(element).value !=3D ''; }, activate: function(element) { element =3D $(element); try { element.focus(); if (element.select && (element.tagName.toLowerCase() !=3D 'input' || !['button', 'reset', 'submit'].include(element.type))) element.select(); } catch (e) { } return element; }, disable: function(element) { element =3D $(element); element.blur(); element.disabled =3D true; return element; }, enable: function(element) { element =3D $(element); element.disabled =3D false; return element; } }; /*-------------------------------------------------------------------------= -*/ var Field =3D Form.Element; var $F =3D Form.Element.Methods.getValue; /*-------------------------------------------------------------------------= -*/ Form.Element.Serializers =3D { input: function(element, value) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': return Form.Element.Serializers.inputSelector(element, value); default: return Form.Element.Serializers.textarea(element, value); } }, inputSelector: function(element, value) { if (Object.isUndefined(value)) return element.checked ? element.value := null; else element.checked =3D !!value; }, textarea: function(element, value) { if (Object.isUndefined(value)) return element.value; else element.value =3D value; }, select: function(element, index) { if (Object.isUndefined(index)) return this[element.type =3D=3D 'select-one' ? 'selectOne' : 'selectMany'](element); else { var opt, value, single =3D !Object.isArray(index); for (var i =3D 0, length =3D element.length; i < length; i++) { opt =3D element.options[i]; value =3D this.optionValue(opt); if (single) { if (value =3D=3D index) { opt.selected =3D true; return; } } else opt.selected =3D index.include(value); } } }, selectOne: function(element) { var index =3D element.selectedIndex; return index >=3D 0 ? this.optionValue(element.options[index]) : null; }, selectMany: function(element) { var values, length =3D element.length; if (!length) return null; for (var i =3D 0, values =3D []; i < length; i++) { var opt =3D element.options[i]; if (opt.selected) values.push(this.optionValue(opt)); } return values; }, optionValue: function(opt) { // extend element because hasAttribute may not be native return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text= ; } }; /*-------------------------------------------------------------------------= -*/ Abstract.TimedObserver =3D Class.create(PeriodicalExecuter, { initialize: function($super, element, frequency, callback) { $super(callback, frequency); this.element =3D $(element); this.lastValue =3D this.getValue(); }, execute: function() { var value =3D this.getValue(); if (Object.isString(this.lastValue) && Object.isString(value) ? this.lastValue !=3D value : String(this.lastValue) !=3D String(valu= e)) { this.callback(this.element, value); this.lastValue =3D value; } } }); Form.Element.Observer =3D Class.create(Abstract.TimedObserver, { getValue: function() { return Form.Element.getValue(this.element); } }); Form.Observer =3D Class.create(Abstract.TimedObserver, { getValue: function() { return Form.serialize(this.element); } }); /*-------------------------------------------------------------------------= -*/ Abstract.EventObserver =3D Class.create({ initialize: function(element, callback) { this.element =3D $(element); this.callback =3D callback; this.lastValue =3D this.getValue(); if (this.element.tagName.toLowerCase() =3D=3D 'form') this.registerFormCallbacks(); else this.registerCallback(this.element); }, onElementEvent: function() { var value =3D this.getValue(); if (this.lastValue !=3D value) { this.callback(this.element, value); this.lastValue =3D value; } }, registerFormCallbacks: function() { Form.getElements(this.element).each(this.registerCallback, this); }, registerCallback: function(element) { if (element.type) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': Event.observe(element, 'click', this.onElementEvent.bind(this)); break; default: Event.observe(element, 'change', this.onElementEvent.bind(this)); break; } } } }); Form.Element.EventObserver =3D Class.create(Abstract.EventObserver, { getValue: function() { return Form.Element.getValue(this.element); } }); Form.EventObserver =3D Class.create(Abstract.EventObserver, { getValue: function() { return Form.serialize(this.element); } }); if (!window.Event) var Event =3D { }; Object.extend(Event, { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, KEY_INSERT: 45, cache: { }, relatedTarget: function(event) { var element; switch(event.type) { case 'mouseover': element =3D event.fromElement; break; case 'mouseout': element =3D event.toElement; break; default: return null; } return Element.extend(element); } }); Event.Methods =3D (function() { var isButton; if (Prototype.Browser.IE) { var buttonMap =3D { 0: 1, 1: 4, 2: 2 }; isButton =3D function(event, code) { return event.button =3D=3D buttonMap[code]; }; } else if (Prototype.Browser.WebKit) { isButton =3D function(event, code) { switch (code) { case 0: return event.which =3D=3D 1 && !event.metaKey; case 1: return event.which =3D=3D 1 && event.metaKey; default: return false; } }; } else { isButton =3D function(event, code) { return event.which ? (event.which =3D=3D=3D code + 1) : (event.button= =3D=3D=3D code); }; } return { isLeftClick: function(event) { return isButton(event, 0) }, isMiddleClick: function(event) { return isButton(event, 1) }, isRightClick: function(event) { return isButton(event, 2) }, element: function(event) { var node =3D Event.extend(event).target; return Element.extend(node.nodeType =3D=3D Node.TEXT_NODE ? node.pare= ntNode : node); }, findElement: function(event, expression) { var element =3D Event.element(event); if (!expression) return element; var elements =3D [element].concat(element.ancestors()); return Selector.findElement(elements, expression, 0); }, pointer: function(event) { return { x: event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)= ), y: event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) }; }, pointerX: function(event) { return Event.pointer(event).x }, pointerY: function(event) { return Event.pointer(event).y }, stop: function(event) { Event.extend(event); event.preventDefault(); event.stopPropagation(); event.stopped =3D true; } }; })(); Event.extend =3D (function() { var methods =3D Object.keys(Event.Methods).inject({ }, function(m, name) = { m[name] =3D Event.Methods[name].methodize(); return m; }); if (Prototype.Browser.IE) { Object.extend(methods, { stopPropagation: function() { this.cancelBubble =3D true }, preventDefault: function() { this.returnValue =3D false }, inspect: function() { return "[object Event]" } }); return function(event) { if (!event) return false; if (event._extendedByPrototype) return event; event._extendedByPrototype =3D Prototype.emptyFunction; var pointer =3D Event.pointer(event); Object.extend(event, { target: event.srcElement, relatedTarget: Event.relatedTarget(event), pageX: pointer.x, pageY: pointer.y }); return Object.extend(event, methods); }; } else { Event.prototype =3D Event.prototype || document.createEvent("HTMLEvents= ").__proto__; Object.extend(Event.prototype, methods); return Prototype.K; } })(); Object.extend(Event, (function() { var cache =3D Event.cache; function getEventID(element) { if (element._prototypeEventID) return element._prototypeEventID[0]; arguments.callee.id =3D arguments.callee.id || 1; return element._prototypeEventID =3D [++arguments.callee.id]; } function getDOMEventName(eventName) { if (eventName && eventName.include(':')) return "dataavailable"; return eventName; } function getCacheForID(id) { return cache[id] =3D cache[id] || { }; } function getWrappersForEventName(id, eventName) { var c =3D getCacheForID(id); return c[eventName] =3D c[eventName] || []; } function createWrapper(element, eventName, handler) { var id =3D getEventID(element); var c =3D getWrappersForEventName(id, eventName); if (c.pluck("handler").include(handler)) return false; var wrapper =3D function(event) { if (!Event || !Event.extend || (event.eventName && event.eventName !=3D eventName)) return false; Event.extend(event); handler.call(element, event); }; wrapper.handler =3D handler; c.push(wrapper); return wrapper; } function findWrapper(id, eventName, handler) { var c =3D getWrappersForEventName(id, eventName); return c.find(function(wrapper) { return wrapper.handler =3D=3D handler= }); } function destroyWrapper(id, eventName, handler) { var c =3D getCacheForID(id); if (!c[eventName]) return false; c[eventName] =3D c[eventName].without(findWrapper(id, eventName, handle= r)); } function destroyCache() { for (var id in cache) for (var eventName in cache[id]) cache[id][eventName] =3D null; } if (window.attachEvent) { window.attachEvent("onunload", destroyCache); } return { observe: function(element, eventName, handler) { element =3D $(element); var name =3D getDOMEventName(eventName); var wrapper =3D createWrapper(element, eventName, handler); if (!wrapper) return element; if (element.addEventListener) { element.addEventListener(name, wrapper, false); } else { element.attachEvent("on" + name, wrapper); } return element; }, stopObserving: function(element, eventName, handler) { element =3D $(element); var id =3D getEventID(element), name =3D getDOMEventName(eventName); if (!handler && eventName) { getWrappersForEventName(id, eventName).each(function(wrapper) { element.stopObserving(eventName, wrapper.handler); }); return element; } else if (!eventName) { Object.keys(getCacheForID(id)).each(function(eventName) { element.stopObserving(eventName); }); return element; } var wrapper =3D findWrapper(id, eventName, handler); if (!wrapper) return element; if (element.removeEventListener) { element.removeEventListener(name, wrapper, false); } else { element.detachEvent("on" + name, wrapper); } destroyWrapper(id, eventName, handler); return element; }, fire: function(element, eventName, memo) { element =3D $(element); if (element =3D=3D document && document.createEvent && !element.dispa= tchEvent) element =3D document.documentElement; var event; if (document.createEvent) { event =3D document.createEvent("HTMLEvents"); event.initEvent("dataavailable", true, true); } else { event =3D document.createEventObject(); event.eventType =3D "ondataavailable"; } event.eventName =3D eventName; event.memo =3D memo || { }; if (document.createEvent) { element.dispatchEvent(event); } else { element.fireEvent(event.eventType, event); } return Event.extend(event); } }; })()); Object.extend(Event, Event.Methods); Element.addMethods({ fire: Event.fire, observe: Event.observe, stopObserving: Event.stopObserving }); Object.extend(document, { fire: Element.Methods.fire.methodize(), observe: Element.Methods.observe.methodize(), stopObserving: Element.Methods.stopObserving.methodize(), loaded: false }); (function() { /* Support for the DOMContentLoaded event is based on work by Dan Webb, Matthias Miller, Dean Edwards and John Resig. */ var timer; function fireContentLoadedEvent() { if (document.loaded) return; if (timer) window.clearInterval(timer); document.fire("dom:loaded"); document.loaded =3D true; } if (document.addEventListener) { if (Prototype.Browser.WebKit) { timer =3D window.setInterval(function() { if (/loaded|complete/.test(document.readyState)) fireContentLoadedEvent(); }, 0); Event.observe(window, "load", fireContentLoadedEvent); } else { document.addEventListener("DOMContentLoaded", fireContentLoadedEvent, false); } } else { document.write("