Fooman_Speedster - Version 1.1.3

Version Notes

remove extra files

Download this release

Release Info

Developer Magento Core Team
Extension Fooman_Speedster
Version 1.1.3
Comparing to
See all releases


Code changes from version 1.1.2 to 1.1.3

package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fooman_Speedster</name>
4
- <version>1.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0 / BSD see files</license>
7
  <channel>community</channel>
@@ -10,11 +10,11 @@
10
  <description>&lt;p&gt;FOOMAN Speedster 1.1&lt;/p&gt;
11
  &lt;p&gt;Speed up your store by combining, compressing and caching JS and CSS.&lt;/p&gt;
12
  &lt;p&gt;Please read the installation instructions and latest changes &lt;a href="http://www.magentocommerce.com/extension/457/fooman-speedster"&gt;here.&lt;/a&gt;&lt;/p&gt;</description>
13
- <notes>only replace js/prototype/validation.js</notes>
14
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
15
- <date>2010-05-12</date>
16
- <time>10:10:54</time>
17
- <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fooman_Speedster.xml" hash="5c2b369753dd7e626619535708f89add"/></dir></dir></dir><dir name="js"><dir name="prototype"><file name="validation-4min.js" hash="f8865bb7a07f1a22dc5a08ed362daa83"/></dir></dir><dir name="lib"><dir name="minify"><file name=".htaccess" hash="4d6b8833e4ccae2d2393dfeba369b894"/></dir></dir><dir name="var"><dir name="minifycache"><file name="cache.txt" hash="5709c1d6a6f85fb7b7ea2eef23086b46"/><file name="minify_036b1964ffc19e72b8e0134d21cb8d22" hash="9621775445337fd2f2558fd1762b40d7"/><file name="minify_036b1964ffc19e72b8e0134d21cb8d22.gz" hash="b3075658ed15d2df985c5b03a73a57f2"/><file name="minify_1b6ee19a4c3855472c3e3dd57413cb65" hash="6a5733db3132a5d49183fc5f124709df"/><file name="minify_1b6ee19a4c3855472c3e3dd57413cb65.gz" hash="fa1b71ed6bf3e1e546a9f1cd440e7f1e"/><file name="minify_9c58e36f7d68249efd03de258c77c943" hash="6e6f08dfd0403115a2aef5743673daff"/><file name="minify_9c58e36f7d68249efd03de258c77c943.gz" hash="a1ebda590e3cce3a56edda99110bc587"/><file name="minify_95afbee78c0f49b564250d655add1ca9" hash="a36015a93d7f6e5c86841fa58de1b5b6"/><file name="minify_95afbee78c0f49b564250d655add1ca9.gz" hash="f4f1e77134b49ff6f7fea41698041925"/><file name="minify_97d580685fb8887878fe4214a6eeeeae" hash="3e6819c39f845e8ca090441b8443f68b"/><file name="minify_97d580685fb8887878fe4214a6eeeeae.gz" hash="c5586d6db8db064855928bcc51841c0b"/><file name="minify_268acb4da1a243c2c1434894bf7e5841" hash="634e9e2cf70ce1d4af6db730ed13ee80"/><file name="minify_268acb4da1a243c2c1434894bf7e5841.gz" hash="f83916a6b76d43bf6708a2fd9d774a61"/><file name="minify_676fb2e38e9cb2203204bcf556430103" hash="bd60df770b2ba3c91871385e19551f1e"/><file name="minify_676fb2e38e9cb2203204bcf556430103.gz" hash="aac811ba6a666e5d4b4ec696f8955c1f"/><file name="minify_900559c432c691b50ba33f48b4909a4f" hash="1f22f6c2eed4d5e492da968130e02eb6"/><file name="minify_900559c432c691b50ba33f48b4909a4f.gz" hash="3ce68dbeba488461e38977f4bcecc5cc"/><file name="minify_bcb6d8461d369d3fefce349c1958be75" hash="9ad2f5e606ba9812ee49ca9abd499f7a"/><file name="minify_bcb6d8461d369d3fefce349c1958be75.gz" hash="30e43e9caeb64f61614e1c14d0788548"/><file name="minify_bdab6e5a58d4f89e11387fdb24236c6b" hash="8aa96266695ebf591dfc625ad7872177"/><file name="minify_bdab6e5a58d4f89e11387fdb24236c6b.gz" hash="7016ec97506dd158d9a62e1a92c2da31"/><file name="minify_c8063ab3f62bf2c69f8ccbb72f282ebf" hash="88fa754fb2010559e65bca81c7b59032"/><file name="minify_c8063ab3f62bf2c69f8ccbb72f282ebf.gz" hash="1c346c10e08724d917ebe5caf93417f6"/><file name="minify_cd7c858ba45ed5a0ea4b8be974841f54" hash="6fe219caccbc68517305b8d89a99c565"/><file name="minify_cd7c858ba45ed5a0ea4b8be974841f54.gz" hash="c601199d54ce8497311eb0b26a4e6e6b"/><file name="minify_db8fc92a79f3619bba917ee2a7d54930" hash="d5010324aea35d2271875005dfe87c79"/><file name="minify_db8fc92a79f3619bba917ee2a7d54930.gz" hash="e281dbe66d412a9e2e004ea954cecd1e"/><file name="minify_dc25924d9cd7975a54b365ef08ea5947" hash="2d57b0327c46dccee1b335878dd3c352"/><file name="minify_dc25924d9cd7975a54b365ef08ea5947.gz" hash="273215918b35ed5cd4dbd6f001958f91"/><file name="minify_f98a277d2fb39a774858112e07fed300" hash="3f9b3674fdb30d3b341048da7ba4947d"/><file name="minify_f98a277d2fb39a774858112e07fed300.gz" hash="b9527b7a805a1e1a1af6903cfc4d0bd2"/></dir></dir></target><target name="magecommunity"><dir name="Fooman"><dir name="Speedster"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Head.php" hash="d850197d05af7b972eda1ef6bf3da2ed"/></dir></dir><dir name="Page"><dir name="Html"><file name="Head.php" hash="c5e51230c68eee557f5305d99d656243"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="e7df9018130da0909a9a529086d0ac33"/></dir></dir></dir></target><target name="magelib"><dir name="minify"><dir name="lib"><dir name="HTTP"><file name="ConditionalGet.php" hash="f9760a41a6688eca78c27e4afd760a02"/><file name="Encoder.php" hash="71d0651830bbf9153191f1749bf54e62"/></dir><dir name="Minify"><dir name="Cache"><file name="APC.php" hash="2766ccf5e1e4d6e38d3ec128dbc4bc6f"/><file name="File.php" hash="26d02518b2035f1b1ae49da001baa26a"/><file name="Memcache.php" hash="fa208d979196d0479e3aacec853502c8"/></dir><dir name="Controller"><file name="Base.php" hash="766127568874bfa7e2a9985bb028321c"/><file name="Files.php" hash="18a48dde08afee8620d3a79b36addb9d"/><file name="Groups.php" hash="12c1e6818e7a7115e38eeb9492970019"/><file name="MinApp.php" hash="88a6eb77b74178d0e29a099e0e6ccc63"/><file name="Page.php" hash="02bc8325362e435d4af75a6ec138c2d4"/><file name="Version1.php" hash="4369c8793be1d5cf061a99651b16da26"/></dir><dir name="CSS"><file name="Compressor.php" hash="b514fdc1f7c010031631994c77a18bf6"/><file name="UriRewriter.php" hash="5ab5dfdb489e28a39a4e9d6ad70117d6"/></dir><file name="Build.php" hash="6e329c2acc80b72cfde52be6918940bb"/><file name="BuildSpeedster.php" hash="b93d3e802e2bf7b31eecf9537d3e92f9"/><file name="CommentPreserver.php" hash="86bab05265083b57935503bdd735ce74"/><file name="CSS.php" hash="cdeb49c0f35a6cef166c6cfee7f1dd95"/><file name="HTML.php" hash="e774a70491041048fef690d4b162e0ce"/><file name="ImportProcessor.php" hash="5ce5f2c30830af408d82d4d1511e0c8a"/><file name="Javascript.php" hash="1baa1a43818fcecb89c2a08b40a544da"/><file name="Lines.php" hash="80b2932320c98d1e84aa7f48fceb35e8"/><file name="Logger.php" hash="b2844a8c35e028b9ee725be05adbcf7e"/><file name="Packer.php" hash="25e6f213205f060853db918c2d67ef06"/><file name="Source.php" hash="f7055f963f00e5ae9f5b0005d5e4a5ec"/><file name="YUICompressor.php" hash="13840856d6340e70e7289035827b8b7d"/></dir><dir name="Solar"><file name="Dir.php" hash="6c88f363f6830ac4dc3917eac3c9d78c"/></dir><file name="FirePHP.php" hash="f619b5a77fee4b21e4397e98d858fbf4"/><file name="JSMin.php" hash="5716028656e1d402c98a43ee18648dd3"/><file name="JSMinPlus.php" hash="9d982f55fe9526105eaf9c0fc661263e"/><file name="Minify.php" hash="091d6a6c852610303b405bcfa363b21f"/></dir><file name="HISTORY.txt" hash="72bf6c9ceb63bab5fc35aff334a79bd2"/><file name="LICENSE.txt" hash="911d374696c0a5e9e6e848e7f20d0ee1"/><file name="m.php" hash="5fdee8e085d93a755dd0d00e6b5dfc0e"/><file name="README.txt" hash="6e961a626ae6814c72fab53bcad4a4a7"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fooman_Speedster</name>
4
+ <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0 / BSD see files</license>
7
  <channel>community</channel>
10
  <description>&lt;p&gt;FOOMAN Speedster 1.1&lt;/p&gt;
11
  &lt;p&gt;Speed up your store by combining, compressing and caching JS and CSS.&lt;/p&gt;
12
  &lt;p&gt;Please read the installation instructions and latest changes &lt;a href="http://www.magentocommerce.com/extension/457/fooman-speedster"&gt;here.&lt;/a&gt;&lt;/p&gt;</description>
13
+ <notes>remove extra files</notes>
14
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
15
+ <date>2010-05-19</date>
16
+ <time>14:00:39</time>
17
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fooman_Speedster.xml" hash="5c2b369753dd7e626619535708f89add"/></dir></dir></dir><dir name="js"><dir name="prototype"><file name="validation-4min.js" hash="f8865bb7a07f1a22dc5a08ed362daa83"/></dir></dir><dir name="lib"><dir name="minify"><file name=".htaccess" hash="4d6b8833e4ccae2d2393dfeba369b894"/></dir></dir><dir name="var"><dir name="minifycache"><file name="cache.txt" hash="5709c1d6a6f85fb7b7ea2eef23086b46"/></dir></dir></target><target name="magecommunity"><dir name="Fooman"><dir name="Speedster"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Head.php" hash="d850197d05af7b972eda1ef6bf3da2ed"/></dir></dir><dir name="Page"><dir name="Html"><file name="Head.php" hash="c5e51230c68eee557f5305d99d656243"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="e7df9018130da0909a9a529086d0ac33"/></dir></dir></dir></target><target name="magelib"><dir name="minify"><dir name="lib"><dir name="HTTP"><file name="ConditionalGet.php" hash="f9760a41a6688eca78c27e4afd760a02"/><file name="Encoder.php" hash="71d0651830bbf9153191f1749bf54e62"/></dir><dir name="Minify"><dir name="Cache"><file name="APC.php" hash="2766ccf5e1e4d6e38d3ec128dbc4bc6f"/><file name="File.php" hash="26d02518b2035f1b1ae49da001baa26a"/><file name="Memcache.php" hash="fa208d979196d0479e3aacec853502c8"/></dir><dir name="Controller"><file name="Base.php" hash="766127568874bfa7e2a9985bb028321c"/><file name="Files.php" hash="18a48dde08afee8620d3a79b36addb9d"/><file name="Groups.php" hash="12c1e6818e7a7115e38eeb9492970019"/><file name="MinApp.php" hash="88a6eb77b74178d0e29a099e0e6ccc63"/><file name="Page.php" hash="02bc8325362e435d4af75a6ec138c2d4"/><file name="Version1.php" hash="4369c8793be1d5cf061a99651b16da26"/></dir><dir name="CSS"><file name="Compressor.php" hash="b514fdc1f7c010031631994c77a18bf6"/><file name="UriRewriter.php" hash="5ab5dfdb489e28a39a4e9d6ad70117d6"/></dir><file name="Build.php" hash="6e329c2acc80b72cfde52be6918940bb"/><file name="BuildSpeedster.php" hash="b93d3e802e2bf7b31eecf9537d3e92f9"/><file name="CommentPreserver.php" hash="86bab05265083b57935503bdd735ce74"/><file name="CSS.php" hash="cdeb49c0f35a6cef166c6cfee7f1dd95"/><file name="HTML.php" hash="e774a70491041048fef690d4b162e0ce"/><file name="ImportProcessor.php" hash="5ce5f2c30830af408d82d4d1511e0c8a"/><file name="Javascript.php" hash="1baa1a43818fcecb89c2a08b40a544da"/><file name="Lines.php" hash="80b2932320c98d1e84aa7f48fceb35e8"/><file name="Logger.php" hash="b2844a8c35e028b9ee725be05adbcf7e"/><file name="Packer.php" hash="25e6f213205f060853db918c2d67ef06"/><file name="Source.php" hash="f7055f963f00e5ae9f5b0005d5e4a5ec"/><file name="YUICompressor.php" hash="13840856d6340e70e7289035827b8b7d"/></dir><dir name="Solar"><file name="Dir.php" hash="6c88f363f6830ac4dc3917eac3c9d78c"/></dir><file name="FirePHP.php" hash="f619b5a77fee4b21e4397e98d858fbf4"/><file name="JSMin.php" hash="5716028656e1d402c98a43ee18648dd3"/><file name="JSMinPlus.php" hash="9d982f55fe9526105eaf9c0fc661263e"/><file name="Minify.php" hash="091d6a6c852610303b405bcfa363b21f"/></dir><file name="HISTORY.txt" hash="72bf6c9ceb63bab5fc35aff334a79bd2"/><file name="LICENSE.txt" hash="911d374696c0a5e9e6e848e7f20d0ee1"/><file name="m.php" hash="5fdee8e085d93a755dd0d00e6b5dfc0e"/><file name="README.txt" hash="6e961a626ae6814c72fab53bcad4a4a7"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
var/minifycache/minify_036b1964ffc19e72b8e0134d21cb8d22 DELETED
@@ -1,433 +0,0 @@
1
- var varienTabs=new Class.create();varienTabs.prototype={initialize:function(containerId,destElementId,activeTabId,shadowTabs){this.containerId=containerId;this.destElementId=destElementId;this.activeTab=null;this.tabOnClick=this.tabMouseClick.bindAsEventListener(this);this.tabs=$$('#'+this.containerId+' li a.tab-item-link');this.hideAllTabsContent();for(var tab=0;tab<this.tabs.length;tab++){Event.observe(this.tabs[tab],'click',this.tabOnClick);if($(this.destElementId)){var tabContentElement=$(this.getTabContentElementId(this.tabs[tab]));if(tabContentElement&&tabContentElement.parentNode.id!=this.destElementId){$(this.destElementId).appendChild(tabContentElement);tabContentElement.container=this;tabContentElement.statusBar=this.tabs[tab];tabContentElement.tabObject=this.tabs[tab];this.tabs[tab].contentMoved=true;this.tabs[tab].container=this;this.tabs[tab].show=function(){this.container.showTabContent(this);}
2
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('moveTab',{tab:this.tabs[tab]});}}}
3
- if(this.tabs[tab].id&&shadowTabs&&shadowTabs[this.tabs[tab].id]){this.tabs[tab].shadowTabs=shadowTabs[this.tabs[tab].id];}}
4
- this.displayFirst=activeTabId;Event.observe(window,'load',this.moveTabContentInDest.bind(this));},setSkipDisplayFirstTab:function(){this.displayFirst=null;},moveTabContentInDest:function(){for(var tab=0;tab<this.tabs.length;tab++){if($(this.destElementId)&&!this.tabs[tab].contentMoved){var tabContentElement=$(this.getTabContentElementId(this.tabs[tab]));if(tabContentElement&&tabContentElement.parentNode.id!=this.destElementId){$(this.destElementId).appendChild(tabContentElement);tabContentElement.container=this;tabContentElement.statusBar=this.tabs[tab];tabContentElement.tabObject=this.tabs[tab];this.tabs[tab].container=this;this.tabs[tab].show=function(){this.container.showTabContent(this);}
5
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('moveTab',{tab:this.tabs[tab]});}}}}
6
- if(this.displayFirst){this.showTabContent($(this.displayFirst));this.displayFirst=null;}},getTabContentElementId:function(tab){if(tab){return tab.id+'_content';}
7
- return false;},tabMouseClick:function(event){var tab=Event.findElement(event,'a');if((tab.href.indexOf('#')!=tab.href.length-1)&&!(Element.hasClassName(tab,'ajax'))){location.href=tab.href;}
8
- else{this.showTabContent(tab);}
9
- Event.stop(event);},hideAllTabsContent:function(){for(var tab in this.tabs){this.hideTabContent(this.tabs[tab]);}},showTabContentImmediately:function(tab){this.hideAllTabsContent();var tabContentElement=$(this.getTabContentElementId(tab));if(tabContentElement){Element.show(tabContentElement);Element.addClassName(tab,'active');if(tab.shadowTabs&&tab.shadowTabs.length){for(var k in tab.shadowTabs){this.loadShadowTab($(tab.shadowTabs[k]));}}
10
- if(!Element.hasClassName(tab,'ajax only')){Element.removeClassName(tab,'notloaded');}
11
- this.activeTab=tab;}
12
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('showTab',{tab:tab});}},showTabContent:function(tab){var tabContentElement=$(this.getTabContentElementId(tab));if(tabContentElement){if(this.activeTab!=tab){if(varienGlobalEvents){if(varienGlobalEvents.fireEvent('tabChangeBefore',$(this.getTabContentElementId(this.activeTab))).indexOf('cannotchange')!=-1){return;};}}
13
- var isAjax=Element.hasClassName(tab,'ajax');var isEmpty=tabContentElement.innerHTML==''&&tab.href.indexOf('#')!=tab.href.length-1;var isNotLoaded=Element.hasClassName(tab,'notloaded');if(isAjax&&(isEmpty||isNotLoaded))
14
- {new Ajax.Request(tab.href,{parameters:{form_key:FORM_KEY},evalScripts:true,onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
15
- if(response.error){alert(response.message);}
16
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(tabContentElement.id).update(transport.responseText);this.showTabContentImmediately(tab)}}
17
- catch(e){$(tabContentElement.id).update(transport.responseText);this.showTabContentImmediately(tab)}}.bind(this)});}
18
- else{this.showTabContentImmediately(tab);}}},loadShadowTab:function(tab){var tabContentElement=$(this.getTabContentElementId(tab));if(tabContentElement&&Element.hasClassName(tab,'ajax')&&Element.hasClassName(tab,'notloaded')){new Ajax.Request(tab.href,{parameters:{form_key:FORM_KEY},evalScripts:true,onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
19
- if(response.error){alert(response.message);}
20
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(tabContentElement.id).update(transport.responseText);if(!Element.hasClassName(tab,'ajax only')){Element.removeClassName(tab,'notloaded');}}}
21
- catch(e){$(tabContentElement.id).update(transport.responseText);if(!Element.hasClassName(tab,'ajax only')){Element.removeClassName(tab,'notloaded');}}}.bind(this)});}},hideTabContent:function(tab){var tabContentElement=$(this.getTabContentElementId(tab));if($(this.destElementId)&&tabContentElement){Element.hide(tabContentElement);Element.removeClassName(tab,'active');}
22
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('hideTab',{tab:tab});}}};var varienForm=new Class.create();varienForm.prototype={initialize:function(formId,validationUrl){this.formId=formId;this.validationUrl=validationUrl;this.submitUrl=false;if($(this.formId)){this.validator=new Validation(this.formId,{onElementValidate:this.checkErrors.bind(this)});}
23
- this.errorSections=$H({});},checkErrors:function(result,elm){if(!result)
24
- elm.setHasError(true,this);else
25
- elm.setHasError(false,this);},submit:function(url){if(typeof varienGlobalEvents!=undefined){varienGlobalEvents.fireEvent('formSubmit',this.formId);}
26
- this.errorSections=$H({});this.canShowError=true;this.submitUrl=url;if(this.validator&&this.validator.validate()){if(this.validationUrl){this._validate();}
27
- else{this._submit();}
28
- return true;}
29
- return false;},_validate:function(){new Ajax.Request(this.validationUrl,{method:'post',parameters:$(this.formId).serialize(),onComplete:this._processValidationResult.bind(this),onFailure:this._processFailure.bind(this)});},_processValidationResult:function(transport){var response=transport.responseText.evalJSON();if(response.error){if($('messages')){$('messages').innerHTML=response.message;}}
30
- else{this._submit();}},_processFailure:function(transport){location.href=BASE_URL;},_submit:function(){if(this.submitUrl){$(this.formId).action=this.submitUrl;}
31
- $(this.formId).submit();}}
32
- Validation.isVisible=function(elm){while(elm&&elm.tagName!='BODY'){if(elm.disabled)return false;if((Element.hasClassName(elm,'template')&&Element.hasClassName(elm,'no-display'))||Element.hasClassName(elm,'ignore-validate')){return false;}
33
- elm=elm.parentNode;}
34
- return true;}
35
- var varienElementMethods={setHasChanges:function(element,event){if($(element)&&$(element).hasClassName('no-changes'))return;var elm=element;while(elm&&elm.tagName!='BODY'){if(elm.statusBar)
36
- Element.addClassName($(elm.statusBar),'changed')
37
- elm=elm.parentNode;}},setHasError:function(element,flag,form){var elm=element;while(elm&&elm.tagName!='BODY'){if(elm.statusBar){if(form.errorSections.keys().indexOf(elm.statusBar.id)<0)
38
- form.errorSections.set(elm.statusBar.id,flag);if(flag){Element.addClassName($(elm.statusBar),'error');if(form.canShowError&&$(elm.statusBar).show){form.canShowError=false;$(elm.statusBar).show();}
39
- form.errorSections.set(elm.statusBar.id,flag);}
40
- else if(!form.errorSections.get(elm.statusBar.id)){Element.removeClassName($(elm.statusBar),'error')}}
41
- elm=elm.parentNode;}
42
- this.canShowElement=false;}}
43
- Element.addMethods(varienElementMethods);varienWindowOnloadCache={};function varienWindowOnload(useCache){var dataElements=$$('input','select','textarea');for(var i=0;i<dataElements.length;i++){if(dataElements[i]&&dataElements[i].id){if((!useCache)||(!varienWindowOnloadCache[dataElements[i].id])){Event.observe(dataElements[i],'change',dataElements[i].setHasChanges.bind(dataElements[i]));if(useCache){varienWindowOnloadCache[dataElements[i].id]=true;}}}}}
44
- Event.observe(window,'load',varienWindowOnload);RegionUpdater=Class.create();RegionUpdater.prototype={initialize:function(countryEl,regionTextEl,regionSelectEl,regions,disableAction,clearRegionValueOnDisable)
45
- {this.countryEl=$(countryEl);this.regionTextEl=$(regionTextEl);this.regionSelectEl=$(regionSelectEl);this.regions=regions;this.disableAction=(typeof disableAction=='undefined')?'hide':disableAction;this.clearRegionValueOnDisable=(typeof clearRegionValueOnDisable=='undefined')?false:clearRegionValueOnDisable;if(this.regionSelectEl.options.length<=1){this.update();}
46
- else{this.lastCountryId=this.countryEl.value;}
47
- this.countryEl.changeUpdater=this.update.bind(this);Event.observe(this.countryEl,'change',this.update.bind(this));},update:function()
48
- {if(this.regions[this.countryEl.value]){if(this.lastCountryId!=this.countryEl.value){var i,option,region,def;if(this.regionTextEl){def=this.regionTextEl.value.toLowerCase();this.regionTextEl.value='';}
49
- if(!def){def=this.regionSelectEl.getAttribute('defaultValue');}
50
- this.regionSelectEl.options.length=1;for(regionId in this.regions[this.countryEl.value]){region=this.regions[this.countryEl.value][regionId];option=document.createElement('OPTION');option.value=regionId;option.text=region.name;if(this.regionSelectEl.options.add){this.regionSelectEl.options.add(option);}else{this.regionSelectEl.appendChild(option);}
51
- if(regionId==def||region.name.toLowerCase()==def||region.code.toLowerCase()==def){this.regionSelectEl.value=regionId;}}}
52
- if(this.disableAction=='hide'){if(this.regionTextEl){this.regionTextEl.style.display='none';this.regionTextEl.style.disabled=true;}
53
- this.regionSelectEl.style.display='';this.regionSelectEl.disabled=false;}else if(this.disableAction=='disable'){if(this.regionTextEl){this.regionTextEl.disabled=true;}
54
- this.regionSelectEl.disabled=false;}
55
- this.setMarkDisplay(this.regionSelectEl,true);this.lastCountryId=this.countryEl.value;}else{if(this.disableAction=='hide'){if(this.regionTextEl){this.regionTextEl.style.display='';this.regionTextEl.style.disabled=false;}
56
- this.regionSelectEl.style.display='none';this.regionSelectEl.disabled=true;}else if(this.disableAction=='disable'){if(this.regionTextEl){this.regionTextEl.disabled=false;}
57
- this.regionSelectEl.disabled=true;if(this.clearRegionValueOnDisable){this.regionSelectEl.value='';}}else if(this.disableAction=='nullify'){this.regionSelectEl.options.length=1;this.regionSelectEl.value='';this.regionSelectEl.selectedIndex=0;this.lastCountryId='';}
58
- this.setMarkDisplay(this.regionSelectEl,false);}
59
- varienGlobalEvents.fireEvent("address_country_changed",this.countryEl);},setMarkDisplay:function(elem,display){if(elem.parentNode.parentNode){var marks=Element.select(elem.parentNode.parentNode,'.required');if(marks[0]){display?marks[0].show():marks[0].hide();}}}}
60
- regionUpdater=RegionUpdater;Event.pointerX=function(event){try{return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));}
61
- catch(e){}}
62
- Event.pointerY=function(event){try{return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));}
63
- catch(e){}}
64
- SelectUpdater=Class.create();SelectUpdater.prototype={initialize:function(firstSelect,secondSelect,selectFirstMessage,noValuesMessage,values,selected)
65
- {this.first=$(firstSelect);this.second=$(secondSelect);this.message=selectFirstMessage;this.values=values;this.noMessage=noValuesMessage;this.selected=selected;this.update();Event.observe(this.first,'change',this.update.bind(this));},update:function()
66
- {this.second.length=0;this.second.value='';if(this.first.value&&this.values[this.first.value]){for(optionValue in this.values[this.first.value]){optionTitle=this.values[this.first.value][optionValue];this.addOption(this.second,optionValue,optionTitle);}
67
- this.second.disabled=false;}else if(this.first.value&&!this.values[this.first.value]){this.addOption(this.second,'',this.noMessage);}else{this.addOption(this.second,'',this.message);this.second.disabled=true;}},addOption:function(select,value,text)
68
- {option=document.createElement('OPTION');option.value=value;option.text=text;if(this.selected&&option.value==this.selected){option.selected=true;this.selected=false;}
69
- if(select.options.add){select.options.add(option);}else{select.appendChild(option);}}}
70
- FormElementDependenceController=Class.create();FormElementDependenceController.prototype={initialize:function(elementsMap)
71
- {for(var idTo in elementsMap){for(var idFrom in elementsMap[idTo]){Event.observe($(idFrom),'change',this.trackChange.bindAsEventListener(this,idTo,elementsMap[idTo]));this.trackChange(null,idTo,elementsMap[idTo]);}}},trackChange:function(e,idTo,valuesFrom)
72
- {var shouldShowUp=true;for(var idFrom in valuesFrom){if($(idFrom).value!=valuesFrom[idFrom]){shouldShowUp=false;}}
73
- if(shouldShowUp){$(idTo).up(1).select('input','select').each(function(item){if(!item.type||item.type!='hidden'){item.disabled=false;}});$(idTo).up(1).show();}else{$(idTo).up(1).select('input','select').each(function(item){if(!item.type||item.type!='hidden'){item.disabled=true;}});$(idTo).up(1).hide();}}};var varienAccordion=new Class.create();varienAccordion.prototype={initialize:function(containerId,activeOnlyOne){this.containerId=containerId;this.activeOnlyOne=activeOnlyOne||false;this.container=$(this.containerId);this.items=$$('#'+this.containerId+' dt');this.loader=new varienLoader(true);var links=$$('#'+this.containerId+' dt a');for(var i in links){if(links[i].href){Event.observe(links[i],'click',this.clickItem.bind(this));this.items[i].dd=this.items[i].next('dd');this.items[i].link=links[i];}}
74
- this.initFromCookie();},initFromCookie:function(){var activeItemId,visibility;if(this.activeOnlyOne&&(activeItemId=Cookie.read(this.cookiePrefix()+'active-item'))!==null){this.hideAllItems();this.showItem(this.getItemById(activeItemId));}else if(!this.activeOnlyOne){this.items.each(function(item){if((visibility=Cookie.read(this.cookiePrefix()+item.id))!==null){if(visibility==0){this.hideItem(item);}else{this.showItem(item);}}}.bind(this));}},cookiePrefix:function(){return'accordion-'+this.containerId+'-';},getItemById:function(itemId){var result=null;this.items.each(function(item){if(item.id==itemId){result=item;throw $break;}});return result;},clickItem:function(event){var item=Event.findElement(event,'dt');if(this.activeOnlyOne){this.hideAllItems();this.showItem(item);Cookie.write(this.cookiePrefix()+'active-item',item.id,30*24*60*60);}
75
- else{if(this.isItemVisible(item)){this.hideItem(item);Cookie.write(this.cookiePrefix()+item.id,0,30*24*60*60);}
76
- else{this.showItem(item);Cookie.write(this.cookiePrefix()+item.id,1,30*24*60*60);}}
77
- Event.stop(event);},showItem:function(item){if(item&&item.link){if(item.link.href){this.loadContent(item);}
78
- Element.addClassName(item,'open');Element.addClassName(item.dd,'open');}},hideItem:function(item){Element.removeClassName(item,'open');Element.removeClassName(item.dd,'open');},isItemVisible:function(item){return Element.hasClassName(item,'open');},loadContent:function(item){if(item.link.href.indexOf('#')==item.link.href.length-1){return;}
79
- if(Element.hasClassName(item.link,'ajax')){this.loadingItem=item;this.loader.load(item.link.href,{updaterId:this.loadingItem.dd.id},this.setItemContent.bind(this));return;}
80
- location.href=item.link.href;},setItemContent:function(content){if(content.isJSON){return;}
81
- this.loadingItem.dd.innerHTML=content;},hideAllItems:function(){for(var i in this.items){if(this.items[i].id){Element.removeClassName(this.items[i],'open');Element.removeClassName(this.items[i].dd,'open');}}}};function setLocation(url){window.location.href=url;}
82
- function confirmSetLocation(message,url){if(confirm(message)){setLocation(url);}
83
- return false;}
84
- function deleteConfirm(message,url){confirmSetLocation(message,url);}
85
- function setElementDisable(element,disable){if($(element)){$(element).disabled=disable;}}
86
- function toggleParentVis(obj){obj=$(obj).parentNode;if(obj.style.display=='none'){obj.style.display='';}else{obj.style.display='none';}}
87
- function toggleFieldsetVis(obj){id=obj;obj=$(obj);if(obj.style.display=='none'){obj.style.display='';}else{obj.style.display='none';}
88
- obj=obj.parentNode.childElements();for(var i=0;i<obj.length;i++){if(obj[i].id!=undefined&&obj[i].id==id&&obj[(i-1)].classNames()=='entry-edit-head')
89
- {if(obj[i-1].style.display=='none'){obj[i-1].style.display='';}else{obj[i-1].style.display='none';}}}}
90
- function toggleVis(obj){obj=$(obj);if(obj.style.display=='none'){obj.style.display='';}else{obj.style.display='none';}}
91
- function imagePreview(element){if($(element)){var win=window.open('','preview','width=400,height=400,resizable=1,scrollbars=1');win.document.open();win.document.write('<body style="padding:0;margin:0"><img src="'+$(element).src+'" id="image_preview"/></body>');win.document.close();Event.observe(win,'load',function(){var img=win.document.getElementById('image_preview');win.resizeTo(img.width+40,img.height+80)});}}
92
- function toggleValueElements(checkbox,container){if(container&&checkbox){var elems=Element.select(container,['select','input','textarea','button','img']);elems.each(function(elem){if(elem!=checkbox){elem.disabled=checkbox.checked;if(checkbox.checked){elem.addClassName('disabled');}else{elem.removeClassName('disabled');}
93
- if(elem.tagName=='IMG'){checkbox.checked?elem.hide():elem.show();}};})}}
94
- function submitAndReloadArea(area,url){if($(area)){var fields=$(area).select('input','select','textarea');var data=Form.serializeElements(fields,true);url=url+(url.match(new RegExp('\\?'))?'&isAjax=true':'?isAjax=true');new Ajax.Request(url,{parameters:$H(data),loaderArea:area,onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
95
- if(response.error){alert(response.message);}
96
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(area).update(transport.responseText);}}
97
- catch(e){$(area).update(transport.responseText);}}});}}
98
- function syncOnchangeValue(baseElem,distElem){var compare={baseElem:baseElem,distElem:distElem}
99
- Event.observe(baseElem,'change',function(){if($(this.baseElem)&&$(this.distElem)){$(this.distElem).value=$(this.baseElem).value;}}.bind(compare));}
100
- function updateElementAtCursor(el,value,win){if(win==undefined){win=window.self;}
101
- if(document.selection){el.focus();sel=win.document.selection.createRange();sel.text=value;}else if(el.selectionStart||el.selectionStart=='0'){var startPos=el.selectionStart;var endPos=el.selectionEnd;el.value=el.value.substring(0,startPos)+value+el.value.substring(endPos,el.value.length);}else{el.value+=value;}}
102
- function firebugEnabled(){if(window.console&&window.console.firebug){return true;}
103
- return false;}
104
- function disableElements(search){$$('.'+search).each(function(elem){elem.disabled=true;elem.addClassName('disabled');});}
105
- function enableElements(search){$$('.'+search).each(function(elem){elem.disabled=false;elem.removeClassName('disabled');});}
106
- if(!navigator.appVersion.match('MSIE 6.')){var header,header_offset,header_copy;Event.observe(window,'load',function(){createTopButtonToolbarToggle();});function createTopButtonToolbarToggle()
107
- {var headers=$$('.content-header');for(var i=0;i<headers.length;i++){if(!headers[i].hasClassName('skip-header')){header=headers[i];}}
108
- if(!header){return;}
109
- header_offset=Element.cumulativeOffset(header)[1];var buttons=$$('.content-buttons')[0];if(buttons){Element.insert(buttons,{before:'<div class="content-buttons-placeholder"></div>'});buttons.placeholder=buttons.previous('.content-buttons-placeholder');buttons.remove();buttons.placeholder.appendChild(buttons);header_offset=Element.cumulativeOffset(buttons)[1];}
110
- header_copy=document.createElement('div');header_copy.appendChild(header.cloneNode(true));document.body.insertBefore(header_copy,document.body.lastChild)
111
- $(header_copy).addClassName('content-header-floating');if($(header_copy).down('.content-buttons-placeholder')){$(header_copy).down('.content-buttons-placeholder').remove();}}
112
- function updateTopButtonToolbarToggle()
113
- {if(header_copy){header_copy.remove();}
114
- createTopButtonToolbarToggle();floatingTopButtonToolbarToggle();}
115
- function floatingTopButtonToolbarToggle(){if(!header||!header_copy||!header_copy.parentNode){return;}
116
- var s;if(self.pageYOffset){s=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){s=document.documentElement.scrollTop;}else if(document.body){s=document.body.scrollTop;}
117
- var buttons=$$('.content-buttons')[0];if(s>header_offset){if(buttons){if(!buttons.oldParent){buttons.oldParent=buttons.parentNode;buttons.oldBefore=buttons.previous();}
118
- if(buttons.oldParent==buttons.parentNode){var dimensions=buttons.placeholder.getDimensions()
119
- buttons.placeholder.style.width=dimensions.width+'px';buttons.placeholder.style.height=dimensions.height+'px';buttons.hide();buttons.remove();$(header_copy).down('div').appendChild(buttons);buttons.show();}}
120
- header_copy.style.display='block';}else{if(buttons&&buttons.oldParent&&buttons.oldParent!=buttons.parentNode){buttons.remove();buttons.oldParent.insertBefore(buttons,buttons.oldBefore);}
121
- header.style.visibility='visible';header_copy.style.display='none';}}
122
- Event.observe(window,'scroll',floatingTopButtonToolbarToggle);Event.observe(window,'resize',floatingTopButtonToolbarToggle);}
123
- var Cookie={all:function(){var pairs=document.cookie.split(';');var cookies={};pairs.each(function(item,index){var pair=item.strip().split('=');cookies[unescape(pair[0])]=unescape(pair[1]);});return cookies;},read:function(cookieName){var cookies=this.all();if(cookies[cookieName]){return cookies[cookieName];}
124
- return null;},write:function(cookieName,cookieValue,cookieLifeTime){var expires='';if(cookieLifeTime){var date=new Date();date.setTime(date.getTime()+(cookieLifeTime*1000));expires='; expires='+date.toGMTString();}
125
- var urlPath='/'+BASE_URL.split('/').slice(3).join('/');document.cookie=escape(cookieName)+"="+escape(cookieValue)+expires+"; path="+urlPath;},clear:function(cookieName){this.write(cookieName,'',-1);}};var Fieldset={cookiePrefix:'fh-',applyCollapse:function(containerId){if($(containerId+'-state')){collapsed=$(containerId+'-state').value==1?0:1;}else{collapsed=$(containerId+'-head').collapsed;}
126
- if(collapsed==1||collapsed===undefined){$(containerId+'-head').removeClassName('open');$(containerId).hide();}else{$(containerId+'-head').addClassName('open');$(containerId).show();}},toggleCollapse:function(containerId,saveThroughAjax){if($(containerId+'-state')){collapsed=$(containerId+'-state').value==1?0:1;}else{collapsed=$(containerId+'-head').collapsed;}
127
- if(collapsed==1||collapsed===undefined){if($(containerId+'-state')){$(containerId+'-state').value=1;}
128
- $(containerId+'-head').collapsed=0;}else{if($(containerId+'-state')){$(containerId+'-state').value=0;}
129
- $(containerId+'-head').collapsed=1;}
130
- this.applyCollapse(containerId);if(typeof saveThroughAjax!="undefined"){this.saveState(saveThroughAjax,{container:containerId,value:$(containerId+'-state').value});}},addToPrefix:function(value){this.cookiePrefix+=value+'-';},saveState:function(url,parameters){new Ajax.Request(url,{method:'get',parameters:Object.toQueryString(parameters),loaderArea:false});}};var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
131
- output=output+
132
- this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+
133
- this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
134
- return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
135
- if(enc4!=64){output=output+String.fromCharCode(chr3);}}
136
- output=Base64._utf8_decode(output);return output;},mageEncode:function(input){return this.encode(input).replace(/\+/g,'-').replace(/\//g,'_').replace(/=/g,',');},mageDecode:function(output){output=output.replace(/\-/g,'+').replace(/_/g,'/').replace(/,/g,'=');return this.decode(output);},idEncode:function(input){return this.encode(input).replace(/\+/g,':').replace(/\//g,'_').replace(/=/g,'-');},idDecode:function(output){output=output.replace(/\-/g,'=').replace(/_/g,'/').replace(/\:/g,'\+');return this.decode(output);},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
137
- else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
138
- else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
139
- return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
140
- else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
141
- else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
142
- return string;}};;function MultiSelector(list_target,field_name,max,new_element_html,delete_text,new_file_input){this.list_target=list_target;this.field_name=field_name;this.count=0;this.id=0;if(max){this.max=max;}else{this.max=-1;};this.new_element_html=new_element_html;this.delete_text=delete_text;this.new_file_input=new_file_input;this.addElement=function(element){if(element.tagName=='INPUT'&&element.type=='file'){this.id++;element.name=this.field_name+'[]';element.multi_selector=this;element.onchange=function(){var new_element=document.createElement('input');new_element.type='file';this.parentNode.insertBefore(new_element,this);this.multi_selector.addElement(new_element);this.multi_selector.addListRow(this);this.style.position='absolute';this.style.left='-1000px';};if(this.max!=-1&&this.count>=this.max){element.disabled=true;};this.count++;this.current_element=element;}else{alert('Error: not a file input element');};};this.addListRow=function(element){var new_row_input=document.createElement('input');new_row_input.type='text';new_row_input.name='general[position_new][]';new_row_input.size='3';new_row_input.value='0';var new_row_button=document.createElement('input');new_row_button.type='checkbox';new_row_button.value='Delete';var new_row_span=document.createElement('span');new_row_span.innerHTML=this.delete_text;table=this.list_target;noOfRows=table.rows.length;noOfCols=table.rows[noOfRows-2].cells.length;var x=table.insertRow(noOfRows-1);for(var j=0;j<noOfCols;j++){newCell=x.insertCell(j);newCell.align="center";newCell.valign="middle";if(j==3){newCell.appendChild(new_row_input);}
143
- else if(j==4){newCell.appendChild(new_row_button);}
144
- else{newCell.innerHTML=this.new_file_input.replace(/%id%/g,this.id).replace(/%j%/g,j);}}
145
- new_row_button.onclick=function(){this.parentNode.element.parentNode.removeChild(this.parentNode.element);this.parentNode.parentNode.removeChild(this.parentNode);this.parentNode.element.multi_selector.count--;this.parentNode.element.multi_selector.current_element.disabled=false;return false;};};this.insRowLast=function(table){noOfRows=table.rows.length;noOfCols=table.rows[noOfRows-1].cells.length;var x=table.insertRow(noOfRows);for(var j=0;j<noOfCols;j++){newCell=x.insertCell(j);newCell.innerHTML="NEW CELL"+j;}};this.deleteRow=function(table,row){table.deleteRow(row);};this.deleteRow=function(table){noOfRows=table.rows.length;table.deleteRow(noOfRows-1);};};;var Product={};Product.Gallery=Class.create();Product.Gallery.prototype={images:[],file2id:{'no_selection':0},idIncrement:1,containerId:'',container:null,uploader:null,imageTypes:{},initialize:function(containerId,uploader,imageTypes){this.containerId=containerId,this.container=$(this.containerId);this.uploader=uploader;this.imageTypes=imageTypes;if(this.uploader){this.uploader.onFilesComplete=this.handleUploadComplete.bind(this);}
146
- this.images=this.getElement('save').value.evalJSON();this.imagesValues=this.getElement('save_image').value.evalJSON();this.template=new Template('<tr id="__id__" class="preview">'+this.getElement('template').innerHTML+'</tr>',new RegExp('(^|.|\\r|\\n)(__([a-zA-Z0-9_]+)__)',''));this.fixParentTable();this.updateImages();varienGlobalEvents.attachEventHandler('moveTab',this.onImageTabMove.bind(this));},onImageTabMove:function(event){var imagesTab=false;this.container.ancestors().each(function(parentItem){if(parentItem.tabObject){imagesTab=parentItem.tabObject;throw $break;}}.bind(this));if(imagesTab&&event.tab&&event.tab.name&&imagesTab.name==event.tab.name){this.container.select('input[type="radio"]').each(function(radio){radio.observe('change',this.onChangeRadio);}.bind(this));this.updateImages();}},fixParentTable:function(){this.container.ancestors().each(function(parentItem){if(parentItem.tagName.toLowerCase()=='td'){parentItem.style.width='100%';}
147
- if(parentItem.tagName.toLowerCase()=='table'){parentItem.style.width='100%';throw $break;}});},getElement:function(name){return $(this.containerId+'_'+name);},showUploader:function(){this.getElement('add_images_button').hide();this.getElement('uploader').show();},handleUploadComplete:function(files){files.each(function(item){if(!item.response.isJSON()){try{console.log(item.response);}catch(e2){alert(item.response);}
148
- return;}
149
- var response=item.response.evalJSON();if(response.error){return;}
150
- var newImage={};newImage.url=response.url;newImage.file=response.file;newImage.label='';newImage.position=this.getNextPosition();newImage.disabled=0;newImage.removed=0;this.images.push(newImage);this.uploader.removeFile(item.id);}.bind(this));this.container.setHasChanges();this.updateImages();},updateImages:function(){this.getElement('save').value=this.images.toJSON();$H(this.imageTypes).each(function(pair){this.getFileElement('no_selection','cell-'+pair.key+' input').checked=true;}.bind(this));this.images.each(function(row){if(!$(this.prepareId(row.file))){this.createImageRow(row);}
151
- this.updateVisualisation(row.file);}.bind(this));this.updateUseDefault(false);},onChangeRadio:function(evt){var element=Event.element(evt);element.setHasChanges();},createImageRow:function(image){var vars=Object.clone(image);vars.id=this.prepareId(image.file);var html=this.template.evaluate(vars);Element.insert(this.getElement('list'),{bottom:html});$(vars.id).select('input[type="radio"]').each(function(radio){radio.observe('change',this.onChangeRadio);}.bind(this));},prepareId:function(file){if(typeof this.file2id[file]=='undefined'){this.file2id[file]=this.idIncrement++;}
152
- return this.containerId+'-image-'+this.file2id[file];},getNextPosition:function(){var maxPosition=0;this.images.each(function(item){if(parseInt(item.position)>maxPosition){maxPosition=parseInt(item.position);}});return maxPosition+1;},updateImage:function(file){var index=this.getIndexByFile(file);this.images[index].label=this.getFileElement(file,'cell-label input').value;this.images[index].position=this.getFileElement(file,'cell-position input').value;this.images[index].removed=(this.getFileElement(file,'cell-remove input').checked?1:0);this.images[index].disabled=(this.getFileElement(file,'cell-disable input').checked?1:0);this.getElement('save').value=this.images.toJSON();this.updateState(file);this.container.setHasChanges();},loadImage:function(file){var image=this.getImageByFile(file);this.getFileElement(file,'cell-image img').src=image.url;this.getFileElement(file,'cell-image img').show();this.getFileElement(file,'cell-image .place-holder').hide();},setProductImages:function(file){$H(this.imageTypes).each(function(pair){if(this.getFileElement(file,'cell-'+pair.key+' input').checked){this.imagesValues[pair.key]=(file=='no_selection'?null:file);}}.bind(this));this.getElement('save_image').value=$H(this.imagesValues).toJSON();},updateVisualisation:function(file){var image=this.getImageByFile(file);this.getFileElement(file,'cell-label input').value=image.label;this.getFileElement(file,'cell-position input').value=image.position;this.getFileElement(file,'cell-remove input').checked=(image.removed==1);this.getFileElement(file,'cell-disable input').checked=(image.disabled==1);$H(this.imageTypes).each(function(pair){if(this.imagesValues[pair.key]==file){this.getFileElement(file,'cell-'+pair.key+' input').checked=true;}}.bind(this));this.updateState(file);},updateState:function(file){if(this.getFileElement(file,'cell-disable input').checked){this.getFileElement(file,'cell-position input').disabled=true;}else{this.getFileElement(file,'cell-position input').disabled=false;}},getFileElement:function(file,element){var selector='#'+this.prepareId(file)+' .'+element;var elems=$$(selector);if(!elems[0]){try{console.log(selector);}catch(e2){alert(selector);}}
153
- return $$('#'+this.prepareId(file)+' .'+element)[0];},getImageByFile:function(file){if(this.getIndexByFile(file)===null){return false;}
154
- return this.images[this.getIndexByFile(file)];},getIndexByFile:function(file){var index;this.images.each(function(item,i){if(item.file==file){index=i;}});return index;},updateUseDefault:function(){if(this.getElement('default')){this.getElement('default').select('input').each(function(input){$(this.containerId).select('.cell-'+input.value+' input').each(function(radio){radio.disabled=input.checked;});}.bind(this));}
155
- if(arguments.length==0){this.container.setHasChanges();}},handleUploadProgress:function(file){},handleUploadError:function(fileId){}};Product.AttributesBridge={tabsObject:false,bindTabs2Attributes:{},bind:function(tabId,attributesObject){this.bindTabs2Attributes[tabId]=attributesObject;},getAttributes:function(tabId){return this.bindTabs2Attributes[tabId];},setTabsObject:function(tabs){this.tabsObject=tabs;},getTabsObject:function(){return this.tabsObject;},addAttributeRow:function(data){$H(data).each(function(item){if(this.getTabsObject().activeTab.name!=item.key){this.getTabsObject().showTabContent($(item.key));}
156
- this.getAttributes(item.key).addRow(item.value);}.bind(this));}};Product.Attributes=Class.create();Product.Attributes.prototype={config:{},containerId:null,initialize:function(containerId){this.containerId=containerId;},setConfig:function(config){this.config=config;Product.AttributesBridge.bind(this.getConfig().tab_id,this);},getConfig:function(){return this.config;},create:function(){var win=window.open(this.getConfig().url,'new_attribute','width=900,height=600,resizable=1,scrollbars=1');win.focus();},addRow:function(html){var attributesContainer=$$('#group_fields'+this.getConfig().group_id+' .form-list tbody')[0];Element.insert(attributesContainer,{bottom:html});var childs=attributesContainer.childElements();var element=childs[childs.size()-1].select('input','select','textarea')[0];if(element){window.scrollTo(0,Position.cumulativeOffset(element)[1]
157
- +element.offsetHeight);}}};Product.Configurable=Class.create();Product.Configurable.prototype={initialize:function(attributes,links,idPrefix,grid,readonly){this.templatesSyntax=new RegExp('(^|.|\\r|\\n)(\'{{\\s*(\\w+)\\s*}}\')',"");this.attributes=attributes;this.idPrefix=idPrefix;this.links=$H(links);this.newProducts=[];this.readonly=readonly;this.addAttributeTemplate=new Template($(idPrefix+'attribute_template').innerHTML.replace(/__id__/g,"'{{html_id}}'").replace(/ template no-display/g,''),this.templatesSyntax);this.addValueTemplate=new Template($(idPrefix+'value_template').innerHTML.replace(/__id__/g,"'{{html_id}}'").replace(/ template no-display/g,''),this.templatesSyntax);this.pricingValueTemplate=new Template($(idPrefix+'simple_pricing').innerHTML,this.templatesSyntax);this.pricingValueViewTemplate=new Template($(idPrefix+'simple_pricing_view').innerHTML,this.templatesSyntax);this.container=$(idPrefix+'attributes');this.onLabelUpdate=this.updateLabel.bindAsEventListener(this);this.onValuePriceUpdate=this.updateValuePrice.bindAsEventListener(this);this.onValueTypeUpdate=this.updateValueType.bindAsEventListener(this);this.onValueDefaultUpdate=this.updateValueUseDefault.bindAsEventListener(this);this.createAttributes();this.grid=grid;this.grid.rowClickCallback=this.rowClick.bind(this);this.grid.initRowCallback=this.rowInit.bind(this);this.grid.checkboxCheckCallback=this.registerProduct.bind(this);this.grid.rows.each(function(row){this.rowInit(this.grid,row);}.bind(this));},createAttributes:function(){this.attributes.each(function(attribute,index){var li=$(document.createElement('LI'));li.className='attribute';li.id=this.idPrefix+'_attribute_'+index;attribute.html_id=li.id;if(attribute&&attribute.label&&attribute.label.blank()){attribute.label='&nbsp;'}
158
- var label_readonly='';var use_default_checked='';if(attribute.use_default=='1'){use_default_checked=' checked="checked"';label_readonly=' redonly="redonly"';}
159
- var template=this.addAttributeTemplate.evaluate(attribute);template=template.replace(new RegExp(' readonly="label"','g'),label_readonly);template=template.replace(new RegExp(' checked="use_default"','g'),use_default_checked);li.update(template);li.attributeObject=attribute;this.container.appendChild(li);li.attributeValues=li.down('.attribute-values');if(attribute.values){attribute.values.each(function(value){this.createValueRow(li,value);}.bind(this));}
160
- Event.observe(li.down('.attribute-label'),'change',this.onLabelUpdate);Event.observe(li.down('.attribute-label'),'keyup',this.onLabelUpdate);Event.observe(li.down('.attribute-use-default-label'),'change',this.onLabelUpdate);}.bind(this));if(!this.readonly){Sortable.create(this.container,{handle:'attribute-name-container',onUpdate:this.updatePositions.bind(this)});}
161
- this.updateSaveInput();},updateLabel:function(event){var li=Event.findElement(event,'LI');var labelEl=li.down('.attribute-label');var defEl=li.down('.attribute-use-default-label');li.attributeObject.label=labelEl.value;if(defEl.checked){labelEl.readOnly=true;li.attributeObject.use_default=1;}else{labelEl.readOnly=false;li.attributeObject.use_default=0;}
162
- this.updateSaveInput();},updatePositions:function(param){this.container.childElements().each(function(row,index){row.attributeObject.position=index;});this.updateSaveInput();},addNewProduct:function(productId,attributes){if(this.checkAttributes(attributes)){this.links.set(productId,this.cloneAttributes(attributes));}else{this.newProducts.push(productId);}
163
- this.updateGrid();this.updateValues();this.grid.reload(null);},createEmptyProduct:function(){this.createPopup(this.createEmptyUrl)},createNewProduct:function(){this.createPopup(this.createNormalUrl);},createPopup:function(url){if(this.win&&!this.win.closed){this.win.close();}
164
- this.win=window.open(url,'','width=1000,height=700,resizable=1,scrollbars=1');this.win.focus();},registerProduct:function(grid,element,checked){if(checked){if(element.linkAttributes){this.links.set(element.value,element.linkAttributes);}}else{this.links.unset(element.value);}
165
- this.updateGrid();this.grid.rows.each(function(row){this.revalidateRow(this.grid,row);}.bind(this));this.updateValues();},updateProduct:function(productId,attributes){var isAssociated=false;if(typeof this.links.get(productId)!='undefined'){isAssociated=true;this.links.unset(productId);}
166
- if(isAssociated&&this.checkAttributes(attributes)){this.links.set(productId,this.cloneAttributes(attributes));}else if(isAssociated){this.newProducts.push(productId);}
167
- this.updateGrid();this.updateValues();this.grid.reload(null);},cloneAttributes:function(attributes){var newObj=[];for(var i=0,length=attributes.length;i<length;i++){newObj[i]=Object.clone(attributes[i]);}
168
- return newObj;},rowClick:function(grid,event){var trElement=Event.findElement(event,'tr');var isInput=Event.element(event).tagName.toUpperCase()=='INPUT';if($(Event.findElement(event,'td')).down('a')){return;}
169
- if(trElement){var checkbox=$(trElement).down('input');if(checkbox&&!checkbox.disabled){var checked=isInput?checkbox.checked:!checkbox.checked;grid.setCheckboxChecked(checkbox,checked);}}},rowInit:function(grid,row){var checkbox=$(row).down('.checkbox');var input=$(row).down('.value-json');if(checkbox&&input){checkbox.linkAttributes=input.value.evalJSON();if(!checkbox.checked){if(!this.checkAttributes(checkbox.linkAttributes)){$(row).addClassName('invalid');checkbox.disable();}else{$(row).removeClassName('invalid');checkbox.enable();}}}},revalidateRow:function(grid,row){var checkbox=$(row).down('.checkbox');if(checkbox){if(!checkbox.checked){if(!this.checkAttributes(checkbox.linkAttributes)){$(row).addClassName('invalid');checkbox.disable();}else{$(row).removeClassName('invalid');checkbox.enable();}}}},checkAttributes:function(attributes){var result=true;this.links.each(function(pair){var fail=false;for(var i=0;i<pair.value.length&&!fail;i++){for(var j=0;j<attributes.length&&!fail;j++){if(pair.value[i].attribute_id==attributes[j].attribute_id&&pair.value[i].value_index!=attributes[j].value_index){fail=true;}}}
170
- if(!fail){result=false;}});return result;},updateGrid:function(){this.grid.reloadParams={'products[]':this.links.keys().size()?this.links.keys():[0],'new_products[]':this.newProducts};},updateValues:function(){var uniqueAttributeValues=$H({});this.links.each(function(pair){for(var i=0,length=pair.value.length;i<length;i++){var attribute=pair.value[i];if(uniqueAttributeValues.keys().indexOf(attribute.attribute_id)==-1){uniqueAttributeValues.set(attribute.attribute_id,$H({}));}
171
- uniqueAttributeValues.get(attribute.attribute_id).set(attribute.value_index,attribute);}});this.container.childElements().each(function(row){var attribute=row.attributeObject;for(var i=0,length=attribute.values.length;i<length;i++){if(uniqueAttributeValues.keys().indexOf(attribute.attribute_id)==-1||uniqueAttributeValues.get(attribute.attribute_id).keys().indexOf(attribute.values[i].value_index)==-1){row.attributeValues.childElements().each(function(elem){if(elem.valueObject.value_index==attribute.values[i].value_index){elem.remove();}});attribute.values[i]=undefined;}else{uniqueAttributeValues.get(attribute.attribute_id).unset(attribute.values[i].value_index);}}
172
- attribute.values=attribute.values.compact();if(uniqueAttributeValues.get(attribute.attribute_id)){uniqueAttributeValues.get(attribute.attribute_id).each(function(pair){attribute.values.push(pair.value);this.createValueRow(row,pair.value);}.bind(this));}}.bind(this));this.updateSaveInput();this.updateSimpleForm();},createValueRow:function(container,value){var templateVariables=$H({});if(!this.valueAutoIndex){this.valueAutoIndex=1;}
173
- templateVariables.set('html_id',container.id+'_'
174
- +this.valueAutoIndex);templateVariables.update(value);var pricingValue=parseFloat(templateVariables.get('pricing_value'));if(!isNaN(pricingValue)){templateVariables.set('pricing_value',pricingValue);}else{templateVariables.unset('pricing_value');}
175
- this.valueAutoIndex++;var li=$(document.createElement('LI'));li.className='attribute-value';li.id=templateVariables.get('html_id');li.update(this.addValueTemplate.evaluate(templateVariables));li.valueObject=value;if(typeof li.valueObject.is_percent=='undefined'){li.valueObject.is_percent=0;}
176
- if(typeof li.valueObject.pricing_value=='undefined'){li.valueObject.pricing_value='';}
177
- container.attributeValues.appendChild(li);var priceField=li.down('.attribute-price');var priceTypeField=li.down('.attribute-price-type');if(parseInt(value.is_percent)){priceTypeField.options[1].selected=!(priceTypeField.options[0].selected=false);}else{priceTypeField.options[1].selected=!(priceTypeField.options[0].selected=true);}
178
- Event.observe(priceField,'keyup',this.onValuePriceUpdate);Event.observe(priceField,'change',this.onValuePriceUpdate);Event.observe(priceTypeField,'change',this.onValueTypeUpdate);var useDefaultEl=li.down('.attribute-use-default-value');if(useDefaultEl){if(li.valueObject.use_default_value){useDefaultEl.checked=true;this.updateUseDefaultRow(useDefaultEl,li);}
179
- Event.observe(useDefaultEl,'change',this.onValueDefaultUpdate);}},updateValuePrice:function(event){var li=Event.findElement(event,'LI');li.valueObject.pricing_value=(Event.element(event).value.blank()?null:Event.element(event).value);this.updateSimpleForm();this.updateSaveInput();},updateValueType:function(event){var li=Event.findElement(event,'LI');li.valueObject.is_percent=(Event.element(event).value.blank()?null:Event.element(event).value);this.updateSimpleForm();this.updateSaveInput();},updateValueUseDefault:function(event){var li=Event.findElement(event,'LI');var useDefaultEl=Event.element(event);li.valueObject.use_default_value=useDefaultEl.checked;this.updateUseDefaultRow(useDefaultEl,li);},updateUseDefaultRow:function(useDefaultEl,li){var priceField=li.down('.attribute-price');var priceTypeField=li.down('.attribute-price-type');if(useDefaultEl.checked){priceField.disabled=true;priceTypeField.disabled=true;}else{priceField.disabled=false;priceTypeField.disabled=false;}
180
- this.updateSimpleForm();this.updateSaveInput();},updateSaveInput:function(){$(this.idPrefix+'save_attributes').value=this.attributes.toJSON();$(this.idPrefix+'save_links').value=this.links.toJSON();},initializeAdvicesForSimpleForm:function(){if($(this.idPrefix+'simple_form').advicesInited){return;}
181
- $(this.idPrefix+'simple_form').select('td.value').each(function(td){var adviceContainer=$(Builder.node('div'));td.appendChild(adviceContainer);td.select('input','select').each(function(element){element.advaiceContainer=adviceContainer;});});$(this.idPrefix+'simple_form').advicesInited=true;},quickCreateNewProduct:function(){this.initializeAdvicesForSimpleForm();$(this.idPrefix+'simple_form').removeClassName('ignore-validate');var validationResult=$(this.idPrefix+'simple_form').select('input','select','textarea').collect(function(elm){return Validation.validate(elm,{useTitle:false,onElementValidate:function(){}});}).all();$(this.idPrefix+'simple_form').addClassName('ignore-validate');if(!validationResult){return;}
182
- var params=Form.serializeElements($(this.idPrefix+'simple_form').select('input','select','textarea'),true);params.form_key=FORM_KEY;$('messages').update();new Ajax.Request(this.createQuickUrl,{parameters:params,method:'post',area:$(this.idPrefix+'simple_form'),onComplete:this.quickCreateNewProductComplete.bind(this)});},quickCreateNewProductComplete:function(transport){var result=transport.responseText.evalJSON();if(result.error){if(result.error.fields){$(this.idPrefix+'simple_form').removeClassName('ignore-validate');$H(result.error.fields).each(function(pair){$('simple_product_'+pair.key).value=pair.value;$('simple_product_'+pair.key+'_autogenerate').checked=false;toggleValueElements($('simple_product_'+pair.key+'_autogenerate'),$('simple_product_'+pair.key+'_autogenerate').parentNode);Validation.ajaxError($('simple_product_'+pair.key),result.error.message);});$(this.idPrefix+'simple_form').addClassName('ignore-validate');}else{if(result.error.message){alert(result.error.message);}else{alert(result.error);}}
183
- return;}else if(result.messages){$('messages').update(result.messages);}
184
- result.attributes.each(function(attribute){var attr=this.getAttributeById(attribute.attribute_id);if(!this.getValueByIndex(attr,attribute.value_index)&&result.pricing&&result.pricing[attr.attribute_code]){attribute.is_percent=result.pricing[attr.attribute_code].is_percent;attribute.pricing_value=(result.pricing[attr.attribute_code].value==null?'':result.pricing[attr.attribute_code].value);}}.bind(this));this.attributes.each(function(attribute){if($('simple_product_'+attribute.attribute_code)){$('simple_product_'+attribute.attribute_code).value='';}}.bind(this));this.links.set(result.product_id,result.attributes);this.updateGrid();this.updateValues();this.grid.reload();},checkCreationUniqueAttributes:function(){var attributes=[];this.attributes.each(function(attribute){attributes.push({attribute_id:attribute.attribute_id,value_index:$('simple_product_'+attribute.attribute_code).value});}.bind(this));return this.checkAttributes(attributes);},getAttributeByCode:function(attributeCode){var attribute=null;this.attributes.each(function(item){if(item.attribute_code==attributeCode){attribute=item;throw $break;}});return attribute;},getAttributeById:function(attributeId){var attribute=null;this.attributes.each(function(item){if(item.attribute_id==attributeId){attribute=item;throw $break;}});return attribute;},getValueByIndex:function(attribute,valueIndex){var result=null;attribute.values.each(function(value){if(value.value_index==valueIndex){result=value;throw $break;}});return result;},showPricing:function(select,attributeCode){var attribute=this.getAttributeByCode(attributeCode);if(!attribute){return;}
185
- select=$(select);if(select.value&&!$('simple_product_'+attributeCode+'_pricing_container')){Element.insert(select,{after:'<div class="left"></div> <div id="simple_product_'+attributeCode+'_pricing_container" class="left"></div>'});var newContainer=select.next('div');select.parentNode.removeChild(select);newContainer.appendChild(select);$(this.idPrefix+'simple_form').down('.form-list').style.width='100%';}
186
- var container=$('simple_product_'+attributeCode+'_pricing_container');if(select.value){var value=this.getValueByIndex(attribute,select.value);if(!value){if(!container.down('.attribute-price')){if(value==null){value={};}
187
- container.update(this.pricingValueTemplate.evaluate(value));var priceValueField=container.down('.attribute-price');var priceTypeField=container.down('.attribute-price-type');priceValueField.attributeCode=attributeCode;priceValueField.priceField=priceValueField;priceValueField.typeField=priceTypeField;priceTypeField.attributeCode=attributeCode;priceTypeField.priceField=priceValueField;priceTypeField.typeField=priceTypeField;Event.observe(priceValueField,'change',this.updateSimplePricing.bindAsEventListener(this));Event.observe(priceValueField,'keyup',this.updateSimplePricing.bindAsEventListener(this));Event.observe(priceTypeField,'change',this.updateSimplePricing.bindAsEventListener(this));$('simple_product_'+attributeCode+'_pricing_value').value=null;$('simple_product_'+attributeCode+'_pricing_type').value=null;}}else if(!isNaN(parseFloat(value.pricing_value))){container.update(this.pricingValueViewTemplate.evaluate({'value':(parseFloat(value.pricing_value)>0?'+':'')
188
- +parseFloat(value.pricing_value)
189
- +(parseInt(value.is_percent)>0?'%':'')}));$('simple_product_'+attributeCode+'_pricing_value').value=value.pricing_value;$('simple_product_'+attributeCode+'_pricing_type').value=value.is_percent;}else{container.update('');$('simple_product_'+attributeCode+'_pricing_value').value=null;$('simple_product_'+attributeCode+'_pricing_type').value=null;}}else if(container){container.update('');$('simple_product_'+attributeCode+'_pricing_value').value=null;$('simple_product_'+attributeCode+'_pricing_type').value=null;}},updateSimplePricing:function(evt){var element=Event.element(evt);if(!element.priceField.value.blank()){$('simple_product_'+element.attributeCode+'_pricing_value').value=element.priceField.value;$('simple_product_'+element.attributeCode+'_pricing_type').value=element.typeField.value;}else{$('simple_product_'+element.attributeCode+'_pricing_value').value=null;$('simple_product_'+element.attributeCode+'_pricing_type').value=null;}},updateSimpleForm:function(){this.attributes.each(function(attribute){if($('simple_product_'+attribute.attribute_code)){this.showPricing($('simple_product_'+attribute.attribute_code),attribute.attribute_code);}}.bind(this));},showNoticeMessage:function(){$('assign_product_warrning').show();}}
190
- var onInitDisableFieldsList=[];function toogleFieldEditMode(toogleIdentifier,fieldContainer){if($(toogleIdentifier).checked){enableFieldEditMode(fieldContainer);}else{disableFieldEditMode(fieldContainer);}}
191
- function disableFieldEditMode(fieldContainer){$(fieldContainer).disabled=true;if($(fieldContainer+'_hidden')){$(fieldContainer+'_hidden').disabled=true;}}
192
- function enableFieldEditMode(fieldContainer){$(fieldContainer).disabled=false;if($(fieldContainer+'_hidden')){$(fieldContainer+'_hidden').disabled=false;}}
193
- function initDisableFields(fieldContainer){onInitDisableFieldsList.push(fieldContainer);}
194
- function onCompleteDisableInited(){onInitDisableFieldsList.each(function(item){disableFieldEditMode(item);});}
195
- Event.observe(window,'load',onCompleteDisableInited);;Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")
196
- Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}
197
- Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")
198
- Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}
199
- Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.is_gecko=navigator.userAgent.match(/gecko/i);Calendar.getStyle=function(element,style){if(element.currentStyle){var y=element.currentStyle[style];}else if(window.getComputedStyle){var y=document.defaultView.getComputedStyle(element,null).getPropertyValue(style);}
200
- return y;};Calendar.getAbsolutePos=function(element){var res=new Object();res.x=0;res.y=0;do{res.x+=element.offsetLeft||0;res.y+=element.offsetTop||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Calendar.getStyle(element,'position');if(p!=='static')break;}}while(element);return res;if(element!==null){res.x=element.offsetLeft;res.y=element.offsetTop;var offsetParent=element.offsetParent;var parentNode=element.parentNode;while(offsetParent!==null){res.x+=offsetParent.offsetLeft;res.y+=offsetParent.offsetTop;if(offsetParent!=document.body&&offsetParent!=document.documentElement){res.x-=offsetParent.scrollLeft;res.y-=offsetParent.scrollTop;}
201
- if(Calendar.is_gecko){while(offsetParent!=parentNode&&parentNode!==null){res.x-=parentNode.scrollLeft;res.y-=parentNode.scrollTop;parentNode=parentNode.parentNode;}}
202
- parentNode=offsetParent.parentNode;offsetParent=offsetParent.offsetParent;}}
203
- return res;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}
204
- while(related){if(related==el){return true;}
205
- related=related.parentNode;}
206
- return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}
207
- var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}
208
- el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))
209
- f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)
210
- f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}
211
- return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}
212
- if(typeof parent!="undefined"){parent.appendChild(el);}
213
- return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}
214
- return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}
215
- return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}
216
- var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
217
- if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}
218
- var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)
219
- s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")
220
- mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}
221
- s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}
222
- var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}
223
- if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}
224
- cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}
225
- yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}
226
- if(show){var s=yc.style;s.display="block";if(cd.navtype<0)
227
- s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")
228
- ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}
229
- s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}
230
- if(cal.timeout){clearTimeout(cal.timeout);}
231
- var el=cal.activeDiv;if(!el){return false;}
232
- var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}
233
- var mon=Calendar.findMonth(target);var date=null;if(mon){date=new CalendarDateObject(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new CalendarDateObject(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}
234
- with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}
235
- var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))
236
- Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}
237
- ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else
238
- dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)
239
- if(range[i]==current)
240
- break;while(count-->0)
241
- if(decrease){if(--i<0)
242
- i=range.length-1;}else if(++i>=range.length)
243
- i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}
244
- var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
245
- Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
246
- var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}
247
- Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}
248
- return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}
249
- var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}
250
- cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}
251
- cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}
252
- cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}
253
- var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else
254
- addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}
255
- if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}
256
- return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}
257
- if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}
258
- el.calendar.tooltips.innerHTML=el.ttip;}
259
- if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}
260
- return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)
261
- return false;removeClass(el,"hilite");if(el.caldate)
262
- removeClass(el.parentNode,"rowhilite");if(el.calendar)
263
- el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}
264
- cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)
265
- cal._toggleMultipleDate(new CalendarDateObject(date));else
266
- newdate=!el.disabled;if(other_month)
267
- cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}
268
- date=new CalendarDateObject(cal.date);if(el.navtype==0)
269
- date.setDateOnly(new CalendarDateObject());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}
270
- date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}
271
- alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}
272
- break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}
273
- break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}
274
- break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}
275
- break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)
276
- if(range[i]==current)
277
- break;if(ev&&ev.shiftKey){if(--i<0)
278
- i=range.length-1;}else if(++i>=range.length)
279
- i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}
280
- break;}
281
- if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)
282
- newdate=closing=true;}
283
- if(newdate){ev&&cal.callHandler();}
284
- if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}
285
- this.date=this.dateStr?new CalendarDateObject(this.dateStr):new CalendarDateObject();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}
286
- div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)
287
- cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("&#x00d7;",1,200).ttip=Calendar._TT["CLOSE"];}
288
- row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}
289
- for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}
290
- this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}
291
- for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}
292
- if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||"&nbsp;";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")
293
- part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}
294
- Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)
295
- AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else
296
- cell.innerHTML="&nbsp;";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}
297
- H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)
298
- h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)
299
- h=0;}
300
- var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}
301
- var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}
302
- this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}
303
- div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}
304
- this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)
305
- return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new CalendarDateObject(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new CalendarDateObject(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)
306
- ne=cal.ar_days[y][x];else{x=6;K=38;continue;}
307
- break;case 38:if(--y>=0)
308
- ne=cal.ar_days[y][x];else{prevMonth();setVars();}
309
- break;case 39:if(++x<7)
310
- ne=cal.ar_days[y][x];else{x=0;K=40;continue;}
311
- break;case 40:if(++y<cal.ar_days.length)
312
- ne=cal.ar_days[y][x];else{nextMonth();setVars();}
313
- break;}
314
- break;}
315
- if(ne){if(!ne.disabled)
316
- Calendar.cellClick(ne);else if(prev)
317
- prevMonth();else
318
- nextMonth();}}
319
- break;case 13:if(act)
320
- Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}
321
- return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new CalendarDateObject(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}
322
- this.firstDayOfWeek=firstDayOfWeek;this.date=new CalendarDateObject(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)
323
- day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}
324
- row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML="&nbsp;";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}
325
- cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)
326
- dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)
327
- cell.title=toolTip;}
328
- if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))
329
- cell.disabled=true;cell.className+=" "+status;}}
330
- if(!cell.disabled){cell.caldate=new CalendarDateObject(date);cell.ttip="_";if(!this.multiple&&current_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}
331
- if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}
332
- if(weekend.indexOf(wday.toString())!=-1)
333
- cell.className+=cell.otherMonth?" oweekend":" weekend";}}
334
- if(!(hasdays||this.showsOtherMonths))
335
- row.className="emptyrow";}
336
- this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)
337
- continue;if(cell)
338
- cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}
339
- this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}
340
- var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}
341
- this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}
342
- this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}
343
- this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}
344
- function fixPosition(box){if(box.x<0)
345
- box.x=0;if(box.y<0)
346
- box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}
347
- var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}
348
- switch(valign){case"T":p.y-=h;break;case"B":p.y+=el.offsetHeight;break;case"C":p.y+=(el.offsetHeight-h)/2;break;case"t":p.y+=el.offsetHeight-h;break;case"b":break;}
349
- switch(halign){case"L":p.x-=w;break;case"R":p.x+=el.offsetWidth;break;case"C":p.x+=(el.offsetWidth-w)/2;break;case"l":p.x+=el.offsetWidth-w;break;case"r":break;}
350
- p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)
351
- setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else
352
- Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)
353
- fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)
354
- return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)
355
- value=document.defaultView.getComputedStyle(obj,"").getPropertyValue("visibility");else
356
- value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else
357
- value='';}
358
- return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}
359
- cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}
360
- cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}
361
- if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}
362
- cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}
363
- this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}
364
- var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new CalendarDateObject();var y=0;var m=-1;var d=0;var a=str;var i;for(i=0;i<Calendar._MN.length;i++){a=a.replace(Calendar._MN[i],enUS.m.wide[i]);}
365
- for(i=0;i<Calendar._SMN.length;i++){a=a.replace(Calendar._SMN[i],enUS.m.abbr[i]);}
366
- a=a.replace(Calendar._am,'am');a=a.replace(Calendar._am.toLowerCase(),'am');a=a.replace(Calendar._pm,'pm');a=a.replace(Calendar._pm.toLowerCase(),'pm');a=a.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])
367
- continue;switch(b[i]){case"%d":case"%e":d=parseInt(a[i],10);break;case"%m":m=parseInt(a[i],10)-1;break;case"%Y":case"%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case"%b":for(j=0;j<12;++j){if(enUS.m.abbr[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}
368
- break;case"%B":for(j=0;j<12;++j){if(enUS.m.wide[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}
369
- break;case"%H":case"%I":case"%k":case"%l":hr=parseInt(a[i],10);break;case"%P":case"%p":if(/pm/i.test(a[i])&&hr<12)
370
- hr+=12;else if(/am/i.test(a[i])&&hr>=12)
371
- hr-=12;break;case"%M":min=parseInt(a[i],10);break;}}
372
- if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)
373
- return new CalendarDateObject(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}
374
- if(t!=-1){if(m!=-1){d=m+1;}
375
- m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}
376
- if(y==0)
377
- y=today.getFullYear();if(m!=-1&&d!=0)
378
- return new CalendarDateObject(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}
379
- if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new CalendarDateObject(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new CalendarDateObject(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new CalendarDateObject(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new CalendarDateObject(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)
380
- ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?Calendar._pm.toUpperCase():Calendar._am.toUpperCase();s["%P"]=pm?Calendar._pm.toLowerCase():Calendar._am.toLowerCase();s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)
381
- return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}
382
- return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new CalendarDateObject(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())
383
- this.setDate(28);this.__msh_oldSetFullYear(y);};CalendarDateObject.prototype=new Date();CalendarDateObject.prototype.constructor=CalendarDateObject;CalendarDateObject.prototype.parent=Date.prototype;function CalendarDateObject(){var dateObj;if(arguments.length>1){dateObj=eval("new this.parent.constructor("+Array.prototype.slice.call(arguments).join(",")+");");}else if(arguments.length>0){dateObj=new this.parent.constructor(arguments[0]);}else{dateObj=new this.parent.constructor();if(typeof(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS)!="undefined"){dateObj.setTime(dateObj.getTime()+(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS-dateObj.getTimezoneOffset())*1000);}}
384
- return dateObj;}
385
- window._dynarch_popupCalendar=null;;Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;};;Ext={};window["undefined"]=window["undefined"];Ext.apply=function(o,c,_3){if(_3){Ext.apply(o,_3);}if(o&&c&&typeof c=="object"){for(var p in c){o[p]=c[p];}}return o;};(function(){var _5=0;var ua=navigator.userAgent.toLowerCase();var _7=document.compatMode=="CSS1Compat",_8=ua.indexOf("opera")>-1,_9=(/webkit|khtml/).test(ua),_a=ua.indexOf("msie")>-1,_b=ua.indexOf("msie 7")>-1,_c=!_9&&ua.indexOf("gecko")>-1,_d=_a&&!_7,_e=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),_f=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),_10=window.location.href.toLowerCase().indexOf("https")===0;if(_a&&!_b){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}Ext.apply(Ext,{isStrict:_7,isSecure:_10,isReady:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p];}}}return o;},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o);});return;}var _15={};for(var b in o){var _17=b.split("@");if(_17[1]){var s=_17[0];if(!_15[s]){_15[s]=Ext.select(s);}_15[s].on(_17[1],o[b]);}}_15=null;},id:function(el,_1a){_1a=_1a||"ext-gen";el=Ext.getDom(el);var id=_1a+(++_5);return el?(el.id?el.id:(el.id=id)):id;},extend:function(){var io=function(o){for(var m in o){this[m]=o[m];}};return function(sb,sp,_21){if(typeof sp=="object"){_21=sp;sp=sb;sb=function(){sp.apply(this,arguments);};}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==Object.prototype.constructor){spp.constructor=sp;}sb.override=function(o){Ext.override(sb,o);};sbp.override=io;sbp.__extcls=sb;Ext.override(sb,_21);return sb;};}(),override:function(_26,_27){if(_27){var p=_26.prototype;for(var _29 in _27){p[_29]=_27[_29];}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+" == \"undefined\"){"+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}},urlEncode:function(o){if(!o){return"";}var buf=[];for(var key in o){var ov=o[key];var _34=typeof ov;if(_34=="undefined"){buf.push(encodeURIComponent(key),"=&");}else{if(_34!="function"&&_34!="object"){buf.push(encodeURIComponent(key),"=",encodeURIComponent(ov),"&");}else{if(ov instanceof Array){for(var i=0,len=ov.length;i<len;i++){buf.push(encodeURIComponent(key),"=",encodeURIComponent(ov[i]===undefined?"":ov[i]),"&");}}}}}buf.pop();return buf.join("");},urlDecode:function(_37,_38){if(!_37||!_37.length){return{};}var obj={};var _3a=_37.split("&");var _3b,_3c,_3d;for(var i=0,len=_3a.length;i<len;i++){_3b=_3a[i].split("=");_3c=decodeURIComponent(_3b[0]);_3d=decodeURIComponent(_3b[1]);if(_38!==true){if(typeof obj[_3c]=="undefined"){obj[_3c]=_3d;}else{if(typeof obj[_3c]=="string"){obj[_3c]=[obj[_3c]];obj[_3c].push(_3d);}else{obj[_3c].push(_3d);}}}else{obj[_3c]=_3d;}}return obj;},each:function(_40,fn,_42){if(typeof _40.length=="undefined"||typeof _40=="string"){_40=[_40];}for(var i=0,len=_40.length;i<len;i++){if(fn.call(_42||_40[i],_40[i],i,_40)===false){return i;}}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(a instanceof Array){r=r.concat(a);}else{if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0));}else{r.push(a);}}}return r;},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");},callback:function(cb,_4c,_4d,_4e){if(typeof cb=="function"){if(_4e){cb.defer(_4e,_4c,_4d||[]);}else{cb.apply(_4c,_4d||[]);}}},getDom:function(el){if(!el){return null;}return el.dom?el.dom:(typeof el=="string"?document.getElementById(el):el);},getCmp:function(id){return Ext.ComponentMgr.get(id);},num:function(v,_52){if(typeof v!="number"){return _52;}return v;},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;i++){var as=a[i];if(as){if(as.dom){as.removeAllListeners();as.remove();continue;}if(typeof as.purgeListeners=="function"){as.purgeListeners();}if(typeof as.destroy=="function"){as.destroy();}}}},isOpera:_8,isSafari:_9,isIE:_a,isIE7:_b,isGecko:_c,isBorderBox:_d,isWindows:_e,isMac:_f,useShims:((_a&&!_b)||(_c&&_f))});})();Ext.namespace("Ext","Ext.util","Ext.grid","Ext.dd","Ext.tree","Ext.data","Ext.form","Ext.menu","Ext.state","Ext.lib","Ext.layout");Ext.apply(Function.prototype,{createCallback:function(){var _57=arguments;var _58=this;return function(){return _58.apply(window,_57);};},createDelegate:function(obj,_5a,_5b){var _5c=this;return function(){var _5d=_5a||arguments;if(_5b===true){_5d=Array.prototype.slice.call(arguments,0);_5d=_5d.concat(_5a);}else{if(typeof _5b=="number"){_5d=Array.prototype.slice.call(arguments,0);var _5e=[_5b,0].concat(_5a);Array.prototype.splice.apply(_5d,_5e);}}return _5c.apply(obj||window,_5d);};},defer:function(_5f,obj,_61,_62){var fn=this.createDelegate(obj,_61,_62);if(_5f){return setTimeout(fn,_5f);}fn();return 0;},createSequence:function(fcn,_65){if(typeof fcn!="function"){return this;}var _66=this;return function(){var _67=_66.apply(this||window,arguments);fcn.apply(_65||this||window,arguments);return _67;};},createInterceptor:function(fcn,_69){if(typeof fcn!="function"){return this;}var _6a=this;return function(){fcn.target=this;fcn.method=_6a;if(fcn.apply(_69||this||window,arguments)===false){return;}return _6a.apply(this||window,arguments);};}});Ext.applyIf(String,{escape:function(_6b){return _6b.replace(/('|\\)/g,"\\$1");},leftPad:function(val,_6d,ch){var _6f=new String(val);if(ch==null){ch=" ";}while(_6f.length<_6d){_6f=ch+_6f;}return _6f;},format:function(_70){var _71=Array.prototype.slice.call(arguments,1);return _70.replace(/\{(\d+)\}/g,function(m,i){return _71[i];});}});String.prototype.toggle=function(_74,_75){return this==_74?_75:_74;};Ext.applyIf(Number.prototype,{constrain:function(min,max){return Math.min(Math.max(this,min),max);}});Ext.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,len=this.length;i<len;i++){if(this[i]==o){return i;}}return-1;},remove:function(o){var _7c=this.indexOf(o);if(_7c!=-1){this.splice(_7c,1);}}});Date.prototype.getElapsed=function(_7d){return Math.abs((_7d||new Date()).getTime()-this.getTime());};(function(){var _1;Ext.lib.Dom={getViewWidth:function(_2){return _2?this.getDocumentWidth():this.getViewportWidth();},getViewHeight:function(_3){return _3?this.getDocumentHeight():this.getViewportHeight();},getDocumentHeight:function(){var _4=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(_4,this.getViewportHeight());},getDocumentWidth:function(){var _5=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(_5,this.getViewportWidth());},getViewportHeight:function(){var _6=self.innerHeight;var _7=document.compatMode;if((_7||Ext.isIE)&&!Ext.isOpera){_6=(_7=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return _6;},getViewportWidth:function(){var _8=self.innerWidth;var _9=document.compatMode;if(_9||Ext.isIE){_8=(_9=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return _8;},isAncestor:function(p,c){p=Ext.getDom(p);c=Ext.getDom(c);if(!p||!c){return false;}if(p.contains&&!Ext.isSafari){return p.contains(c);}else{if(p.compareDocumentPosition){return!!(p.compareDocumentPosition(c)&16);}else{var _c=c.parentNode;while(_c){if(_c==p){return true;}else{if(!_c.tagName||_c.tagName.toUpperCase()=="HTML"){return false;}}_c=_c.parentNode;}return false;}}},getRegion:function(el){return Ext.lib.Region.getRegion(el);},getY:function(el){return this.getXY(el)[1];},getX:function(el){return this.getXY(el)[0];},getXY:function(el){var p,pe,b,_14,bd=document.body;el=Ext.getDom(el);if(el.getBoundingClientRect){b=el.getBoundingClientRect();_14=fly(document).getScroll();return[b.left+_14.left,b.top+_14.top];}else{var x=el.offsetLeft,y=el.offsetTop;p=el.offsetParent;var _18=false;if(p!=el){while(p){x+=p.offsetLeft;y+=p.offsetTop;if(Ext.isSafari&&!_18&&fly(p).getStyle("position")=="absolute"){_18=true;}if(Ext.isGecko){pe=fly(p);var bt=parseInt(pe.getStyle("borderTopWidth"),10)||0;var bl=parseInt(pe.getStyle("borderLeftWidth"),10)||0;x+=bl;y+=bt;if(p!=el&&pe.getStyle("overflow")!="visible"){x+=bl;y+=bt;}}p=p.offsetParent;}}if(Ext.isSafari&&(_18||fly(el).getStyle("position")=="absolute")){x-=bd.offsetLeft;y-=bd.offsetTop;}}p=el.parentNode;while(p&&p!=bd){if(!Ext.isOpera||(Ext.isOpera&&p.tagName!="TR"&&fly(p).getStyle("display")!="inline")){x-=p.scrollLeft;y-=p.scrollTop;}p=p.parentNode;}return[x,y];},setXY:function(el,xy){el=Ext.fly(el,"_setXY");el.position();var pts=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=pts.left+"px";}if(xy[1]!==false){el.dom.style.top=pts.top+"px";}},setX:function(el,x){this.setXY(el,[x,false]);},setY:function(el,y){this.setXY(el,[false,y]);}};Ext.lib.Event={getPageX:function(e){return Event.pointerX(e.browserEvent||e);},getPageY:function(e){return Event.pointerY(e.browserEvent||e);},getXY:function(e){e=e.browserEvent||e;return[Event.pointerX(e),Event.pointerY(e)];},getTarget:function(e){return Event.element(e.browserEvent||e);},resolveTextNode:function(_26){if(_26&&3==_26.nodeType){return _26.parentNode;}else{return _26;}},getRelatedTarget:function(ev){ev=ev.browserEvent||ev;var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},on:function(el,_2a,fn){Event.observe(el,_2a,fn,false);},un:function(el,_2d,fn){Event.stopObserving(el,_2d,fn,false);},purgeElement:function(el){},preventDefault:function(e){e=e.browserEvent||e;if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}},stopPropagation:function(e){e=e.browserEvent||e;if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble=true;}},stopEvent:function(e){Event.stop(e.browserEvent||e);},onAvailable:function(el,fn,_35,_36){var _37=new Date(),iid;var f=function(){if(_37.getElapsed()>10000){clearInterval(iid);}var el=document.getElementById(id);if(el){clearInterval(iid);fn.call(_35||window,el);}};iid=setInterval(f,50);}};Ext.lib.Ajax=function(){var _3b=function(cb){return cb.success?function(xhr){cb.success.call(cb.scope||window,{responseText:xhr.responseText,responseXML:xhr.responseXML,argument:cb.argument});}:Ext.emptyFn;};var _3e=function(cb){return cb.failure?function(xhr){cb.failure.call(cb.scope||window,{responseText:xhr.responseText,responseXML:xhr.responseXML,argument:cb.argument});}:Ext.emptyFn;};return{request:function(_41,uri,cb,_44){new Ajax.Request(uri,{method:_41,parameters:_44||"",timeout:cb.timeout,onSuccess:_3b(cb),onFailure:_3e(cb)});},formRequest:function(_45,uri,cb,_48,_49,_4a){new Ajax.Request(uri,{method:Ext.getDom(_45).method||"POST",parameters:Form.serialize(_45)+(_48?"&"+_48:""),timeout:cb.timeout,onSuccess:_3b(cb),onFailure:_3e(cb)});},isCallInProgress:function(_4b){return false;},abort:function(_4c){return false;},serializeForm:function(_4d){return Form.serialize(_4d.dom||_4d,true);}};}();Ext.lib.Anim=function(){var _4e={easeOut:function(pos){return 1-Math.pow(1-pos,2);},easeIn:function(pos){return 1-Math.pow(1-pos,2);}};var _51=function(cb,_53){return{stop:function(_54){this.effect.cancel();},isAnimated:function(){return this.effect.state=="running";},proxyCallback:function(){Ext.callback(cb,_53);}};};return{scroll:function(el,_56,_57,_58,cb,_5a){var _5b=_51(cb,_5a);el=Ext.getDom(el);el.scrollLeft=_56.to[0];el.scrollTop=_56.to[1];_5b.proxyCallback();return _5b;},motion:function(el,_5d,_5e,_5f,cb,_61){return this.run(el,_5d,_5e,_5f,cb,_61);},color:function(el,_63,_64,_65,cb,_67){return this.run(el,_63,_64,_65,cb,_67);},run:function(el,_69,_6a,_6b,cb,_6d,_6e){var o={};for(var k in _69){switch(k){case"points":var by,pts,e=Ext.fly(el,"_animrun");e.position();if(by=_69.points.by){var xy=e.getXY();pts=e.translatePoints([xy[0]+by[0],xy[1]+by[1]]);}else{pts=e.translatePoints(_69.points.to);}o.left=pts.left+"px";o.top=pts.top+"px";break;case"width":o.width=_69.width.to+"px";break;case"height":o.height=_69.height.to+"px";break;case"opacity":o.opacity=String(_69.opacity.to);break;default:o[k]=String(_69[k].to);break;}}var _75=_51(cb,_6d);_75.effect=new Effect.Morph(Ext.id(el),{duration:_6a,afterFinish:_75.proxyCallback,transition:_4e[_6b]||Effect.Transitions.linear,style:o});return _75;}};}();function fly(el){if(!_1){_1=new Ext.Element.Flyweight();}_1.dom=el;return _1;}Ext.lib.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};Ext.lib.Region.prototype={contains:function(_7b){return(_7b.left>=this.left&&_7b.right<=this.right&&_7b.top>=this.top&&_7b.bottom<=this.bottom);},getArea:function(){return((this.bottom-this.top)*(this.right-this.left));},intersect:function(_7c){var t=Math.max(this.top,_7c.top);var r=Math.min(this.right,_7c.right);var b=Math.min(this.bottom,_7c.bottom);var l=Math.max(this.left,_7c.left);if(b>=t&&r>=l){return new Ext.lib.Region(t,r,b,l);}else{return null;}},union:function(_81){var t=Math.min(this.top,_81.top);var r=Math.max(this.right,_81.right);var b=Math.max(this.bottom,_81.bottom);var l=Math.min(this.left,_81.left);return new Ext.lib.Region(t,r,b,l);},adjust:function(t,l,b,r){this.top+=t;this.left+=l;this.right+=r;this.bottom+=b;return this;}};Ext.lib.Region.getRegion=function(el){var p=Ext.lib.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new Ext.lib.Region(t,r,b,l);};Ext.lib.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};Ext.lib.Point.prototype=new Ext.lib.Region();if(Ext.isIE){Event.observe(window,"unload",function(){var p=Function.prototype;delete p.createSequence;delete p.defer;delete p.createDelegate;delete p.createCallback;delete p.createInterceptor;});}})();Ext.DomHelper=function(){var _1=null;var _2=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var _3=function(o){if(typeof o=="string"){return o;}var b="";if(!o.tag){o.tag="div";}b+="<"+o.tag;for(var _6 in o){if(_6=="tag"||_6=="children"||_6=="cn"||_6=="html"||typeof o[_6]=="function"){continue;}if(_6=="style"){var s=o["style"];if(typeof s=="function"){s=s.call();}if(typeof s=="string"){b+=" style=\""+s+"\"";}else{if(typeof s=="object"){b+=" style=\"";for(var _8 in s){if(typeof s[_8]!="function"){b+=_8+":"+s[_8]+";";}}b+="\"";}}}else{if(_6=="cls"){b+=" class=\""+o["cls"]+"\"";}else{if(_6=="htmlFor"){b+=" for=\""+o["htmlFor"]+"\"";}else{b+=" "+_6+"=\""+o[_6]+"\"";}}}}if(_2.test(o.tag)){b+="/>";}else{b+=">";var cn=o.children||o.cn;if(cn){if(cn instanceof Array){for(var i=0,_b=cn.length;i<_b;i++){b+=_3(cn[i],b);}}else{b+=_3(cn,b);}}if(o.html){b+=o.html;}b+="</"+o.tag+">";}return b;};var _c=function(o,_e){var el=document.createElement(o.tag);var _10=el.setAttribute?true:false;for(var _11 in o){if(_11=="tag"||_11=="children"||_11=="cn"||_11=="html"||_11=="style"||typeof o[_11]=="function"){continue;}if(_11=="cls"){el.className=o["cls"];}else{if(_10){el.setAttribute(_11,o[_11]);}else{el[_11]=o[_11];}}}Ext.DomHelper.applyStyles(el,o.style);var cn=o.children||o.cn;if(cn){if(cn instanceof Array){for(var i=0,len=cn.length;i<len;i++){_c(cn[i],el);}}else{_c(cn,el);}}if(o.html){el.innerHTML=o.html;}if(_e){_e.appendChild(el);}return el;};var _15=function(_16,s,h,e){_1.innerHTML=[s,h,e].join("");var i=-1,el=_1;while(++i<_16){el=el.firstChild;}return el;};var ts="<table>",te="</table>",tbs=ts+"<tbody>",tbe="</tbody>"+te,trs=tbs+"<tr>",tre="</tr>"+tbe;var _22=function(tag,_24,el,_26){if(!_1){_1=document.createElement("div");}var _27;var _28=null;if(tag=="td"){if(_24=="afterbegin"||_24=="beforeend"){return;}if(_24=="beforebegin"){_28=el;el=el.parentNode;}else{_28=el.nextSibling;el=el.parentNode;}_27=_15(4,trs,_26,tre);}else{if(tag=="tr"){if(_24=="beforebegin"){_28=el;el=el.parentNode;_27=_15(3,tbs,_26,tbe);}else{if(_24=="afterend"){_28=el.nextSibling;el=el.parentNode;_27=_15(3,tbs,_26,tbe);}else{if(_24=="afterbegin"){_28=el.firstChild;}_27=_15(4,trs,_26,tre);}}}else{if(tag=="tbody"){if(_24=="beforebegin"){_28=el;el=el.parentNode;_27=_15(2,ts,_26,te);}else{if(_24=="afterend"){_28=el.nextSibling;el=el.parentNode;_27=_15(2,ts,_26,te);}else{if(_24=="afterbegin"){_28=el.firstChild;}_27=_15(3,tbs,_26,tbe);}}}else{if(_24=="beforebegin"||_24=="afterend"){return;}if(_24=="afterbegin"){_28=el.firstChild;}_27=_15(2,ts,_26,te);}}}el.insertBefore(_27,_28);return _27;};return{useDom:false,markup:function(o){return _3(o);},applyStyles:function(el,_2b){if(_2b){el=Ext.fly(el);if(typeof _2b=="string"){var re=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var _2d;while((_2d=re.exec(_2b))!=null){el.setStyle(_2d[1],_2d[2]);}}else{if(typeof _2b=="object"){for(var _2e in _2b){el.setStyle(_2e,_2b[_2e]);}}else{if(typeof _2b=="function"){Ext.DomHelper.applyStyles(el,_2b.call());}}}}},insertHtml:function(_2f,el,_31){_2f=_2f.toLowerCase();if(el.insertAdjacentHTML){var tag=el.tagName.toLowerCase();if(tag=="table"||tag=="tbody"||tag=="tr"||tag=="td"){var rs;if(rs=_22(tag,_2f,el,_31)){return rs;}}switch(_2f){case"beforebegin":el.insertAdjacentHTML(_2f,_31);return el.previousSibling;case"afterbegin":el.insertAdjacentHTML(_2f,_31);return el.firstChild;case"beforeend":el.insertAdjacentHTML(_2f,_31);return el.lastChild;case"afterend":el.insertAdjacentHTML(_2f,_31);return el.nextSibling;}throw"Illegal insertion point -> \""+_2f+"\"";}var _34=el.ownerDocument.createRange();var _35;switch(_2f){case"beforebegin":_34.setStartBefore(el);_35=_34.createContextualFragment(_31);el.parentNode.insertBefore(_35,el);return el.previousSibling;case"afterbegin":if(el.firstChild){_34.setStartBefore(el.firstChild);_35=_34.createContextualFragment(_31);el.insertBefore(_35,el.firstChild);return el.firstChild;}else{el.innerHTML=_31;return el.firstChild;}case"beforeend":if(el.lastChild){_34.setStartAfter(el.lastChild);_35=_34.createContextualFragment(_31);el.appendChild(_35);return el.lastChild;}else{el.innerHTML=_31;return el.lastChild;}case"afterend":_34.setStartAfter(el);_35=_34.createContextualFragment(_31);el.parentNode.insertBefore(_35,el.nextSibling);return el.nextSibling;}throw"Illegal insertion point -> \""+_2f+"\"";},insertBefore:function(el,o,_38){return this.doInsert(el,o,_38,"beforeBegin");},insertAfter:function(el,o,_3b){return this.doInsert(el,o,_3b,"afterEnd","nextSibling");},insertFirst:function(el,o,_3e){return this.doInsert(el,o,_3e,"afterBegin");},doInsert:function(el,o,_41,pos,_43){el=Ext.getDom(el);var _44;if(this.useDom){_44=_c(o,null);el.parentNode.insertBefore(_44,_43?el[_43]:el);}else{var _45=_3(o);_44=this.insertHtml(pos,el,_45);}return _41?Ext.get(_44,true):_44;},append:function(el,o,_48){el=Ext.getDom(el);var _49;if(this.useDom){_49=_c(o,null);el.appendChild(_49);}else{var _4a=_3(o);_49=this.insertHtml("beforeEnd",el,_4a);}return _48?Ext.get(_49,true):_49;},overwrite:function(el,o,_4d){el=Ext.getDom(el);el.innerHTML=_3(o);return _4d?Ext.get(el.firstChild,true):el.firstChild;},createTemplate:function(o){var _4f=_3(o);return new Ext.Template(_4f);}};}();Ext.Template=function(_1){if(_1 instanceof Array){_1=_1.join("");}else{if(arguments.length>1){_1=Array.prototype.join.call(arguments,"");}}this.html=_1;};Ext.Template.prototype={applyTemplate:function(_2){if(this.compiled){return this.compiled(_2);}var _3=this.disableFormats!==true;var fm=Ext.util.Format,_5=this;var fn=function(m,_8,_9,_a){if(_9&&_3){if(_9.substr(0,5)=="this."){return _5.call(_9.substr(5),_2[_8]);}else{if(_a){var re=/^\s*['"](.*)["']\s*$/;_a=_a.split(",");for(var i=0,_d=_a.length;i<_d;i++){_a[i]=_a[i].replace(re,"$1");}_a=[_2[_8]].concat(_a);}else{_a=[_2[_8]];}return fm[_9].apply(fm,_a);}}else{return _2[_8]!==undefined?_2[_8]:"";}};return this.html.replace(this.re,fn);},set:function(_e,_f){this.html=_e;this.compiled=null;if(_f){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Ext.util.Format;var _11=this.disableFormats!==true;var sep=Ext.isGecko?"+":",";var fn=function(m,_15,_16,_17){if(_16&&_11){_17=_17?","+_17:"";if(_16.substr(0,5)!="this."){_16="fm."+_16+"(";}else{_16="this.call(\""+_16.substr(5)+"\", ";_17="";}}else{_17="",_16="(values['"+_15+"'] == undefined ? '' : ";}return"'"+sep+_16+"values['"+_15+"']"+_17+")"+sep+"'";};var _18;if(Ext.isGecko){_18="this.compiled = function(values){ return '"+this.html.replace(/(\r\n|\n)/g,"\\n").replace("'","\\'").replace(this.re,fn)+"';};";}else{_18=["this.compiled = function(values){ return ['"];_18.push(this.html.replace(/(\r\n|\n)/g,"\\n").replace("'","\\'").replace(this.re,fn));_18.push("'].join('');};");_18=_18.join("");}eval(_18);return this;},call:function(_19,_1a){return this[_19](_1a);},insertFirst:function(el,_1c,_1d){return this.doInsert("afterBegin",el,_1c,_1d);},insertBefore:function(el,_1f,_20){return this.doInsert("beforeBegin",el,_1f,_20);},insertAfter:function(el,_22,_23){return this.doInsert("afterEnd",el,_22,_23);},append:function(el,_25,_26){return this.doInsert("beforeEnd",el,_25,_26);},doInsert:function(_27,el,_29,_2a){el=Ext.getDom(el);var _2b=Ext.DomHelper.insertHtml(_27,el,this.applyTemplate(_29));return _2a?Ext.get(_2b,true):_2b;},overwrite:function(el,_2d,_2e){el=Ext.getDom(el);el.innerHTML=this.applyTemplate(_2d);return _2e?Ext.get(el.firstChild,true):el.firstChild;}};Ext.Template.prototype.apply=Ext.Template.prototype.applyTemplate;Ext.DomHelper.Template=Ext.Template;Ext.Template.from=function(el){el=Ext.getDom(el);return new Ext.Template(el.value||el.innerHTML);};Ext.MasterTemplate=function(){Ext.MasterTemplate.superclass.constructor.apply(this,arguments);this.originalHtml=this.html;var st={};var m,re=this.subTemplateRe;re.lastIndex=0;var _33=0;while(m=re.exec(this.html)){var _34=m[1],_35=m[2];st[_33]={name:_34,index:_33,buffer:[],tpl:new Ext.Template(_35)};if(_34){st[_34]=st[_33];}st[_33].tpl.compile();st[_33].tpl.call=this.call.createDelegate(this);_33++;}this.subCount=_33;this.subs=st;};Ext.extend(Ext.MasterTemplate,Ext.Template,{subTemplateRe:/<tpl(?:\sname="([\w-]+)")?>((?:.|\n)*?)<\/tpl>/gi,add:function(_36,_37){if(arguments.length==1){_37=arguments[0];_36=0;}var s=this.subs[_36];s.buffer[s.buffer.length]=s.tpl.apply(_37);return this;},fill:function(_39,_3a,_3b){var a=arguments;if(a.length==1||(a.length==2&&typeof a[1]=="boolean")){_3a=a[0];_39=0;_3b=a[1];}if(_3b){this.reset();}for(var i=0,len=_3a.length;i<len;i++){this.add(_39,_3a[i]);}return this;},reset:function(){var s=this.subs;for(var i=0;i<this.subCount;i++){s[i].buffer=[];}return this;},applyTemplate:function(_41){var s=this.subs;var _43=-1;this.html=this.originalHtml.replace(this.subTemplateRe,function(m,_45){return s[++_43].buffer.join("");});return Ext.MasterTemplate.superclass.applyTemplate.call(this,_41);},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Ext.MasterTemplate.prototype.addAll=Ext.MasterTemplate.prototype.fill;Ext.MasterTemplate.from=function(el){el=Ext.getDom(el);return new Ext.MasterTemplate(el.value||el.innerHTML);};Ext.DomQuery=function(){var _1={},_2={},_3={};var _4=/\S/;var _5=/^\s+|\s+$/g;var _6=/\{(\d+)\}/g;var _7=/^(\s?[\/>]\s?|\s|$)/;var _8=/^(#)?([\w-\*]+)/;function child(p,_a){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==_a){return n;}}n=n.nextSibling;}return null;}function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}return n;}function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}return n;}function clean(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!_4.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}return this;}function byClassName(c,a,v,re,cn){if(!v){return c;}var r=[];for(var i=0,ci;ci=c[i];i++){cn=ci.className;if(cn&&(" "+cn+" ").indexOf(v)!=-1){r[r.length]=ci;}}return r;}function attrValue(n,_1c){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];}if(!n){return null;}if(_1c=="for"){return n.htmlFor;}if(_1c=="class"||_1c=="className"){return n.className;}return n.getAttribute(_1c)||n[_1c];}function getNodes(ns,_1e,_1f){var _20=[],cs;if(!ns){return _20;}_1e=_1e?_1e.replace(_5,""):"";_1f=_1f||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];}if(_1e!="/"&&_1e!=">"){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(_1f);for(var j=0,ci;ci=cs[j];j++){_20[_20.length]=ci;}}}else{for(var i=0,ni;ni=ns[i];i++){var cn=ni.getElementsByTagName(_1f);for(var j=0,cj;cj=cn[j];j++){if(cj.parentNode==ni){_20[_20.length]=cj;}}}}return _20;}function concat(a,b){if(b.slice){return a.concat(b);}for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i];}return a;}function byTag(cs,_2d){if(cs.tagName||cs==document){cs=[cs];}if(!_2d){return cs;}var r=[];_2d=_2d.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==_2d){r[r.length]=ci;}}return r;}function byId(cs,_32,id){if(cs.tagName||cs==document){cs=[cs];}if(!id){return cs;}var r=[];for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[r.length]=ci;return r;}}return r;}function byAttribute(cs,_38,_39,op,_3b){var r=[],st=_3b=="{";var f=Ext.DomQuery.operators[op];for(var i=0;ci=cs[i];i++){var a;if(st){a=Ext.DomQuery.getStyle(ci,_38);}else{if(_38=="class"||_38=="className"){a=ci.className;}else{if(_38=="for"){a=ci.htmlFor;}else{if(_38=="href"){a=ci.getAttribute("href",2);}else{a=ci.getAttribute(_38);}}}}if((f&&f(a,_39))||(!f&&a)){r[r.length]=ci;}}return r;}function byPseudo(cs,_42,_43){return Ext.DomQuery.pseudos[_42](cs,_43);}var _44=window.ActiveXObject?true:false;var key=30803;function nodupIEXml(cs){var d=++key;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup");}return r;}function nodup(cs){if(!cs){return[];}var len=cs.length,c,i,r=cs,cj;if(!len||typeof cs.nodeType!="undefined"||len==1){return cs;}if(_44&&typeof cs[0].selectSingleNode!="undefined"){return nodupIEXml(cs);}var d=++key;cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d;}else{r=[];for(var j=0;j<i;j++){r[r.length]=cs[j];}for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[r.length]=cj;}}return r;}}return r;}function quickDiffIEXml(c1,c2){var d=++key;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d);}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff");}return r;}function quickDiff(c1,c2){var _5c=c1.length;if(!_5c){return c2;}if(_44&&c1[0].selectSingleNode){return quickDiffIEXml(c1,c2);}var d=++key;for(var i=0;i<_5c;i++){c1[i]._qdiff=d;}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}return r;}function quickId(ns,_62,_63,id){if(ns==_63){var d=_63.ownerDocument||_63;return d.getElementById(id);}ns=getNodes(ns,_62,"*");return byId(ns,null,id);}return{getStyle:function(el,_67){return Ext.fly(el).getStyle(_67);},compile:function(_68,_69){while(_68.substr(0,1)=="/"){_68=_68.substr(1);}_69=_69||"select";var fn=["var f = function(root){\n var mode; var n = root || document;\n"];var q=_68,_6c,lq;var tk=Ext.DomQuery.matchers;var _6f=tk.length;var mm;while(q&&lq!=q){lq=q;var tm=q.match(_8);if(_69=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]="n = quickId(n, mode, root, \""+tm[2]+"\");";}else{fn[fn.length]="n = getNodes(n, mode, \""+tm[2]+"\");";}q=q.replace(tm[0],"");}else{if(q.substr(0,1)!="@"){fn[fn.length]="n = getNodes(n, mode, \"*\");";}}}else{if(tm){if(tm[1]=="#"){fn[fn.length]="n = byId(n, null, \""+tm[2]+"\");";}else{fn[fn.length]="n = byTag(n, \""+tm[2]+"\");";}q=q.replace(tm[0],"");}}while(!(mm=q.match(_7))){var _72=false;for(var j=0;j<_6f;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(_6,function(x,i){return m[i];});q=q.replace(m[0],"");_72=true;break;}}if(!_72){throw"Error parsing selector, parsing failed at \""+q+"\"";}}if(mm[1]){fn[fn.length]="mode=\""+mm[1]+"\";";q=q.replace(mm[1],"");}}fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(_78,_79,_7a){if(!_79||_79==document){_79=document;}if(typeof _79=="string"){_79=document.getElementById(_79);}var _7b=_78.split(",");var _7c=[];for(var i=0,len=_7b.length;i<len;i++){var p=_7b[i].replace(_5,"");if(!_1[p]){_1[p]=Ext.DomQuery.compile(p);if(!_1[p]){throw p+" is not a valid selector";}}var _80=_1[p](_79);if(_80&&_80!=document){_7c=_7c.concat(_80);}}return _7c;},selectNode:function(_81,_82){return Ext.DomQuery.select(_81,_82)[0];},selectValue:function(_83,_84,_85){_83=_83.replace(_5,"");if(!_3[_83]){_3[_83]=Ext.DomQuery.compile(_83,"select");}var n=_3[_83](_84);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return(v===null?_85:v);},selectNumber:function(_88,_89,_8a){var v=Ext.DomQuery.selectValue(_88,_89,_8a||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}var _8e=(el instanceof Array);var _8f=Ext.DomQuery.filter(_8e?el:[el],ss);return _8e?(_8f.length==el.length):(_8f.length>0);},filter:function(els,ss,_92){ss=ss.replace(_5,"");if(!_2[ss]){_2[ss]=Ext.DomQuery.compile(ss,"simple");}var _93=_2[ss](els);return _92?quickDiff(_93,els):_93;},matchers:[{re:/^\.([\w-]+)/,select:"n = byClassName(n, null, \" {1} \");"},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:"n = byPseudo(n, \"{1}\", \"{2}\");"},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:"n = byAttribute(n, \"{2}\", \"{4}\", \"{3}\", \"{1}\");"},{re:/^#([\w-]+)/,select:"n = byId(n, null, \"{1}\");"},{re:/^@([\w-]+)/,select:"return {firstChild:{nodeValue:attrValue(n, \"{1}\")}};"}],operators:{"=":function(a,v){return a==v;},"!=":function(a,v){return a!=v;},"^=":function(a,v){return a&&a.substr(0,v.length)==v;},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v;},"*=":function(a,v){return a&&a.indexOf(v)!==-1;},"%=":function(a,v){return(a%v)==0;}},pseudos:{"first-child":function(c){var r=[],n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[r.length]=ci;}}return r;},"last-child":function(c){var r=[];for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[r.length]=ci;}}return r;},"nth-child":function(c,a){var r=[];if(a!="odd"&&a!="even"){for(var i=0,ci;ci=c[i];i++){var m=child(ci.parentNode,a);if(m==ci){r[r.length]=m;}}return r;}var p;for(var i=0,l=c.length;i<l;i++){var cp=c[i].parentNode;if(cp!=p){clean(cp);p=cp;}}for(var i=0,ci;ci=c[i];i++){var m=false;if(a=="odd"){m=((ci.nodeIndex+1)%2==1);}else{if(a=="even"){m=((ci.nodeIndex+1)%2==0);}}if(m){r[r.length]=ci;}}return r;},"only-child":function(c){var r=[];for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[r.length]=ci;}}return r;},"empty":function(c){var r=[];for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,_bd=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){_bd=false;break;}}if(_bd){r[r.length]=ci;}}return r;},"contains":function(c,v){var r=[];for(var i=0,ci;ci=c[i];i++){if(ci.innerHTML.indexOf(v)!==-1){r[r.length]=ci;}}return r;},"nodeValue":function(c,v){var r=[];for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[r.length]=ci;}}return r;},"checked":function(c){var r=[];for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[r.length]=ci;}}return r;},"not":function(c,ss){return Ext.DomQuery.filter(c,ss,true);},"odd":function(c){return this["nth-child"](c,"odd");},"even":function(c){return this["nth-child"](c,"even");},"nth":function(c,a){return c[a-1]||[];},"first":function(c){return c[0]||[];},"last":function(c){return c[c.length-1]||[];},"has":function(c,ss){var s=Ext.DomQuery.select;var r=[];for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[r.length]=ci;}}return r;},"next":function(c,ss){var is=Ext.DomQuery.is;var r=[];for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[r.length]=ci;}}return r;},"prev":function(c,ss){var is=Ext.DomQuery.is;var r=[];for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[r.length]=ci;}}return r;}}};}();Ext.query=Ext.DomQuery.select;Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete this.listeners;}};Ext.util.Observable.prototype={fireEvent:function(){var ce=this.events[arguments[0].toLowerCase()];if(typeof ce=="object"){return ce.fire.apply(ce,Array.prototype.slice.call(arguments,1));}else{return true;}},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(_2,fn,_4,o){if(typeof _2=="object"){o=_2;for(var e in o){if(this.filterOptRe.test(e)){continue;}if(typeof o[e]=="function"){this.addListener(e,o[e],o.scope,o);}else{this.addListener(e,o[e].fn,o[e].scope,o[e]);}}return;}o=(!o||typeof o=="boolean")?{}:o;_2=_2.toLowerCase();var ce=this.events[_2]||true;if(typeof ce=="boolean"){ce=new Ext.util.Event(this,_2);this.events[_2]=ce;}ce.addListener(fn,_4,o);},removeListener:function(_8,fn,_a){var ce=this.events[_8.toLowerCase()];if(typeof ce=="object"){ce.removeListener(fn,_a);}},purgeListeners:function(){for(var _c in this.events){if(typeof this.events[_c]=="object"){this.events[_c].clearListeners();}}},relayEvents:function(o,_e){var _f=function(_10){return function(){return this.fireEvent.apply(this,Ext.combine(_10,Array.prototype.slice.call(arguments,0)));};};for(var i=0,len=_e.length;i<len;i++){var _13=_e[i];if(!this.events[_13]){this.events[_13]=true;}o.on(_13,_f(_13),this);}},addEvents:function(o){if(!this.events){this.events={};}Ext.applyIf(this.events,o);},hasListener:function(_15){var e=this.events[_15];return typeof e=="object"&&e.listeners.length>0;}};Ext.util.Observable.prototype.on=Ext.util.Observable.prototype.addListener;Ext.util.Observable.prototype.un=Ext.util.Observable.prototype.removeListener;Ext.util.Observable.capture=function(o,fn,_19){o.fireEvent=o.fireEvent.createInterceptor(fn,_19);};Ext.util.Observable.releaseCapture=function(o){o.fireEvent=Ext.util.Observable.prototype.fireEvent;};(function(){var _1b=function(h,o,_1e){var _1f=new Ext.util.DelayedTask();return function(){_1f.delay(o.buffer,h,_1e,Array.prototype.slice.call(arguments,0));};};var _20=function(h,e,fn,_24){return function(){e.removeListener(fn,_24);return h.apply(_24,arguments);};};var _25=function(h,o,_28){return function(){var _29=Array.prototype.slice.call(arguments,0);setTimeout(function(){h.apply(_28,_29);},o.delay||10);};};Ext.util.Event=function(obj,_2b){this.name=_2b;this.obj=obj;this.listeners=[];};Ext.util.Event.prototype={addListener:function(fn,_2d,_2e){var o=_2e||{};_2d=_2d||this.obj;if(!this.isListening(fn,_2d)){var l={fn:fn,scope:_2d,options:o};var h=fn;if(o.delay){h=_25(h,o,_2d);}if(o.single){h=_20(h,this,fn,_2d);}if(o.buffer){h=_1b(h,o,_2d);}l.fireFn=h;if(!this.firing){this.listeners.push(l);}else{this.listeners=this.listeners.slice(0);this.listeners.push(l);}}},findListener:function(fn,_33){_33=_33||this.obj;var ls=this.listeners;for(var i=0,len=ls.length;i<len;i++){var l=ls[i];if(l.fn==fn&&l.scope==_33){return i;}}return-1;},isListening:function(fn,_39){return this.findListener(fn,_39)!=-1;},removeListener:function(fn,_3b){var _3c;if((_3c=this.findListener(fn,_3b))!=-1){if(!this.firing){this.listeners.splice(_3c,1);}else{this.listeners=this.listeners.slice(0);this.listeners.splice(_3c,1);}return true;}return false;},clearListeners:function(){this.listeners=[];},fire:function(){var ls=this.listeners,_3e,len=ls.length;if(len>0){this.firing=true;var _40=Array.prototype.slice.call(arguments,0);for(var i=0;i<len;i++){var l=ls[i];if(l.fireFn.apply(l.scope,arguments)===false){this.firing=false;return false;}}this.firing=false;}return true;}};})();Ext.EventManager=function(){var _1,_2,_3=false;var _4,_5,_6,_7;var E=Ext.lib.Event;var D=Ext.lib.Dom;var _a=function(){if(!_3){_3=true;Ext.isReady=true;if(_2){clearInterval(_2);}if(Ext.isGecko||Ext.isOpera){document.removeEventListener("DOMContentLoaded",_a,false);}if(_1){_1.fire();_1.clearListeners();}}};var _b=function(){_1=new Ext.util.Event();if(Ext.isGecko||Ext.isOpera){document.addEventListener("DOMContentLoaded",_a,false);}else{if(Ext.isIE){document.write("<s"+"cript id=\"ie-deferred-loader\" defer=\"defer\" src=\"/"+"/:\"></s"+"cript>");var _c=document.getElementById("ie-deferred-loader");_c.onreadystatechange=function(){if(this.readyState=="complete"){_a();_c.onreadystatechange=null;_c.parentNode.removeChild(_c);}};}else{if(Ext.isSafari){_2=setInterval(function(){var rs=document.readyState;if(rs=="complete"){_a();}},10);}}}E.on(window,"load",_a);};var _e=function(h,o){var _11=new Ext.util.DelayedTask(h);return function(e){e=new Ext.EventObjectImpl(e);_11.delay(o.buffer,h,null,[e]);};};var _13=function(h,el,_16,fn){return function(e){Ext.EventManager.removeListener(el,_16,fn);h(e);};};var _19=function(h,o){return function(e){e=new Ext.EventObjectImpl(e);setTimeout(function(){h(e);},o.delay||10);};};var _1d=function(_1e,_1f,opt,fn,_22){var o=(!opt||typeof opt=="boolean")?{}:opt;fn=fn||o.fn;_22=_22||o.scope;var el=Ext.getDom(_1e);if(!el){throw"Error listening for \""+_1f+"\". Element \""+_1e+"\" doesn't exist.";}var h=function(e){e=Ext.EventObject.setEvent(e);var t;if(o.delegate){t=e.getTarget(o.delegate,el);if(!t){return;}}else{t=e.target;}if(o.stopEvent===true){e.stopEvent();}if(o.preventDefault===true){e.preventDefault();}if(o.stopPropagation===true){e.stopPropagation();}if(o.normalized===false){e=e.browserEvent;}fn.call(_22||el,e,t,o);};if(o.delay){h=_19(h,o);}if(o.single){h=_13(h,el,_1f,fn);}if(o.buffer){h=_e(h,o);}fn._handlers=fn._handlers||[];fn._handlers.push([Ext.id(el),_1f,h]);E.on(el,_1f,h);if(_1f=="mousewheel"&&el.addEventListener){el.addEventListener("DOMMouseScroll",h,false);E.on(window,"unload",function(){el.removeEventListener("DOMMouseScroll",h,false);});}if(_1f=="mousedown"&&el==document){Ext.EventManager.stoppedMouseDownEvent.addListener(h);}return h;};var _28=function(el,_2a,fn){var id=Ext.id(el),hds=fn._handlers,hd=fn;if(hds){for(var i=0,len=hds.length;i<len;i++){var h=hds[i];if(h[0]==id&&h[1]==_2a){hd=h[2];hds.splice(i,1);break;}}}E.un(el,_2a,hd);el=Ext.getDom(el);if(_2a=="mousewheel"&&el.addEventListener){el.removeEventListener("DOMMouseScroll",hd,false);}if(_2a=="mousedown"&&el==document){Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);}};var _32=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized)$/;var pub={wrap:function(fn,_35,_36){return function(e){Ext.EventObject.setEvent(e);fn.call(_36?_35||window:window,Ext.EventObject,_35);};},addListener:function(_38,_39,fn,_3b,_3c){if(typeof _39=="object"){var o=_39;for(var e in o){if(_32.test(e)){continue;}if(typeof o[e]=="function"){_1d(_38,e,o,o[e],o.scope);}else{_1d(_38,e,o[e]);}}return;}return _1d(_38,_39,_3c,fn,_3b);},removeListener:function(_3f,_40,fn){return _28(_3f,_40,fn);},onDocumentReady:function(fn,_43,_44){if(_3){fn.call(_43||window,_43);return;}if(!_1){_b();}_1.addListener(fn,_43,_44);},onWindowResize:function(fn,_46,_47){if(!_4){_4=new Ext.util.Event();_5=new Ext.util.DelayedTask(function(){_4.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){if(Ext.isIE){_5.delay(50);}else{_4.fire(D.getViewWidth(),D.getViewHeight());}});}_4.addListener(fn,_46,_47);},onTextResize:function(fn,_49,_4a){if(!_6){_6=new Ext.util.Event();var _4b=new Ext.Element(document.createElement("div"));_4b.dom.className="x-text-resize";_4b.dom.innerHTML="X";_4b.appendTo(document.body);_7=_4b.dom.offsetHeight;setInterval(function(){if(_4b.dom.offsetHeight!=_7){_6.fire(_7,_7=_4b.dom.offsetHeight);}},this.textResizeInterval);}_6.addListener(fn,_49,_4a);},removeResizeListener:function(fn,_4d){if(_4){_4.removeListener(fn,_4d);}},fireResize:function(){if(_4){_4.fire(D.getViewWidth(),D.getViewHeight());}},ieDeferSrc:false,textResizeInterval:50};pub.on=pub.addListener;pub.un=pub.removeListener;pub.stoppedMouseDownEvent=new Ext.util.Event();return pub;}();Ext.onReady=Ext.EventManager.onDocumentReady;Ext.onReady(function(){var bd=Ext.get(document.body);if(!bd){return;}var cls=Ext.isIE?"ext-ie":Ext.isGecko?"ext-gecko":Ext.isOpera?"ext-opera":Ext.isSafari?"ext-safari":"";if(Ext.isBorderBox){cls+=" ext-border-box";}if(Ext.isStrict){cls+=" ext-strict";}bd.addClass(cls);});Ext.EventObject=function(){var E=Ext.lib.Event;var _51={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var _52=Ext.isIE?{1:0,4:1,2:2}:(Ext.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Ext.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Ext.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;}this.browserEvent=e;if(e){this.button=e.button?_52[e.button]:(e.which?e.which-1:-1);this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;this.charCode=e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}return this;},stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this);}E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}},isNavKeyPress:function(){var k=this.keyCode;k=Ext.isSafari?(_51[k]||k):k;return(k>=33&&k<=40)||k==this.RETURN||k==this.TAB||k==this.ESC;},isSpecialKey:function(){var k=this.keyCode;return k==9||k==13||k==40||k==27||(k==16)||(k==17)||(k>=18&&k<=20)||(k>=33&&k<=35)||(k>=36&&k<=39)||(k>=44&&k<=45);},stopPropagation:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this);}E.stopPropagation(this.browserEvent);}},getCharCode:function(){return this.charCode||this.keyCode;},getKey:function(){var k=this.keyCode||this.charCode;return Ext.isSafari?(_51[k]||k):k;},getPageX:function(){return this.xy[0];},getPageY:function(){return this.xy[1];},getTime:function(){if(this.browserEvent){return E.getTime(this.browserEvent);}return null;},getXY:function(){return this.xy;},getTarget:function(_58,_59,_5a){return _58?Ext.fly(this.target).findParent(_58,_59,_5a):this.target;},getRelatedTarget:function(){if(this.browserEvent){return E.getRelatedTarget(this.browserEvent);}return null;},getWheelDelta:function(){var e=this.browserEvent;var _5c=0;if(e.wheelDelta){_5c=e.wheelDelta/120;if(window.opera){_5c=-_5c;}}else{if(e.detail){_5c=-e.detail/3;}}return _5c;},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)?true:false;},within:function(el,_5e){var t=this[_5e?"getRelatedTarget":"getTarget"]();return t&&Ext.fly(el).contains(t);},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1]);}};return new Ext.EventObjectImpl();}();(function(){var D=Ext.lib.Dom;var E=Ext.lib.Event;var A=Ext.lib.Anim;var _4={};var _5=/(-[a-z])/gi;var _6=function(m,a){return a.charAt(1).toUpperCase();};var _9=document.defaultView;Ext.Element=function(_a,_b){var _c=typeof _a=="string"?document.getElementById(_a):_a;if(!_c){return null;}if(!_b&&Ext.Element.cache[_c.id]){return Ext.Element.cache[_c.id];}this.dom=_c;this.id=_c.id||Ext.id(_c);};var El=Ext.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(_e){this.visibilityMode=_e;return this;},enableDisplayMode:function(_f){this.setVisibilityMode(El.DISPLAY);if(typeof _f!="undefined"){this.originalDisplay=_f;}return this;},findParent:function(_10,_11,_12){var p=this.dom,b=document.body,_15=0,dq=Ext.DomQuery,_17;_11=_11||50;if(typeof _11!="number"){_17=Ext.getDom(_11);_11=10;}while(p&&p.nodeType==1&&_15<_11&&p!=b&&p!=_17){if(dq.is(p,_10)){return _12?Ext.get(p):p;}_15++;p=p.parentNode;}return null;},findParentNode:function(_18,_19,_1a){var p=Ext.fly(this.dom.parentNode,"_internal");return p?p.findParent(_18,_19,_1a):null;},up:function(_1c,_1d){return this.findParentNode(_1c,_1d,true);},is:function(_1e){return Ext.DomQuery.is(this.dom,_1e);},animate:function(_1f,_20,_21,_22,_23){this.anim(_1f,{duration:_20,callback:_21,easing:_22},_23);return this;},anim:function(_24,opt,_26,_27,_28,cb){_26=_26||"run";opt=opt||{};var _2a=Ext.lib.Anim[_26](this.dom,_24,(opt.duration||_27)||0.35,(opt.easing||_28)||"easeOut",function(){Ext.callback(cb,this);Ext.callback(opt.callback,opt.scope||this,[this,opt]);},this);opt.anim=_2a;return _2a;},preanim:function(a,i){return!a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]});},clean:function(_2d){if(this.isCleaned&&_2d!==true){return this;}var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}this.isCleaned=true;return this;},calcOffsetsTo:function(el){el=Ext.get(el),d=el.dom;var _34=false;if(el.getStyle("position")=="static"){el.position("relative");_34=true;}var x=0,y=0;var op=this.dom;while(op&&op!=d&&op.tagName!="HTML"){x+=op.offsetLeft;y+=op.offsetTop;op=op.offsetParent;}if(_34){el.position("static");}return[x,y];},scrollIntoView:function(_38,_39){var c=Ext.getDom(_38)||document.body;var el=this.dom;var o=this.calcOffsetsTo(c),l=o[0],t=o[1],b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(t<ct){c.scrollTop=t;}else{if(b>cb){c.scrollTop=b-ch;}}if(_39!==false){if(l<cl){c.scrollLeft=l;}else{if(r>cr){c.scrollLeft=r-c.clientWidth;}}}return this;},scrollChildIntoView:function(_46){Ext.fly(_46,"_scrollChildIntoView").scrollIntoView(this);},autoHeight:function(_47,_48,_49,_4a){var _4b=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var _4c=parseInt(this.dom.scrollHeight,10);if(!_47){this.setHeight(_4c);this.unclip();if(typeof _49=="function"){_49();}}else{this.setHeight(_4b);this.setHeight(_4c,_47,_48,function(){this.unclip();if(typeof _49=="function"){_49();}}.createDelegate(this),_4a);}}.createDelegate(this),0);return this;},contains:function(el){if(!el){return false;}return D.isAncestor(this.dom,el.dom?el.dom:el);},isVisible:function(_4e){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(_4e!==true||!vis){return vis;}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Ext.fly(p,"_isVisible").isVisible()){return false;}p=p.parentNode;}return true;},select:function(_51,_52){return El.select("#"+Ext.id(this.dom)+" "+_51,_52);},query:function(_53,_54){return Ext.DomQuery.select("#"+Ext.id(this.dom)+" "+_53);},child:function(_55,_56){var n=Ext.DomQuery.selectNode("#"+Ext.id(this.dom)+" "+_55);return _56?n:Ext.get(n);},down:function(_58,_59){var n=Ext.DomQuery.selectNode("#"+Ext.id(this.dom)+" > "+_58);return _59?n:Ext.get(n);},initDD:function(_5b,_5c,_5d){var dd=new Ext.dd.DD(Ext.id(this.dom),_5b,_5c);return Ext.apply(dd,_5d);},initDDProxy:function(_5f,_60,_61){var dd=new Ext.dd.DDProxy(Ext.id(this.dom),_5f,_60);return Ext.apply(dd,_61);},initDDTarget:function(_63,_64,_65){var dd=new Ext.dd.DDTarget(Ext.id(this.dom),_63,_64);return Ext.apply(dd,_65);},setVisible:function(_67,_68){if(!_68||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(_67);}else{this.fixDisplay();this.dom.style.visibility=_67?"visible":"hidden";}}else{var dom=this.dom;var _6a=this.visibilityMode;if(_67){this.setOpacity(0.01);this.setVisible(true);}this.anim({opacity:{to:(_67?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!_67){if(_6a==El.DISPLAY){dom.style.display="none";}else{dom.style.visibility="hidden";}Ext.get(dom).setOpacity(1);}});}return this;},isDisplayed:function(){return this.getStyle("display")!="none";},toggle:function(_6b){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this;},setDisplayed:function(_6c){if(typeof _6c=="boolean"){_6c=_6c?this.originalDisplay:"none";}this.setStyle("display",_6c);return this;},focus:function(){try{this.dom.focus();}catch(e){}return this;},blur:function(){try{this.dom.blur();}catch(e){}return this;},addClass:function(_6d){if(_6d instanceof Array){for(var i=0,len=_6d.length;i<len;i++){this.addClass(_6d[i]);}}else{if(_6d&&!this.hasClass(_6d)){this.dom.className=this.dom.className+" "+_6d;}}return this;},radioClass:function(_70){var _71=this.dom.parentNode.childNodes;for(var i=0;i<_71.length;i++){var s=_71[i];if(s.nodeType==1){Ext.get(s).removeClass(_70);}}this.addClass(_70);return this;},removeClass:function(_74){if(!_74||!this.dom.className){return this;}if(_74 instanceof Array){for(var i=0,len=_74.length;i<len;i++){this.removeClass(_74[i]);}}else{if(this.hasClass(_74)){var re=this.classReCache[_74];if(!re){re=new RegExp("(?:^|\\s+)"+_74+"(?:\\s+|$)","g");this.classReCache[_74]=re;}this.dom.className=this.dom.className.replace(re," ");}}return this;},classReCache:{},toggleClass:function(_78){if(this.hasClass(_78)){this.removeClass(_78);}else{this.addClass(_78);}return this;},hasClass:function(_79){return _79&&(" "+this.dom.className+" ").indexOf(" "+_79+" ")!=-1;},replaceClass:function(_7a,_7b){this.removeClass(_7a);this.addClass(_7b);return this;},getStyles:function(){var a=arguments,len=a.length,r={};for(var i=0;i<len;i++){r[a[i]]=this.getStyle(a[i]);}return r;},getStyle:function(){return _9&&_9.getComputedStyle?function(_80){var el=this.dom,v,cs,_84;if(_80=="float"){_80="cssFloat";}if(v=el.style[_80]){return v;}if(cs=_9.getComputedStyle(el,"")){if(!(_84=_4[_80])){_84=_4[_80]=_80.replace(_5,_6);}return cs[_84];}return null;}:function(_85){var el=this.dom,v,cs,_89;if(_85=="opacity"){if(typeof el.filter=="string"){var fv=parseFloat(el.filter.match(/alpha\(opacity=(.*)\)/i)[1]);if(!isNaN(fv)){return fv?fv/100:0;}}return 1;}else{if(_85=="float"){_85="styleFloat";}}if(!(_89=_4[_85])){_89=_4[_85]=_85.replace(_5,_6);}if(v=el.style[_89]){return v;}if(cs=el.currentStyle){return cs[_89];}return null;};}(),setStyle:function(_8b,_8c){if(typeof _8b=="string"){var _8d;if(!(_8d=_4[_8b])){_8d=_4[_8b]=_8b.replace(_5,_6);}if(_8d=="opacity"){this.setOpacity(_8c);}else{this.dom.style[_8d]=_8c;}}else{for(var _8e in _8b){if(typeof _8b[_8e]!="function"){this.setStyle(_8e,_8b[_8e]);}}}return this;},applyStyles:function(_8f){Ext.DomHelper.applyStyles(this.dom,_8f);return this;},getX:function(){return D.getX(this.dom);},getY:function(){return D.getY(this.dom);},getXY:function(){return D.getXY(this.dom);},setX:function(x,_91){if(!_91||!A){D.setX(this.dom,x);}else{this.setXY([x,this.getY()],this.preanim(arguments,1));}return this;},setY:function(y,_93){if(!_93||!A){D.setY(this.dom,y);}else{this.setXY([this.getX(),y],this.preanim(arguments,1));}return this;},setLeft:function(_94){this.setStyle("left",this.addUnits(_94));return this;},setTop:function(top){this.setStyle("top",this.addUnits(top));return this;},setRight:function(_96){this.setStyle("right",this.addUnits(_96));return this;},setBottom:function(_97){this.setStyle("bottom",this.addUnits(_97));return this;},setXY:function(pos,_99){if(!_99||!A){D.setXY(this.dom,pos);}else{this.anim({points:{to:pos}},this.preanim(arguments,1),"motion");}return this;},setLocation:function(x,y,_9c){this.setXY([x,y],this.preanim(arguments,2));return this;},moveTo:function(x,y,_9f){this.setXY([x,y],this.preanim(arguments,2));return this;},getRegion:function(){return D.getRegion(this.dom);},getHeight:function(_a0){var h=this.dom.offsetHeight||0;return _a0!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");},getWidth:function(_a2){var w=this.dom.offsetWidth||0;return _a2!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr");},getComputedHeight:function(){var h=Math.max(this.dom.offsetHeight,this.dom.clientHeight);if(!h){h=parseInt(this.getStyle("height"),10)||0;if(!this.isBorderBox()){h+=this.getFrameWidth("tb");}}return h;},getComputedWidth:function(){var w=Math.max(this.dom.offsetWidth,this.dom.clientWidth);if(!w){w=parseInt(this.getStyle("width"),10)||0;if(!this.isBorderBox()){w+=this.getFrameWidth("lr");}}return w;},getSize:function(_a6){return{width:this.getWidth(_a6),height:this.getHeight(_a6)};},getViewSize:function(){var d=this.dom,doc=document,aw=0,ah=0;if(d==doc||d==doc.body){return{width:D.getViewWidth(),height:D.getViewHeight()};}else{return{width:d.clientWidth,height:d.clientHeight};}},getValue:function(_ab){return _ab?parseInt(this.dom.value,10):this.dom.value;},adjustWidth:function(_ac){if(typeof _ac=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){_ac-=(this.getBorderWidth("lr")+this.getPadding("lr"));}if(_ac<0){_ac=0;}}return _ac;},adjustHeight:function(_ad){if(typeof _ad=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){_ad-=(this.getBorderWidth("tb")+this.getPadding("tb"));}if(_ad<0){_ad=0;}}return _ad;},setWidth:function(_ae,_af){_ae=this.adjustWidth(_ae);if(!_af||!A){this.dom.style.width=this.addUnits(_ae);}else{this.anim({width:{to:_ae}},this.preanim(arguments,1));}return this;},setHeight:function(_b0,_b1){_b0=this.adjustHeight(_b0);if(!_b1||!A){this.dom.style.height=this.addUnits(_b0);}else{this.anim({height:{to:_b0}},this.preanim(arguments,1));}return this;},setSize:function(_b2,_b3,_b4){if(typeof _b2=="object"){_b3=_b2.height;_b2=_b2.width;}_b2=this.adjustWidth(_b2);_b3=this.adjustHeight(_b3);if(!_b4||!A){this.dom.style.width=this.addUnits(_b2);this.dom.style.height=this.addUnits(_b3);}else{this.anim({width:{to:_b2},height:{to:_b3}},this.preanim(arguments,2));}return this;},setBounds:function(x,y,_b7,_b8,_b9){if(!_b9||!A){this.setSize(_b7,_b8);this.setLocation(x,y);}else{_b7=this.adjustWidth(_b7);_b8=this.adjustHeight(_b8);this.anim({points:{to:[x,y]},width:{to:_b7},height:{to:_b8}},this.preanim(arguments,4),"motion");}return this;},setRegion:function(_ba,_bb){this.setBounds(_ba.left,_ba.top,_ba.right-_ba.left,_ba.bottom-_ba.top,this.preanim(arguments,1));return this;},addListener:function(_bc,fn,_be,_bf){Ext.EventManager.on(this.dom,_bc,fn,_be||this,_bf);},removeListener:function(_c0,fn){Ext.EventManager.removeListener(this.dom,_c0,fn);return this;},removeAllListeners:function(){E.purgeElement(this.dom);return this;},relayEvent:function(_c2,_c3){this.on(_c2,function(e){_c3.fireEvent(_c2,e);});},setOpacity:function(_c5,_c6){if(!_c6||!A){var s=this.dom.style;if(Ext.isIE){s.zoom=1;s.filter=(s.filter||"").replace(/alpha\([^\)]*\)/gi,"")+(_c5==1?"":"alpha(opacity="+_c5*100+")");}else{s.opacity=_c5;}}else{this.anim({opacity:{to:_c5}},this.preanim(arguments,1),null,0.35,"easeIn");}return this;},getLeft:function(_c8){if(!_c8){return this.getX();}else{return parseInt(this.getStyle("left"),10)||0;}},getRight:function(_c9){if(!_c9){return this.getX()+this.getWidth();}else{return(this.getLeft(true)+this.getWidth())||0;}},getTop:function(_ca){if(!_ca){return this.getY();}else{return parseInt(this.getStyle("top"),10)||0;}},getBottom:function(_cb){if(!_cb){return this.getY()+this.getHeight();}else{return(this.getTop(true)+this.getHeight())||0;}},position:function(pos,_cd,x,y){if(!pos){if(this.getStyle("position")=="static"){this.setStyle("position","relative");}}else{this.setStyle("position",pos);}if(_cd){this.setStyle("z-index",_cd);}if(x!==undefined&&y!==undefined){this.setXY([x,y]);}else{if(x!==undefined){this.setX(x);}else{if(y!==undefined){this.setY(y);}}}},clearPositioning:function(_d0){_d0=_d0||"";this.setStyle({"left":_d0,"right":_d0,"top":_d0,"bottom":_d0,"z-index":"","position":"static"});return this;},getPositioning:function(){var l=this.getStyle("left");var t=this.getStyle("top");return{"position":this.getStyle("position"),"left":l,"right":l?"":this.getStyle("right"),"top":t,"bottom":t?"":this.getStyle("bottom"),"z-index":this.getStyle("z-index")};},getBorderWidth:function(_d3){return this.addStyles(_d3,El.borders);},getPadding:function(_d4){return this.addStyles(_d4,El.paddings);},setPositioning:function(pc){this.applyStyles(pc);if(pc.right=="auto"){this.dom.style.right="";}if(pc.bottom=="auto"){this.dom.style.bottom="";}return this;},fixDisplay:function(){if(this.getStyle("display")=="none"){this.setStyle("visibility","hidden");this.setStyle("display",this.originalDisplay);if(this.getStyle("display")=="none"){this.setStyle("display","block");}}},setLeftTop:function(_d6,top){this.dom.style.left=this.addUnits(_d6);this.dom.style.top=this.addUnits(top);return this;},move:function(_d8,_d9,_da){var xy=this.getXY();_d8=_d8.toLowerCase();switch(_d8){case"l":case"left":this.moveTo(xy[0]-_d9,xy[1],this.preanim(arguments,2));break;case"r":case"right":this.moveTo(xy[0]+_d9,xy[1],this.preanim(arguments,2));break;case"t":case"top":case"up":this.moveTo(xy[0],xy[1]-_d9,this.preanim(arguments,2));break;case"b":case"bottom":case"down":this.moveTo(xy[0],xy[1]+_d9,this.preanim(arguments,2));break;}return this;},clip:function(){if(!this.isClipped){this.isClipped=true;this.originalClip={"o":this.getStyle("overflow"),"x":this.getStyle("overflow-x"),"y":this.getStyle("overflow-y")};this.setStyle("overflow","hidden");this.setStyle("overflow-x","hidden");this.setStyle("overflow-y","hidden");}return this;},unclip:function(){if(this.isClipped){this.isClipped=false;var o=this.originalClip;if(o.o){this.setStyle("overflow",o.o);}if(o.x){this.setStyle("overflow-x",o.x);}if(o.y){this.setStyle("overflow-y",o.y);}}return this;},getAnchorXY:function(_dd,_de,s){var w,h,vp=false;if(!s){var d=this.dom;if(d==document.body||d==document){vp=true;w=D.getViewWidth();h=D.getViewHeight();}else{w=this.getWidth();h=this.getHeight();}}else{w=s.width;h=s.height;}var x=0,y=0,r=Math.round;switch((_dd||"tl").toLowerCase()){case"c":x=r(w*0.5);y=r(h*0.5);break;case"t":x=r(w*0.5);y=0;break;case"l":x=0;y=r(h*0.5);break;case"r":x=w;y=r(h*0.5);break;case"b":x=r(w*0.5);y=h;break;case"tl":x=0;y=0;break;case"bl":x=0;y=h;break;case"br":x=w;y=h;break;case"tr":x=w;y=0;break;}if(_de===true){return[x,y];}if(vp){var sc=this.getScroll();return[x+sc.left,y+sc.top];}var o=this.getXY();return[x+o[0],y+o[1]];},getAlignToXY:function(el,p,o){el=Ext.get(el),d=this.dom;if(!el.dom){throw"Element.alignTo with an element that doesn't exist";}var c=false;var p1="",p2="";o=o||[0,0];if(!p){p="tl-bl";}else{if(p=="?"){p="tl-bl?";}else{if(p.indexOf("-")==-1){p="tl-"+p;}}}p=p.toLowerCase();var m=p.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!m){throw"Element.alignTo with an invalid alignment "+p;}p1=m[1],p2=m[2],c=m[3]?true:false;var a1=this.getAnchorXY(p1,true);var a2=el.getAnchorXY(p2,false);var x=a2[0]-a1[0]+o[0];var y=a2[1]-a1[1]+o[1];if(c){var w=this.getWidth(),h=this.getHeight(),r=el.getRegion();var dw=D.getViewWidth()-5,dh=D.getViewHeight()-5;var p1y=p1.charAt(0),p1x=p1.charAt(p1.length-1);var p2y=p2.charAt(0),p2x=p2.charAt(p2.length-1);var _fd=((p1y=="t"&&p2y=="b")||(p1y=="b"&&p2y=="t"));var _fe=((p1x=="r"&&p2x=="l")||(p1x=="l"&&p2x=="r"));var doc=document;var _100=(doc.documentElement.scrollLeft||doc.body.scrollLeft||0)+5;var _101=(doc.documentElement.scrollTop||doc.body.scrollTop||0)+5;if((x+w)>dw){x=_fe?r.left-w:dw-w;}if(x<_100){x=_fe?r.right:_100;}if((y+h)>dh){y=_fd?r.top-h:dh-h;}if(y<_101){y=_fd?r.bottom:_101;}}return[x,y];},getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,_104,_105){el=Ext.get(el);_105=_105?Ext.applyIf(_105,os):os;var vw,vh,vx=0,vy=0;if(el.dom==document.body||el.dom==document){vw=Ext.lib.Dom.getViewWidth();vh=Ext.lib.Dom.getViewHeight();}else{vw=el.dom.clientWidth;vh=el.dom.clientHeight;if(!_104){var vxy=el.getXY();vx=vxy[0];vy=vxy[1];}}var s=el.getScroll();vx+=_105.left+s.left;vy+=_105.top+s.top;vw-=_105.right;vh-=_105.bottom;var vr=vx+vw;var vb=vy+vh;var xy=!_104?this.getXY():[this.getLeft(true),this.getTop(true)];var x=xy[0],y=xy[1];var w=this.dom.offsetWidth,h=this.dom.offsetHeight;var _113=false;if((x+w)>vr){x=vr-w;_113=true;}if((y+h)>vb){y=vb-h;_113=true;}if(x<vx){x=vx;_113=true;}if(y<vy){y=vy;_113=true;}return _113?[x,y]:false;};}(),alignTo:function(_114,_115,_116,_117){var xy=this.getAlignToXY(_114,_115,_116);this.setXY(xy,this.preanim(arguments,3));return this;},anchorTo:function(el,_11a,_11b,_11c,_11d,_11e){var _11f=function(){this.alignTo(el,_11a,_11b,_11c);Ext.callback(_11e,this);};Ext.EventManager.onWindowResize(_11f,this);var tm=typeof _11d;if(tm!="undefined"){Ext.EventManager.on(window,"scroll",_11f,this,{buffer:tm=="number"?_11d:50});}_11f.call(this);return this;},clearOpacity:function(){if(window.ActiveXObject){this.dom.style.filter="";}else{this.dom.style.opacity="";this.dom.style["-moz-opacity"]="";this.dom.style["-khtml-opacity"]="";}return this;},hide:function(_121){this.setVisible(false,this.preanim(arguments,0));return this;},show:function(_122){this.setVisible(true,this.preanim(arguments,0));return this;},addUnits:function(size){return Ext.Element.addUnits(size,this.defaultUnit);},beginMeasure:function(){var el=this.dom;if(el.offsetWidth||el.offsetHeight){return this;}var _125=[];var p=this.dom,b=document.body;while((!el.offsetWidth&&!el.offsetHeight)&&p&&p.tagName&&p!=b){var pe=Ext.get(p);if(pe.getStyle("display")=="none"){_125.push({el:p,visibility:pe.getStyle("visibility")});p.style.visibility="hidden";p.style.display="block";}p=p.parentNode;}this._measureChanged=_125;return this;},endMeasure:function(){var _129=this._measureChanged;if(_129){for(var i=0,len=_129.length;i<len;i++){var r=_129[i];r.el.style.visibility=r.visibility;r.el.style.display="none";}this._measureChanged=null;}return this;},update:function(html,_12e,_12f){if(typeof html=="undefined"){html="";}if(_12e!==true){this.dom.innerHTML=html;if(typeof _12f=="function"){_12f();}return this;}var id=Ext.id();var dom=this.dom;html+="<span id=\""+id+"\"></span>";E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var _134=/\ssrc=([\'\"])(.*?)\1/i;var _135=/\stype=([\'\"])(.*?)\1/i;var _136;while(_136=re.exec(html)){var _137=_136[1];var _138=_137?_137.match(_134):false;if(_138&&_138[2]){var s=document.createElement("script");s.src=_138[2];var _13a=_137.match(_135);if(_13a&&_13a[2]){s.type=_13a[2];}hd.appendChild(s);}else{if(_136[2]&&_136[2].length>0){eval(_136[2]);}}}var el=document.getElementById(id);if(el){el.parentNode.removeChild(el);}if(typeof _12f=="function"){_12f();}});dom.innerHTML=html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this;},load:function(){var um=this.getUpdateManager();um.update.apply(um,arguments);return this;},getUpdateManager:function(){if(!this.updateManager){this.updateManager=new Ext.UpdateManager(this);}return this.updateManager;},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this;},getCenterXY:function(){return this.getAlignToXY(document,"c-c");},center:function(_13d){this.alignTo(_13d||document,"c-c");return this;},isBorderBox:function(){return _13e[this.dom.tagName.toLowerCase()]||Ext.isBorderBox;},getBox:function(_13f,_140){var xy;if(!_140){xy=this.getXY();}else{var left=parseInt(this.getStyle("left"),10)||0;var top=parseInt(this.getStyle("top"),10)||0;xy=[left,top];}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!_13f){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h};}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)};}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx;},getFrameWidth:function(_14c){return this.getPadding(_14c)+this.getBorderWidth(_14c);},setBox:function(box,_14e,_14f){var w=box.width,h=box.height;if((_14e&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"));}this.setBounds(box.x,box.y,w,h,this.preanim(arguments,2));return this;},repaint:function(){var dom=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.get(dom).removeClass("x-repaint");},1);return this;},getMargins:function(side){if(!side){return{top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0};}else{return this.addStyles(side,El.margins);}},addStyles:function(_154,_155){var val=0;for(var i=0,len=_154.length;i<len;i++){var w=parseInt(this.getStyle(_155[_154.charAt(i)]),10);if(!isNaN(w)){val+=w;}}return val;},createProxy:function(_15a,_15b,_15c){if(_15b){_15b=Ext.getDom(_15b);}else{_15b=document.body;}_15a=typeof _15a=="object"?_15a:{tag:"div",cls:_15a};var _15d=Ext.DomHelper.append(_15b,_15a,true);if(_15c){_15d.setBox(this.getBox());}return _15d;},mask:function(msg,_15f){if(this.getStyle("position")=="static"){this.setStyle("position","relative");}if(!this._mask){this._mask=Ext.DomHelper.append(this.dom,{tag:"div",cls:"ext-el-mask"},true);}this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof msg=="string"){if(!this._maskMsg){this._maskMsg=Ext.DomHelper.append(this.dom,{tag:"div",cls:"ext-el-mask-msg",cn:{tag:"div"}},true);}var mm=this._maskMsg;mm.dom.className=_15f?"ext-el-mask-msg "+_15f:"ext-el-mask-msg";mm.dom.firstChild.innerHTML=msg;mm.setDisplayed(true);mm.center(this);}return this._mask;},unmask:function(_161){if(this._mask){if(_161===true){this._mask.remove();delete this._mask;if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg;}}else{this._mask.setDisplayed(false);if(this._maskMsg){this._maskMsg.setDisplayed(false);}}}this.removeClass("x-masked");},isMasked:function(){return this._mask&&this._mask.isVisible();},createShim:function(){var el=document.createElement("iframe");el.frameBorder="no";el.className="ext-shim";if(Ext.isIE&&Ext.isSecure){el.src=Ext.SSL_SECURE_URL;}var shim=Ext.get(this.dom.parentNode.insertBefore(el,this.dom));shim.autoBoxAdjust=false;return shim;},remove:function(){if(this.dom.parentNode){this.dom.parentNode.removeChild(this.dom);}delete El.cache[this.dom.id];},addClassOnOver:function(_164,_165){this.on("mouseover",function(){Ext.fly(this,"_internal").addClass(_164);},this.dom);var _166=function(e){if(_165!==true||!e.within(this,true)){Ext.fly(this,"_internal").removeClass(_164);}};this.on("mouseout",_166,this.dom);return this;},addClassOnFocus:function(_168){this.on("focus",function(){Ext.fly(this,"_internal").addClass(_168);},this.dom);this.on("blur",function(){Ext.fly(this,"_internal").removeClass(_168);},this.dom);return this;},addClassOnClick:function(_169){var dom=this.dom;this.on("mousedown",function(){Ext.fly(dom,"_internal").addClass(_169);var d=Ext.get(document);var fn=function(){Ext.fly(dom,"_internal").removeClass(_169);d.removeListener("mouseup",fn);};d.on("mouseup",fn);});return this;},swallowEvent:function(_16d,_16e){var fn=function(e){e.stopPropagation();if(_16e){e.preventDefault();}};if(_16d instanceof Array){for(var i=0,len=_16d.length;i<len;i++){this.on(_16d[i],fn);}return this;}this.on(_16d,fn);return this;},fitToParent:function(_173,_174){var p=Ext.get(_174||this.dom.parentNode);this.setSize(p.getComputedWidth()-p.getFrameWidth("lr"),p.getComputedHeight()-p.getFrameWidth("tb"));if(_173===true){Ext.EventManager.onWindowResize(this.fitToParent.createDelegate(this,[]));}return this;},getNextSibling:function(){var n=this.dom.nextSibling;while(n&&n.nodeType!=1){n=n.nextSibling;}return n;},getPrevSibling:function(){var n=this.dom.previousSibling;while(n&&n.nodeType!=1){n=n.previousSibling;}return n;},appendChild:function(el){el=Ext.get(el);el.appendTo(this);return this;},createChild:function(_179,_17a,_17b){_179=_179||{tag:"div"};if(_17a){return Ext.DomHelper.insertBefore(_17a,_179,_17b!==true);}return Ext.DomHelper[!this.dom.firstChild?"overwrite":"append"](this.dom,_179,_17b!==true);},appendTo:function(el){el=Ext.getDom(el);el.appendChild(this.dom);return this;},insertBefore:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el);return this;},insertAfter:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el.nextSibling);return this;},insertFirst:function(el,_180){el=el||{};if(typeof el=="object"&&!el.nodeType){return this.createChild(el,this.dom.firstChild,_180);}else{el=Ext.getDom(el);this.dom.insertBefore(el,this.dom.firstChild);return!_180?Ext.get(el):el;}},insertSibling:function(el,_182,_183){_182=_182?_182.toLowerCase():"before";el=el||{};var rt,_185=_182=="before"?this.dom:this.dom.nextSibling;if(typeof el=="object"&&!el.nodeType){if(_182=="after"&&!this.dom.nextSibling){rt=Ext.DomHelper.append(this.dom.parentNode,el,!_183);}else{rt=Ext.DomHelper[_182=="after"?"insertAfter":"insertBefore"](this.dom,el,!_183);}}else{rt=this.dom.parentNode.insertBefore(Ext.getDom(el),_182=="before"?this.dom:this.dom.nextSibling);if(!_183){rt=Ext.get(rt);}}return rt;},wrap:function(_186,_187){if(!_186){_186={tag:"div"};}var _188=Ext.DomHelper.insertBefore(this.dom,_186,!_187);_188.dom?_188.dom.appendChild(this.dom):_188.appendChild(this.dom);return _188;},replace:function(el){el=Ext.get(el);this.insertBefore(el);el.remove();return this;},insertHtml:function(_18a,html){return Ext.DomHelper.insertHtml(_18a,this.dom,html);},set:function(o,_18d){var el=this.dom;_18d=typeof _18d=="undefined"?(el.setAttribute?true:false):_18d;for(var attr in o){if(attr=="style"||typeof o[attr]=="function"){continue;}if(attr=="cls"){el.className=o["cls"];}else{if(_18d){el.setAttribute(attr,o[attr]);}else{el[attr]=o[attr];}}}Ext.DomHelper.applyStyles(el,o.style);return this;},addKeyListener:function(key,fn,_192){var _193;if(typeof key!="object"||key instanceof Array){_193={key:key,fn:fn,scope:_192};}else{_193={key:key.key,shift:key.shift,ctrl:key.ctrl,alt:key.alt,fn:fn,scope:_192};}return new Ext.KeyMap(this,_193);},addKeyMap:function(_194){return new Ext.KeyMap(this,_194);},isScrollable:function(){var dom=this.dom;return dom.scrollHeight>dom.clientHeight||dom.scrollWidth>dom.clientWidth;},scrollTo:function(side,_197,_198){var prop=side.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!_198||!A){this.dom[prop]=_197;}else{var to=prop=="scrollLeft"?[_197,this.dom.scrollTop]:[this.dom.scrollLeft,_197];this.anim({scroll:{"to":to}},this.preanim(arguments,2),"scroll");}return this;},scroll:function(_19b,_19c,_19d){if(!this.isScrollable()){return;}var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;_19b=_19b.toLowerCase();var _1a5=false;var a=this.preanim(arguments,2);switch(_19b){case"l":case"left":if(w-l>cw){var v=Math.min(l+_19c,w-cw);this.scrollTo("left",v,a);_1a5=true;}break;case"r":case"right":if(l>0){var v=Math.max(l-_19c,0);this.scrollTo("left",v,a);_1a5=true;}break;case"t":case"top":case"up":if(t>0){var v=Math.max(t-_19c,0);this.scrollTo("top",v,a);_1a5=true;}break;case"b":case"bottom":case"down":if(h-t>ch){var v=Math.min(t+_19c,h-ch);this.scrollTo("top",v,a);_1a5=true;}break;}return _1a5;},translatePoints:function(x,y){if(typeof x=="object"||x instanceof Array){y=x[1];x=x[0];}var p=this.getStyle("position");var o=this.getXY();var l=parseInt(this.getStyle("left"),10);var t=parseInt(this.getStyle("top"),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft;}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop;}return{left:(x-o[0]+l),top:(y-o[1]+t)};},getScroll:function(){var d=this.dom,doc=document;if(d==doc||d==doc.body){var l=window.pageXOffset||doc.documentElement.scrollLeft||doc.body.scrollLeft||0;var t=window.pageYOffset||doc.documentElement.scrollTop||doc.body.scrollTop||0;return{left:l,top:t};}else{return{left:d.scrollLeft,top:d.scrollTop};}},getColor:function(attr,_1b3,_1b4){var v=this.getStyle(attr);if(!v||v=="transparent"||v=="inherit"){return _1b3;}var _1b6=typeof _1b4=="undefined"?"#":_1b4;if(v.substr(0,4)=="rgb("){var rvs=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(rvs[i]).toString(16);if(h<16){h="0"+h;}_1b6+=h;}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);_1b6+=c+c;}}else{if(v.length==7){_1b6+=v.substr(1);}}}}return(_1b6.length>5?_1b6.toLowerCase():_1b3);},boxWrap:function(cls){cls=cls||"x-box";var el=Ext.get(this.insertHtml("beforeBegin",String.format("<div class=\"{0}\">"+El.boxMarkup+"</div>",cls)));el.child("."+cls+"-mc").dom.appendChild(this.dom);return el;},getAttributeNS:Ext.isIE?function(ns,name){var d=this.dom;var type=typeof d[ns+":"+name];if(type!="undefined"&&type!="unknown"){return d[ns+":"+name];}return d[name];}:function(ns,name){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name];}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.un=ep.removeListener;ep.autoBoxAdjust=true;ep.autoDisplayMode=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,_1c6){if(v===""||v=="auto"){return v;}if(v===undefined){return"";}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(_1c6||"px");}return v;};El.boxMarkup="<div class=\"{0}-tl\"><div class=\"{0}-tr\"><div class=\"{0}-tc\"></div></div></div><div class=\"{0}-ml\"><div class=\"{0}-mr\"><div class=\"{0}-mc\"></div></div></div><div class=\"{0}-bl\"><div class=\"{0}-br\"><div class=\"{0}-bc\"></div></div></div>";El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var _1c7;El.get=function(el){var ex,elm,id;if(!el){return null;}if(typeof el=="string"){if(!(elm=document.getElementById(el))){return null;}if(ex=El.cache[el]){ex.dom=elm;}else{ex=El.cache[el]=new El(elm);}return ex;}else{if(el.tagName){if(!(id=el.id)){id=Ext.id(el);}if(ex=El.cache[id]){ex.dom=el;}else{ex=El.cache[id]=new El(el);}return ex;}else{if(el instanceof El){if(el!=_1c7){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el;}return el;}else{if(el.isComposite){return el;}else{if(el instanceof Array){return El.select(el);}else{if(el==document){if(!_1c7){var f=function(){};f.prototype=El.prototype;_1c7=new f();_1c7.dom=document;}return _1c7;}}}}}}return null;};El.uncache=function(el){for(var i=0,a=arguments,len=a.length;i<len;i++){if(a[i]){delete El.cache[a[i].id||a[i]];}}};El.Flyweight=function(dom){this.dom=dom;};El.Flyweight.prototype=El.prototype;El._flyweights={};El.fly=function(el,_1d3){_1d3=_1d3||"_global";el=Ext.getDom(el);if(!el){return null;}if(!El._flyweights[_1d3]){El._flyweights[_1d3]=new El.Flyweight();}El._flyweights[_1d3].dom=el;return El._flyweights[_1d3];};Ext.get=El.get;Ext.fly=El.fly;var _13e=Ext.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Ext.isIE||Ext.isGecko){_13e["button"]=1;}Ext.EventManager.on(window,"unload",function(){delete El.cache;delete El._flyweights;});})();Ext.enableFx=true;Ext.Fx={slideIn:function(_1,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){_1=_1||"t";this.fixDisplay();var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var _6=this.fxWrap(r.pos,o,"hidden");var st=this.dom.style;st.visibility="visible";st.position="absolute";var _8=function(){el.fxUnwrap(_6,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o);};var a,pt={to:[b.x,b.y]},bw={to:b.width},bh={to:b.height};switch(_1.toLowerCase()){case"t":_6.setSize(b.width,0);st.left=st.bottom="0";a={height:bh};break;case"l":_6.setSize(0,b.height);st.right=st.top="0";a={width:bw};break;case"r":_6.setSize(0,b.height);_6.setX(b.right);st.left=st.top="0";a={width:bw,points:pt};break;case"b":_6.setSize(b.width,0);_6.setY(b.bottom);st.left=st.top="0";a={height:bh,points:pt};break;case"tl":_6.setSize(0,0);st.right=st.bottom="0";a={width:bw,height:bh};break;case"bl":_6.setSize(0,0);_6.setY(b.y+b.height);st.right=st.top="0";a={width:bw,height:bh,points:pt};break;case"br":_6.setSize(0,0);_6.setXY([b.right,b.bottom]);st.left=st.top="0";a={width:bw,height:bh,points:pt};break;case"tr":_6.setSize(0,0);_6.setX(b.x+b.width);st.left=st.bottom="0";a={width:bw,height:bh,points:pt};break;}this.dom.style.visibility="visible";_6.show();arguments.callee.anim=_6.fxanim(a,o,"motion",0.5,"easeOut",_8);});return this;},slideOut:function(_d,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){_d=_d||"t";var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var _12=this.fxWrap(r.pos,o,"visible");var st=this.dom.style;st.visibility="visible";st.position="absolute";_12.setSize(b);var _14=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.fxUnwrap(_12,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o);};var a,_16={to:0};switch(_d.toLowerCase()){case"t":st.left=st.bottom="0";a={height:_16};break;case"l":st.right=st.top="0";a={width:_16};break;case"r":st.left=st.top="0";a={width:_16,points:{to:[b.right,b.y]}};break;case"b":st.left=st.top="0";a={height:_16,points:{to:[b.x,b.bottom]}};break;case"tl":st.right=st.bottom="0";a={width:_16,height:_16};break;case"bl":st.right=st.top="0";a={width:_16,height:_16,points:{to:[b.x,b.bottom]}};break;case"br":st.left=st.top="0";a={width:_16,height:_16,points:{to:[b.x+b.width,b.bottom]}};break;case"tr":st.left=st.bottom="0";a={width:_16,height:_16,points:{to:[b.right,b.y]}};break;}arguments.callee.anim=_12.fxanim(a,o,"motion",0.5,"easeOut",_14);});return this;},puff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.show();var r=this.getFxRestore();var st=this.dom.style;var _1b=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;st.fontSize="";el.afterFx(o);};var _1c=this.getWidth();var _1d=this.getHeight();arguments.callee.anim=this.fxanim({width:{to:this.adjustWidth(_1c*2)},height:{to:this.adjustHeight(_1d*2)},points:{by:[-(_1c*0.5),-(_1d*0.5)]},opacity:{to:0},fontSize:{to:200,unit:"%"}},o,"motion",0.5,"easeOut",_1b);});return this;},switchOff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.clip();var r=this.getFxRestore();var st=this.dom.style;var _22=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o);};this.fxanim({opacity:{to:0.3}},null,null,0.1,null,function(){this.clearOpacity();(function(){this.fxanim({height:{to:1},points:{by:[0,this.getHeight()*0.5]}},o,"motion",0.3,"easeIn",_22);}).defer(100,this);});});return this;},highlight:function(_23,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){_23=_23||"ffff9c";attr=o.attr||"backgroundColor";this.clearOpacity();this.show();var _26=this.getColor(attr);var _27=this.dom.style[attr];endColor=(o.endColor||_26)||"ffffff";var _28=function(){el.dom.style[attr]=_27;el.afterFx(o);};var a={};a[attr]={from:_23,to:endColor};arguments.callee.anim=this.fxanim(a,o,"color",1,"easeIn",_28);});return this;},frame:function(_2a,_2b,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){_2a=_2a||"#C3DAF9";if(_2a.length==6){_2a="#"+_2a;}_2b=_2b||1;duration=o.duration||1;this.show();var b=this.getBox();var _2f=function(){var _30=this.createProxy({tag:"div",style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+_2a}});var _31=Ext.isBorderBox?2:1;_30.animate({top:{from:b.y,to:b.y-20},left:{from:b.x,to:b.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:b.height,to:(b.height+(20*_31))},width:{from:b.width,to:(b.width+(20*_31))}},duration,function(){_30.remove();});if(--_2b>0){_2f.defer((duration/2)*1000,this);}else{el.afterFx(o);}};_2f.call(this);});return this;},pause:function(_32){var el=this.getFxEl();var o={};el.queueFx(o,function(){setTimeout(function(){el.afterFx(o);},_32*1000);});return this;},fadeIn:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility="visible";var to=o.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:to}},o,null,0.5,"easeOut",function(){if(to==1){this.clearOpacity();}el.afterFx(o);});});return this;},fadeOut:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){arguments.callee.anim=this.fxanim({opacity:{to:o.endOpacity||0}},o,null,0.5,"easeOut",function(){if(this.visibilityMode==Ext.Element.DISPLAY||o.useDisplay){this.dom.style.display="none";}else{this.dom.style.visibility="hidden";}this.clearOpacity();el.afterFx(o);});});return this;},scale:function(w,h,o){this.shift(Ext.apply({},o,{width:w,height:h}));return this;},shift:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){var a={},w=o.width,h=o.height,x=o.x,y=o.y,op=o.opacity;if(w!==undefined){a.width={to:this.adjustWidth(w)};}if(h!==undefined){a.height={to:this.adjustHeight(h)};}if(x!==undefined||y!==undefined){a.points={to:[x!==undefined?x:this.getX(),y!==undefined?y:this.getY()]};}if(op!==undefined){a.opacity={to:op};}if(o.xy!==undefined){a.points={to:o.xy};}arguments.callee.anim=this.fxanim(a,o,"motion",0.35,"easeOut",function(){el.afterFx(o);});});return this;},ghost:function(_45,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){_45=_45||"b";var r=this.getFxRestore();var w=this.getWidth(),h=this.getHeight();var st=this.dom.style;var _4c=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o);};var a={opacity:{to:0},points:{}},pt=a.points;switch(_45.toLowerCase()){case"t":pt.by=[0,-h];break;case"l":pt.by=[-w,0];break;case"r":pt.by=[w,0];break;case"b":pt.by=[0,h];break;case"tl":pt.by=[-w,-h];break;case"bl":pt.by=[-w,h];break;case"br":pt.by=[w,h];break;case"tr":pt.by=[w,-h];break;}arguments.callee.anim=this.fxanim(a,o,"motion",0.5,"easeOut",_4c);});return this;},syncFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this;},sequenceFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:false,stopFx:false});return this;},nextFx:function(){var ef=this.fxQueue[0];if(ef){ef.call(this);}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0];},stopFx:function(){if(this.hasActiveFx()){var cur=this.fxQueue[0];if(cur&&cur.anim&&cur.anim.isAnimated()){this.fxQueue=[cur];cur.anim.stop(true);}}return this;},beforeFx:function(o){if(this.hasActiveFx()&&!o.concurrent){if(o.stopFx){this.stopFx();return true;}return false;}return true;},hasFxBlock:function(){var q=this.fxQueue;return q&&q[0]&&q[0].block;},queueFx:function(o,fn){if(!this.fxQueue){this.fxQueue=[];}if(!this.hasFxBlock()){Ext.applyIf(o,this.fxDefaults);if(!o.concurrent){var run=this.beforeFx(o);fn.block=o.block;this.fxQueue.push(fn);if(run){this.nextFx();}}else{fn.call(this);}}return this;},fxWrap:function(pos,o,vis){var _59;if(!o.wrap||!(_59=Ext.get(o.wrap))){var _5a;if(o.fixPosition){_5a=this.getXY();}var div=document.createElement("div");div.style.visibility=vis;_59=Ext.get(this.dom.parentNode.insertBefore(div,this.dom));_59.setPositioning(pos);if(_59.getStyle("position")=="static"){_59.position("relative");}this.clearPositioning("auto");_59.clip();_59.dom.appendChild(this.dom);if(_5a){_59.setXY(_5a);}}return _59;},fxUnwrap:function(_5c,pos,o){this.clearPositioning();this.setPositioning(pos);if(!o.wrap){_5c.dom.parentNode.insertBefore(this.dom,_5c.dom);_5c.remove();}},getFxRestore:function(){var st=this.dom.style;return{pos:this.getPositioning(),width:st.width,height:st.height};},afterFx:function(o){if(o.afterStyle){this.applyStyles(o.afterStyle);}if(o.afterCls){this.addClass(o.afterCls);}if(o.remove===true){this.remove();}Ext.callback(o.callback,o.scope,[this]);if(!o.concurrent){this.fxQueue.shift();this.nextFx();}},getFxEl:function(){return Ext.get(this.dom);},fxanim:function(_61,opt,_63,_64,_65,cb){_63=_63||"run";opt=opt||{};var _67=Ext.lib.Anim[_63](this.dom,_61,(opt.duration||_64)||0.35,(opt.easing||_65)||"easeOut",function(){Ext.callback(cb,this);},this);opt.anim=_67;return _67;}};Ext.Fx.resize=Ext.Fx.scale;Ext.apply(Ext.Element.prototype,Ext.Fx);Ext.CompositeElement=function(_1){this.elements=[];this.addElements(_1);};Ext.CompositeElement.prototype={isComposite:true,addElements:function(_2){if(!_2){return this;}if(typeof _2=="string"){_2=Ext.Element.selectorFunction(_2);}var _3=this.elements;var _4=_3.length-1;for(var i=0,_6=_2.length;i<_6;i++){_3[++_4]=Ext.get(_2[i],true);}return this;},invoke:function(fn,_8){var _9=this.elements;for(var i=0,_b=_9.length;i<_b;i++){Ext.Element.prototype[fn].apply(_9[i],_8);}return this;},add:function(_c){if(typeof _c=="string"){this.addElements(Ext.Element.selectorFunction(_c));}else{if(_c.length!==undefined){this.addElements(_c);}else{this.addElements([_c]);}}return this;},each:function(fn,_e){var _f=this.elements;for(var i=0,len=_f.length;i<len;i++){if(fn.call(_e||_f[i],_f[i],this,i)===false){break;}}return this;},item:function(_12){return this.elements[_12];}};(function(){Ext.CompositeElement.createCall=function(_13,_14){if(!_13[_14]){_13[_14]=function(){return this.invoke(_14,arguments);};}};for(var _15 in Ext.Element.prototype){if(typeof Ext.Element.prototype[_15]=="function"){Ext.CompositeElement.createCall(Ext.CompositeElement.prototype,_15);}}})();Ext.CompositeElementLite=function(els){Ext.CompositeElementLite.superclass.constructor.call(this,els);var _17=function(){};_17.prototype=Ext.Element.prototype;this.el=new Ext.Element.Flyweight();};Ext.extend(Ext.CompositeElementLite,Ext.CompositeElement,{addElements:function(els){if(els){if(els instanceof Array){this.elements=this.elements.concat(els);}else{var _19=this.elements;var _1a=_19.length-1;for(var i=0,len=els.length;i<len;i++){_19[++_1a]=els[i];}}}return this;},invoke:function(fn,_1e){var els=this.elements;var el=this.el;for(var i=0,len=els.length;i<len;i++){el.dom=els[i];Ext.Element.prototype[fn].apply(el,_1e);}return this;},item:function(_23){this.el.dom=this.elements[_23];return this.el;},addListener:function(_24,_25,_26,opt){var els=this.elements;for(var i=0,len=els.length;i<len;i++){Ext.EventManager.on(els[i],_24,_25,_26||els[i],opt);}return this;},each:function(fn,_2c){var els=this.elements;var el=this.el;for(var i=0,len=els.length;i<len;i++){el.dom=els[i];if(fn.call(_2c||el,el,this,i)===false){break;}}return this;}});Ext.CompositeElementLite.prototype.on=Ext.CompositeElementLite.prototype.addListener;if(Ext.DomQuery){Ext.Element.selectorFunction=Ext.DomQuery.select;}Ext.Element.select=function(_31,_32){var els;if(typeof _31=="string"){els=Ext.Element.selectorFunction(_31);}else{if(_31.length!==undefined){els=_31;}else{throw"Invalid selector";}}if(_32===true){return new Ext.CompositeElement(els);}else{return new Ext.CompositeElementLite(els);}};Ext.select=Ext.Element.select;Ext.UpdateManager=function(el,_2){el=Ext.get(el);if(!_2&&el.updateManager){return el.updateManager;}this.el=el;this.defaultUrl=null;this.addEvents({"beforeupdate":true,"update":true,"failure":true});var d=Ext.UpdateManager.defaults;this.sslBlankUrl=d.sslBlankUrl;this.disableCaching=d.disableCaching;this.indicatorText=d.indicatorText;this.showLoadIndicator=d.showLoadIndicator;this.timeout=d.timeout;this.loadScripts=d.loadScripts;this.transaction=null;this.autoRefreshProcId=null;this.refreshDelegate=this.refresh.createDelegate(this);this.updateDelegate=this.update.createDelegate(this);this.formUpdateDelegate=this.formUpdate.createDelegate(this);this.successDelegate=this.processSuccess.createDelegate(this);this.failureDelegate=this.processFailure.createDelegate(this);this.renderer=new Ext.UpdateManager.BasicRenderer();Ext.UpdateManager.superclass.constructor.call(this);};Ext.extend(Ext.UpdateManager,Ext.util.Observable,{getEl:function(){return this.el;},update:function(_4,_5,_6,_7){if(this.fireEvent("beforeupdate",this.el,_4,_5)!==false){var _8=this.method;if(typeof _4=="object"){var _9=_4;_4=_9.url;_5=_5||_9.params;_6=_6||_9.callback;_7=_7||_9.discardUrl;if(_6&&_9.scope){_6=_6.createDelegate(_9.scope);}if(typeof _9.method!="undefined"){_8=_9.method;}if(typeof _9.nocache!="undefined"){this.disableCaching=_9.nocache;}if(typeof _9.text!="undefined"){this.indicatorText="<div class=\"loading-indicator\">"+_9.text+"</div>";}if(typeof _9.scripts!="undefined"){this.loadScripts=_9.scripts;}if(typeof _9.timeout!="undefined"){this.timeout=_9.timeout;}}this.showLoading();if(!_7){this.defaultUrl=_4;}if(typeof _4=="function"){_4=_4.call(this);}if(typeof _5=="function"){_5=_5();}if(_5&&typeof _5!="string"){var _a=[];for(var _b in _5){if(typeof _5[_b]!="function"){_a.push(encodeURIComponent(_b),"=",encodeURIComponent(_5[_b]),"&");}}delete _a[_a.length-1];_5=_a.join("");}var cb={success:this.successDelegate,failure:this.failureDelegate,timeout:(this.timeout*1000),argument:{"url":_4,"form":null,"callback":_6,"params":_5}};_8=_8||(_5?"POST":"GET");if(_8=="GET"){_4=this.prepareUrl(_4);}this.transaction=Ext.lib.Ajax.request(_8,_4,cb,_5);}},formUpdate:function(_d,_e,_f,_10){if(this.fireEvent("beforeupdate",this.el,_d,_e)!==false){formEl=Ext.getDom(_d);if(typeof _e=="function"){_e=_e.call(this);}if(typeof params=="function"){params=params();}_e=_e||formEl.action;var cb={success:this.successDelegate,failure:this.failureDelegate,timeout:(this.timeout*1000),argument:{"url":_e,"form":formEl,"callback":_10,"reset":_f}};var _12=false;var _13=formEl.getAttribute("enctype");if(_13&&_13.toLowerCase()=="multipart/form-data"){_12=true;cb.upload=this.successDelegate;}this.transaction=Ext.lib.Ajax.formRequest(formEl,_e,cb,null,_12,this.sslBlankUrl);this.showLoading.defer(1,this);}},refresh:function(_14){if(this.defaultUrl==null){return;}this.update(this.defaultUrl,null,_14,true);},startAutoRefresh:function(_15,url,_17,_18,_19){if(_19){this.update(url||this.defaultUrl,_17,_18,true);}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);}this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[url||this.defaultUrl,_17,_18,true]),_15*1000);},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId;}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false;},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText);}},prepareUrl:function(url){if(this.disableCaching){var _1b="_dc="+(new Date().getTime());if(url.indexOf("?")!==-1){url+="&"+_1b;}else{url+="?"+_1b;}}return url;},processSuccess:function(_1c){this.transaction=null;if(_1c.argument.form&&_1c.argument.reset){try{_1c.argument.form.reset();}catch(e){}}if(this.loadScripts){this.renderer.render(this.el,_1c,this,this.updateComplete.createDelegate(this,[_1c]));}else{this.renderer.render(this.el,_1c,this);this.updateComplete(_1c);}},updateComplete:function(_1d){this.fireEvent("update",this.el,_1d);if(typeof _1d.argument.callback=="function"){_1d.argument.callback(this.el,true,_1d);}},processFailure:function(_1e){this.transaction=null;this.fireEvent("failure",this.el,_1e);if(typeof _1e.argument.callback=="function"){_1e.argument.callback(this.el,false,_1e);}},setRenderer:function(_1f){this.renderer=_1f;},getRenderer:function(){return this.renderer;},setDefaultUrl:function(_20){this.defaultUrl=_20;},abort:function(){if(this.transaction){Ext.lib.Ajax.abort(this.transaction);}},isUpdating:function(){if(this.transaction){return Ext.lib.Ajax.isCallInProgress(this.transaction);}return false;}});Ext.UpdateManager.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Ext.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:"<div class=\"loading-indicator\">Loading...</div>"};Ext.UpdateManager.updateElement=function(el,url,_23,_24){var um=Ext.get(el,true).getUpdateManager();Ext.apply(um,_24);um.update(url,_23,_24?_24.callback:null);};Ext.UpdateManager.update=Ext.UpdateManager.updateElement;Ext.UpdateManager.BasicRenderer=function(){};Ext.UpdateManager.BasicRenderer.prototype={render:function(el,_27,_28,_29){el.update(_27.responseText,_28.loadScripts,_29);}};Ext.util.DelayedTask=function(fn,_2,_3){var id=null,d,t;var _7=function(){var _8=new Date().getTime();if(_8-t>=d){clearInterval(id);id=null;fn.apply(_2,_3||[]);}};this.delay=function(_9,_a,_b,_c){if(id&&_9!=d){this.cancel();}d=_9;t=new Date().getTime();fn=_a||fn;_2=_b||_2;_3=_c||_3;if(!id){id=setInterval(_7,d);}};this.cancel=function(){if(id){clearInterval(id);id=null;}};};Ext.util.TaskRunner=function(_1){_1=_1||10;var _2=[],_3=[];var id=0;var _5=false;var _6=function(){_5=false;clearInterval(id);id=0;};var _7=function(){if(!_5){_5=true;id=setInterval(_8,_1);}};var _9=function(_a){_3.push(_a);if(_a.onStop){_a.onStop();}};var _8=function(){if(_3.length>0){for(var i=0,_c=_3.length;i<_c;i++){_2.remove(_3[i]);}_3=[];if(_2.length<1){_6();return;}}var _d=new Date().getTime();for(var i=0,_c=_2.length;i<_c;++i){var t=_2[i];var _f=_d-t.taskRunTime;if(t.interval<=_f){var rt=t.run.apply(t.scope||t,t.args||[++t.taskRunCount]);t.taskRunTime=_d;if(rt===false||t.taskRunCount===t.repeat){_9(t);return;}}if(t.duration&&t.duration<=(_d-t.taskStartTime)){_9(t);}}};this.start=function(_11){_2.push(_11);_11.taskStartTime=new Date().getTime();_11.taskRunTime=0;_11.taskRunCount=0;_7();return _11;};this.stop=function(_12){_9(_12);return _12;};this.stopAll=function(){_6();for(var i=0,len=_2.length;i<len;i++){if(_2[i].onStop){_2[i].onStop();}}_2=[];_3=[];};};Ext.TaskMgr=new Ext.util.TaskRunner();Ext.util.MixedCollection=function(_1,_2){this.items=[];this.map={};this.keys=[];this.length=0;this.addEvents({"clear":true,"add":true,"replace":true,"remove":true,"sort":true});this.allowFunctions=_1===true;if(_2){this.getKey=_2;}Ext.util.MixedCollection.superclass.constructor.call(this);};Ext.extend(Ext.util.MixedCollection,Ext.util.Observable,{allowFunctions:false,add:function(_3,o){if(arguments.length==1){o=arguments[0];_3=this.getKey(o);}if(typeof _3=="undefined"||_3===null){this.length++;this.items.push(o);this.keys.push(null);}else{var _5=this.map[_3];if(_5){return this.replace(_3,o);}this.length++;this.items.push(o);this.map[_3]=o;this.keys.push(_3);}this.fireEvent("add",this.length-1,o,_3);return o;},getKey:function(o){return o.id;},replace:function(_7,o){if(arguments.length==1){o=arguments[0];_7=this.getKey(o);}var _9=this.item(_7);if(typeof _7=="undefined"||_7===null||typeof _9=="undefined"){return this.add(_7,o);}var _a=this.indexOfKey(_7);this.items[_a]=o;this.map[_7]=o;this.fireEvent("replace",_7,_9,o);return o;},addAll:function(_b){if(arguments.length>1||_b instanceof Array){var _c=arguments.length>1?arguments:_b;for(var i=0,_e=_c.length;i<_e;i++){this.add(_c[i]);}}else{for(var _f in _b){if(this.allowFunctions||typeof _b[_f]!="function"){this.add(_b[_f],_f);}}}},each:function(fn,_11){var _12=[].concat(this.items);for(var i=0,len=_12.length;i<len;i++){if(fn.call(_11||_12[i],_12[i],i,len)===false){break;}}},eachKey:function(fn,_16){for(var i=0,len=this.keys.length;i<len;i++){fn.call(_16||window,this.keys[i],this.items[i],i,len);}},find:function(fn,_1a){for(var i=0,len=this.items.length;i<len;i++){if(fn.call(_1a||window,this.items[i],this.keys[i])){return this.items[i];}}return null;},insert:function(_1d,key,o){if(arguments.length==2){o=arguments[1];key=this.getKey(o);}if(_1d>=this.length){return this.add(key,o);}this.length++;this.items.splice(_1d,0,o);if(typeof key!="undefined"&&key!=null){this.map[key]=o;}this.keys.splice(_1d,0,key);this.fireEvent("add",_1d,o,key);return o;},remove:function(o){return this.removeAt(this.indexOf(o));},removeAt:function(_21){if(_21<this.length&&_21>=0){this.length--;var o=this.items[_21];this.items.splice(_21,1);var key=this.keys[_21];if(typeof key!="undefined"){delete this.map[key];}this.keys.splice(_21,1);this.fireEvent("remove",o,key);}},removeKey:function(key){return this.removeAt(this.indexOfKey(key));},getCount:function(){return this.length;},indexOf:function(o){if(!this.items.indexOf){for(var i=0,len=this.items.length;i<len;i++){if(this.items[i]==o){return i;}}return-1;}else{return this.items.indexOf(o);}},indexOfKey:function(key){if(!this.keys.indexOf){for(var i=0,len=this.keys.length;i<len;i++){if(this.keys[i]==key){return i;}}return-1;}else{return this.keys.indexOf(key);}},item:function(key){var _2c=typeof this.map[key]!="undefined"?this.map[key]:this.items[key];return typeof _2c!="function"||this.allowFunctions?_2c:null;},itemAt:function(_2d){return this.items[_2d];},key:function(key){return this.map[key];},contains:function(o){return this.indexOf(o)!=-1;},containsKey:function(key){return typeof this.map[key]!="undefined";},clear:function(){this.length=0;this.items=[];this.keys=[];this.map={};this.fireEvent("clear");},first:function(){return this.items[0];},last:function(){return this.items[this.length-1];},_sort:function(_31,dir,fn){var dsc=String(dir).toUpperCase()=="DESC"?-1:1;fn=fn||function(a,b){return a-b;};var c=[],k=this.keys,_39=this.items;for(var i=0,len=_39.length;i<len;i++){c[c.length]={key:k[i],value:_39[i],index:i};}c.sort(function(a,b){var v=fn(a[_31],b[_31])*dsc;if(v==0){v=(a.index<b.index?-1:1);}return v;});for(var i=0,len=c.length;i<len;i++){_39[i]=c[i].value;k[i]=c[i].key;}this.fireEvent("sort",this);},sort:function(dir,fn){this._sort("value",dir,fn);},keySort:function(dir,fn){this._sort("key",dir,fn||function(a,b){return String(a).toUpperCase()-String(b).toUpperCase();});},getRange:function(_45,end){var _47=this.items;if(_47.length<1){return[];}_45=_45||0;end=Math.min(typeof end=="undefined"?this.length-1:end,this.length-1);var r=[];if(_45<=end){for(var i=_45;i<=end;i++){r[r.length]=_47[i];}}else{for(var i=_45;i>=end;i--){r[r.length]=_47[i];}}return r;},filter:function(_4a,_4b){if(!_4b.exec){_4b=String(_4b);if(_4b.length==0){return this.clone();}_4b=new RegExp("^"+Ext.escapeRe(_4b),"i");}return this.filterBy(function(o){return o&&_4b.test(o[_4a]);});},filterBy:function(fn,_4e){var r=new Ext.util.MixedCollection();r.getKey=this.getKey;var k=this.keys,it=this.items;for(var i=0,len=it.length;i<len;i++){if(fn.call(_4e||this,it[i],k[i])){r.add(k[i],it[i]);}}return r;},clone:function(){var r=new Ext.util.MixedCollection();var k=this.keys,it=this.items;for(var i=0,len=it.length;i<len;i++){r.add(k[i],it[i]);}r.getKey=this.getKey;return r;}});Ext.util.MixedCollection.prototype.get=Ext.util.MixedCollection.prototype.item;Ext.util.JSON=new(function(){var _1={}.hasOwnProperty?true:false;var _2=function(n){return n<10?"0"+n:n;};var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"};var _5=function(s){if(/["\\\x00-\x1f]/.test(s)){return"\""+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);})+"\"";}return"\""+s+"\"";};var _a=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i<l;i+=1){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",");}a.push(v===null?"null":Ext.util.JSON.encode(v));b=true;}}a.push("]");return a.join("");};var _11=function(o){return"\""+o.getFullYear()+"-"+_2(o.getMonth()+1)+"-"+_2(o.getDate())+"T"+_2(o.getHours())+":"+_2(o.getMinutes())+":"+_2(o.getSeconds())+"\"";};this.encode=function(o){if(typeof o=="undefined"||o===null){return"null";}else{if(o instanceof Array){return _a(o);}else{if(o instanceof Date){return _11(o);}else{if(typeof o=="string"){return _5(o);}else{if(typeof o=="number"){return isFinite(o)?String(o):"null";}else{if(typeof o=="boolean"){return String(o);}else{var a=["{"],b,i,v;for(i in o){if(!_1||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",");}a.push(this.encode(i),":",v===null?"null":this.encode(v));b=true;}}}a.push("}");return a.join("");}}}}}}};this.decode=function(_18){return eval("("+_18+")");};})();Ext.encode=Ext.util.JSON.encode;Ext.decode=Ext.util.JSON.decode;Ext.util.Format=function(){var _1=/^\s+|\s+$/g;return{ellipsis:function(_2,_3){if(_2&&_2.length>_3){return _2.substr(0,_3-3)+"...";}return _2;},undef:function(_4){return typeof _4!="undefined"?_4:"";},htmlEncode:function(_5){return!_5?_5:String(_5).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");},trim:function(_6){return String(_6).replace(_1,"");},substr:function(_7,_8,_9){return String(_7).substr(_8,_9);},lowercase:function(_a){return String(_a).toLowerCase();},uppercase:function(_b){return String(_b).toUpperCase();},capitalize:function(_c){return!_c?_c:_c.charAt(0).toUpperCase()+_c.substr(1).toLowerCase();},call:function(_d,fn){if(arguments.length>2){var _f=Array.prototype.slice.call(arguments,2);_f.unshift(_d);return eval(fn).apply(window,_f);}else{return eval(fn).call(window,_d);}},usMoney:function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);return"$"+v;},date:function(v,_12){if(!v){return"";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(_12||"m/d/Y");},dateRenderer:function(_13){return function(v){return Ext.util.Format.date(v,_13);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return!v?v:String(v).replace(this.stripTagsRE,"");}};}();Ext.util.CSS=function(){var _1=null;var _2=document;var _3=/(-[a-z])/gi;var _4=function(m,a){return a.charAt(1).toUpperCase();};return{createStyleSheet:function(_7){var ss;if(Ext.isIE){ss=_2.createStyleSheet();ss.cssText=_7;}else{var _9=_2.getElementsByTagName("head")[0];var _a=_2.createElement("style");_a.setAttribute("type","text/css");try{_a.appendChild(_2.createTextNode(_7));}catch(e){_a.cssText=_7;}_9.appendChild(_a);ss=_a.styleSheet?_a.styleSheet:(_a.sheet||_2.styleSheets[_2.styleSheets.length-1]);}this.cacheStyleSheet(ss);return ss;},removeStyleSheet:function(id){var _c=_2.getElementById(id);if(_c){_c.parentNode.removeChild(_c);}},swapStyleSheet:function(id,_e){this.removeStyleSheet(id);var ss=_2.createElement("link");ss.setAttribute("rel","stylesheet");ss.setAttribute("type","text/css");ss.setAttribute("id",id);ss.setAttribute("href",_e);_2.getElementsByTagName("head")[0].appendChild(ss);},refreshCache:function(){return this.getRules(true);},cacheStyleSheet:function(ss){if(!_1){_1={};}try{var _11=ss.cssRules||ss.rules;for(var j=_11.length-1;j>=0;--j){_1[_11[j].selectorText]=_11[j];}}catch(e){}},getRules:function(_13){if(_1==null||_13){_1={};var ds=_2.styleSheets;for(var i=0,len=ds.length;i<len;i++){try{this.cacheStyleSheet(ds[i]);}catch(e){}}}return _1;},getRule:function(_17,_18){var rs=this.getRules(_18);if(!(_17 instanceof Array)){return rs[_17];}for(var i=0;i<_17.length;i++){if(rs[_17[i]]){return rs[_17[i]];}}return null;},updateRule:function(_1b,_1c,_1d){if(!(_1b instanceof Array)){var _1e=this.getRule(_1b);if(_1e){_1e.style[_1c.replace(_3,_4)]=_1d;return true;}}else{for(var i=0;i<_1b.length;i++){if(this.updateRule(_1b[i],_1c,_1d)){return true;}}}return false;}};}();Ext.util.ClickRepeater=function(el,_2){this.el=Ext.get(el);this.el.unselectable();Ext.apply(this,_2);this.addEvents({"mousedown":true,"click":true,"mouseup":true});this.el.on("mousedown",this.handleMouseDown,this);if(this.preventDefault||this.stopDefault){this.el.on("click",function(e){if(this.preventDefault){e.preventDefault();}if(this.stopDefault){e.stopEvent();}},this);}if(this.handler){this.on("click",this.handler,this.scope||this);}Ext.util.ClickRepeater.superclass.constructor.call(this);};Ext.extend(Ext.util.ClickRepeater,Ext.util.Observable,{interval:20,delay:250,preventDefault:true,stopDefault:false,timer:0,docEl:Ext.get(document),handleMouseDown:function(){clearTimeout(this.timer);this.el.blur();if(this.pressClass){this.el.addClass(this.pressClass);}this.mousedownTime=new Date();this.docEl.on("mouseup",this.handleMouseUp,this);this.el.on("mouseout",this.handleMouseOut,this);this.fireEvent("mousedown",this);this.fireEvent("click",this);this.timer=this.click.defer(this.delay||this.interval,this);},click:function(){this.fireEvent("click",this);this.timer=this.click.defer(this.getInterval(),this);},getInterval:function(){if(!this.accelerate){return this.interval;}var _4=this.mousedownTime.getElapsed();if(_4<500){return 400;}else{if(_4<1700){return 320;}else{if(_4<2600){return 250;}else{if(_4<3500){return 180;}else{if(_4<4400){return 140;}else{if(_4<5300){return 80;}else{if(_4<6200){return 50;}else{return 10;}}}}}}}},handleMouseOut:function(){clearTimeout(this.timer);if(this.pressClass){this.el.removeClass(this.pressClass);}this.el.on("mouseover",this.handleMouseReturn,this);},handleMouseReturn:function(){this.el.un("mouseover",this.handleMouseReturn);if(this.pressClass){this.el.addClass(this.pressClass);}this.click();},handleMouseUp:function(){clearTimeout(this.timer);this.el.un("mouseover",this.handleMouseReturn);this.el.un("mouseout",this.handleMouseOut);this.docEl.un("mouseup",this.handleMouseUp);this.el.removeClass(this.pressClass);this.fireEvent("mouseup",this);}});Ext.KeyNav=function(el,_2){this.el=Ext.get(el);Ext.apply(this,_2);if(!this.disabled){this.disabled=true;this.enable();}};Ext.KeyNav.prototype={disabled:false,defaultEventAction:"stopEvent",prepareEvent:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(Ext.isSafari&&h&&k>=37&&k<=40){e.stopEvent();}},relay:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(h&&this[h]){if(this.doRelay(e,this[h],h)!==true){e[this.defaultEventAction]();}}},doRelay:function(e,h,_b){return h.call(this.scope||this,e);},enter:false,left:false,right:false,up:false,down:false,tab:false,esc:false,pageUp:false,pageDown:false,del:false,home:false,end:false,keyToHandler:{37:"left",39:"right",38:"up",40:"down",33:"pageUp",34:"pageDown",46:"del",36:"home",35:"end",13:"enter",27:"esc",9:"tab"},enable:function(){if(this.disabled){if(Ext.isIE){this.el.on("keydown",this.relay,this);}else{this.el.on("keydown",this.prepareEvent,this);this.el.on("keypress",this.relay,this);}this.disabled=false;}},disable:function(){if(!this.disabled){if(Ext.isIE){this.el.un("keydown",this.relay);}else{this.el.un("keydown",this.prepareEvent);this.el.un("keypress",this.relay);}this.disabled=true;}}};Ext.KeyMap=function(el,_2,_3){this.el=Ext.get(el);this.eventName=_3||"keydown";this.bindings=[];if(_2 instanceof Array){for(var i=0,_5=_2.length;i<_5;i++){this.addBinding(_2[i]);}}else{this.addBinding(_2);}this.keyDownDelegate=Ext.EventManager.wrap(this.handleKeyDown,this,true);this.enable();};Ext.KeyMap.prototype={stopEvent:false,addBinding:function(_6){var _7=_6.key,_8=_6.shift,_9=_6.ctrl,_a=_6.alt,fn=_6.fn,_c=_6.scope;if(typeof _7=="string"){var ks=[];var _e=_7.toUpperCase();for(var j=0,len=_e.length;j<len;j++){ks.push(_e.charCodeAt(j));}_7=ks;}var _11=_7 instanceof Array;var _12=function(e){if((!_8||e.shiftKey)&&(!_9||e.ctrlKey)&&(!_a||e.altKey)){var k=e.getKey();if(_11){for(var i=0,len=_7.length;i<len;i++){if(_7[i]==k){if(this.stopEvent){e.stopEvent();}fn.call(_c||window,k,e);return;}}}else{if(k==_7){if(this.stopEvent){e.stopEvent();}fn.call(_c||window,k,e);}}}};this.bindings.push(_12);},handleKeyDown:function(e){if(this.enabled){var b=this.bindings;for(var i=0,len=b.length;i<len;i++){b[i].call(this,e);}}},isEnabled:function(){return this.enabled;},enable:function(){if(!this.enabled){this.el.on(this.eventName,this.keyDownDelegate);this.enabled=true;}},disable:function(){if(this.enabled){this.el.removeListener(this.eventName,this.keyDownDelegate);this.enabled=false;}}};Ext.util.TextMetrics=function(){var _1;return{measure:function(el,_3,_4){if(!_1){_1=Ext.util.TextMetrics.Instance(el,_4);}_1.bind(el);_1.setFixedWidth(_4||"auto");return _1.getSize(_3);},createInstance:function(el,_6){return Ext.util.TextMetrics.Instance(el,_6);}};}();Ext.util.TextMetrics.Instance=function(_7,_8){var ml=new Ext.Element(document.createElement("div"));document.body.appendChild(ml.dom);ml.position("absolute");ml.setLeftTop(-1000,-1000);ml.hide();if(_8){mi.setWidth(_8);}var _a={getSize:function(_b){ml.update(_b);var s=ml.getSize();ml.update("");return s;},bind:function(el){ml.setStyle(Ext.fly(el).getStyles("font-size","font-style","font-weight","font-family","line-height"));},setFixedWidth:function(_e){ml.setWidth(_e);},getWidth:function(_f){ml.dom.style.width="auto";return this.getSize(_f).width;},getHeight:function(_10){return this.getSize(_10).height;}};_a.bind(_7);return _a;};Ext.Element.measureText=Ext.util.TextMetrics.measure;(function(){var _1=Ext.EventManager;var _2=Ext.lib.Dom;Ext.dd.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};Ext.dd.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(_1d,pad,_1f){if(typeof pad=="number"){pad={left:pad,right:pad,top:pad,bottom:pad};}pad=pad||this.defaultPadding;var b=Ext.get(this.getEl()).getBox();var ce=Ext.get(_1d);var s=ce.getScroll();var c,cd=ce.dom;if(cd==document.body){c={x:s.left,y:s.top,width:Ext.lib.Dom.getViewWidth(),height:Ext.lib.Dom.getViewHeight()};}else{xy=ce.getXY();c={x:xy[0]+s.left,y:xy[1]+s.top,width:cd.clientWidth,height:cd.clientHeight};}var _25=b.y-c.y;var _26=b.x-c.x;this.resetConstraints();this.setXConstraint(_26-(pad.left||0),c.width-_26-b.width-(pad.right||0));this.setYConstraint(_25-(pad.top||0),c.height-_25-b.height-(pad.bottom||0));},getEl:function(){if(!this._domRef){this._domRef=Ext.getDom(this.id);}return this._domRef;},getDragEl:function(){return Ext.getDom(this.dragElId);},init:function(id,_28,_29){this.initTarget(id,_28,_29);_1.on(this.id,"mousedown",this.handleMouseDown,this);},initTarget:function(id,_2b,_2c){this.config=_2c||{};this.DDM=Ext.dd.DDM;this.groups={};if(typeof id!=="string"){id=Ext.id(id);}this.id=id;this.addToGroup((_2b)?_2b:"default");this.handleElId=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();this.handleOnAvailable();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_2d,_2e,_2f,_30){if(!_2e&&0!==_2e){this.padding=[_2d,_2d,_2d,_2d];}else{if(!_2f&&0!==_2f){this.padding=[_2d,_2e,_2d,_2e];}else{this.padding=[_2d,_2e,_2f,_30];}}},setInitPosition:function(_31,_32){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_31||0;var dy=_32||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_39){this.groups[_39]=true;this.DDM.regDragDrop(this,_39);},removeFromGroup:function(_3a){if(this.groups[_3a]){delete this.groups[_3a];}this.DDM.removeDDFromGroup(this,_3a);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Ext.id(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Ext.id(id);}_1.on(id,"mousedown",this.handleMouseDown,this);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.un(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){if(this.primaryButtonOnly&&e.button!=0){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new Ext.lib.Point(Ext.lib.Event.getPageX(e),Ext.lib.Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _42=Ext.lib.Event.getTarget(e);return(this.isValidHandleChild(_42)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_42,this.id)));},addInvalidHandleType:function(_43){var _44=_43.toUpperCase();this.invalidHandleTypes[_44]=_44;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Ext.id(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_46){this.invalidHandleClasses.push(_46);},removeInvalidHandleType:function(_47){var _48=_47.toUpperCase();delete this.invalidHandleTypes[_48];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Ext.id(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_4a){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==_4a){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(_4d){var _4e=true;var _4f;try{_4f=_4d.nodeName.toUpperCase();}catch(e){_4f=_4d.nodeName;}_4e=_4e&&!this.invalidHandleTypes[_4f];_4e=_4e&&!this.invalidHandleIds[_4d.id];for(var i=0,len=this.invalidHandleClasses.length;_4e&&i<len;++i){_4e=!_2.hasClass(_4d,this.invalidHandleClasses[i]);}return _4e;},setXTicks:function(_52,_53){this.xTicks=[];this.xTickSize=_53;var _54={};for(var i=this.initPageX;i>=this.minX;i=i-_53){if(!_54[i]){this.xTicks[this.xTicks.length]=i;_54[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_53){if(!_54[i]){this.xTicks[this.xTicks.length]=i;_54[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_56,_57){this.yTicks=[];this.yTickSize=_57;var _58={};for(var i=this.initPageY;i>=this.minY;i=i-_57){if(!_58[i]){this.yTicks[this.yTicks.length]=i;_58[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_57){if(!_58[i]){this.yTicks[this.yTicks.length]=i;_58[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_5a,_5b,_5c){this.leftConstraint=_5a;this.rightConstraint=_5b;this.minX=this.initPageX-_5a;this.maxX=this.initPageX+_5b;if(_5c){this.setXTicks(this.initPageX,_5c);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_5e,_5f){this.topConstraint=iUp;this.bottomConstraint=_5e;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_5e;if(_5f){this.setYTicks(this.initPageY,_5f);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_63){if(!_63){return val;}else{if(_63[0]>=val){return _63[0];}else{for(var i=0,len=_63.length;i<len;++i){var _66=i+1;if(_63[_66]&&_63[_66]>=val){var _67=val-_63[i];var _68=_63[_66]-val;return(_68>_67)?_63[i]:_63[_66];}}return _63[_63.length-1];}}},toString:function(){return("DragDrop "+this.id);}};})();if(!Ext.dd.DragDropMgr){Ext.dd.DragDropMgr=function(){var _69=Ext.EventManager;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_6a,_6b){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_6a].apply(oDD,_6b);}}},_onLoad:function(){this.init();_69.on(document,"mouseup",this.handleMouseUp,this,true);_69.on(window,"unload",this._onUnload,this,true);_69.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_71){if(!this.initialized){this.init();}if(!this.ids[_71]){this.ids[_71]={};}this.ids[_71][oDD.id]=oDD;},removeDDFromGroup:function(oDD,_73){if(!this.ids[_73]){this.ids[_73]={};}var obj=this.ids[_73];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];},regHandle:function(_77,_78){if(!this.handleIds[_77]){this.handleIds[_77]={};}this.handleIds[_77][_78]=_78;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(_7a,_7b){var _7c=[];for(var i in _7a.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_7b||dd.isTarget){_7c[_7c.length]=dd;}}}return _7c;},isLegalTarget:function(oDD,_80){var _81=this.getRelated(oDD,true);for(var i=0,len=_81.length;i<len;++i){if(_81[i].id==_80.id){return true;}}return false;},isTypeOfDD:function(oDD){return(oDD&&oDD.__ygDragDrop);},isHandle:function(_85,_86){return(this.handleIds[_85]&&this.handleIds[_85][_86]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}return null;},handleMouseDown:function(e,oDD){_69.on(document,"mousemove",this.handleMouseMove,this,true);this.currentTarget=Ext.lib.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=Ext.lib.Event.getPageX(e);this.startY=Ext.lib.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=Ext.dd.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}this.dragThreshMet=true;},handleMouseUp:function(e){_69.un(document,"mousemove",this.handleMouseMove,this,true);if(!this.dragCurrent){return true;}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){e.stopPropagation();}if(this.preventDefault){e.preventDefault();}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}this.dragCurrent.onMouseUp(e);}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}if(Ext.isIE&&(e.button!==0&&e.button!==1&&e.button!==2)){this.stopEvent(e);return this.handleMouseUp(e);}if(!this.dragThreshMet){var _93=Math.abs(this.startX-Ext.lib.Event.getPageX(e));var _94=Math.abs(this.startY-Ext.lib.Event.getPageY(e));if(_93>this.clickPixelThresh||_94>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);if(!this.dragCurrent.moveOnly){this.fireEvents(e,false);}}this.stopEvent(e);return true;},fireEvents:function(e,_96){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=Ext.lib.Event.getPageX(e);var y=Ext.lib.Event.getPageY(e);var pt=new Ext.lib.Point(x,y);var _9b=[];var _9c=[];var _9d=[];var _9e=[];var _9f=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_9c.push(ddo);}_9b[i]=true;delete this.dragOvers[i];}for(var _a2 in dc.groups){if("string"!=typeof _a2){continue;}for(i in this.ids[_a2]){var oDD=this.ids[_a2][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_96){_9e.push(oDD);}else{if(!_9b[oDD.id]){_9f.push(oDD);}else{_9d.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_9c.length){dc.b4DragOut(e,_9c);dc.onDragOut(e,_9c);}if(_9f.length){dc.onDragEnter(e,_9f);}if(_9d.length){dc.b4DragOver(e,_9d);dc.onDragOver(e,_9d);}if(_9e.length){dc.b4DragDrop(e,_9e);dc.onDragDrop(e,_9e);}}else{var len=0;for(i=0,len=_9c.length;i<len;++i){dc.b4DragOut(e,_9c[i].id);dc.onDragOut(e,_9c[i].id);}for(i=0,len=_9f.length;i<len;++i){dc.onDragEnter(e,_9f[i].id);}for(i=0,len=_9d.length;i<len;++i){dc.b4DragOver(e,_9d[i].id);dc.onDragOver(e,_9d[i].id);}for(i=0,len=_9e.length;i<len;++i){dc.b4DragDrop(e,_9e[i].id);dc.onDragDrop(e,_9e[i].id);}}if(_96&&!_9e.length){dc.onInvalidDrop(e);}},getBestMatch:function(dds){var _a6=null;var len=dds.length;if(len==1){_a6=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(dd.cursorIsOver){_a6=dd;break;}else{if(!_a6||_a6.overlap.getArea()<dd.overlap.getArea()){_a6=dd;}}}}return _a6;},refreshCache:function(_aa){for(var _ab in _aa){if("string"!=typeof _ab){continue;}for(var i in this.ids[_ab]){var oDD=this.ids[_ab][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){try{if(el){var _b0=el.offsetParent;if(_b0){return true;}}}catch(e){}return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=Ext.lib.Dom.getXY(el);}catch(e){}if(!pos){return null;}x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new Ext.lib.Region(t,r,b,l);},isOverTarget:function(pt,_bd,_be){var loc=this.locationCache[_bd.id];if(!loc||!this.useCache){loc=this.getLocation(_bd);this.locationCache[_bd.id]=loc;}if(!loc){return false;}_bd.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!_be&&!dc.constrainX&&!dc.constrainY)){return _bd.cursorIsOver;}_bd.overlap=null;var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var _c3=new Ext.lib.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var _c4=_c3.intersect(loc);if(_c4){_bd.overlap=_c4;return(_be)?true:_bd.cursorIsOver;}else{return false;}},_onUnload:function(e,me){Ext.dd.DragDropMgr.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var _c8=this.elementCache[id];if(!_c8||!_c8.el){_c8=this.elementCache[id]=new this.ElementWrapper(Ext.getDom(id));}return _c8;},getElement:function(id){return Ext.getDom(id);},getCss:function(id){var el=Ext.getDom(id);return(el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return Ext.lib.Dom.getX(el);},getPosY:function(el){return Ext.lib.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else{if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else{if(db){t=db.scrollTop;l=db.scrollLeft;}else{}}return{top:t,left:l};},getStyle:function(el,_d8){return Ext.fly(el).getStyle(_d8);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(_d9,_da){var _db=Ext.lib.Dom.getXY(_da);Ext.lib.Dom.setXY(_d9,_db);},numericSort:function(a,b){return(a-b);},_timeoutCount:0,_addListeners:function(){var DDM=Ext.dd.DDM;if(Ext.lib.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(_df,id){if(this.isHandle(id,_df.id)){return true;}else{var p=_df.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();Ext.dd.DDM=Ext.dd.DragDropMgr;Ext.dd.DDM._addListeners();}Ext.dd.DD=function(id,_e3,_e4){if(id){this.init(id,_e3,_e4);}};Ext.extend(Ext.dd.DD,Ext.dd.DragDrop,{scroll:true,autoOffset:function(_e5,_e6){var x=_e5-this.startPageX;var y=_e6-this.startPageY;this.setDelta(x,y);},setDelta:function(_e9,_ea){this.deltaX=_e9;this.deltaY=_ea;},setDragElPos:function(_eb,_ec){var el=this.getDragEl();this.alignElWithMouse(el,_eb,_ec);},alignElWithMouse:function(el,_ef,_f0){var _f1=this.getTargetCoord(_ef,_f0);var fly=el.dom?el:Ext.fly(el);if(!this.deltaSetXY){var _f3=[_f1.x,_f1.y];fly.setXY(_f3);var _f4=fly.getLeft(true);var _f5=fly.getTop(true);this.deltaSetXY=[_f4-_f1.x,_f5-_f1.y];}else{fly.setLeftTop(_f1.x+this.deltaSetXY[0],_f1.y+this.deltaSetXY[1]);}this.cachePosition(_f1.x,_f1.y);this.autoScroll(_f1.x,_f1.y,el.offsetHeight,el.offsetWidth);return _f1;},cachePosition:function(_f6,_f7){if(_f6){this.lastPageX=_f6;this.lastPageY=_f7;}else{var _f8=Ext.lib.Dom.getXY(this.getEl());this.lastPageX=_f8[0];this.lastPageY=_f8[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var _fd=Ext.lib.Dom.getViewWidth();var _fe=Ext.lib.Dom.getViewHeight();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _102=w+x;var _103=(_fd+st-y-this.deltaY);var _104=(_fe+sl-x-this.deltaX);var _105=40;var _106=(document.all)?80:30;if(bot>_fd&&_103<_105){window.scrollTo(sl,st+_106);}if(y<st&&st>0&&y-st<_105){window.scrollTo(sl,st-_106);}if(_102>_fe&&_104<_105){window.scrollTo(sl+_106,st);}if(x<sl&&sl>0&&x-sl<_105){window.scrollTo(sl-_106,st);}}},getTargetCoord:function(_107,_108){var x=_107-this.deltaX;var y=_108-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;}if(y>this.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},applyConfig:function(){Ext.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(Ext.lib.Event.getPageX(e),Ext.lib.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(Ext.lib.Event.getPageX(e),Ext.lib.Event.getPageY(e));},toString:function(){return("DD "+this.id);}});Ext.dd.DDProxy=function(id,_10e,_10f){if(id){this.init(id,_10e,_10f);this.initFrame();}};Ext.dd.DDProxy.dragElId="ygddfdiv";Ext.extend(Ext.dd.DDProxy,Ext.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){Ext.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Ext.dd.DDProxy.dragElId);},showFrame:function(_114,_115){var el=this.getEl();var _117=this.getDragEl();var s=_117.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_114,_115);Ext.fly(_117).show();},_resizeProxy:function(){if(this.resizeFrame){var el=this.getEl();Ext.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight);}},b4MouseDown:function(e){var x=Ext.lib.Event.getPageX(e);var y=Ext.lib.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){Ext.fly(this.getDragEl()).hide();},endDrag:function(e){var lel=this.getEl();var del=this.getDragEl();del.style.visibility="";this.beforeMove();lel.style.visibility="hidden";Ext.dd.DDM.moveToEl(lel,del);del.style.visibility="hidden";lel.style.visibility="";this.afterDrag();},beforeMove:function(){},afterDrag:function(){},toString:function(){return("DDProxy "+this.id);}});Ext.dd.DDTarget=function(id,_124,_125){if(id){this.initTarget(id,_124,_125);}};Ext.extend(Ext.dd.DDTarget,Ext.dd.DragDrop,{toString:function(){return("DDTarget "+this.id);}});Ext.dd.ScrollManager=function(){var _1=Ext.dd.DragDropMgr;var _2={};var _3=null;var _4={};var _5=function(e){_3=null;_7();};var _8=function(){if(_1.dragCurrent){_1.refreshCache(_1.dragCurrent.groups);}};var _9=function(){if(_1.dragCurrent){var _a=Ext.dd.ScrollManager;if(!_a.animate){if(_4.el.scroll(_4.dir,_a.increment)){_8();}}else{_4.el.scroll(_4.dir,_a.increment,true,_a.animDuration,_8);}}};var _7=function(){if(_4.id){clearInterval(_4.id);}_4.id=0;_4.el=null;_4.dir="";};var _b=function(el,_d){_7();_4.el=el;_4.dir=_d;_4.id=setInterval(_9,Ext.dd.ScrollManager.frequency);};var _e=function(e,_10){if(_10||!_1.dragCurrent){return;}var dds=Ext.dd.ScrollManager;if(!_3||_3!=_1.dragCurrent){_3=_1.dragCurrent;dds.refreshCache();}var xy=Ext.lib.Event.getXY(e);var pt=new Ext.lib.Point(xy[0],xy[1]);for(var id in _2){var el=_2[id],r=el._region;if(r.contains(pt)&&el.isScrollable()){if(r.bottom-pt.y<=dds.thresh){if(_4.el!=el){_b(el,"down");}return;}else{if(r.right-pt.x<=dds.thresh){if(_4.el!=el){_b(el,"left");}return;}else{if(pt.y-r.top<=dds.thresh){if(_4.el!=el){_b(el,"up");}return;}else{if(pt.x-r.left<=dds.thresh){if(_4.el!=el){_b(el,"right");}return;}}}}}}_7();};_1.fireEvents=_1.fireEvents.createSequence(_e,_1);_1.stopDrag=_1.stopDrag.createSequence(_5,_1);return{register:function(el){if(el instanceof Array){for(var i=0,len=el.length;i<len;i++){this.register(el[i]);}}else{el=Ext.get(el);_2[el.id]=el;}},unregister:function(el){if(el instanceof Array){for(var i=0,len=el.length;i<len;i++){this.unregister(el[i]);}}else{el=Ext.get(el);delete _2[el.id];}},thresh:25,increment:100,frequency:500,animate:true,animDuration:0.4,refreshCache:function(){for(var id in _2){if(typeof _2[id]=="object"){_2[id]._region=_2[id].getRegion();}}}};}();Ext.dd.Registry=function(){var _1={};var _2={};var _3=0;var _4=function(el,_6){if(typeof el=="string"){return el;}var id=el.id;if(!id&&_6!==false){id="extdd-"+(++_3);el.id=id;}return id;};return{register:function(el,_9){_9=_9||{};if(typeof el=="string"){el=document.getElementById(el);}_9.ddel=el;_1[_4(el)]=_9;if(_9.isHandle!==false){_2[_9.ddel.id]=_9;}if(_9.handles){var hs=_9.handles;for(var i=0,_c=hs.length;i<_c;i++){_2[_4(hs[i])]=_9;}}},unregister:function(el){var id=_4(el,false);var _f=_1[id];if(_f){delete _1[id];if(_f.handles){var hs=_f.handles;for(var i=0,len=hs.length;i<len;i++){delete _2[_4(hs[i],false)];}}}},getHandle:function(id){if(typeof id!="string"){id=id.id;}return _2[id];},getHandleFromEvent:function(e){var t=Ext.lib.Event.getTarget(e);return t?_2[t.id]:null;},getTarget:function(id){if(typeof id!="string"){id=id.id;}return _1[id];},getTargetFromEvent:function(e){var t=Ext.lib.Event.getTarget(e);return t?_1[t.id]||_2[t.id]:null;}};}();Ext.dd.StatusProxy=function(_1){Ext.apply(this,_1);this.id=this.id||Ext.id();this.el=new Ext.Layer({dh:{id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[{tag:"div",cls:"x-dd-drop-icon"},{tag:"div",cls:"x-dd-drag-ghost"}]},shadow:!_1||_1.shadow!==false});this.ghost=Ext.get(this.el.dom.childNodes[1]);this.dropStatus=this.dropNotAllowed;};Ext.dd.StatusProxy.prototype={dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",setStatus:function(_2){_2=_2||this.dropNotAllowed;if(this.dropStatus!=_2){this.el.replaceClass(this.dropStatus,_2);this.dropStatus=_2;}},reset:function(_3){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(_3){this.ghost.update("");}},update:function(_4){if(typeof _4=="string"){this.ghost.update(_4);}else{this.ghost.update("");_4.style.margin="0";this.ghost.dom.appendChild(_4);}},getEl:function(){return this.el;},getGhost:function(){return this.ghost;},hide:function(_5){this.el.hide();if(_5){this.reset(true);}},stop:function(){if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){this.anim.stop();}},show:function(){this.el.show();},sync:function(){this.el.sync();},repair:function(xy,_7,_8){this.callback=_7;this.scope=_8;if(xy&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||0.5,easing:"easeOut",xy:xy,stopFx:true,callback:this.afterRepair,scope:this});}else{this.afterRepair();}},afterRepair:function(){this.hide(true);if(typeof this.callback=="function"){this.callback.call(this.scope||this);}this.callback==null;this.scope==null;}};Ext.dd.DragSource=function(el,_2){this.el=Ext.get(el);this.dragData={};Ext.apply(this,_2);if(!this.proxy){this.proxy=new Ext.dd.StatusProxy();}this.el.on("mouseup",this.handleMouseUp);Ext.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true});this.dragging=false;};Ext.extend(Ext.dd.DragSource,Ext.dd.DDProxy,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",getDragData:function(e){return this.dragData;},onDragEnter:function(e,id){var _6=Ext.dd.DragDropMgr.getDDById(id);this.cachedTarget=_6;if(this.beforeDragEnter(_6,e,id)!==false){if(_6.isNotifyTarget){var _7=_6.notifyEnter(this,e,this.dragData);this.proxy.setStatus(_7);}else{this.proxy.setStatus(this.dropAllowed);}if(this.afterDragEnter){this.afterDragEnter(_6,e,id);}}},beforeDragEnter:function(_8,e,id){return true;},alignElWithMouse:function(){Ext.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync();},onDragOver:function(e,id){var _d=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);if(this.beforeDragOver(_d,e,id)!==false){if(_d.isNotifyTarget){var _e=_d.notifyOver(this,e,this.dragData);this.proxy.setStatus(_e);}if(this.afterDragOver){this.afterDragOver(_d,e,id);}}},beforeDragOver:function(_f,e,id){return true;},onDragOut:function(e,id){var _14=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);if(this.beforeDragOut(_14,e,id)!==false){if(_14.isNotifyTarget){_14.notifyOut(this,e,this.dragData);}this.proxy.reset();if(this.afterDragOut){this.afterDragOut(_14,e,id);}}this.cachedTarget=null;},beforeDragOut:function(_15,e,id){return true;},onDragDrop:function(e,id){var _1a=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);if(this.beforeDragDrop(_1a,e,id)!==false){if(_1a.isNotifyTarget){if(_1a.notifyDrop(this,e,this.dragData)){this.onValidDrop(_1a,e,id);}else{this.onInvalidDrop(_1a,e,id);}}else{this.onValidDrop(_1a,e,id);}if(this.afterDragDrop){this.afterDragDrop(_1a,e,id);}}},beforeDragDrop:function(_1b,e,id){return true;},onValidDrop:function(_1e,e,id){this.hideProxy();},getRepairXY:function(e,_22){return this.el.getXY();},onInvalidDrop:function(_23,e,id){this.beforeInvalidDrop(_23,e,id);if(this.cachedTarget){if(this.cachedTarget.isNotifyTarget){this.cachedTarget.notifyOut(this,e,this.dragData);}this.cacheTarget=null;}this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);if(this.afterInvalidDrop){this.afterInvalidDrop(e,id);}},afterRepair:function(){if(Ext.enableFx){this.el.highlight(this.hlColor||"c3daf9");}this.dragging=false;},beforeInvalidDrop:function(_26,e,id){return true;},handleMouseDown:function(e){if(this.dragging){return;}if(Ext.QuickTips){Ext.QuickTips.disable();}var _2a=this.getDragData(e);if(_2a&&this.onBeforeDrag(_2a,e)!==false){this.dragData=_2a;this.proxy.stop();Ext.dd.DragSource.superclass.handleMouseDown.apply(this,arguments);}},handleMouseUp:function(e){if(Ext.QuickTips){Ext.QuickTips.enable();}},onBeforeDrag:function(_2c,e){return true;},onStartDrag:Ext.emptyFn,startDrag:function(x,y){this.proxy.reset();this.dragging=true;this.proxy.update("");this.onInitDrag(x,y);this.proxy.show();},onInitDrag:function(x,y){var _32=this.el.dom.cloneNode(true);_32.id=Ext.id();this.proxy.update(_32);this.onStartDrag(x,y);return true;},getProxy:function(){return this.proxy;},hideProxy:function(){this.proxy.hide();this.proxy.reset(true);this.dragging=false;},triggerCacheRefresh:function(){Ext.dd.DDM.refreshCache(this.groups);},b4EndDrag:function(e){},endDrag:function(e){this.onEndDrag(this.dragData,e);},onEndDrag:function(_35,e){},autoOffset:function(x,y){this.setDelta(-12,-20);}});Ext.dd.DropTarget=function(el,_2){this.el=Ext.get(el);Ext.apply(this,_2);if(this.containerScroll){Ext.dd.ScrollManager.register(this.el);}Ext.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{isTarget:true});};Ext.extend(Ext.dd.DropTarget,Ext.dd.DDTarget,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",isTarget:true,isNotifyTarget:true,notifyEnter:function(dd,e,_5){if(this.overClass){this.el.addClass(this.overClass);}return this.dropAllowed;},notifyOver:function(dd,e,_8){return this.dropAllowed;},notifyOut:function(dd,e,_b){if(this.overClass){this.el.removeClass(this.overClass);}},notifyDrop:function(dd,e,_e){return false;}});Ext.dd.DragZone=function(el,_2){Ext.dd.DragZone.superclass.constructor.call(this,el,_2);if(this.containerScroll){Ext.dd.ScrollManager.register(this.el);}};Ext.extend(Ext.dd.DragZone,Ext.dd.DragSource,{getDragData:function(e){return Ext.dd.Registry.getHandleFromEvent(e);},onInitDrag:function(x,y){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(x,y);return true;},afterRepair:function(){if(Ext.enableFx){Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");}this.dragging=false;},getRepairXY:function(e){return Ext.Element.fly(this.dragData.ddel).getXY();}});Ext.dd.DropZone=function(el,_2){Ext.dd.DropZone.superclass.constructor.call(this,el,_2);};Ext.extend(Ext.dd.DropZone,Ext.dd.DropTarget,{getTargetFromEvent:function(e){return Ext.dd.Registry.getTargetFromEvent(e);},onNodeEnter:function(n,dd,e,_7){},onNodeOver:function(n,dd,e,_b){return this.dropAllowed;},onNodeOut:function(n,dd,e,_f){},onNodeDrop:function(n,dd,e,_13){return false;},onContainerOver:function(dd,e,_16){return this.dropNotAllowed;},onContainerDrop:function(dd,e,_19){return false;},notifyEnter:function(dd,e,_1c){return this.dropNotAllowed;},notifyOver:function(dd,e,_1f){var n=this.getTargetFromEvent(e);if(!n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,_1f);this.lastOverNode=null;}return this.onContainerOver(dd,e,_1f);}if(this.lastOverNode!=n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,_1f);}this.onNodeEnter(n,dd,e,_1f);this.lastOverNode=n;}return this.onNodeOver(n,dd,e,_1f);},notifyOut:function(dd,e,_23){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,_23);this.lastOverNode=null;}},notifyDrop:function(dd,e,_26){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,_26);this.lastOverNode=null;}var n=this.getTargetFromEvent(e);return n?this.onNodeDrop(n,dd,e,_26):this.onContainerDrop(dd,e,_26);},triggerCacheRefresh:function(){Ext.dd.DDM.refreshCache(this.groups);}});Ext.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase();},asDate:function(s){if(!s){return 0;}if(s instanceof Date){return s.getTime();}return Date.parse(String(s));},asFloat:function(s){var _7=parseFloat(String(s).replace(/,/g,""));if(isNaN(_7)){_7=0;}return _7;},asInt:function(s){var _9=parseInt(String(s).replace(/,/g,""));if(isNaN(_9)){_9=0;}return _9;}};Ext.data.Record=function(_1,id){this.id=(id||id===0)?id:++Ext.data.Record.AUTO_ID;this.data=_1;};Ext.data.Record.create=function(o){var f=function(){f.superclass.constructor.apply(this,arguments);};Ext.extend(f,Ext.data.Record);var p=f.prototype;p.fields=new Ext.util.MixedCollection(false,function(_6){return _6.name;});for(var i=0,_8=o.length;i<_8;i++){p.fields.add(new Ext.data.Field(o[i]));}f.getField=function(_9){return p.fields.get(_9);};return f;};Ext.data.Record.AUTO_ID=1000;Ext.data.Record.EDIT="edit";Ext.data.Record.REJECT="reject";Ext.data.Record.COMMIT="commit";Ext.data.Record.prototype={dirty:false,editing:false,error:null,modified:null,join:function(_a){this.store=_a;},set:function(_b,_c){if(this.data[_b]==_c){return;}this.dirty=true;if(!this.modified){this.modified={};}if(typeof this.modified[_b]=="undefined"){this.modified[_b]=this.data[_b];}this.data[_b]=_c;if(!this.editing){this.store.afterEdit(this);}},get:function(_d){return this.data[_d];},beginEdit:function(){this.editing=true;this.modified={};},cancelEdit:function(){this.editing=false;delete this.modified;},endEdit:function(){this.editing=false;if(this.dirty&&this.store){this.store.afterEdit(this);}},reject:function(){var m=this.modified;for(var n in m){if(typeof m[n]!="function"){this.data[n]=m[n];}}this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterReject(this);}},commit:function(){this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterCommit(this);}},hasError:function(){return this.error!=null;},clearError:function(){this.error=null;}};Ext.data.Store=function(_1){this.data=new Ext.util.MixedCollection(false);this.data.getKey=function(o){return o.id;};this.baseParams={};this.paramNames={"start":"start","limit":"limit","sort":"sort","dir":"dir"};Ext.apply(this,_1);if(this.reader&&!this.recordType){this.recordType=this.reader.recordType;}this.fields=this.recordType.prototype.fields;this.modified=[];this.addEvents({datachanged:true,add:true,remove:true,update:true,clear:true,beforeload:true,load:true,loadexception:true});if(this.proxy){this.relayEvents(this.proxy,["loadexception"]);}this.sortToggle={};Ext.data.Store.superclass.constructor.call(this);};Ext.extend(Ext.data.Store,Ext.util.Observable,{remoteSort:false,lastOptions:null,add:function(_3){_3=[].concat(_3);for(var i=0,_5=_3.length;i<_5;i++){_3[i].join(this);}var _6=this.data.length;this.data.addAll(_3);this.fireEvent("add",this,_3,_6);},remove:function(_7){var _8=this.data.indexOf(_7);this.data.removeAt(_8);this.fireEvent("remove",this,_7,_8);},removeAll:function(){this.data.clear();this.fireEvent("clear",this);},insert:function(_9,_a){_a=[].concat(_a);for(var i=0,_c=_a.length;i<_c;i++){this.data.insert(_9,_a[i]);_a[i].join(this);}this.fireEvent("add",this,_a,_9);},indexOf:function(_d){return this.data.indexOf(_d);},indexOfId:function(id){return this.data.indexOfKey(id);},getById:function(id){return this.data.key(id);},getAt:function(_10){return this.data.itemAt(_10);},getRange:function(_11,end){return this.data.getRange(_11,end);},storeOptions:function(o){o=Ext.apply({},o);delete o.callback;delete o.scope;this.lastOptions=o;},load:function(_14){_14=_14||{};if(this.fireEvent("beforeload",this,_14)!==false){this.storeOptions(_14);var p=Ext.apply(_14.params||{},this.baseParams);if(this.sortInfo&&this.remoteSort){var pn=this.paramNames;p[pn["sort"]]=this.sortInfo.field;p[pn["dir"]]=this.sortInfo.direction;}this.proxy.load(p,this.reader,this.loadRecords,this,_14);}},reload:function(_17){this.load(Ext.applyIf(_17||{},this.lastOptions));},loadRecords:function(o,_19,_1a){if(!o||_1a===false){if(_1a!==false){this.fireEvent("load",this,[],_19);}if(_19.callback){_19.callback.call(_19.scope||this,[],_19,false);}return;}var r=o.records,t=o.totalRecords||r.length;for(var i=0,len=r.length;i<len;i++){r[i].join(this);}if(!_19||_19.add!==true){this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else{this.totalLength=Math.max(t,this.data.length+r.length);this.data.addAll(r);}this.fireEvent("load",this,r,_19);if(_19.callback){_19.callback.call(_19.scope||this,r,_19,true);}},loadData:function(o,_20){var r=this.reader.readRecords(o);this.loadRecords(r,{add:_20},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);}}},setDefaultSort:function(_2a,dir){this.sortInfo={field:_2a,direction:dir?dir.toUpperCase():"ASC"};},sort:function(_2c,dir){var f=this.fields.get(_2c);if(!dir){if(this.sortInfo&&this.sortInfo.field==f.name){dir=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");}else{dir=f.sortDir;}}this.sortToggle[f.name]=dir;this.sortInfo={field:f.name,direction:dir};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else{this.load(this.lastOptions);}},each:function(fn,_30){this.data.each(fn,_30);},getModifiedRecords:function(){return this.modified;},filter:function(_31,_32){if(!_32.exec){_32=String(_32);if(_32.length==0){return this.clearFilter();}_32=new RegExp("^"+Ext.escapeRe(_32),"i");}this.filterBy(function(r){return _32.test(r.data[_31]);});},filterBy:function(fn,_35){var _36=this.snapshot||this.data;this.snapshot=_36;this.data=_36.filterBy(fn,_35);this.fireEvent("datachanged",this);},clearFilter:function(_37){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(_37!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(_38){if(this.modified.indexOf(_38)==-1){this.modified.push(_38);}this.fireEvent("update",this,_38,Ext.data.Record.EDIT);},afterReject:function(_39){this.modified.remove(_39);this.fireEvent("update",this,_39,Ext.data.Record.REJECT);},afterCommit:function(_3a){this.modified.remove(_3a);this.fireEvent("update",this,_3a,Ext.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,len=m.length;i<len;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,len=m.length;i<len;i++){m[i].reject();}}});Ext.data.Connection=function(_1){Ext.apply(this,_1);this.addEvents({"beforerequest":true,"requestcomplete":true,"requestexception":true});Ext.data.Connection.superclass.constructor.call(this);};Ext.extend(Ext.data.Connection,Ext.util.Observable,{timeout:30000,request:function(_2){if(this.fireEvent("beforerequest",this,_2)!==false){var p=_2.params;if(typeof p=="object"){p=Ext.urlEncode(Ext.apply(_2.params,this.extraParams));}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:_2},timeout:this.timeout};var _5=_2.method||this.method||(p?"POST":"GET");var _6=_2.url||this.url;if(this.autoAbort!==false){this.abort();}if(_5=="GET"&&p){_6+=(_6.indexOf("?")!=-1?"&":"?")+p;p="";}this.transId=Ext.lib.Ajax.request(_5,_6,cb,p);}else{if(typeof _2.callback=="function"){_2.callback.call(_2.scope||window,_2,null,null);}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Ext.lib.Ajax.abort(this.transId);}},handleResponse:function(_7){this.transId=false;var _8=_7.argument.options;this.fireEvent("requestcomplete",this,_7,_8);if(typeof _8.callback=="function"){_8.callback.call(_8.scope||window,_8,true,_7);}},handleFailure:function(_9,e){this.transId=false;var _b=_9.argument.options;this.fireEvent("requestexception",this,_9,_b,e);if(typeof _b.callback=="function"){_b.callback.call(_b.scope||window,_b,false,_9);}}});Ext.data.Field=function(_1){if(typeof _1=="string"){_1={name:_1};}Ext.apply(this,_1);if(!this.type){this.type="auto";}var st=Ext.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}if(!this.sortType){switch(this.type){case"string":this.sortType=st.asUCString;break;case"date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}var _3=/[\$,%]/g;if(!this.convert){var cv,_5=this.dateFormat;switch(this.type){case"":case"auto":case undefined:cv=function(v){return v;};break;case"string":cv=function(v){return String(v);};break;case"int":cv=function(v){return v!==undefined&&v!==null&&v!==""?parseInt(String(v).replace(_3,""),10):"";};break;case"float":cv=function(v){return v!==undefined&&v!==null&&v!==""?parseFloat(String(v).replace(_3,""),10):"";};break;case"bool":case"boolean":cv=function(v){return v===true||v==="true"||v==1;};break;case"date":cv=function(v){if(!v){return"";}if(v instanceof Date){return v;}if(_5){if(_5=="timestamp"){return new Date(v*1000);}return Date.parseDate(v,_5);}var _c=Date.parse(v);return _c?new Date(_c):null;};break;}this.convert=cv;}};Ext.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"};Ext.data.DataReader=function(_1,_2){this.meta=_1;this.recordType=_2 instanceof Array?Ext.data.Record.create(_2):_2;};Ext.data.DataReader.prototype={};Ext.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Ext.data.DataProxy.superclass.constructor.call(this);};Ext.extend(Ext.data.DataProxy,Ext.util.Observable);Ext.data.MemoryProxy=function(_1){Ext.data.MemoryProxy.superclass.constructor.call(this);this.data=_1;};Ext.extend(Ext.data.MemoryProxy,Ext.data.DataProxy,{load:function(_2,_3,_4,_5,_6){_2=_2||{};var _7;try{_7=_3.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,_6,null,e);_4.call(_5,null,_6,false);return;}_4.call(_5,_7,_6,true);},update:function(_8,_9){}});Ext.data.HttpProxy=function(_1){Ext.data.HttpProxy.superclass.constructor.call(this);this.conn=_1.events?_1:new Ext.data.Connection(_1);};Ext.extend(Ext.data.HttpProxy,Ext.data.DataProxy,{getConnection:function(){return this.conn;},load:function(_2,_3,_4,_5,_6){if(this.fireEvent("beforeload",this,_2)!==false){this.conn.request({params:_2||{},request:{callback:_4,scope:_5,arg:_6},reader:_3,callback:this.loadResponse,scope:this});}else{_4.call(_5||this,null,_6,false);}},loadResponse:function(o,_8,_9){if(!_8){this.fireEvent("loadexception",this,o,_9);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var _a;try{_a=o.reader.read(_9);}catch(e){this.fireEvent("loadexception",this,o,_9,e);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,_a,o.request.arg,true);},update:function(_b){},updateResponse:function(_c){}});Ext.data.ScriptTagProxy=function(_1){Ext.data.ScriptTagProxy.superclass.constructor.call(this);Ext.apply(this,_1);this.head=document.getElementsByTagName("head")[0];};Ext.data.ScriptTagProxy.TRANS_ID=1000;Ext.extend(Ext.data.ScriptTagProxy,Ext.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(_2,_3,_4,_5,_6){if(this.fireEvent("beforeload",this,_2)!==false){var p=Ext.urlEncode(Ext.apply(_2,this.extraParams));var _8=this.url;_8+=(_8.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){_8+="&_dc="+(new Date().getTime());}var _9=++Ext.data.ScriptTagProxy.TRANS_ID;var _a={id:_9,cb:"stcCallback"+_9,scriptId:"stcScript"+_9,params:_2,arg:_6,url:_8,callback:_4,scope:_5,reader:_3};var _b=this;window[_a.cb]=function(o){_b.handleResponse(o,_a);};_8+=String.format("&{0}={1}",this.callbackParam,_a.cb);if(this.autoAbort!==false){this.abort();}_a.timeoutId=this.handleFailure.defer(this.timeout,this,[_a]);var _d=document.createElement("script");_d.setAttribute("src",_8);_d.setAttribute("type","text/javascript");_d.setAttribute("id",_a.scriptId);this.head.appendChild(_d);this.trans=_a;}else{_4.call(_5||this,null,_6,false);}},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);}},destroyTrans:function(_e,_f){this.head.removeChild(document.getElementById(_e.scriptId));clearTimeout(_e.timeoutId);if(_f){window[_e.cb]=undefined;try{delete window[_e.cb];}catch(e){}}else{window[_e.cb]=function(){window[_e.cb]=undefined;try{delete window[_e.cb];}catch(e){}};}},handleResponse:function(o,_11){this.trans=false;this.destroyTrans(_11,true);var _12;try{_12=_11.reader.readRecords(o);}catch(e){this.fireEvent("loadexception",this,o,_11.arg,e);_11.callback.call(_11.scope||window,null,_11.arg,false);return;}this.fireEvent("load",this,o,_11.arg);_11.callback.call(_11.scope||window,_12,_11.arg,true);},handleFailure:function(_13){this.trans=false;this.destroyTrans(_13,false);this.fireEvent("loadexception",this,null,_13.arg);_13.callback.call(_13.scope||window,null,_13.arg,false);}});Ext.data.JsonReader=function(_1,_2){Ext.data.JsonReader.superclass.constructor.call(this,_1,_2);};Ext.extend(Ext.data.JsonReader,Ext.data.DataReader,{read:function(_3){var _4=_3.responseText;var o=eval("("+_4+")");if(!o){throw{message:"JsonReader.read: Json object not found"};}return this.readRecords(o);},simpleAccess:function(_6,_7){return _6[_7];},getJsonAccessor:function(){var re=/[\[\.]/;return function(_9){try{return(re.test(_9))?new Function("obj","return obj."+_9):function(_a){return _a[_9];};}catch(e){}return Ext.emptyFn;};}(),readRecords:function(o){this.jsonData=o;var s=this.meta,_d=this.recordType,f=_d.prototype.fields,fi=f.items,fl=f.length;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);}this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(rec){var r=g(rec);return(r===undefined||r==="")?null:r;};}else{this.getId=function(){return null;};}this.ef=[];for(var i=0;i<fl;i++){f=fi[i];var map=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[i]=this.getJsonAccessor(map);}}var _17=this.getRoot(o),c=_17.length,_19=c,_1a=true;if(s.totalProperty){var v=parseInt(this.getTotal(o),10);if(!isNaN(v)){_19=v;}}if(s.successProperty){var v=this.getSuccess(o);if(v===false||v==="false"){_1a=false;}}var _1c=[];for(var i=0;i<c;i++){var n=_17[i];var _1e={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);_1e[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var _21=new _d(_1e,id);_21.json=n;_1c[i]=_21;}return{success:_1a,records:_1c,totalRecords:_19};}});Ext.data.ArrayReader=function(_1,_2){Ext.data.ArrayReader.superclass.constructor.call(this,_1,_2);};Ext.extend(Ext.data.ArrayReader,Ext.data.JsonReader,{readRecords:function(o){var _4=this.meta?this.meta.id:null;var _5=this.recordType,_6=_5.prototype.fields;var _7=[];var _8=o;for(var i=0;i<_8.length;i++){var n=_8[i];var _b={};var id=((_4||_4===0)&&n[_4]!==undefined&&n[_4]!==""?n[_4]:null);for(var j=0,_e=_6.length;j<_e;j++){var f=_6.items[j];var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;var v=n[k]!==undefined?n[k]:f.defaultValue;v=f.convert(v);_b[f.name]=v;}var _12=new _5(_b,id);_12.json=n;_7[_7.length]=_12;}return{records:_7,totalRecords:_7.length};}});Ext.data.Tree=function(_1){this.nodeHash={};this.root=null;if(_1){this.setRootNode(_1);}this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});Ext.data.Tree.superclass.constructor.call(this);};Ext.extend(Ext.data.Tree,Ext.util.Observable,{pathSeparator:"/",getRootNode:function(){return this.root;},setRootNode:function(_2){this.root=_2;_2.ownerTree=this;_2.isRoot=true;this.registerNode(_2);return _2;},getNodeById:function(id){return this.nodeHash[id];},registerNode:function(_4){this.nodeHash[_4.id]=_4;},unregisterNode:function(_5){delete this.nodeHash[_5.id];},toString:function(){return"[Tree"+(this.id?" "+this.id:"")+"]";}});Ext.data.Node=function(_6){this.attributes=_6||{};this.leaf=this.attributes.leaf;this.id=this.attributes.id;if(!this.id){this.id=Ext.id(null,"ynode-");this.attributes.id=this.id;}this.childNodes=[];if(!this.childNodes.indexOf){this.childNodes.indexOf=function(o){for(var i=0,_9=this.length;i<_9;i++){if(this[i]==o){return i;}}return-1;};}this.parentNode=null;this.firstChild=null;this.lastChild=null;this.previousSibling=null;this.nextSibling=null;this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});this.listeners=this.attributes.listeners;Ext.data.Node.superclass.constructor.call(this);};Ext.extend(Ext.data.Node,Ext.util.Observable,{fireEvent:function(_a){if(Ext.data.Node.superclass.fireEvent.apply(this,arguments)===false){return false;}var ot=this.getOwnerTree();if(ot){if(ot.fireEvent.apply(this.ownerTree,arguments)===false){return false;}}return true;},isLeaf:function(){return this.leaf===true;},setFirstChild:function(_c){this.firstChild=_c;},setLastChild:function(_d){this.lastChild=_d;},isLast:function(){return(!this.parentNode?true:this.parentNode.lastChild==this);},isFirst:function(){return(!this.parentNode?true:this.parentNode.firstChild==this);},hasChildNodes:function(){return!this.isLeaf()&&this.childNodes.length>0;},appendChild:function(_e){var _f=false;if(_e instanceof Array){_f=_e;}else{if(arguments.length>1){_f=arguments;}}if(_f){for(var i=0,len=_f.length;i<len;i++){this.appendChild(_f[i]);}}else{if(this.fireEvent("beforeappend",this.ownerTree,this,_e)===false){return false;}var _12=this.childNodes.length;var _13=_e.parentNode;if(_13){if(_e.fireEvent("beforemove",_e.getOwnerTree(),_e,_13,this,_12)===false){return false;}_13.removeChild(_e);}_12=this.childNodes.length;if(_12==0){this.setFirstChild(_e);}this.childNodes.push(_e);_e.parentNode=this;var ps=this.childNodes[_12-1];if(ps){_e.previousSibling=ps;ps.nextSibling=_e;}else{_e.previousSibling=null;}_e.nextSibling=null;this.setLastChild(_e);_e.setOwnerTree(this.getOwnerTree());this.fireEvent("append",this.ownerTree,this,_e,_12);if(_13){_e.fireEvent("move",this.ownerTree,_e,_13,this,_12);}return _e;}},removeChild:function(_15){var _16=this.childNodes.indexOf(_15);if(_16==-1){return false;}if(this.fireEvent("beforeremove",this.ownerTree,this,_15)===false){return false;}this.childNodes.splice(_16,1);if(_15.previousSibling){_15.previousSibling.nextSibling=_15.nextSibling;}if(_15.nextSibling){_15.nextSibling.previousSibling=_15.previousSibling;}if(this.firstChild==_15){this.setFirstChild(_15.nextSibling);}if(this.lastChild==_15){this.setLastChild(_15.previousSibling);}_15.setOwnerTree(null);_15.parentNode=null;_15.previousSibling=null;_15.nextSibling=null;this.fireEvent("remove",this.ownerTree,this,_15);return _15;},insertBefore:function(_17,_18){if(!_18){return this.appendChild(_17);}if(_17==_18){return false;}if(this.fireEvent("beforeinsert",this.ownerTree,this,_17,_18)===false){return false;}var _19=this.childNodes.indexOf(_18);var _1a=_17.parentNode;var _1b=_19;if(_1a==this&&this.childNodes.indexOf(_17)<_19){_1b--;}if(_1a){if(_17.fireEvent("beforemove",_17.getOwnerTree(),_17,_1a,this,_19,_18)===false){return false;}_1a.removeChild(_17);}if(_1b==0){this.setFirstChild(_17);}this.childNodes.splice(_1b,0,_17);_17.parentNode=this;var ps=this.childNodes[_1b-1];if(ps){_17.previousSibling=ps;ps.nextSibling=_17;}else{_17.previousSibling=null;}_17.nextSibling=_18;_18.previousSibling=_17;_17.setOwnerTree(this.getOwnerTree());this.fireEvent("insert",this.ownerTree,this,_17,_18);if(_1a){_17.fireEvent("move",this.ownerTree,_17,_1a,this,_1b,_18);}return _17;},item:function(_1d){return this.childNodes[_1d];},replaceChild:function(_1e,_1f){this.insertBefore(_1e,_1f);this.removeChild(_1f);return _1f;},indexOf:function(_20){return this.childNodes.indexOf(_20);},getOwnerTree:function(){if(!this.ownerTree){var p=this;while(p){if(p.ownerTree){this.ownerTree=p.ownerTree;break;}p=p.parentNode;}}return this.ownerTree;},getDepth:function(){var _22=0;var p=this;while(p.parentNode){++_22;p=p.parentNode;}return _22;},setOwnerTree:function(_24){if(_24!=this.ownerTree){if(this.ownerTree){this.ownerTree.unregisterNode(this);}this.ownerTree=_24;var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].setOwnerTree(_24);}if(_24){_24.registerNode(this);}}},getPath:function(_28){_28=_28||"id";var p=this.parentNode;var b=[this.attributes[_28]];while(p){b.unshift(p.attributes[_28]);p=p.parentNode;}var sep=this.getOwnerTree().pathSeparator;return sep+b.join(sep);},bubble:function(fn,_2d,_2e){var p=this;while(p){if(fn.call(_2d||p,_2e||p)===false){break;}p=p.parentNode;}},cascade:function(fn,_31,_32){if(fn.call(_31||this,_32||this)!==false){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].cascade(fn,_31,_32);}}},eachChild:function(fn,_37,_38){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(fn.call(_37||this,_38||cs[i])===false){break;}}},findChild:function(_3c,_3d){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(cs[i].attributes[_3c]==_3d){return cs[i];}}return null;},findChildBy:function(fn,_42){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(fn.call(_42||cs[i],cs[i])===true){return cs[i];}}return null;},sort:function(fn,_47){var cs=this.childNodes;var len=cs.length;if(len>0){var _4a=_47?function(){fn.apply(_47,arguments);}:fn;cs.sort(_4a);for(var i=0;i<len;i++){var n=cs[i];n.previousSibling=cs[i-1];n.nextSibling=cs[i+1];if(i==0){this.setFirstChild(n);}if(i==len-1){this.setLastChild(n);}}}},contains:function(_4d){return _4d.isAncestor(this);},isAncestor:function(_4e){var p=this.parentNode;while(p){if(p==_4e){return true;}p=p.parentNode;}return false;},toString:function(){return"[Node"+(this.id?" "+this.id:"")+"]";}});Ext.ComponentMgr=function(){var _1=new Ext.util.MixedCollection();return{register:function(c){_1.add(c);},unregister:function(c){_1.remove(c);},get:function(id){return _1.get(id);},onAvailable:function(id,fn,_7){_1.on("add",function(_8,o){if(o.id==id){fn.call(_7||o,o);_1.un("add",fn,_7);}});}};}();Ext.Component=function(_a){_a=_a||{};if(_a.tagName||_a.dom||typeof _a=="string"){_a={el:_a,id:_a.id||_a};}this.initialConfig=_a;Ext.apply(this,_a);this.addEvents({disable:true,enable:true,beforeshow:true,show:true,beforehide:true,hide:true,beforerender:true,render:true,beforedestroy:true,destroy:true});if(!this.id){this.id="ext-comp-"+(++Ext.Component.AUTO_ID);}Ext.ComponentMgr.register(this);Ext.Component.superclass.constructor.call(this);this.initComponent();};Ext.Component.AUTO_ID=1000;Ext.extend(Ext.Component,Ext.util.Observable,{hidden:false,disabled:false,disabledClass:"x-item-disabled",rendered:false,allowDomMove:true,ctype:"Ext.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Ext.emptyFn,render:function(_b,_c){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!_b&&this.el){this.el=Ext.get(this.el);_b=this.el.dom.parentNode;this.allowDomMove=false;}this.container=Ext.get(_b);this.rendered=true;if(_c!==undefined){if(typeof _c=="number"){_c=this.container.dom.childNodes[_c];}else{_c=Ext.getDom(_c);}}this.onRender(this.container,_c||null);if(this.cls){this.el.addClass(this.cls);delete this.cls;}if(this.style){this.el.applyStyles(this.style);delete this.style;}this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();}if(this.disabled){this.disable();}}return this;},onRender:function(ct,_e){if(this.el){this.el=Ext.get(this.el);if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,_e);}}},getAutoCreate:function(){var _f=typeof this.autoCreate=="object"?this.autoCreate:Ext.apply({},this.defaultAutoCreate);if(this.id&&!_f.id){_f.id=this.id;}return _f;},afterRender:Ext.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.purgeListeners();this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();if(this.actionMode=="container"){this.container.remove();}}this.onDestroy();Ext.ComponentMgr.unregister(this);this.fireEvent("destroy",this);}},beforeDestroy:function(){},onDestroy:function(){},getEl:function(){return this.el;},getId:function(){return this.id;},focus:function(_10){if(this.rendered){this.el.focus();if(_10===true){this.el.dom.select();}}return this;},blur:function(){if(this.rendered){this.el.blur();}return this;},disable:function(){if(this.rendered){this.onDisable();}this.disabled=true;this.fireEvent("disable",this);return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();}this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);this.el.dom.disabled=false;},setDisabled:function(_11){this[_11?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.rendered){this.onShow();}this.fireEvent("show",this);}return this;},onShow:function(){var st=this.getActionEl().dom.style;st.display="";st.visibility="visible";},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();}this.fireEvent("hide",this);}return this;},onHide:function(){this.getActionEl().dom.style.display="none";},setVisible:function(_13){if(_13){this.show();}else{this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(_14){_14=_14||{};var id=_14.id||Ext.id();var cfg=Ext.applyIf(_14,this.initialConfig);cfg.id=id;return new this.__extcls(cfg);}});(function(){Ext.Layer=function(_1,_2){_1=_1||{};var dh=Ext.DomHelper;var cp=_1.parentEl,_5=cp?Ext.getDom(cp):document.body;if(_2){this.dom=Ext.getDom(_2);}if(!this.dom){var o=_1.dh||{tag:"div",cls:"x-layer"};this.dom=dh.append(_5,o);}if(_1.cls){this.addClass(_1.cls);}this.constrain=_1.constrain!==false;this.visibilityMode=Ext.Element.VISIBILITY;if(_1.id){this.id=this.dom.id=_1.id;}else{this.id=Ext.id(this.dom);}this.zindex=_1.zindex||this.getZIndex();this.position("absolute",this.zindex);if(_1.shadow){this.shadowOffset=_1.shadowOffset||4;this.shadow=new Ext.Shadow({offset:this.shadowOffset,mode:_1.shadow});}else{this.shadowOffset=0;}this.useShim=_1.shim!==false&&Ext.useShims;this.useDisplay=_1.useDisplay;this.hide();};var _7=Ext.Element.prototype;var _8=[];Ext.extend(Ext.Layer,Ext.Element,{getZIndex:function(){return this.zindex||parseInt(this.getStyle("z-index"),10)||11000;},getShim:function(){if(!this.useShim){return null;}if(this.shim){return this.shim;}var _9=_8.shift();if(!_9){_9=this.createShim();_9.enableDisplayMode("block");_9.dom.style.display="none";_9.dom.style.visibility="visible";}var pn=this.dom.parentNode;if(_9.dom.parentNode!=pn){pn.insertBefore(_9.dom,this.dom);}_9.setStyle("z-index",this.getZIndex()-2);this.shim=_9;return _9;},hideShim:function(){if(this.shim){this.shim.setDisplayed(false);_8.push(this.shim);delete this.shim;}},disableShadow:function(){if(this.shadow){this.shadowDisabled=true;this.shadow.hide();this.lastShadowOffset=this.shadowOffset;this.shadowOffset=0;}},enableShadow:function(_b){if(this.shadow){this.shadowDisabled=false;this.shadowOffset=this.lastShadowOffset;delete this.lastShadowOffset;if(_b){this.sync(true);}}},sync:function(_c){var sw=this.shadow;if(!this.updating&&this.isVisible()&&(sw||this.useShim)){var sh=this.getShim();var w=this.getWidth(),h=this.getHeight();var l=this.getLeft(true),t=this.getTop(true);if(sw&&!this.shadowDisabled){if(_c&&!sw.isVisible()){sw.show(this);}else{sw.realign(l,t,w,h);}if(sh){if(_c){sh.show();}var a=sw.adjusts,s=sh.dom.style;s.left=(Math.min(l,l+a.l))+"px";s.top=(Math.min(t,t+a.t))+"px";s.width=(w+a.w)+"px";s.height=(h+a.h)+"px";}}else{if(sh){if(_c){sh.show();}sh.setSize(w,h);sh.setLeftTop(l,t);}}}},destroy:function(){this.hideShim();if(this.shadow){this.shadow.hide();}this.removeAllListeners();var pn=this.dom.parentNode;if(pn){pn.removeChild(this.dom);}Ext.Element.uncache(this.id);},remove:function(){this.destroy();},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.sync(true);},hideUnders:function(_16){if(this.shadow){this.shadow.hide();}this.hideShim();},constrainXY:function(){if(this.constrain){var vw=Ext.lib.Dom.getViewWidth(),vh=Ext.lib.Dom.getViewHeight();var s=Ext.get(document).getScroll();var xy=this.getXY();var x=xy[0],y=xy[1];var w=this.dom.offsetWidth+this.shadowOffset,h=this.dom.offsetHeight+this.shadowOffset;var _1f=false;if((x+w)>vw+s.left){x=vw-w-this.shadowOffset;_1f=true;}if((y+h)>vh+s.top){y=vh-h-this.shadowOffset;_1f=true;}if(x<s.left){x=s.left;_1f=true;}if(y<s.top){y=s.top;_1f=true;}if(_1f){if(this.avoidY){var ay=this.avoidY;if(y<=ay&&(y+h)>=ay){y=ay-h-5;}}xy=[x,y];this.storeXY(xy);_7.setXY.call(this,xy);this.sync();}}},isVisible:function(){return this.visible;},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("");}else{if(this.lastXY){_7.setXY.call(this,this.lastXY);}else{if(this.lastLT){_7.setLeftTop.call(this,this.lastLT[0],this.lastLT[1]);}}}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false);}else{this.setLeftTop(-10000,-10000);}},setVisible:function(v,a,d,c,e){if(v){this.showAction();}if(a&&v){var cb=function(){this.sync(true);if(c){c();}}.createDelegate(this);_7.setVisible.call(this,true,true,d,cb,e);}else{if(!v){this.hideUnders(true);}var cb=c;if(a){cb=function(){this.hideAction();if(c){c();}}.createDelegate(this);}_7.setVisible.call(this,v,a,d,cb,e);if(v){this.sync(true);}else{if(!a){this.hideAction();}}}},storeXY:function(xy){delete this.lastLT;this.lastXY=xy;},storeLeftTop:function(_28,top){delete this.lastXY;this.lastLT=[_28,top];},beforeFx:function(){this.beforeAction();return Ext.Layer.superclass.beforeFx.apply(this,arguments);},afterFx:function(){Ext.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible());},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide();}},setLeft:function(_2a){this.storeLeftTop(_2a,this.getTop(true));_7.setLeft.apply(this,arguments);this.sync();},setTop:function(top){this.storeLeftTop(this.getLeft(true),top);_7.setTop.apply(this,arguments);this.sync();},setLeftTop:function(_2c,top){this.storeLeftTop(_2c,top);_7.setLeftTop.apply(this,arguments);this.sync();},setXY:function(xy,a,d,c,e){this.fixDisplay();this.beforeAction();this.storeXY(xy);var cb=this.createCB(c);_7.setXY.call(this,xy,a,d,cb,e);if(!a){cb();}},createCB:function(c){var el=this;return function(){el.constrainXY();el.sync(true);if(c){c();}};},setX:function(x,a,d,c,e){this.setXY([x,this.getY()],a,d,c,e);},setY:function(y,a,d,c,e){this.setXY([this.getX(),y],a,d,c,e);},setSize:function(w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);_7.setSize.call(this,w,h,a,d,cb,e);if(!a){cb();}},setWidth:function(w,a,d,c,e){this.beforeAction();var cb=this.createCB(c);_7.setWidth.call(this,w,a,d,cb,e);if(!a){cb();}},setHeight:function(h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);_7.setHeight.call(this,h,a,d,cb,e);if(!a){cb();}},setBounds:function(x,y,w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);if(!a){this.storeXY([x,y]);_7.setXY.call(this,[x,y]);_7.setSize.call(this,w,h,a,d,cb,e);cb();}else{_7.setBounds.call(this,x,y,w,h,a,d,cb,e);}return this;},setZIndex:function(_5c){this.zindex=_5c;this.setStyle("z-index",_5c+2);if(this.shadow){this.shadow.setZIndex(_5c+1);}if(this.shim){this.shim.setStyle("z-index",_5c);}}});})();Ext.Shadow=function(_1){Ext.apply(this,_1);if(typeof this.mode!="string"){this.mode=this.defaultMode;}var o=this.offset,a={h:0};switch(this.mode.toLowerCase()){case"drop":a.w=0;a.l=a.t=o;break;case"sides":a.w=(o*2);a.l=-o;a.t=o;break;case"frame":a.w=a.h=(o*2);a.l=a.t=-o;break;}this.adjusts=a;};Ext.Shadow.prototype={offset:4,defaultMode:"drop",show:function(_4){_4=Ext.get(_4);if(!this.el){this.el=Ext.Shadow.Pool.pull();if(this.el.dom.nextSibling!=_4.dom){this.el.insertBefore(_4);}}this.el.setStyle("z-index",this.zIndex||parseInt(_4.getStyle("z-index"),10)-1);if(Ext.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+this.offset+")";}this.realign(_4.getLeft(true),_4.getTop(true),_4.getWidth(),_4.getHeight());this.el.dom.style.display="block";},isVisible:function(){return this.el?true:false;},realign:function(l,t,w,h){if(!this.el){return;}var a=this.adjusts,d=this.el.dom,s=d.style;var _c=0;if(Ext.isIE){_c=-(this.offset);}s.left=(l+a.l+_c)+"px";s.top=(t+a.t+_c)+"px";var sw=(w+a.w),sh=(h+a.h),_f=sw+"px",shs=sh+"px";if(s.width!=_f||s.height!=shs){s.width=_f;s.height=shs;if(!Ext.isIE){var cn=d.childNodes;var sww=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=sww;cn[1].childNodes[1].style.width=sww;cn[2].childNodes[1].style.width=sww;cn[1].style.height=Math.max(0,(sh-12))+"px";}}},hide:function(){if(this.el){this.el.dom.style.display="none";Ext.Shadow.Pool.push(this.el);delete this.el;}},setZIndex:function(z){this.zIndex=z;if(this.el){this.el.setStyle("z-index",z);}}};Ext.Shadow.Pool=function(){var p=[];var _15=Ext.isIE?"<div class=\"x-ie-shadow\"></div>":"<div class=\"x-shadow\"><div class=\"xst\"><div class=\"xstl\"></div><div class=\"xstc\"></div><div class=\"xstr\"></div></div><div class=\"xsc\"><div class=\"xsml\"></div><div class=\"xsmc\"></div><div class=\"xsmr\"></div></div><div class=\"xsb\"><div class=\"xsbl\"></div><div class=\"xsbc\"></div><div class=\"xsbr\"></div></div></div>";return{pull:function(){var sh=p.shift();if(!sh){sh=Ext.get(Ext.DomHelper.insertHtml("beforeBegin",document.body.firstChild,_15));sh.autoBoxAdjust=false;}return sh;},push:function(sh){p.push(sh);}};}();Ext.Editor=function(_1,_2){Ext.Editor.superclass.constructor.call(this,_2);this.field=_1;this.addEvents({"beforestartedit":true,"startedit":true,"beforecomplete":true,"complete":true,"specialkey":true});};Ext.extend(Ext.Editor,Ext.Component,{value:"",alignment:"c-c?",shadow:"frame",updateEl:false,onRender:function(ct,_4){this.el=new Ext.Layer({shadow:this.shadow,cls:"x-editor",parentEl:ct,shim:this.shim,shadowOffset:3,id:this.id});this.el.setStyle("overflow",Ext.isGecko?"auto":"hidden");this.field.render(this.el);if(Ext.isGecko){this.field.el.dom.setAttribute("autocomplete","off");}this.field.show();this.field.on("blur",this.onBlur,this);this.relayEvents(this.field,["specialkey"]);if(this.field.grow){this.field.on("autosize",this.el.sync,this.el,{delay:1});}},startEdit:function(el,_6){if(this.editing){this.completeEdit();}this.boundEl=Ext.get(el);var v=_6!==undefined?_6:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body);}if(this.fireEvent("beforestartedit",this,this.boundEl,v)===false){return;}this.startValue=v;this.field.setValue(v);if(this.autoSize){var sz=this.boundEl.getSize();switch(this.autoSize){case"width":this.setSize(sz.width,"");break;case"height":this.setSize("",sz.height);break;default:this.setSize(sz.width,sz.height);}}this.el.alignTo(this.boundEl,this.alignment);this.editing=true;if(Ext.QuickTips){Ext.QuickTips.disable();}this.show();},setSize:function(w,h){this.field.setSize(w,h);if(this.el){this.el.sync();}},realign:function(){this.el.alignTo(this.boundEl,this.alignment);},completeEdit:function(_b){if(!this.editing){return;}var v=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){v=this.startValue;this.cancelEdit(true);}if(String(v)==String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return;}if(this.fireEvent("beforecomplete",this,v,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(v);}if(_b!==true){this.hide();}this.fireEvent("complete",this,v,this.startValue);}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide();}this.field.show();this.field.focus();this.fireEvent("startedit",this.boundEl,this.startValue);},cancelEdit:function(_d){if(this.editing){this.setValue(this.startValue);if(_d!==true){this.hide();}}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit();}},onHide:function(){if(this.editing){this.completeEdit();return;}this.field.blur();if(this.field.collapse){this.field.collapse();}this.el.hide();if(this.hideEl!==false){this.boundEl.show();}if(Ext.QuickTips){Ext.QuickTips.enable();}},setValue:function(v){this.field.setValue(v);},getValue:function(){return this.field.getValue();}});Ext.tree.TreePanel=function(el,_2){Ext.tree.TreePanel.superclass.constructor.call(this);this.el=Ext.get(el);this.el.addClass("x-tree");this.id=this.el.id;Ext.apply(this,_2);this.addEvents({"beforeload":true,"load":true,"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true,"startdrag":true,"enddrag":true,"dragdrop":true,"beforenodedrop":true,"nodedrop":true,"nodedragover":true});if(this.singleExpand){this.on("beforeexpand",this.restrictExpand,this);}};Ext.extend(Ext.tree.TreePanel,Ext.data.Tree,{rootVisible:true,animate:Ext.enableFx,lines:true,enableDD:false,hlDrop:Ext.enableFx,restrictExpand:function(_3){var p=_3.parentNode;if(p){if(p.expandedChild&&p.expandedChild.parentNode==p){p.expandedChild.collapse();}p.expandedChild=_3;}},setRootNode:function(_5){Ext.tree.TreePanel.superclass.setRootNode.call(this,_5);if(!this.rootVisible){_5.ui=new Ext.tree.RootTreeNodeUI(_5);}return _5;},getEl:function(){return this.el;},getLoader:function(){return this.loader;},expandAll:function(){this.root.expand(true);},collapseAll:function(){this.root.collapse(true);},getSelectionModel:function(){if(!this.selModel){this.selModel=new Ext.tree.DefaultSelectionModel();}return this.selModel;},expandPath:function(_6,_7,_8){_7=_7||"id";var _9=_6.split(this.pathSeparator);var _a=this.root;if(_a.attributes[_7]!=_9[1]){if(_8){_8(false,null);}return;}var _b=1;var f=function(){if(++_b==_9.length){if(_8){_8(true,_a);}return;}var c=_a.findChild(_7,_9[_b]);if(!c){if(_8){_8(false,_a);}return;}_a=c;c.expand(false,false,f);};_a.expand(false,false,f);},selectPath:function(_e,_f,_10){_f=_f||"id";var _11=_e.split(this.pathSeparator);var v=_11.pop();if(_11.length>0){var f=function(_14,_15){if(_14&&_15){var n=_15.findChild(_f,v);if(n){n.select();if(_10){_10(true,n);}}}else{if(_10){_10(false,n);}}};this.expandPath(_11.join(this.pathSeparator),_f,f);}else{this.root.select();if(_10){_10(true,this.root);}}},render:function(){this.container=this.el.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.lines?"x-tree-lines":"x-tree-no-lines")});if(this.containerScroll){Ext.dd.ScrollManager.register(this.el);}if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Ext.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true});}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Ext.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll});}this.getSelectionModel().init(this);this.root.render();if(!this.rootVisible){this.root.renderChildren();}return this;}});Ext.tree.DefaultSelectionModel=function(){this.selNode=null;this.addEvents({"selectionchange":true,"beforeselect":true});};Ext.extend(Ext.tree.DefaultSelectionModel,Ext.util.Observable,{init:function(_1){this.tree=_1;_1.el.on("keydown",this.onKeyDown,this);_1.on("click",this.onNodeClick,this);},onNodeClick:function(_2,e){this.select(_2);},select:function(_4){var _5=this.selNode;if(_5!=_4&&this.fireEvent("beforeselect",this,_4,_5)!==false){if(_5){_5.ui.onSelectedChange(false);}this.selNode=_4;_4.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,_4,_5);}return _4;},unselect:function(_6){if(this.selNode==_6){this.clearSelections();}},clearSelections:function(){var n=this.selNode;if(n){n.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null);}return n;},getSelectedNode:function(){return this.selNode;},isSelected:function(_8){return this.selNode==_8;},selectPrevious:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}var ps=s.previousSibling;if(ps){if(!ps.isExpanded()||ps.childNodes.length<1){return this.select(ps);}else{var lc=ps.lastChild;while(lc&&lc.isExpanded()&&lc.childNodes.length>0){lc=lc.lastChild;}return this.select(lc);}}else{if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){return this.select(s.parentNode);}}return null;},selectNext:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}if(s.firstChild&&s.isExpanded()){return this.select(s.firstChild);}else{if(s.nextSibling){return this.select(s.nextSibling);}else{if(s.parentNode){var _d=null;s.parentNode.bubble(function(){if(this.nextSibling){_d=this.getOwnerTree().selModel.select(this.nextSibling);return false;}});return _d;}}}return null;},onKeyDown:function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return;}var k=e.getKey();switch(k){case e.DOWN:e.stopEvent();this.selectNext();break;case e.UP:e.stopEvent();this.selectPrevious();break;case e.RIGHT:e.preventDefault();if(s.hasChildNodes()){if(!s.isExpanded()){s.expand();}else{if(s.firstChild){this.select(s.firstChild,e);}}}break;case e.LEFT:e.preventDefault();if(s.hasChildNodes()&&s.isExpanded()){s.collapse();}else{if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){this.select(s.parentNode,e);}}break;}}});Ext.tree.MultiSelectionModel=function(){this.selNodes=[];this.selMap={};this.addEvents({"selectionchange":true});};Ext.extend(Ext.tree.MultiSelectionModel,Ext.util.Observable,{init:function(_12){this.tree=_12;_12.el.on("keydown",this.onKeyDown,this);_12.on("click",this.onNodeClick,this);},onNodeClick:function(_13,e){this.select(_13,e,e.ctrlKey);},select:function(_15,e,_17){if(_17!==true){this.clearSelections(true);}if(this.isSelected(_15)){this.lastSelNode=_15;return _15;}this.selNodes.push(_15);this.selMap[_15.id]=_15;this.lastSelNode=_15;_15.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return _15;},unselect:function(_18){if(this.selMap[_18.id]){_18.ui.onSelectedChange(false);var sn=this.selNodes;var _1a=-1;if(sn.indexOf){_1a=sn.indexOf(_18);}else{for(var i=0,len=sn.length;i<len;i++){if(sn[i]==_18){_1a=i;break;}}}if(_1a!=-1){this.selNodes.splice(_1a,1);}delete this.selMap[_18.id];this.fireEvent("selectionchange",this,this.selNodes);}},clearSelections:function(_1d){var sn=this.selNodes;if(sn.length>0){for(var i=0,len=sn.length;i<len;i++){sn[i].ui.onSelectedChange(false);}this.selNodes=[];this.selMap={};if(_1d!==true){this.fireEvent("selectionchange",this,this.selNodes);}}},isSelected:function(_21){return this.selMap[_21.id]?true:false;},getSelectedNodes:function(){return this.selNodes;},onKeyDown:Ext.tree.DefaultSelectionModel.prototype.onKeyDown,selectNext:Ext.tree.DefaultSelectionModel.prototype.selectNext,selectPrevious:Ext.tree.DefaultSelectionModel.prototype.selectPrevious});Ext.tree.TreeNode=function(_1){_1=_1||{};if(typeof _1=="string"){_1={text:_1};}this.childrenRendered=false;this.rendered=false;Ext.tree.TreeNode.superclass.constructor.call(this,_1);this.expanded=_1.expanded===true;this.isTarget=_1.isTarget!==false;this.draggable=_1.draggable!==false&&_1.allowDrag!==false;this.allowChildren=_1.allowChildren!==false&&_1.allowDrop!==false;this.text=_1.text;this.disabled=_1.disabled===true;this.addEvents({"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true});var _2=this.attributes.uiProvider||Ext.tree.TreeNodeUI;this.ui=new _2(this);};Ext.extend(Ext.tree.TreeNode,Ext.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded;},getUI:function(){return this.ui;},setFirstChild:function(_3){var of=this.firstChild;Ext.tree.TreeNode.superclass.setFirstChild.call(this,_3);if(this.childrenRendered&&of&&_3!=of){of.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},setLastChild:function(_5){var ol=this.lastChild;Ext.tree.TreeNode.superclass.setLastChild.call(this,_5);if(this.childrenRendered&&ol&&_5!=ol){ol.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},appendChild:function(){var _7=Ext.tree.TreeNode.superclass.appendChild.apply(this,arguments);if(_7&&this.childrenRendered){_7.render();}this.ui.updateExpandIcon();return _7;},removeChild:function(_8){this.ownerTree.getSelectionModel().unselect(_8);Ext.tree.TreeNode.superclass.removeChild.apply(this,arguments);if(this.childrenRendered){_8.ui.remove();}if(this.childNodes.length<1){this.collapse(false,false);}else{this.ui.updateExpandIcon();}return _8;},insertBefore:function(_9,_a){var _b=Ext.tree.TreeNode.superclass.insertBefore.apply(this,arguments);if(_b&&_a&&this.childrenRendered){_9.render();}this.ui.updateExpandIcon();return _b;},setText:function(_c){var _d=this.text;this.text=_c;this.attributes.text=_c;if(this.rendered){this.ui.onTextChange(this,_c,_d);}this.fireEvent("textchange",this,_c,_d);},select:function(){this.getOwnerTree().getSelectionModel().select(this);},unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this);},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this);},expand:function(_e,_f,_10){if(!this.expanded){if(this.fireEvent("beforeexpand",this,_e,_f)===false){return;}if(!this.childrenRendered){this.renderChildren();}this.expanded=true;if(!this.isHiddenRoot()&&(this.getOwnerTree().animate&&_f!==false)||_f){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof _10=="function"){_10(this);}if(_e===true){this.expandChildNodes(true);}}.createDelegate(this));return;}else{this.ui.expand();this.fireEvent("expand",this);if(typeof _10=="function"){_10(this);}}}else{if(typeof _10=="function"){_10(this);}}if(_e===true){this.expandChildNodes(true);}},isHiddenRoot:function(){return this.isRoot&&!this.getOwnerTree().rootVisible;},collapse:function(_11,_12){if(this.expanded&&!this.isHiddenRoot()){if(this.fireEvent("beforecollapse",this,_11,_12)===false){return;}this.expanded=false;if((this.getOwnerTree().animate&&_12!==false)||_12){this.ui.animCollapse(function(){this.fireEvent("collapse",this);if(_11===true){this.collapseChildNodes(true);}}.createDelegate(this));return;}else{this.ui.collapse();this.fireEvent("collapse",this);}}if(_11===true){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].collapse(true);}}},delayedExpand:function(_16){if(!this.expandProcId){this.expandProcId=this.expand.defer(_16,this);}},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);}this.expandProcId=false;},toggle:function(){if(this.expanded){this.collapse();}else{this.expand();}},ensureVisible:function(_17){var _18=this.getOwnerTree();_18.expandPath(this.getPath(),false,function(){_18.getEl().scrollChildIntoView(this.ui.anchor);Ext.callback(_17);}.createDelegate(this));},expandChildNodes:function(_19){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].expand(_19);}},collapseChildNodes:function(_1d){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].collapse(_1d);}},disable:function(){this.disabled=true;this.unselect();if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,true);}this.fireEvent("disabledchange",this,true);},enable:function(){this.disabled=false;if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,false);}this.fireEvent("disabledchange",this,false);},renderChildren:function(_21){if(_21!==false){this.fireEvent("beforechildrenrendered",this);}var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].render(true);}this.childrenRendered=true;},sort:function(fn,_26){Ext.tree.TreeNode.superclass.sort.apply(this,arguments);if(this.childrenRendered){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].render(true);}}},render:function(_2a){this.ui.render(_2a);if(!this.rendered){this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false);}}},renderIndent:function(_2b,_2c){if(_2c){this.ui.childIndent=null;}this.ui.renderIndent();if(_2b===true&&this.childrenRendered){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].renderIndent(true,_2c);}}}});Ext.tree.AsyncTreeNode=function(_1){this.loaded=false;this.loading=false;Ext.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);this.addEvents({"beforeload":true,"load":true});};Ext.extend(Ext.tree.AsyncTreeNode,Ext.tree.TreeNode,{expand:function(_2,_3,_4){if(this.loading){var _5;var f=function(){if(!this.loading){clearInterval(_5);this.expand(_2,_3,_4);}}.createDelegate(this);_5=setInterval(f,200);return;}if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return;}this.loading=true;this.ui.beforeLoad(this);var _7=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();if(_7){_7.load(this,this.loadComplete.createDelegate(this,[_2,_3,_4]));return;}}Ext.tree.AsyncTreeNode.superclass.expand.call(this,_2,_3,_4);},isLoading:function(){return this.loading;},loadComplete:function(_8,_9,_a){this.loading=false;this.loaded=true;this.ui.afterLoad(this);this.fireEvent("load",this);this.expand(_8,_9,_a);},isLoaded:function(){return this.loaded;},hasChildNodes:function(){if(!this.isLeaf()&&!this.loaded){return true;}else{return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);}},reload:function(_b){this.collapse(false,false);while(this.firstChild){this.removeChild(this.firstChild);}this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false;}this.expand(false,false,_b);}});Ext.tree.TreeNodeUI=function(_1){this.node=_1;this.rendered=false;this.animating=false;this.emptyIcon=Ext.BLANK_IMAGE_URL;};Ext.tree.TreeNodeUI.prototype={removeChild:function(_2){if(this.rendered){this.ctNode.removeChild(_2.ui.getEl());}},beforeLoad:function(){this.addClass("x-tree-node-loading");},afterLoad:function(){this.removeClass("x-tree-node-loading");},onTextChange:function(_3,_4,_5){if(this.rendered){this.textNode.innerHTML=_4;}},onDisableChange:function(_6,_7){this.disabled=_7;if(_7){this.addClass("x-tree-node-disabled");}else{this.removeClass("x-tree-node-disabled");}},onSelectedChange:function(_8){if(_8){this.focus();this.addClass("x-tree-selected");}else{this.removeClass("x-tree-selected");}},onMove:function(_9,_a,_b,_c,_d,_e){this.childIndent=null;if(this.rendered){var _f=_c.ui.getContainer();if(!_f){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);return;}var _10=_e?_e.ui.getEl():null;if(_10){_f.insertBefore(this.wrap,_10);}else{_f.appendChild(this.wrap);}this.node.renderIndent(true);}},addClass:function(cls){if(this.elNode){Ext.fly(this.elNode).addClass(cls);}},removeClass:function(cls){if(this.elNode){Ext.fly(this.elNode).removeClass(cls);}},remove:function(){if(this.rendered){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);}},fireEvent:function(){return this.node.fireEvent.apply(this.node,arguments);},initEvents:function(){this.node.on("move",this.onMove,this);var E=Ext.EventManager;var a=this.anchor;var el=Ext.fly(a);if(Ext.isOpera){el.setStyle("text-decoration","none");}el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);el.on("contextmenu",this.onContextMenu,this);var _16=Ext.fly(this.iconNode);_16.on("click",this.onClick,this);_16.on("dblclick",this.onDblClick,this);_16.on("contextmenu",this.onContextMenu,this);E.on(this.ecNode,"click",this.ecClick,this,true);if(this.node.disabled){this.addClass("x-tree-node-disabled");}if(this.node.hidden){this.addClass("x-tree-node-disabled");}var ot=this.node.getOwnerTree();var dd=ot.enableDD||ot.enableDrag||ot.enableDrop;if(dd&&(!this.node.isRoot||ot.rootVisible)){Ext.dd.Registry.register(this.elNode,{node:this.node,handles:[this.iconNode,this.textNode],isHandle:false});}},hide:function(){if(this.rendered){this.wrap.style.display="none";}},show:function(){if(this.rendered){this.wrap.style.display="";}},onContextMenu:function(e){e.preventDefault();this.focus();this.fireEvent("contextmenu",this.node,e);},onClick:function(e){if(this.dropping){return;}if(this.fireEvent("beforeclick",this.node,e)!==false){if(!this.disabled&&this.node.attributes.href){this.fireEvent("click",this.node,e);return;}e.preventDefault();if(this.disabled){return;}if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.hasChildNodes()){this.node.toggle();}this.fireEvent("click",this.node,e);}else{e.stopEvent();}},onDblClick:function(e){e.preventDefault();if(this.disabled){return;}if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}this.fireEvent("dblclick",this.node,e);},ecClick:function(e){if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}},startDrop:function(){this.dropping=true;},endDrop:function(){setTimeout(function(){this.dropping=false;}.createDelegate(this),50);},expand:function(){this.updateExpandIcon();this.ctNode.style.display="";},focus:function(){if(!this.node.preventHScroll){try{this.anchor.focus();}catch(e){}}else{if(!Ext.isIE){try{var _1d=this.node.getOwnerTree().el.dom;var l=_1d.scrollLeft;this.anchor.focus();_1d.scrollLeft=l;}catch(e){}}}},blur:function(){try{this.anchor.blur();}catch(e){}},animExpand:function(_1f){var ct=Ext.get(this.ctNode);ct.stopFx();if(!this.node.hasChildNodes()){this.updateExpandIcon();this.ctNode.style.display="";Ext.callback(_1f);return;}this.animating=true;this.updateExpandIcon();ct.slideIn("t",{callback:function(){this.animating=false;Ext.callback(_1f);},scope:this,duration:this.node.ownerTree.duration||0.25});},highlight:function(){var _21=this.node.getOwnerTree();Ext.fly(this.wrap).highlight(_21.hlColor||"C3DAF9",{endColor:_21.hlBaseColor});},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none";},animCollapse:function(_22){var ct=Ext.get(this.ctNode);ct.enableDisplayMode("block");ct.stopFx();this.animating=true;this.updateExpandIcon();ct.slideOut("t",{callback:function(){this.animating=false;Ext.callback(_22);},scope:this,duration:this.node.ownerTree.duration||0.25});},getContainer:function(){return this.ctNode;},getEl:function(){return this.wrap;},appendDDGhost:function(_24){_24.appendChild(this.elNode.cloneNode(true));},getDDRepairXY:function(){return Ext.lib.Dom.getXY(this.iconNode);},onRender:function(){this.render();},render:function(_25){var n=this.node;var _27=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.container.dom;if(!this.rendered){this.rendered=true;var a=n.attributes;this.indentMarkup="";if(n.parentNode){this.indentMarkup=n.parentNode.ui.getChildIndent();}var buf=["<li class=\"x-tree-node\"><div class=\"x-tree-node-el ",n.attributes.cls,"\">","<span class=\"x-tree-node-indent\">",this.indentMarkup,"</span>","<img src=\"",this.emptyIcon,"\" class=\"x-tree-ec-icon\">","<img src=\"",a.icon||this.emptyIcon,"\" class=\"x-tree-node-icon",(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),"\" unselectable=\"on\">","<a hidefocus=\"on\" href=\"",a.href?a.href:"#","\" tabIndex=\"1\" ",a.hrefTarget?" target=\""+a.hrefTarget+"\"":"","><span unselectable=\"on\">",n.text,"</span></a></div>","<ul class=\"x-tree-node-ct\" style=\"display:none;\"></ul>","</li>"];if(_25!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),buf.join(""));}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",_27,buf.join(""));}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];this.anchor=cs[3];this.textNode=cs[3].firstChild;if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);}}else{this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle);}}}this.initEvents();if(!this.node.expanded){this.updateExpandIcon();}}else{if(_25===true){_27.appendChild(this.wrap);}}},getAnchor:function(){return this.anchor;},getTextEl:function(){return this.textNode;},getIconEl:function(){return this.iconNode;},updateExpandIcon:function(){if(this.rendered){var n=this.node,c1,c2;var cls=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";var _2f=n.hasChildNodes();if(_2f){if(n.expanded){cls+="-minus";c1="x-tree-node-collapsed";c2="x-tree-node-expanded";}else{cls+="-plus";c1="x-tree-node-expanded";c2="x-tree-node-collapsed";}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false;}if(this.c1!=c1||this.c2!=c2){Ext.fly(this.elNode).replaceClass(c1,c2);this.c1=c1;this.c2=c2;}}else{if(!this.wasLeaf){Ext.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");this.wasLeaf=true;}}var ecc="x-tree-ec-icon "+cls;if(this.ecc!=ecc){this.ecNode.className=ecc;this.ecc=ecc;}}},getChildIndent:function(){if(!this.childIndent){var buf=[];var p=this.node;while(p){if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){if(!p.isLast()){buf.unshift("<img src=\""+this.emptyIcon+"\" class=\"x-tree-elbow-line\">");}else{buf.unshift("<img src=\""+this.emptyIcon+"\" class=\"x-tree-icon\">");}}p=p.parentNode;}this.childIndent=buf.join("");}return this.childIndent;},renderIndent:function(){if(this.rendered){var _33="";var p=this.node.parentNode;if(p){_33=p.ui.getChildIndent();}if(this.indentMarkup!=_33){this.indentNode.innerHTML=_33;this.indentMarkup=_33;}this.updateExpandIcon();}}};Ext.tree.RootTreeNodeUI=function(){Ext.tree.RootTreeNodeUI.superclass.constructor.apply(this,arguments);};Ext.extend(Ext.tree.RootTreeNodeUI,Ext.tree.TreeNodeUI,{render:function(){if(!this.rendered){var _35=this.node.ownerTree.container.dom;this.node.expanded=true;_35.innerHTML="<div class=\"x-tree-root-node\"></div>";this.wrap=this.ctNode=_35.firstChild;}},collapse:function(){},expand:function(){}});Ext.tree.TreeLoader=function(_1){this.baseParams={};this.requestMethod="POST";Ext.apply(this,_1);this.addEvents({"beforeload":true,"load":true,"loadexception":true});};Ext.extend(Ext.tree.TreeLoader,Ext.util.Observable,{uiProviders:{},clearOnLoad:true,load:function(_2,_3){if(this.clearOnLoad){while(_2.firstChild){_2.removeChild(_2.firstChild);}}if(_2.attributes.children){var cs=_2.attributes.children;for(var i=0,_6=cs.length;i<_6;i++){_2.appendChild(this.createNode(cs[i]));}if(typeof _3=="function"){_3();}}else{if(this.dataUrl){this.requestData(_2,_3);}}},getParams:function(_7){var _8=[],bp=this.baseParams;for(var _a in bp){if(typeof bp[_a]!="function"){_8.push(encodeURIComponent(_a),"=",encodeURIComponent(bp[_a]),"&");}}_8.push("node=",encodeURIComponent(_7.id));return _8.join("");},requestData:function(_b,_c){if(this.fireEvent("beforeload",this,_b,_c)!==false){var _d=this.getParams(_b);var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:_c,node:_b}};this.transId=Ext.lib.Ajax.request(this.requestMethod,this.dataUrl,cb,_d);}else{if(typeof _c=="function"){_c();}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Ext.lib.Ajax.abort(this.transId);}},createNode:function(_f){if(this.applyLoader!==false){_f.loader=this;}if(typeof _f.uiProvider=="string"){_f.uiProvider=this.uiProviders[_f.uiProvider]||eval(_f.uiProvider);}return(_f.leaf?new Ext.tree.TreeNode(_f):new Ext.tree.AsyncTreeNode(_f));},processResponse:function(_10,_11,_12){var _13=_10.responseText;try{var o=eval("("+_13+")");for(var i=0,len=o.length;i<len;i++){var n=this.createNode(o[i]);if(n){_11.appendChild(n);}}if(typeof _12=="function"){_12(this,_11);}}catch(e){this.handleFailure(_10);}},handleResponse:function(_18){this.transId=false;var a=_18.argument;this.processResponse(_18,a.node,a.callback);this.fireEvent("load",this,a.node,_18);},handleFailure:function(_1a){this.transId=false;var a=_1a.argument;this.fireEvent("loadexception",this,a.node,_1a);if(typeof a.callback=="function"){a.callback(this,a.node);}}});Ext.tree.TreeFilter=function(_1,_2){this.tree=_1;this.filtered={};Ext.apply(this,_2,{clearBlank:false,reverse:false,autoClear:false,remove:false});};Ext.tree.TreeFilter.prototype={filter:function(_3,_4,_5){_4=_4||"text";var f;if(typeof _3=="string"){var _7=_3.length;if(_7==0&&this.clearBlank){this.clearFilter();return;}_3=_3.toLowerCase();f=function(n){return n.attributes[_4].substr(0,_7).toLowerCase()==_3;};}else{if(_3.exec){f=function(n){return _3.test(n.attributes[_4]);};}else{throw"Illegal filter type, must be string or regex";}}this.filterBy(f,null,_5);},filterBy:function(fn,_b,_c){_c=_c||this.tree.root;if(this.autoClear){this.clearFilter();}var af=this.filtered,rv=this.reverse;var f=function(n){if(n==_c){return true;}if(af[n.id]){return false;}var m=fn.call(_b||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false;}return true;};_c.cascade(f);if(this.remove){for(var id in af){if(typeof id!="function"){var n=af[id];if(n&&n.parentNode){n.parentNode.removeChild(n);}}}}},clear:function(){var t=this.tree;var af=this.filtered;for(var id in af){if(typeof id!="function"){var n=af[id];if(n){n.ui.show();}}}this.filtered={};}};Ext.tree.TreeSorter=function(_1,_2){Ext.apply(this,_2);_1.on("beforechildrenrendered",this.doSort,this);_1.on("append",this.updateSort,this);_1.on("insert",this.updateSort,this);var _3=this.dir&&this.dir.toLowerCase()=="desc";var p=this.property||"text";var _5=this.sortType;var fs=this.folderSort;var cs=this.caseSensitive===true;var _8=this.leafAttr||"leaf";this.sortFn=function(n1,n2){if(fs){if(n1.attributes[_8]&&!n2.attributes[_8]){return 1;}if(!n1.attributes[_8]&&n2.attributes[_8]){return-1;}}var v1=_5?_5(n1):(cs?n1[p]:n1[p].toUpperCase());var v2=_5?_5(n2):(cs?n2[p]:n2[p].toUpperCase());if(v1<v2){return _3?+1:-1;}else{if(v1>v2){return _3?-1:+1;}else{return 0;}}};};Ext.tree.TreeSorter.prototype={doSort:function(_d){_d.sort(this.sortFn);},compareNodes:function(n1,n2){return(n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1);},updateSort:function(_10,_11){if(_11.childrenRendered){this.doSort.defer(1,this,[_11]);}}};if(Ext.dd.DropZone){Ext.tree.TreeDropZone=function(_1,_2){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Ext.tree.TreeDropZone.superclass.constructor.call(this,_1.container,_2);this.tree=_1;this.lastInsertClass="x-tree-no-status";this.dragOverData={};};Ext.extend(Ext.tree.TreeDropZone,Ext.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(_3){if(_3.hasChildNodes()&&!_3.isExpanded()){_3.expand(false,null,this.triggerCacheRefresh.createDelegate(this));}},queueExpand:function(_4){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[_4]);},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false;}},isValidDropPoint:function(n,pt,dd,e,_9){if(!n||!_9){return false;}var _a=n.node;var _b=_9.node;if(!(_a&&_a.isTarget&&pt)){return false;}if(pt=="append"&&_a.allowChildren===false){return false;}if((pt=="above"||pt=="below")&&(_a.parentNode&&_a.parentNode.allowChildren===false)){return false;}if(_b&&(_a==_b||_b.contains(_a))){return false;}var _c=this.dragOverData;_c.tree=this.tree;_c.target=_a;_c.data=_9;_c.point=pt;_c.source=dd;_c.rawEvent=e;_c.dropNode=_b;_c.cancel=false;var _d=this.tree.fireEvent("nodedragover",_c);return _c.cancel===false&&_d!==false;},getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false;}var _12=n.ddel;var t=Ext.lib.Dom.getY(_12),b=t+_12.offsetHeight;var y=Ext.lib.Event.getPageY(e);var _16=tn.allowChildren===false||tn.isLeaf();if(this.appendOnly||tn.parentNode.allowChildren===false){return _16?false:"append";}var _17=false;if(!this.allowParentInsert){_17=tn.hasChildNodes()&&tn.isExpanded();}var q=(b-t)/(_16?2:3);if(y>=t&&y<(t+q)){return"above";}else{if(!_17&&(_16||y>=b-q&&y<=b)){return"below";}else{return"append";}}},onNodeEnter:function(n,dd,e,_1c){this.cancelExpand();},onNodeOver:function(n,dd,e,_20){var pt=this.getDropPoint(e,n,dd);var _22=n.node;if(!this.expandProcId&&pt=="append"&&_22.hasChildNodes()&&!n.node.isExpanded()){this.queueExpand(_22);}else{if(pt!="append"){this.cancelExpand();}}var _23=this.dropNotAllowed;if(this.isValidDropPoint(n,pt,dd,e,_20)){if(pt){var el=n.ddel;var cls;if(pt=="above"){_23=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";cls="x-tree-drag-insert-above";}else{if(pt=="below"){_23=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";cls="x-tree-drag-insert-below";}else{_23="x-tree-drop-ok-append";cls="x-tree-drag-append";}}if(this.lastInsertClass!=cls){Ext.fly(el).replaceClass(this.lastInsertClass,cls);this.lastInsertClass=cls;}}}return _23;},onNodeOut:function(n,dd,e,_29){this.cancelExpand();this.removeDropIndicators(n);},onNodeDrop:function(n,dd,e,_2d){var _2e=this.getDropPoint(e,n,dd);var _2f=n.node;_2f.ui.startDrop();if(!this.isValidDropPoint(n,_2e,dd,e,_2d)){_2f.ui.endDrop();return false;}var _30=_2d.node||(dd.getTreeNode?dd.getTreeNode(_2d,_2f,_2e,e):null);var _31={tree:this.tree,target:_2f,data:_2d,point:_2e,source:dd,rawEvent:e,dropNode:_30,cancel:!_30};var _32=this.tree.fireEvent("beforenodedrop",_31);if(_32===false||_31.cancel===true||!_31.dropNode){_2f.ui.endDrop();return false;}_2f=_31.target;if(_2e=="append"&&!_2f.isExpanded()){_2f.expand(false,null,function(){this.completeDrop(_31);}.createDelegate(this));}else{this.completeDrop(_31);}return true;},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!(ns instanceof Array)){ns=[ns];}var n;for(var i=0,len=ns.length;i<len;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t);}else{if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling);}else{t.appendChild(n);}}}n.ui.focus();if(this.tree.hlDrop){n.ui.highlight();}t.ui.endDrop();this.tree.fireEvent("nodedrop",de);},afterNodeMoved:function(dd,_3b,e,_3d,_3e){if(this.tree.hlDrop){_3e.ui.focus();_3e.ui.highlight();}this.tree.fireEvent("nodedrop",this.tree,_3d,_3b,dd,e);},getTree:function(){return this.tree;},removeDropIndicators:function(n){if(n&&n.ddel){var el=n.ddel;Ext.fly(el).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass";}},beforeDragDrop:function(_41,e,id){this.cancelExpand();return true;},afterRepair:function(_44){if(_44&&Ext.enableFx){_44.node.ui.highlight();}this.hideProxy();}});}
386
- if(Ext.dd.DragZone){Ext.tree.TreeDragZone=function(_1,_2){Ext.tree.TreeDragZone.superclass.constructor.call(this,_1.getEl(),_2);this.tree=_1;};Ext.extend(Ext.tree.TreeDragZone,Ext.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(_3,e){var n=_3.node;return n&&n.draggable&&!n.disabled;},onInitDrag:function(e){var _7=this.dragData;this.tree.getSelectionModel().select(_7.node);this.proxy.update("");_7.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,_7.node,e);},getRepairXY:function(e,_9){return _9.node.ui.getDDRepairXY();},onEndDrag:function(_a,e){this.tree.fireEvent("enddrag",this.tree,_a.node,e);},onValidDrop:function(dd,e,id){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);this.hideProxy();},beforeInvalidDrop:function(e,id){var sm=this.tree.getSelectionModel();sm.clearSelections();sm.select(this.dragData.node);}});}
387
- Ext.tree.TreeEditor=function(_1,_2){_2=_2||{};var _3=_2.events?_2:new Ext.form.TextField(_2);Ext.tree.TreeEditor.superclass.constructor.call(this,_3);this.tree=_1;_1.on("beforeclick",this.beforeNodeClick,this);_1.el.on("mousedown",this.hide,this);this.on("complete",this.updateNode,this);this.on("beforestartedit",this.fitToTree,this);this.on("startedit",this.bindScroll,this,{delay:10});this.on("specialkey",this.onSpecialKey,this);};Ext.extend(Ext.tree.TreeEditor,Ext.Editor,{alignment:"l-l",autoSize:false,hideEl:false,cls:"x-small-editor x-tree-editor",shim:false,shadow:"frame",maxWidth:250,fitToTree:function(ed,el){var td=this.tree.el.dom,nd=el.dom;if(td.scrollLeft>nd.offsetLeft){td.scrollLeft=nd.offsetLeft;}var w=Math.min(this.maxWidth,(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);this.setSize(w,"");},triggerEdit:function(_9){this.completeEdit();this.editNode=_9;this.startEdit(_9.ui.textNode,_9.text);},bindScroll:function(){this.tree.el.on("scroll",this.cancelEdit,this);},beforeNodeClick:function(_a){if(this.tree.getSelectionModel().isSelected(_a)){this.triggerEdit(_a);return false;}},updateNode:function(ed,_c){this.tree.el.un("scroll",this.cancelEdit,this);this.editNode.setText(_c);},onSpecialKey:function(_d,e){var k=e.getKey();if(k==e.ESC){this.cancelEdit();e.stopEvent();}else{if(k==e.ENTER&&!e.hasModifier()){this.completeEdit();e.stopEvent();}}}});Ext.form.Field=function(_1){Ext.form.Field.superclass.constructor.call(this,_1);this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true});};Ext.extend(Ext.form.Field,Ext.Component,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:"qtip",msgFx:"normal",inputType:undefined,isFormField:true,hasFocus:false,value:undefined,getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||"");},applyTo:function(_2){this.target=_2;this.el=Ext.get(_2);this.render(this.el.dom.parentNode);return this;},onRender:function(ct,_4){if(this.el){this.el=Ext.get(this.el);if(!this.target){ct.dom.appendChild(this.el.dom);}}else{var _5=this.getAutoCreate();if(!_5.name){_5.name=this.name||this.id;}if(this.inputType){_5.type=this.inputType;}if(this.tabIndex!==undefined){_5.tabIndex=this.tabIndex;}this.el=ct.createChild(_5,_4);}var _6=this.el.dom.type;if(_6){if(_6=="password"){_6="text";}this.el.addClass("x-form-"+_6);}if(!this.customSize&&(this.width||this.height)){this.setSize(this.width||"",this.height||"");}if(this.readOnly){this.el.dom.readOnly=true;}this.el.addClass([this.fieldClass,this.cls]);this.initValue();},initValue:function(){if(this.value!==undefined){this.setValue(this.value);}else{if(this.el.dom.value.length>0){this.setValue(this.el.dom.value);}}},afterRender:function(){Ext.form.Field.superclass.afterRender.call(this);this.initEvents();},fireKey:function(e){if(e.isNavKeyPress()){this.fireEvent("specialkey",this,e);}},reset:function(){this.setValue(this.originalValue);this.clearInvalid();},initEvents:function(){this.el.on(Ext.isIE?"keydown":"keypress",this.fireKey,this);this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.originalValue=this.getValue();},onFocus:function(){if(!Ext.isOpera){this.el.addClass(this.focusClass);}this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this);},onBlur:function(){this.el.removeClass(this.focusClass);this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();}var v=this.getValue();if(v!=this.startValue){this.fireEvent("change",this,v,this.startValue);}this.fireEvent("blur",this);},setSize:function(w,h){if(!this.rendered||!this.el){this.width=w;this.height=h;return;}if(w){w=this.adjustWidth(this.el.dom.tagName,w);this.el.setWidth(w);}if(h){this.el.setHeight(h);}var h=this.el.dom.offsetHeight;},isValid:function(_b){if(this.disabled){return true;}var _c=this.preventMark;this.preventMark=_b===true;var v=this.validateValue(this.getRawValue());this.preventMark=_c;return v;},validate:function(){if(this.disabled||this.validateValue(this.getRawValue())){this.clearInvalid();return true;}return false;},validateValue:function(_e){return true;},markInvalid:function(_f){if(!this.rendered||this.preventMark){return;}this.el.addClass(this.invalidClass);_f=_f||this.invalidText;switch(this.msgTarget){case"qtip":this.el.dom.qtip=_f;this.el.dom.qclass="x-form-invalid-tip";break;case"title":this.el.dom.title=_f;break;case"under":if(!this.errorEl){var elp=this.el.findParent(".x-form-element",5,true);this.errorEl=elp.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(elp.getWidth(true)-20);}this.errorEl.update(_f);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){var elp=this.el.findParent(".x-form-element",5,true);this.errorIcon=elp.createChild({cls:"x-form-invalid-icon"});}this.alignErrorIcon();this.errorIcon.dom.qtip=_f;this.errorIcon.dom.qclass="x-form-invalid-tip";this.errorIcon.show();break;default:var t=Ext.getDom(this.msgTarget);t.innerHTML=_f;t.style.display=this.msgDisplay;break;}this.fireEvent("invalid",this,_f);},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,"tl-tr",[2,0]);},clearInvalid:function(){if(!this.rendered||this.preventMark){return;}this.el.removeClass(this.invalidClass);switch(this.msgTarget){case"qtip":this.el.dom.qtip="";break;case"title":this.el.dom.title="";break;case"under":if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}break;case"side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();}break;default:var t=Ext.getDom(this.msgTarget);t.innerHTML="";t.style.display="none";break;}this.fireEvent("valid",this);},getRawValue:function(){return this.el.getValue();},getValue:function(){var v=this.el.getValue();if(v==this.emptyText||v===undefined){v="";}return v;},setRawValue:function(v){return this.el.dom.value=v;},setValue:function(v){this.value=v;if(this.rendered){this.el.dom.value=v;this.validate();}},adjustWidth:function(tag,w){tag=tag.toLowerCase();if(typeof w=="number"&&Ext.isStrict&&!Ext.isSafari){if(Ext.isIE&&(tag=="input"||tag=="textarea")){if(tag=="input"){return w+2;}if(tag="textarea"){return w-2;}}else{if(Ext.isGecko&&tag=="textarea"){return w-6;}else{if(Ext.isOpera){if(tag=="input"){return w+2;}if(tag="textarea"){return w-2;}}}}}return w;}});Ext.form.Field.msgFx={normal:{show:function(_18,f){_18.setDisplayed("block");},hide:function(_1a,f){_1a.setDisplayed(false).update("");}},slide:{show:function(_1c,f){_1c.slideIn("t",{stopFx:true});},hide:function(_1e,f){_1e.slideOut("t",{stopFx:true,useDisplay:true});}},slideRight:{show:function(_20,f){_20.fixDisplay();_20.alignTo(f.el,"tl-tr");_20.slideIn("l",{stopFx:true});},hide:function(_22,f){_22.slideOut("l",{stopFx:true,useDisplay:true});}}};Ext.form.TextField=function(_1){Ext.form.TextField.superclass.constructor.call(this,_1);this.addEvents({autosize:true});};Ext.extend(Ext.form.TextField,Ext.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:"x-form-empty-field",initEvents:function(){Ext.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=="keyup"){this.validationTask=new Ext.util.DelayedTask(this.validate,this);this.el.on("keyup",this.filterValidation,this);}else{if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay});}}if(this.selectOnFocus||this.emptyText){this.on("focus",this.preFocus,this);if(this.emptyText){this.on("blur",this.postBlur,this);this.applyEmptyText();}}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Ext.form.VTypes[this.vtype+"Mask"]))){this.el.on("keypress",this.filterKeys,this);}if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},reset:function(){Ext.form.TextField.superclass.reset.call(this);this.applyEmptyText();},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass);}},preFocus:function(){if(this.emptyText){if(this.getRawValue()==this.emptyText){this.setRawValue("");}this.el.removeClass(this.emptyClass);}if(this.selectOnFocus){this.el.dom.select();}},postBlur:function(){this.applyEmptyText();},filterKeys:function(e){var k=e.getKey();if(!Ext.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return;}var c=e.getCharCode();if(!this.maskRe.test(String.fromCharCode(c)||"")){e.stopEvent();}},setValue:function(v){if(this.emptyText&&v!==undefined&&v!==null&&v!==""){this.el.removeClass(this.emptyClass);}Ext.form.TextField.superclass.setValue.apply(this,arguments);},validateValue:function(_8){if(_8.length<1||_8===this.emptyText){if(this.allowBlank){this.clearInvalid();return true;}else{this.markInvalid(this.blankText);return false;}}if(_8.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false;}if(_8.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false;}if(this.vtype){var vt=Ext.form.VTypes;if(!vt[this.vtype](_8)){this.markInvalid(this.vtypeText||vt[this.vtype+"Text"]);return false;}}if(typeof this.validator=="function"){var _a=this.validator(_8);if(_a!==true){this.markInvalid(_a);return false;}}if(this.regex&&!this.regex.test(_8)){this.markInvalid(this.regexText);return false;}return true;},selectText:function(_b,_c){var v=this.getRawValue();if(v.length>0){_b=_b===undefined?0:_b;_c=_c===undefined?v.length:_c;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(_b,_c);}else{if(d.createTextRange){var _f=d.createTextRange();_f.moveStart("character",_b);_f.moveEnd("character",v.length-_c);_f.select();}}}},autoSize:function(){if(!this.grow||!this.rendered){return;}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el);}var el=this.el;var v=el.dom.value+"&#160;";var w=Math.min(this.growMax,Math.max(this.metrics.getWidth(v)+10,this.growMin));this.el.setWidth(w);this.fireEvent("autosize",this,w);}});;Ext.tree.TreePanel.prototype.getChecked=function(node){var checked=[],i;if(typeof node=='undefined'){node=this.getRootNode();}
388
- if(node.attributes.checked){checked.push(node.id);}
389
- if(node.childNodes.length){for(i=0;i<node.childNodes.length;i++){checked=checked.concat(this.getChecked(node.childNodes[i]));}}
390
- return checked;};Ext.tree.CustomUITreeLoader=function(){Ext.tree.CustomUITreeLoader.superclass.constructor.apply(this,arguments);};Ext.extend(Ext.tree.CustomUITreeLoader,Ext.tree.TreeLoader,{createNode:function(attr){Ext.apply(attr,this.baseAttr||{});if(this.applyLoader!==false){attr.loader=this;}
391
- if(typeof attr.uiProvider=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}
392
- return(attr.leaf?new Ext.tree.TreeNode(attr):new Ext.tree.AsyncTreeNode(attr));}});Ext.tree.CheckboxNodeUI=function(){Ext.tree.CheckboxNodeUI.superclass.constructor.apply(this,arguments);};Ext.extend(Ext.tree.CheckboxNodeUI,Ext.tree.TreeNodeUI,{render:function(bulkRender){var n=this.node;var targetNode=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.container.dom;if(!this.rendered){this.rendered=true;var a=n.attributes;this.indentMarkup="";if(n.parentNode){this.indentMarkup=n.parentNode.ui.getChildIndent();}
393
- var buf=['<li class="x-tree-node"><div class="x-tree-node-el ',n.attributes.cls,'">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon">','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on">','<input class="l-tcb" '+(n.disabled?'disabled="disabled" ':'')+' type="checkbox" ',(a.checked?"checked>":'>'),'<a hidefocus="on" href="',a.href?a.href:"#",'" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'>','<span unselectable="on">',n.text,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"];if(bulkRender!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),buf.join(""));}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",targetNode,buf.join(""));}
394
- this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];this.checkbox=cs[3];this.anchor=cs[4];this.textNode=cs[4].firstChild;if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);}}else{this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle);}}}else if(a.qtipCfg){a.qtipCfg.target=Ext.id(this.textNode);Ext.QuickTips.register(a.qtipCfg);}
395
- this.initEvents();Ext.fly(this.checkbox).on('click',this.check.createDelegate(this,[null]));n.on('dblclick',function(e){if(this.isLeaf()){this.getUI().toggleCheck();}});if(!this.node.expanded){this.updateExpandIcon();}}else{if(bulkRender===true){targetNode.appendChild(this.wrap);}}},checked:function(){return this.checkbox.checked;},check:function(state,descend,bulk){if(this.node.disabled){return;}
396
- var n=this.node;var tree=n.getOwnerTree();var parentNode=n.parentNode;n
397
- if(!n.expanded&&!n.childrenRendered){n.expand(false,false,this.check.createDelegate(this,arguments));}
398
- if(typeof bulk=='undefined'){bulk=false;}
399
- if(typeof state=='undefined'||state===null){state=this.checkbox.checked;descend=!state;if(state){n.expand(false,false);}}else{this.checkbox.checked=state;}
400
- n.attributes.checked=state;if(parentNode!==null&&state){if(parentNode.getUI().check){}}
401
- if(descend&&!n.isLeaf()){var cs=n.childNodes;for(var i=0;i<cs.length;i++){}}
402
- if(!bulk){tree.fireEvent('check',n,state);}},toggleCheck:function(state){this.check(!this.checkbox.checked,true);}});Ext.tree.CheckNodeMultiSelectionModel=function(){Ext.tree.CheckNodeMultiSelectionModel.superclass.constructor.call(this);};Ext.extend(Ext.tree.CheckNodeMultiSelectionModel,Ext.tree.MultiSelectionModel,{init:function(tree){this.tree=tree;tree.el.on("keydown",this.onKeyDown,this);tree.on("click",this.onNodeClick,this);},onNodeClick:function(node,e){if(node.disabled){return;}
403
- if(e.shiftKey&&this.extendSelection(node)){return true;}
404
- if(e.ctrlKey&&this.isSelected(node)){this.unselect(node);}else{this.select(node,e,e.ctrlKey);}},extendSelection:function(node){var last=this.lastSelNode;if(node==last||!last){return false;}
405
- if(node.parentNode==last.parentNode){var cs=node.parentNode.childNodes;var i=0,attr='id',selecting=false,lastSelect=false;this.clearSelections(true);for(i=0;i<cs.length;i++){if(cs[i].attributes[attr]==last.attributes[attr]||cs[i].attributes[attr]==node.attributes[attr]){lastSelect=selecting;selecting=!selecting;}
406
- if(selecting||lastSelect){this.select(cs[i],null,true);if(lastSelect){break;}}}
407
- return true;}else{return false;}},onKeyDown:Ext.tree.DefaultSelectionModel.prototype.onKeyDown.createInterceptor(function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return;}
408
- var k=e.getKey();switch(k){case e.SPACE:e.stopEvent();var sel=this.getSelectedNodes();var state=!s.getUI().checked();if(sel.length==1){s.getUI().check(state,!s.isLeaf());}else{for(var i=0;i<sel.length;i++){sel[i].getUI().check(state,!sel[i].isLeaf());}}
409
- break;}
410
- return true;})});;var tinyMceWysiwygSetup=Class.create();tinyMceWysiwygSetup.prototype={mediaBrowserOpener:null,initialize:function(htmlId,config)
411
- {this.id=htmlId;this.config=config;varienGlobalEvents.attachEventHandler('tinymceChange',this.onChangeContent.bind(this));this.notifyFirebug();if(typeof tinyMceEditors=='undefined'){tinyMceEditors=$H({});}
412
- tinyMceEditors.set(this.id,this);},notifyFirebug:function(){if(firebugEnabled()&&$('fb'+this.id)==undefined){var noticeHtml='<ul class="messages message-firebug" id="fb'+this.id+'"><li class="notice-msg">';noticeHtml+='<ul><li>';noticeHtml+='<b>'+this.config.firebug_warning_title+':</b> ';noticeHtml+=this.config.firebug_warning_text;noticeHtml+=' <a id="hidefb'+this.id+'" href="">'+this.config.firebug_warning_anchor+'</a>';noticeHtml+='</li></ul>';noticeHtml+='</li></ul>';$('buttons'+this.id).insert({before:noticeHtml});Event.observe($('hidefb'+this.id),"click",function(e){$('fb'+this.id).remove();Event.stop(e);}.bind(this));}},setup:function(mode)
413
- {if(this.config.widget_plugin_src){tinymce.PluginManager.load('magentowidget',this.config.widget_plugin_src);}
414
- if(this.config.plugins){(this.config.plugins).each(function(plugin){tinymce.PluginManager.load(plugin.name,plugin.src);});}
415
- tinyMCE.init(this.getSettings(mode));},getSettings:function(mode)
416
- {var plugins='safari,pagebreak,style,layer,table,advhr,advimage,emotions,iespell,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras';if(this.config.widget_plugin_src){plugins='magentowidget,'+plugins;}
417
- if(this.config.plugins){var magentoPluginsOptions=$H({});var magentoPlugins='';(this.config.plugins).each(function(plugin){magentoPlugins=plugin.name+','+magentoPlugins;magentoPluginsOptions.set(plugin.name,plugin.options);});if(magentoPlugins){plugins='-'+magentoPlugins+plugins;}}
418
- var settings={mode:(mode!=undefined?mode:'none'),elements:this.id,theme:'advanced',plugins:plugins,theme_advanced_buttons1:magentoPlugins+'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',theme_advanced_buttons2:'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',theme_advanced_buttons3:'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',theme_advanced_buttons4:'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',theme_advanced_toolbar_location:'top',theme_advanced_toolbar_align:'left',theme_advanced_statusbar_location:'bottom',theme_advanced_resizing:true,convert_urls:false,relative_urls:false,content_css:this.config.content_css,custom_popup_css:this.config.popup_css,magentowidget_url:this.config.widget_window_url,magentoPluginsOptions:magentoPluginsOptions,doctype:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',setup:function(ed){ed.onSubmit.add(function(ed,e){varienGlobalEvents.fireEvent('tinymceSubmit',e);});ed.onPaste.add(function(ed,e,o){varienGlobalEvents.fireEvent('tinymcePaste',o);});ed.onBeforeSetContent.add(function(ed,o){varienGlobalEvents.fireEvent('tinymceBeforeSetContent',o);});ed.onSetContent.add(function(ed,o){varienGlobalEvents.fireEvent('tinymceSetContent',o);});ed.onSaveContent.add(function(ed,o){varienGlobalEvents.fireEvent('tinymceSaveContent',o);});ed.onChange.add(function(ed,l){varienGlobalEvents.fireEvent('tinymceChange',l);});ed.onExecCommand.add(function(ed,cmd,ui,val){varienGlobalEvents.fireEvent('tinymceExecCommand',cmd);});}};if(this.config.files_browser_window_url){settings.file_browser_callback=function(fieldName,url,objectType,w){varienGlobalEvents.fireEvent("open_browser_callback",{win:w,type:objectType,field:fieldName});};}
419
- if(this.config.width){settings.width=this.config.width;}
420
- if(this.config.height){settings.height=this.config.height;}
421
- return settings;},openFileBrowser:function(o){var typeTitle;var wUrl=this.config.files_browser_window_url+'target_element_id/'+this.id+'/';this.mediaBrowserOpener=o.win;this.mediaBrowserOpener.blur();if(typeof(o.type)!='undefined'&&o.type!=""){typeTitle='image'==o.type?this.translate('Insert Image...'):this.translate('Insert Media...');wUrl=wUrl+"type/"+o.type+"/";}else{typeTitle=this.translate('Insert File...');}
422
- MediabrowserUtility.openDialog(wUrl,this.config.files_browser_window_width,this.config.files_browser_window_height,typeTitle);},translate:function(string){return'undefined'!=typeof(Translator)?Translator.translate(string):string;},getMediaBrowserOpener:function(){return this.mediaBrowserOpener;},getToggleButton:function(){return $('toggle'+this.id);},getPluginButtons:function(){return $$('#buttons'+this.id+' > button.plugin');},turnOn:function(){this.closePopups();this.setup();tinyMCE.execCommand('mceAddControl',false,this.id);this.getPluginButtons().each(function(e){e.hide();});},turnOff:function(){this.closePopups();tinyMCE.execCommand('mceRemoveControl',false,this.id);this.getPluginButtons().each(function(e){e.show();});},closePopups:function(){closeEditorPopup('widget_window'+this.id);closeEditorPopup('browser_window'+this.id);},toggle:function(){if(!tinyMCE.get(this.id)){this.turnOn();return true;}else{this.turnOff();return false;}},onFormValidation:function(){if(tinyMCE.get(this.id)){$(this.id).value=tinyMCE.get(this.id).getContent();}},onChangeContent:function(){if(this.config.tab_id){var tab=$$('a[id$='+this.config.tab_id+']')[0];if($(tab)!=undefined&&$(tab).hasClassName('tab-item-link')){$(tab).addClassName('changed');}}},encodeDirectives:function(content){return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=["']\{\{.+?\}\}.*?["'].+?)>/i,function(match){var attributesString=match[2];attributesString=attributesString.gsub(/([a-z0-9\-\_]+)=["'](\{\{.+?\}\})(.*?)["']/i,function(m){var url=m[1].toLowerCase()=='src'?this.config.directives_url:'';return m[1]+'="'+url+'___directive/'+Base64.mageEncode(m[2])+'/'+m[3]+'"';}.bind(this));return'<'+match[1]+attributesString+'>';}.bind(this));},encodeWidgets:function(content){return content.gsub(/\{\{widget(.*?)\}\}/i,function(match){var attributes=this.parseAttributesString(match[1]);if(attributes.type){var placeholderFilename=attributes.type.replace(/\//g,"__")+".gif";if(!this.widgetPlaceholderExist(placeholderFilename)){placeholderFilename='default.gif';}
423
- var imageSrc=this.config.widget_images_url+placeholderFilename;var imageHtml='<img';imageHtml+=' id="'+Base64.idEncode(match[0])+'"';imageHtml+=' src="'+imageSrc+'"';imageHtml+=' title="'+match[0].replace(/\{\{/g,'{').replace(/\}\}/g,'}').replace(/\"/g,'&quot;')+'"';imageHtml+='>';return imageHtml;}}.bind(this));},decodeDirectives:function(content){return content.gsub(/([a-z0-9\-\_]+)=["]\S*?___directive\/([a-zA-Z0-9\-\_\,]+)\/(.*?)["]/i,function(match){return match[1]+'="'+Base64.mageDecode(match[2])+'"';}.bind(this));},decodeWidgets:function(content){return content.gsub(/<img([^>]+id=\"[^>]+)>/i,function(match){var attributes=this.parseAttributesString(match[1]);if(attributes.id){var widgetCode=Base64.idDecode(attributes.id);if(widgetCode.indexOf('{{widget')!=-1){return widgetCode;}
424
- return match[0];}
425
- return match[0];}.bind(this));},parseAttributesString:function(attributes){var result={};attributes.gsub(/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/,function(match){result[match[1]]=match[2];});return result;},beforeSetContent:function(o){if(this.config.add_widgets){o.content=this.encodeWidgets(o.content);o.content=this.encodeDirectives(o.content);}},saveContent:function(o){if(this.config.add_widgets){o.content=this.decodeWidgets(o.content);o.content=this.decodeDirectives(o.content);}},widgetPlaceholderExist:function(filename){return this.config.widget_placeholders.indexOf(filename)!=-1;}};var Variables={textareaElementId:null,variablesContent:null,dialogWindow:null,dialogWindowId:'variables-chooser',overlayShowEffectOptions:null,overlayHideEffectOptions:null,insertFunction:'Variables.insertVariable',init:function(textareaElementId,insertFunction){if($(textareaElementId)){this.textareaElementId=textareaElementId;}
426
- if(insertFunction){this.insertFunction=insertFunction;}},resetData:function(){this.variablesContent=null;this.dialogWindow=null;},openVariableChooser:function(variables){if(this.variablesContent==null&&variables){this.variablesContent='<ul>';variables.each(function(variableGroup){if(variableGroup.label&&variableGroup.value){this.variablesContent+='<li><b>'+variableGroup.label+'</b></li>';(variableGroup.value).each(function(variable){if(variable.value&&variable.label){this.variablesContent+='<li style="padding-left: 20px;">'+
427
- this.prepareVariableRow(variable.value,variable.label)+'</li>';}}.bind(this));}}.bind(this));this.variablesContent+='</ul>';}
428
- if(this.variablesContent){this.openDialogWindow(this.variablesContent);}},openDialogWindow:function(variablesContent){if($(this.dialogWindowId)&&typeof(Windows)!='undefined'){Windows.focus(this.dialogWindowId);return;}
429
- this.overlayShowEffectOptions=Windows.overlayShowEffectOptions;this.overlayHideEffectOptions=Windows.overlayHideEffectOptions;Windows.overlayShowEffectOptions={duration:0};Windows.overlayHideEffectOptions={duration:0};this.dialogWindow=Dialog.info(variablesContent,{draggable:true,resizable:true,closable:true,className:"magento",title:'Insert Variable...',width:700,height:500,zIndex:1000,recenterAuto:false,hideEffect:Element.hide,showEffect:Element.show,id:this.dialogWindowId,onClose:this.closeDialogWindow.bind(this)});variablesContent.evalScripts.bind(variablesContent).defer();},closeDialogWindow:function(window){if(!window){window=this.dialogWindow;}
430
- if(window){window.close();Windows.overlayShowEffectOptions=this.overlayShowEffectOptions;Windows.overlayHideEffectOptions=this.overlayHideEffectOptions;}},prepareVariableRow:function(varValue,varLabel){var value=(varValue).replace(/"/g,'&quot;').replace(/'/g,'\\&#39;');var content='<a href="#" onclick="'+this.insertFunction+'(\''+value+'\');">'+varLabel+'</a>';return content;},insertVariable:function(value){this.closeDialogWindow(this.dialogWindow);var textareaElm=$(this.textareaElementId);if(textareaElm){var scrollPos=textareaElm.scrollTop;updateElementAtCursor(textareaElm,value);textareaElm.focus();textareaElm.scrollTop=scrollPos;textareaElm=null;}
431
- return;}};MagentovariablePlugin={editor:null,variables:null,textareaId:null,setEditor:function(editor){this.editor=editor;},loadChooser:function(url,textareaId){this.textareaId=textareaId;if(this.variables==null){new Ajax.Request(url,{parameters:{},onComplete:function(transport){if(transport.responseText.isJSON()){Variables.init(null,'MagentovariablePlugin.insertVariable');this.variables=transport.responseText.evalJSON();this.openChooser(this.variables);}}.bind(this)});}else{this.openChooser(this.variables);}
432
- return;},openChooser:function(variables){Variables.openVariableChooser(variables);},insertVariable:function(value){if(this.textareaId){Variables.init(this.textareaId);Variables.insertVariable(value);}else{Variables.closeDialogWindow();this.editor.execCommand('mceInsertContent',false,value);}
433
- return;}};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
var/minifycache/minify_036b1964ffc19e72b8e0134d21cb8d22.gz DELETED
Binary file
var/minifycache/minify_1b6ee19a4c3855472c3e3dd57413cb65 DELETED
@@ -1,385 +0,0 @@
1
- var varienTabs=new Class.create();varienTabs.prototype={initialize:function(containerId,destElementId,activeTabId,shadowTabs){this.containerId=containerId;this.destElementId=destElementId;this.activeTab=null;this.tabOnClick=this.tabMouseClick.bindAsEventListener(this);this.tabs=$$('#'+this.containerId+' li a.tab-item-link');this.hideAllTabsContent();for(var tab=0;tab<this.tabs.length;tab++){Event.observe(this.tabs[tab],'click',this.tabOnClick);if($(this.destElementId)){var tabContentElement=$(this.getTabContentElementId(this.tabs[tab]));if(tabContentElement&&tabContentElement.parentNode.id!=this.destElementId){$(this.destElementId).appendChild(tabContentElement);tabContentElement.container=this;tabContentElement.statusBar=this.tabs[tab];tabContentElement.tabObject=this.tabs[tab];this.tabs[tab].contentMoved=true;this.tabs[tab].container=this;this.tabs[tab].show=function(){this.container.showTabContent(this);}
2
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('moveTab',{tab:this.tabs[tab]});}}}
3
- if(this.tabs[tab].id&&shadowTabs&&shadowTabs[this.tabs[tab].id]){this.tabs[tab].shadowTabs=shadowTabs[this.tabs[tab].id];}}
4
- this.displayFirst=activeTabId;Event.observe(window,'load',this.moveTabContentInDest.bind(this));},setSkipDisplayFirstTab:function(){this.displayFirst=null;},moveTabContentInDest:function(){for(var tab=0;tab<this.tabs.length;tab++){if($(this.destElementId)&&!this.tabs[tab].contentMoved){var tabContentElement=$(this.getTabContentElementId(this.tabs[tab]));if(tabContentElement&&tabContentElement.parentNode.id!=this.destElementId){$(this.destElementId).appendChild(tabContentElement);tabContentElement.container=this;tabContentElement.statusBar=this.tabs[tab];tabContentElement.tabObject=this.tabs[tab];this.tabs[tab].container=this;this.tabs[tab].show=function(){this.container.showTabContent(this);}
5
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('moveTab',{tab:this.tabs[tab]});}}}}
6
- if(this.displayFirst){this.showTabContent($(this.displayFirst));this.displayFirst=null;}},getTabContentElementId:function(tab){if(tab){return tab.id+'_content';}
7
- return false;},tabMouseClick:function(event){var tab=Event.findElement(event,'a');if((tab.href.indexOf('#')!=tab.href.length-1)&&!(Element.hasClassName(tab,'ajax'))){location.href=tab.href;}
8
- else{this.showTabContent(tab);}
9
- Event.stop(event);},hideAllTabsContent:function(){for(var tab in this.tabs){this.hideTabContent(this.tabs[tab]);}},showTabContentImmediately:function(tab){this.hideAllTabsContent();var tabContentElement=$(this.getTabContentElementId(tab));if(tabContentElement){Element.show(tabContentElement);Element.addClassName(tab,'active');if(tab.shadowTabs&&tab.shadowTabs.length){for(var k in tab.shadowTabs){this.loadShadowTab($(tab.shadowTabs[k]));}}
10
- if(!Element.hasClassName(tab,'ajax only')){Element.removeClassName(tab,'notloaded');}
11
- this.activeTab=tab;}
12
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('showTab',{tab:tab});}},showTabContent:function(tab){var tabContentElement=$(this.getTabContentElementId(tab));if(tabContentElement){if(this.activeTab!=tab){if(varienGlobalEvents){if(varienGlobalEvents.fireEvent('tabChangeBefore',$(this.getTabContentElementId(this.activeTab))).indexOf('cannotchange')!=-1){return;};}}
13
- var isAjax=Element.hasClassName(tab,'ajax');var isEmpty=tabContentElement.innerHTML==''&&tab.href.indexOf('#')!=tab.href.length-1;var isNotLoaded=Element.hasClassName(tab,'notloaded');if(isAjax&&(isEmpty||isNotLoaded))
14
- {new Ajax.Request(tab.href,{parameters:{form_key:FORM_KEY},evalScripts:true,onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
15
- if(response.error){alert(response.message);}
16
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(tabContentElement.id).update(transport.responseText);this.showTabContentImmediately(tab)}}
17
- catch(e){$(tabContentElement.id).update(transport.responseText);this.showTabContentImmediately(tab)}}.bind(this)});}
18
- else{this.showTabContentImmediately(tab);}}},loadShadowTab:function(tab){var tabContentElement=$(this.getTabContentElementId(tab));if(tabContentElement&&Element.hasClassName(tab,'ajax')&&Element.hasClassName(tab,'notloaded')){new Ajax.Request(tab.href,{parameters:{form_key:FORM_KEY},evalScripts:true,onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
19
- if(response.error){alert(response.message);}
20
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(tabContentElement.id).update(transport.responseText);if(!Element.hasClassName(tab,'ajax only')){Element.removeClassName(tab,'notloaded');}}}
21
- catch(e){$(tabContentElement.id).update(transport.responseText);if(!Element.hasClassName(tab,'ajax only')){Element.removeClassName(tab,'notloaded');}}}.bind(this)});}},hideTabContent:function(tab){var tabContentElement=$(this.getTabContentElementId(tab));if($(this.destElementId)&&tabContentElement){Element.hide(tabContentElement);Element.removeClassName(tab,'active');}
22
- if(varienGlobalEvents){varienGlobalEvents.fireEvent('hideTab',{tab:tab});}}};var varienForm=new Class.create();varienForm.prototype={initialize:function(formId,validationUrl){this.formId=formId;this.validationUrl=validationUrl;this.submitUrl=false;if($(this.formId)){this.validator=new Validation(this.formId,{onElementValidate:this.checkErrors.bind(this)});}
23
- this.errorSections=$H({});},checkErrors:function(result,elm){if(!result)
24
- elm.setHasError(true,this);else
25
- elm.setHasError(false,this);},submit:function(url){if(typeof varienGlobalEvents!=undefined){varienGlobalEvents.fireEvent('formSubmit',this.formId);}
26
- this.errorSections=$H({});this.canShowError=true;this.submitUrl=url;if(this.validator&&this.validator.validate()){if(this.validationUrl){this._validate();}
27
- else{this._submit();}
28
- return true;}
29
- return false;},_validate:function(){new Ajax.Request(this.validationUrl,{method:'post',parameters:$(this.formId).serialize(),onComplete:this._processValidationResult.bind(this),onFailure:this._processFailure.bind(this)});},_processValidationResult:function(transport){var response=transport.responseText.evalJSON();if(response.error){if($('messages')){$('messages').innerHTML=response.message;}}
30
- else{this._submit();}},_processFailure:function(transport){location.href=BASE_URL;},_submit:function(){if(this.submitUrl){$(this.formId).action=this.submitUrl;}
31
- $(this.formId).submit();}}
32
- Validation.isVisible=function(elm){while(elm&&elm.tagName!='BODY'){if(elm.disabled)return false;if((Element.hasClassName(elm,'template')&&Element.hasClassName(elm,'no-display'))||Element.hasClassName(elm,'ignore-validate')){return false;}
33
- elm=elm.parentNode;}
34
- return true;}
35
- var varienElementMethods={setHasChanges:function(element,event){if($(element)&&$(element).hasClassName('no-changes'))return;var elm=element;while(elm&&elm.tagName!='BODY'){if(elm.statusBar)
36
- Element.addClassName($(elm.statusBar),'changed')
37
- elm=elm.parentNode;}},setHasError:function(element,flag,form){var elm=element;while(elm&&elm.tagName!='BODY'){if(elm.statusBar){if(form.errorSections.keys().indexOf(elm.statusBar.id)<0)
38
- form.errorSections.set(elm.statusBar.id,flag);if(flag){Element.addClassName($(elm.statusBar),'error');if(form.canShowError&&$(elm.statusBar).show){form.canShowError=false;$(elm.statusBar).show();}
39
- form.errorSections.set(elm.statusBar.id,flag);}
40
- else if(!form.errorSections.get(elm.statusBar.id)){Element.removeClassName($(elm.statusBar),'error')}}
41
- elm=elm.parentNode;}
42
- this.canShowElement=false;}}
43
- Element.addMethods(varienElementMethods);varienWindowOnloadCache={};function varienWindowOnload(useCache){var dataElements=$$('input','select','textarea');for(var i=0;i<dataElements.length;i++){if(dataElements[i]&&dataElements[i].id){if((!useCache)||(!varienWindowOnloadCache[dataElements[i].id])){Event.observe(dataElements[i],'change',dataElements[i].setHasChanges.bind(dataElements[i]));if(useCache){varienWindowOnloadCache[dataElements[i].id]=true;}}}}}
44
- Event.observe(window,'load',varienWindowOnload);RegionUpdater=Class.create();RegionUpdater.prototype={initialize:function(countryEl,regionTextEl,regionSelectEl,regions,disableAction,clearRegionValueOnDisable)
45
- {this.countryEl=$(countryEl);this.regionTextEl=$(regionTextEl);this.regionSelectEl=$(regionSelectEl);this.regions=regions;this.disableAction=(typeof disableAction=='undefined')?'hide':disableAction;this.clearRegionValueOnDisable=(typeof clearRegionValueOnDisable=='undefined')?false:clearRegionValueOnDisable;if(this.regionSelectEl.options.length<=1){this.update();}
46
- else{this.lastCountryId=this.countryEl.value;}
47
- this.countryEl.changeUpdater=this.update.bind(this);Event.observe(this.countryEl,'change',this.update.bind(this));},update:function()
48
- {if(this.regions[this.countryEl.value]){if(this.lastCountryId!=this.countryEl.value){var i,option,region,def;if(this.regionTextEl){def=this.regionTextEl.value.toLowerCase();this.regionTextEl.value='';}
49
- if(!def){def=this.regionSelectEl.getAttribute('defaultValue');}
50
- this.regionSelectEl.options.length=1;for(regionId in this.regions[this.countryEl.value]){region=this.regions[this.countryEl.value][regionId];option=document.createElement('OPTION');option.value=regionId;option.text=region.name;if(this.regionSelectEl.options.add){this.regionSelectEl.options.add(option);}else{this.regionSelectEl.appendChild(option);}
51
- if(regionId==def||region.name.toLowerCase()==def||region.code.toLowerCase()==def){this.regionSelectEl.value=regionId;}}}
52
- if(this.disableAction=='hide'){if(this.regionTextEl){this.regionTextEl.style.display='none';this.regionTextEl.style.disabled=true;}
53
- this.regionSelectEl.style.display='';this.regionSelectEl.disabled=false;}else if(this.disableAction=='disable'){if(this.regionTextEl){this.regionTextEl.disabled=true;}
54
- this.regionSelectEl.disabled=false;}
55
- this.setMarkDisplay(this.regionSelectEl,true);this.lastCountryId=this.countryEl.value;}else{if(this.disableAction=='hide'){if(this.regionTextEl){this.regionTextEl.style.display='';this.regionTextEl.style.disabled=false;}
56
- this.regionSelectEl.style.display='none';this.regionSelectEl.disabled=true;}else if(this.disableAction=='disable'){if(this.regionTextEl){this.regionTextEl.disabled=false;}
57
- this.regionSelectEl.disabled=true;if(this.clearRegionValueOnDisable){this.regionSelectEl.value='';}}else if(this.disableAction=='nullify'){this.regionSelectEl.options.length=1;this.regionSelectEl.value='';this.regionSelectEl.selectedIndex=0;this.lastCountryId='';}
58
- this.setMarkDisplay(this.regionSelectEl,false);}
59
- varienGlobalEvents.fireEvent("address_country_changed",this.countryEl);},setMarkDisplay:function(elem,display){if(elem.parentNode.parentNode){var marks=Element.select(elem.parentNode.parentNode,'.required');if(marks[0]){display?marks[0].show():marks[0].hide();}}}}
60
- regionUpdater=RegionUpdater;Event.pointerX=function(event){try{return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));}
61
- catch(e){}}
62
- Event.pointerY=function(event){try{return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));}
63
- catch(e){}}
64
- SelectUpdater=Class.create();SelectUpdater.prototype={initialize:function(firstSelect,secondSelect,selectFirstMessage,noValuesMessage,values,selected)
65
- {this.first=$(firstSelect);this.second=$(secondSelect);this.message=selectFirstMessage;this.values=values;this.noMessage=noValuesMessage;this.selected=selected;this.update();Event.observe(this.first,'change',this.update.bind(this));},update:function()
66
- {this.second.length=0;this.second.value='';if(this.first.value&&this.values[this.first.value]){for(optionValue in this.values[this.first.value]){optionTitle=this.values[this.first.value][optionValue];this.addOption(this.second,optionValue,optionTitle);}
67
- this.second.disabled=false;}else if(this.first.value&&!this.values[this.first.value]){this.addOption(this.second,'',this.noMessage);}else{this.addOption(this.second,'',this.message);this.second.disabled=true;}},addOption:function(select,value,text)
68
- {option=document.createElement('OPTION');option.value=value;option.text=text;if(this.selected&&option.value==this.selected){option.selected=true;this.selected=false;}
69
- if(select.options.add){select.options.add(option);}else{select.appendChild(option);}}}
70
- FormElementDependenceController=Class.create();FormElementDependenceController.prototype={initialize:function(elementsMap)
71
- {for(var idTo in elementsMap){for(var idFrom in elementsMap[idTo]){Event.observe($(idFrom),'change',this.trackChange.bindAsEventListener(this,idTo,elementsMap[idTo]));this.trackChange(null,idTo,elementsMap[idTo]);}}},trackChange:function(e,idTo,valuesFrom)
72
- {var shouldShowUp=true;for(var idFrom in valuesFrom){if($(idFrom).value!=valuesFrom[idFrom]){shouldShowUp=false;}}
73
- if(shouldShowUp){$(idTo).up(1).select('input','select').each(function(item){if(!item.type||item.type!='hidden'){item.disabled=false;}});$(idTo).up(1).show();}else{$(idTo).up(1).select('input','select').each(function(item){if(!item.type||item.type!='hidden'){item.disabled=true;}});$(idTo).up(1).hide();}}};var varienAccordion=new Class.create();varienAccordion.prototype={initialize:function(containerId,activeOnlyOne){this.containerId=containerId;this.activeOnlyOne=activeOnlyOne||false;this.container=$(this.containerId);this.items=$$('#'+this.containerId+' dt');this.loader=new varienLoader(true);var links=$$('#'+this.containerId+' dt a');for(var i in links){if(links[i].href){Event.observe(links[i],'click',this.clickItem.bind(this));this.items[i].dd=this.items[i].next('dd');this.items[i].link=links[i];}}
74
- this.initFromCookie();},initFromCookie:function(){var activeItemId,visibility;if(this.activeOnlyOne&&(activeItemId=Cookie.read(this.cookiePrefix()+'active-item'))!==null){this.hideAllItems();this.showItem(this.getItemById(activeItemId));}else if(!this.activeOnlyOne){this.items.each(function(item){if((visibility=Cookie.read(this.cookiePrefix()+item.id))!==null){if(visibility==0){this.hideItem(item);}else{this.showItem(item);}}}.bind(this));}},cookiePrefix:function(){return'accordion-'+this.containerId+'-';},getItemById:function(itemId){var result=null;this.items.each(function(item){if(item.id==itemId){result=item;throw $break;}});return result;},clickItem:function(event){var item=Event.findElement(event,'dt');if(this.activeOnlyOne){this.hideAllItems();this.showItem(item);Cookie.write(this.cookiePrefix()+'active-item',item.id,30*24*60*60);}
75
- else{if(this.isItemVisible(item)){this.hideItem(item);Cookie.write(this.cookiePrefix()+item.id,0,30*24*60*60);}
76
- else{this.showItem(item);Cookie.write(this.cookiePrefix()+item.id,1,30*24*60*60);}}
77
- Event.stop(event);},showItem:function(item){if(item&&item.link){if(item.link.href){this.loadContent(item);}
78
- Element.addClassName(item,'open');Element.addClassName(item.dd,'open');}},hideItem:function(item){Element.removeClassName(item,'open');Element.removeClassName(item.dd,'open');},isItemVisible:function(item){return Element.hasClassName(item,'open');},loadContent:function(item){if(item.link.href.indexOf('#')==item.link.href.length-1){return;}
79
- if(Element.hasClassName(item.link,'ajax')){this.loadingItem=item;this.loader.load(item.link.href,{updaterId:this.loadingItem.dd.id},this.setItemContent.bind(this));return;}
80
- location.href=item.link.href;},setItemContent:function(content){if(content.isJSON){return;}
81
- this.loadingItem.dd.innerHTML=content;},hideAllItems:function(){for(var i in this.items){if(this.items[i].id){Element.removeClassName(this.items[i],'open');Element.removeClassName(this.items[i].dd,'open');}}}};function setLocation(url){window.location.href=url;}
82
- function confirmSetLocation(message,url){if(confirm(message)){setLocation(url);}
83
- return false;}
84
- function deleteConfirm(message,url){confirmSetLocation(message,url);}
85
- function setElementDisable(element,disable){if($(element)){$(element).disabled=disable;}}
86
- function toggleParentVis(obj){obj=$(obj).parentNode;if(obj.style.display=='none'){obj.style.display='';}else{obj.style.display='none';}}
87
- function toggleFieldsetVis(obj){id=obj;obj=$(obj);if(obj.style.display=='none'){obj.style.display='';}else{obj.style.display='none';}
88
- obj=obj.parentNode.childElements();for(var i=0;i<obj.length;i++){if(obj[i].id!=undefined&&obj[i].id==id&&obj[(i-1)].classNames()=='entry-edit-head')
89
- {if(obj[i-1].style.display=='none'){obj[i-1].style.display='';}else{obj[i-1].style.display='none';}}}}
90
- function toggleVis(obj){obj=$(obj);if(obj.style.display=='none'){obj.style.display='';}else{obj.style.display='none';}}
91
- function imagePreview(element){if($(element)){var win=window.open('','preview','width=400,height=400,resizable=1,scrollbars=1');win.document.open();win.document.write('<body style="padding:0;margin:0"><img src="'+$(element).src+'" id="image_preview"/></body>');win.document.close();Event.observe(win,'load',function(){var img=win.document.getElementById('image_preview');win.resizeTo(img.width+40,img.height+80)});}}
92
- function toggleValueElements(checkbox,container){if(container&&checkbox){var elems=Element.select(container,['select','input','textarea','button','img']);elems.each(function(elem){if(elem!=checkbox){elem.disabled=checkbox.checked;if(checkbox.checked){elem.addClassName('disabled');}else{elem.removeClassName('disabled');}
93
- if(elem.tagName=='IMG'){checkbox.checked?elem.hide():elem.show();}};})}}
94
- function submitAndReloadArea(area,url){if($(area)){var fields=$(area).select('input','select','textarea');var data=Form.serializeElements(fields,true);url=url+(url.match(new RegExp('\\?'))?'&isAjax=true':'?isAjax=true');new Ajax.Request(url,{parameters:$H(data),loaderArea:area,onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
95
- if(response.error){alert(response.message);}
96
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(area).update(transport.responseText);}}
97
- catch(e){$(area).update(transport.responseText);}}});}}
98
- function syncOnchangeValue(baseElem,distElem){var compare={baseElem:baseElem,distElem:distElem}
99
- Event.observe(baseElem,'change',function(){if($(this.baseElem)&&$(this.distElem)){$(this.distElem).value=$(this.baseElem).value;}}.bind(compare));}
100
- function updateElementAtCursor(el,value,win){if(win==undefined){win=window.self;}
101
- if(document.selection){el.focus();sel=win.document.selection.createRange();sel.text=value;}else if(el.selectionStart||el.selectionStart=='0'){var startPos=el.selectionStart;var endPos=el.selectionEnd;el.value=el.value.substring(0,startPos)+value+el.value.substring(endPos,el.value.length);}else{el.value+=value;}}
102
- function firebugEnabled(){if(window.console&&window.console.firebug){return true;}
103
- return false;}
104
- function disableElements(search){$$('.'+search).each(function(elem){elem.disabled=true;elem.addClassName('disabled');});}
105
- function enableElements(search){$$('.'+search).each(function(elem){elem.disabled=false;elem.removeClassName('disabled');});}
106
- if(!navigator.appVersion.match('MSIE 6.')){var header,header_offset,header_copy;Event.observe(window,'load',function(){createTopButtonToolbarToggle();});function createTopButtonToolbarToggle()
107
- {var headers=$$('.content-header');for(var i=0;i<headers.length;i++){if(!headers[i].hasClassName('skip-header')){header=headers[i];}}
108
- if(!header){return;}
109
- header_offset=Element.cumulativeOffset(header)[1];var buttons=$$('.content-buttons')[0];if(buttons){Element.insert(buttons,{before:'<div class="content-buttons-placeholder"></div>'});buttons.placeholder=buttons.previous('.content-buttons-placeholder');buttons.remove();buttons.placeholder.appendChild(buttons);header_offset=Element.cumulativeOffset(buttons)[1];}
110
- header_copy=document.createElement('div');header_copy.appendChild(header.cloneNode(true));document.body.insertBefore(header_copy,document.body.lastChild)
111
- $(header_copy).addClassName('content-header-floating');if($(header_copy).down('.content-buttons-placeholder')){$(header_copy).down('.content-buttons-placeholder').remove();}}
112
- function updateTopButtonToolbarToggle()
113
- {if(header_copy){header_copy.remove();}
114
- createTopButtonToolbarToggle();floatingTopButtonToolbarToggle();}
115
- function floatingTopButtonToolbarToggle(){if(!header||!header_copy||!header_copy.parentNode){return;}
116
- var s;if(self.pageYOffset){s=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){s=document.documentElement.scrollTop;}else if(document.body){s=document.body.scrollTop;}
117
- var buttons=$$('.content-buttons')[0];if(s>header_offset){if(buttons){if(!buttons.oldParent){buttons.oldParent=buttons.parentNode;buttons.oldBefore=buttons.previous();}
118
- if(buttons.oldParent==buttons.parentNode){var dimensions=buttons.placeholder.getDimensions()
119
- buttons.placeholder.style.width=dimensions.width+'px';buttons.placeholder.style.height=dimensions.height+'px';buttons.hide();buttons.remove();$(header_copy).down('div').appendChild(buttons);buttons.show();}}
120
- header_copy.style.display='block';}else{if(buttons&&buttons.oldParent&&buttons.oldParent!=buttons.parentNode){buttons.remove();buttons.oldParent.insertBefore(buttons,buttons.oldBefore);}
121
- header.style.visibility='visible';header_copy.style.display='none';}}
122
- Event.observe(window,'scroll',floatingTopButtonToolbarToggle);Event.observe(window,'resize',floatingTopButtonToolbarToggle);}
123
- var Cookie={all:function(){var pairs=document.cookie.split(';');var cookies={};pairs.each(function(item,index){var pair=item.strip().split('=');cookies[unescape(pair[0])]=unescape(pair[1]);});return cookies;},read:function(cookieName){var cookies=this.all();if(cookies[cookieName]){return cookies[cookieName];}
124
- return null;},write:function(cookieName,cookieValue,cookieLifeTime){var expires='';if(cookieLifeTime){var date=new Date();date.setTime(date.getTime()+(cookieLifeTime*1000));expires='; expires='+date.toGMTString();}
125
- var urlPath='/'+BASE_URL.split('/').slice(3).join('/');document.cookie=escape(cookieName)+"="+escape(cookieValue)+expires+"; path="+urlPath;},clear:function(cookieName){this.write(cookieName,'',-1);}};var Fieldset={cookiePrefix:'fh-',applyCollapse:function(containerId){if($(containerId+'-state')){collapsed=$(containerId+'-state').value==1?0:1;}else{collapsed=$(containerId+'-head').collapsed;}
126
- if(collapsed==1||collapsed===undefined){$(containerId+'-head').removeClassName('open');$(containerId).hide();}else{$(containerId+'-head').addClassName('open');$(containerId).show();}},toggleCollapse:function(containerId,saveThroughAjax){if($(containerId+'-state')){collapsed=$(containerId+'-state').value==1?0:1;}else{collapsed=$(containerId+'-head').collapsed;}
127
- if(collapsed==1||collapsed===undefined){if($(containerId+'-state')){$(containerId+'-state').value=1;}
128
- $(containerId+'-head').collapsed=0;}else{if($(containerId+'-state')){$(containerId+'-state').value=0;}
129
- $(containerId+'-head').collapsed=1;}
130
- this.applyCollapse(containerId);if(typeof saveThroughAjax!="undefined"){this.saveState(saveThroughAjax,{container:containerId,value:$(containerId+'-state').value});}},addToPrefix:function(value){this.cookiePrefix+=value+'-';},saveState:function(url,parameters){new Ajax.Request(url,{method:'get',parameters:Object.toQueryString(parameters),loaderArea:false});}};var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
131
- output=output+
132
- this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+
133
- this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
134
- return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
135
- if(enc4!=64){output=output+String.fromCharCode(chr3);}}
136
- output=Base64._utf8_decode(output);return output;},mageEncode:function(input){return this.encode(input).replace(/\+/g,'-').replace(/\//g,'_').replace(/=/g,',');},mageDecode:function(output){output=output.replace(/\-/g,'+').replace(/_/g,'/').replace(/,/g,'=');return this.decode(output);},idEncode:function(input){return this.encode(input).replace(/\+/g,':').replace(/\//g,'_').replace(/=/g,'-');},idDecode:function(output){output=output.replace(/\-/g,'=').replace(/_/g,'/').replace(/\:/g,'\+');return this.decode(output);},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
137
- else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
138
- else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
139
- return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
140
- else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
141
- else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
142
- return string;}};;function MultiSelector(list_target,field_name,max,new_element_html,delete_text,new_file_input){this.list_target=list_target;this.field_name=field_name;this.count=0;this.id=0;if(max){this.max=max;}else{this.max=-1;};this.new_element_html=new_element_html;this.delete_text=delete_text;this.new_file_input=new_file_input;this.addElement=function(element){if(element.tagName=='INPUT'&&element.type=='file'){this.id++;element.name=this.field_name+'[]';element.multi_selector=this;element.onchange=function(){var new_element=document.createElement('input');new_element.type='file';this.parentNode.insertBefore(new_element,this);this.multi_selector.addElement(new_element);this.multi_selector.addListRow(this);this.style.position='absolute';this.style.left='-1000px';};if(this.max!=-1&&this.count>=this.max){element.disabled=true;};this.count++;this.current_element=element;}else{alert('Error: not a file input element');};};this.addListRow=function(element){var new_row_input=document.createElement('input');new_row_input.type='text';new_row_input.name='general[position_new][]';new_row_input.size='3';new_row_input.value='0';var new_row_button=document.createElement('input');new_row_button.type='checkbox';new_row_button.value='Delete';var new_row_span=document.createElement('span');new_row_span.innerHTML=this.delete_text;table=this.list_target;noOfRows=table.rows.length;noOfCols=table.rows[noOfRows-2].cells.length;var x=table.insertRow(noOfRows-1);for(var j=0;j<noOfCols;j++){newCell=x.insertCell(j);newCell.align="center";newCell.valign="middle";if(j==3){newCell.appendChild(new_row_input);}
143
- else if(j==4){newCell.appendChild(new_row_button);}
144
- else{newCell.innerHTML=this.new_file_input.replace(/%id%/g,this.id).replace(/%j%/g,j);}}
145
- new_row_button.onclick=function(){this.parentNode.element.parentNode.removeChild(this.parentNode.element);this.parentNode.parentNode.removeChild(this.parentNode);this.parentNode.element.multi_selector.count--;this.parentNode.element.multi_selector.current_element.disabled=false;return false;};};this.insRowLast=function(table){noOfRows=table.rows.length;noOfCols=table.rows[noOfRows-1].cells.length;var x=table.insertRow(noOfRows);for(var j=0;j<noOfCols;j++){newCell=x.insertCell(j);newCell.innerHTML="NEW CELL"+j;}};this.deleteRow=function(table,row){table.deleteRow(row);};this.deleteRow=function(table){noOfRows=table.rows.length;table.deleteRow(noOfRows-1);};};;var Product={};Product.Gallery=Class.create();Product.Gallery.prototype={images:[],file2id:{'no_selection':0},idIncrement:1,containerId:'',container:null,uploader:null,imageTypes:{},initialize:function(containerId,uploader,imageTypes){this.containerId=containerId,this.container=$(this.containerId);this.uploader=uploader;this.imageTypes=imageTypes;if(this.uploader){this.uploader.onFilesComplete=this.handleUploadComplete.bind(this);}
146
- this.images=this.getElement('save').value.evalJSON();this.imagesValues=this.getElement('save_image').value.evalJSON();this.template=new Template('<tr id="__id__" class="preview">'+this.getElement('template').innerHTML+'</tr>',new RegExp('(^|.|\\r|\\n)(__([a-zA-Z0-9_]+)__)',''));this.fixParentTable();this.updateImages();varienGlobalEvents.attachEventHandler('moveTab',this.onImageTabMove.bind(this));},onImageTabMove:function(event){var imagesTab=false;this.container.ancestors().each(function(parentItem){if(parentItem.tabObject){imagesTab=parentItem.tabObject;throw $break;}}.bind(this));if(imagesTab&&event.tab&&event.tab.name&&imagesTab.name==event.tab.name){this.container.select('input[type="radio"]').each(function(radio){radio.observe('change',this.onChangeRadio);}.bind(this));this.updateImages();}},fixParentTable:function(){this.container.ancestors().each(function(parentItem){if(parentItem.tagName.toLowerCase()=='td'){parentItem.style.width='100%';}
147
- if(parentItem.tagName.toLowerCase()=='table'){parentItem.style.width='100%';throw $break;}});},getElement:function(name){return $(this.containerId+'_'+name);},showUploader:function(){this.getElement('add_images_button').hide();this.getElement('uploader').show();},handleUploadComplete:function(files){files.each(function(item){if(!item.response.isJSON()){try{console.log(item.response);}catch(e2){alert(item.response);}
148
- return;}
149
- var response=item.response.evalJSON();if(response.error){return;}
150
- var newImage={};newImage.url=response.url;newImage.file=response.file;newImage.label='';newImage.position=this.getNextPosition();newImage.disabled=0;newImage.removed=0;this.images.push(newImage);this.uploader.removeFile(item.id);}.bind(this));this.container.setHasChanges();this.updateImages();},updateImages:function(){this.getElement('save').value=this.images.toJSON();$H(this.imageTypes).each(function(pair){this.getFileElement('no_selection','cell-'+pair.key+' input').checked=true;}.bind(this));this.images.each(function(row){if(!$(this.prepareId(row.file))){this.createImageRow(row);}
151
- this.updateVisualisation(row.file);}.bind(this));this.updateUseDefault(false);},onChangeRadio:function(evt){var element=Event.element(evt);element.setHasChanges();},createImageRow:function(image){var vars=Object.clone(image);vars.id=this.prepareId(image.file);var html=this.template.evaluate(vars);Element.insert(this.getElement('list'),{bottom:html});$(vars.id).select('input[type="radio"]').each(function(radio){radio.observe('change',this.onChangeRadio);}.bind(this));},prepareId:function(file){if(typeof this.file2id[file]=='undefined'){this.file2id[file]=this.idIncrement++;}
152
- return this.containerId+'-image-'+this.file2id[file];},getNextPosition:function(){var maxPosition=0;this.images.each(function(item){if(parseInt(item.position)>maxPosition){maxPosition=parseInt(item.position);}});return maxPosition+1;},updateImage:function(file){var index=this.getIndexByFile(file);this.images[index].label=this.getFileElement(file,'cell-label input').value;this.images[index].position=this.getFileElement(file,'cell-position input').value;this.images[index].removed=(this.getFileElement(file,'cell-remove input').checked?1:0);this.images[index].disabled=(this.getFileElement(file,'cell-disable input').checked?1:0);this.getElement('save').value=this.images.toJSON();this.updateState(file);this.container.setHasChanges();},loadImage:function(file){var image=this.getImageByFile(file);this.getFileElement(file,'cell-image img').src=image.url;this.getFileElement(file,'cell-image img').show();this.getFileElement(file,'cell-image .place-holder').hide();},setProductImages:function(file){$H(this.imageTypes).each(function(pair){if(this.getFileElement(file,'cell-'+pair.key+' input').checked){this.imagesValues[pair.key]=(file=='no_selection'?null:file);}}.bind(this));this.getElement('save_image').value=$H(this.imagesValues).toJSON();},updateVisualisation:function(file){var image=this.getImageByFile(file);this.getFileElement(file,'cell-label input').value=image.label;this.getFileElement(file,'cell-position input').value=image.position;this.getFileElement(file,'cell-remove input').checked=(image.removed==1);this.getFileElement(file,'cell-disable input').checked=(image.disabled==1);$H(this.imageTypes).each(function(pair){if(this.imagesValues[pair.key]==file){this.getFileElement(file,'cell-'+pair.key+' input').checked=true;}}.bind(this));this.updateState(file);},updateState:function(file){if(this.getFileElement(file,'cell-disable input').checked){this.getFileElement(file,'cell-position input').disabled=true;}else{this.getFileElement(file,'cell-position input').disabled=false;}},getFileElement:function(file,element){var selector='#'+this.prepareId(file)+' .'+element;var elems=$$(selector);if(!elems[0]){try{console.log(selector);}catch(e2){alert(selector);}}
153
- return $$('#'+this.prepareId(file)+' .'+element)[0];},getImageByFile:function(file){if(this.getIndexByFile(file)===null){return false;}
154
- return this.images[this.getIndexByFile(file)];},getIndexByFile:function(file){var index;this.images.each(function(item,i){if(item.file==file){index=i;}});return index;},updateUseDefault:function(){if(this.getElement('default')){this.getElement('default').select('input').each(function(input){$(this.containerId).select('.cell-'+input.value+' input').each(function(radio){radio.disabled=input.checked;});}.bind(this));}
155
- if(arguments.length==0){this.container.setHasChanges();}},handleUploadProgress:function(file){},handleUploadError:function(fileId){}};Product.AttributesBridge={tabsObject:false,bindTabs2Attributes:{},bind:function(tabId,attributesObject){this.bindTabs2Attributes[tabId]=attributesObject;},getAttributes:function(tabId){return this.bindTabs2Attributes[tabId];},setTabsObject:function(tabs){this.tabsObject=tabs;},getTabsObject:function(){return this.tabsObject;},addAttributeRow:function(data){$H(data).each(function(item){if(this.getTabsObject().activeTab.name!=item.key){this.getTabsObject().showTabContent($(item.key));}
156
- this.getAttributes(item.key).addRow(item.value);}.bind(this));}};Product.Attributes=Class.create();Product.Attributes.prototype={config:{},containerId:null,initialize:function(containerId){this.containerId=containerId;},setConfig:function(config){this.config=config;Product.AttributesBridge.bind(this.getConfig().tab_id,this);},getConfig:function(){return this.config;},create:function(){var win=window.open(this.getConfig().url,'new_attribute','width=900,height=600,resizable=1,scrollbars=1');win.focus();},addRow:function(html){var attributesContainer=$$('#group_fields'+this.getConfig().group_id+' .form-list tbody')[0];Element.insert(attributesContainer,{bottom:html});var childs=attributesContainer.childElements();var element=childs[childs.size()-1].select('input','select','textarea')[0];if(element){window.scrollTo(0,Position.cumulativeOffset(element)[1]
157
- +element.offsetHeight);}}};Product.Configurable=Class.create();Product.Configurable.prototype={initialize:function(attributes,links,idPrefix,grid,readonly){this.templatesSyntax=new RegExp('(^|.|\\r|\\n)(\'{{\\s*(\\w+)\\s*}}\')',"");this.attributes=attributes;this.idPrefix=idPrefix;this.links=$H(links);this.newProducts=[];this.readonly=readonly;this.addAttributeTemplate=new Template($(idPrefix+'attribute_template').innerHTML.replace(/__id__/g,"'{{html_id}}'").replace(/ template no-display/g,''),this.templatesSyntax);this.addValueTemplate=new Template($(idPrefix+'value_template').innerHTML.replace(/__id__/g,"'{{html_id}}'").replace(/ template no-display/g,''),this.templatesSyntax);this.pricingValueTemplate=new Template($(idPrefix+'simple_pricing').innerHTML,this.templatesSyntax);this.pricingValueViewTemplate=new Template($(idPrefix+'simple_pricing_view').innerHTML,this.templatesSyntax);this.container=$(idPrefix+'attributes');this.onLabelUpdate=this.updateLabel.bindAsEventListener(this);this.onValuePriceUpdate=this.updateValuePrice.bindAsEventListener(this);this.onValueTypeUpdate=this.updateValueType.bindAsEventListener(this);this.onValueDefaultUpdate=this.updateValueUseDefault.bindAsEventListener(this);this.createAttributes();this.grid=grid;this.grid.rowClickCallback=this.rowClick.bind(this);this.grid.initRowCallback=this.rowInit.bind(this);this.grid.checkboxCheckCallback=this.registerProduct.bind(this);this.grid.rows.each(function(row){this.rowInit(this.grid,row);}.bind(this));},createAttributes:function(){this.attributes.each(function(attribute,index){var li=$(document.createElement('LI'));li.className='attribute';li.id=this.idPrefix+'_attribute_'+index;attribute.html_id=li.id;if(attribute&&attribute.label&&attribute.label.blank()){attribute.label='&nbsp;'}
158
- var label_readonly='';var use_default_checked='';if(attribute.use_default=='1'){use_default_checked=' checked="checked"';label_readonly=' redonly="redonly"';}
159
- var template=this.addAttributeTemplate.evaluate(attribute);template=template.replace(new RegExp(' readonly="label"','g'),label_readonly);template=template.replace(new RegExp(' checked="use_default"','g'),use_default_checked);li.update(template);li.attributeObject=attribute;this.container.appendChild(li);li.attributeValues=li.down('.attribute-values');if(attribute.values){attribute.values.each(function(value){this.createValueRow(li,value);}.bind(this));}
160
- Event.observe(li.down('.attribute-label'),'change',this.onLabelUpdate);Event.observe(li.down('.attribute-label'),'keyup',this.onLabelUpdate);Event.observe(li.down('.attribute-use-default-label'),'change',this.onLabelUpdate);}.bind(this));if(!this.readonly){Sortable.create(this.container,{handle:'attribute-name-container',onUpdate:this.updatePositions.bind(this)});}
161
- this.updateSaveInput();},updateLabel:function(event){var li=Event.findElement(event,'LI');var labelEl=li.down('.attribute-label');var defEl=li.down('.attribute-use-default-label');li.attributeObject.label=labelEl.value;if(defEl.checked){labelEl.readOnly=true;li.attributeObject.use_default=1;}else{labelEl.readOnly=false;li.attributeObject.use_default=0;}
162
- this.updateSaveInput();},updatePositions:function(param){this.container.childElements().each(function(row,index){row.attributeObject.position=index;});this.updateSaveInput();},addNewProduct:function(productId,attributes){if(this.checkAttributes(attributes)){this.links.set(productId,this.cloneAttributes(attributes));}else{this.newProducts.push(productId);}
163
- this.updateGrid();this.updateValues();this.grid.reload(null);},createEmptyProduct:function(){this.createPopup(this.createEmptyUrl)},createNewProduct:function(){this.createPopup(this.createNormalUrl);},createPopup:function(url){if(this.win&&!this.win.closed){this.win.close();}
164
- this.win=window.open(url,'','width=1000,height=700,resizable=1,scrollbars=1');this.win.focus();},registerProduct:function(grid,element,checked){if(checked){if(element.linkAttributes){this.links.set(element.value,element.linkAttributes);}}else{this.links.unset(element.value);}
165
- this.updateGrid();this.grid.rows.each(function(row){this.revalidateRow(this.grid,row);}.bind(this));this.updateValues();},updateProduct:function(productId,attributes){var isAssociated=false;if(typeof this.links.get(productId)!='undefined'){isAssociated=true;this.links.unset(productId);}
166
- if(isAssociated&&this.checkAttributes(attributes)){this.links.set(productId,this.cloneAttributes(attributes));}else if(isAssociated){this.newProducts.push(productId);}
167
- this.updateGrid();this.updateValues();this.grid.reload(null);},cloneAttributes:function(attributes){var newObj=[];for(var i=0,length=attributes.length;i<length;i++){newObj[i]=Object.clone(attributes[i]);}
168
- return newObj;},rowClick:function(grid,event){var trElement=Event.findElement(event,'tr');var isInput=Event.element(event).tagName.toUpperCase()=='INPUT';if($(Event.findElement(event,'td')).down('a')){return;}
169
- if(trElement){var checkbox=$(trElement).down('input');if(checkbox&&!checkbox.disabled){var checked=isInput?checkbox.checked:!checkbox.checked;grid.setCheckboxChecked(checkbox,checked);}}},rowInit:function(grid,row){var checkbox=$(row).down('.checkbox');var input=$(row).down('.value-json');if(checkbox&&input){checkbox.linkAttributes=input.value.evalJSON();if(!checkbox.checked){if(!this.checkAttributes(checkbox.linkAttributes)){$(row).addClassName('invalid');checkbox.disable();}else{$(row).removeClassName('invalid');checkbox.enable();}}}},revalidateRow:function(grid,row){var checkbox=$(row).down('.checkbox');if(checkbox){if(!checkbox.checked){if(!this.checkAttributes(checkbox.linkAttributes)){$(row).addClassName('invalid');checkbox.disable();}else{$(row).removeClassName('invalid');checkbox.enable();}}}},checkAttributes:function(attributes){var result=true;this.links.each(function(pair){var fail=false;for(var i=0;i<pair.value.length&&!fail;i++){for(var j=0;j<attributes.length&&!fail;j++){if(pair.value[i].attribute_id==attributes[j].attribute_id&&pair.value[i].value_index!=attributes[j].value_index){fail=true;}}}
170
- if(!fail){result=false;}});return result;},updateGrid:function(){this.grid.reloadParams={'products[]':this.links.keys().size()?this.links.keys():[0],'new_products[]':this.newProducts};},updateValues:function(){var uniqueAttributeValues=$H({});this.links.each(function(pair){for(var i=0,length=pair.value.length;i<length;i++){var attribute=pair.value[i];if(uniqueAttributeValues.keys().indexOf(attribute.attribute_id)==-1){uniqueAttributeValues.set(attribute.attribute_id,$H({}));}
171
- uniqueAttributeValues.get(attribute.attribute_id).set(attribute.value_index,attribute);}});this.container.childElements().each(function(row){var attribute=row.attributeObject;for(var i=0,length=attribute.values.length;i<length;i++){if(uniqueAttributeValues.keys().indexOf(attribute.attribute_id)==-1||uniqueAttributeValues.get(attribute.attribute_id).keys().indexOf(attribute.values[i].value_index)==-1){row.attributeValues.childElements().each(function(elem){if(elem.valueObject.value_index==attribute.values[i].value_index){elem.remove();}});attribute.values[i]=undefined;}else{uniqueAttributeValues.get(attribute.attribute_id).unset(attribute.values[i].value_index);}}
172
- attribute.values=attribute.values.compact();if(uniqueAttributeValues.get(attribute.attribute_id)){uniqueAttributeValues.get(attribute.attribute_id).each(function(pair){attribute.values.push(pair.value);this.createValueRow(row,pair.value);}.bind(this));}}.bind(this));this.updateSaveInput();this.updateSimpleForm();},createValueRow:function(container,value){var templateVariables=$H({});if(!this.valueAutoIndex){this.valueAutoIndex=1;}
173
- templateVariables.set('html_id',container.id+'_'
174
- +this.valueAutoIndex);templateVariables.update(value);var pricingValue=parseFloat(templateVariables.get('pricing_value'));if(!isNaN(pricingValue)){templateVariables.set('pricing_value',pricingValue);}else{templateVariables.unset('pricing_value');}
175
- this.valueAutoIndex++;var li=$(document.createElement('LI'));li.className='attribute-value';li.id=templateVariables.get('html_id');li.update(this.addValueTemplate.evaluate(templateVariables));li.valueObject=value;if(typeof li.valueObject.is_percent=='undefined'){li.valueObject.is_percent=0;}
176
- if(typeof li.valueObject.pricing_value=='undefined'){li.valueObject.pricing_value='';}
177
- container.attributeValues.appendChild(li);var priceField=li.down('.attribute-price');var priceTypeField=li.down('.attribute-price-type');if(parseInt(value.is_percent)){priceTypeField.options[1].selected=!(priceTypeField.options[0].selected=false);}else{priceTypeField.options[1].selected=!(priceTypeField.options[0].selected=true);}
178
- Event.observe(priceField,'keyup',this.onValuePriceUpdate);Event.observe(priceField,'change',this.onValuePriceUpdate);Event.observe(priceTypeField,'change',this.onValueTypeUpdate);var useDefaultEl=li.down('.attribute-use-default-value');if(useDefaultEl){if(li.valueObject.use_default_value){useDefaultEl.checked=true;this.updateUseDefaultRow(useDefaultEl,li);}
179
- Event.observe(useDefaultEl,'change',this.onValueDefaultUpdate);}},updateValuePrice:function(event){var li=Event.findElement(event,'LI');li.valueObject.pricing_value=(Event.element(event).value.blank()?null:Event.element(event).value);this.updateSimpleForm();this.updateSaveInput();},updateValueType:function(event){var li=Event.findElement(event,'LI');li.valueObject.is_percent=(Event.element(event).value.blank()?null:Event.element(event).value);this.updateSimpleForm();this.updateSaveInput();},updateValueUseDefault:function(event){var li=Event.findElement(event,'LI');var useDefaultEl=Event.element(event);li.valueObject.use_default_value=useDefaultEl.checked;this.updateUseDefaultRow(useDefaultEl,li);},updateUseDefaultRow:function(useDefaultEl,li){var priceField=li.down('.attribute-price');var priceTypeField=li.down('.attribute-price-type');if(useDefaultEl.checked){priceField.disabled=true;priceTypeField.disabled=true;}else{priceField.disabled=false;priceTypeField.disabled=false;}
180
- this.updateSimpleForm();this.updateSaveInput();},updateSaveInput:function(){$(this.idPrefix+'save_attributes').value=this.attributes.toJSON();$(this.idPrefix+'save_links').value=this.links.toJSON();},initializeAdvicesForSimpleForm:function(){if($(this.idPrefix+'simple_form').advicesInited){return;}
181
- $(this.idPrefix+'simple_form').select('td.value').each(function(td){var adviceContainer=$(Builder.node('div'));td.appendChild(adviceContainer);td.select('input','select').each(function(element){element.advaiceContainer=adviceContainer;});});$(this.idPrefix+'simple_form').advicesInited=true;},quickCreateNewProduct:function(){this.initializeAdvicesForSimpleForm();$(this.idPrefix+'simple_form').removeClassName('ignore-validate');var validationResult=$(this.idPrefix+'simple_form').select('input','select','textarea').collect(function(elm){return Validation.validate(elm,{useTitle:false,onElementValidate:function(){}});}).all();$(this.idPrefix+'simple_form').addClassName('ignore-validate');if(!validationResult){return;}
182
- var params=Form.serializeElements($(this.idPrefix+'simple_form').select('input','select','textarea'),true);params.form_key=FORM_KEY;$('messages').update();new Ajax.Request(this.createQuickUrl,{parameters:params,method:'post',area:$(this.idPrefix+'simple_form'),onComplete:this.quickCreateNewProductComplete.bind(this)});},quickCreateNewProductComplete:function(transport){var result=transport.responseText.evalJSON();if(result.error){if(result.error.fields){$(this.idPrefix+'simple_form').removeClassName('ignore-validate');$H(result.error.fields).each(function(pair){$('simple_product_'+pair.key).value=pair.value;$('simple_product_'+pair.key+'_autogenerate').checked=false;toggleValueElements($('simple_product_'+pair.key+'_autogenerate'),$('simple_product_'+pair.key+'_autogenerate').parentNode);Validation.ajaxError($('simple_product_'+pair.key),result.error.message);});$(this.idPrefix+'simple_form').addClassName('ignore-validate');}else{if(result.error.message){alert(result.error.message);}else{alert(result.error);}}
183
- return;}else if(result.messages){$('messages').update(result.messages);}
184
- result.attributes.each(function(attribute){var attr=this.getAttributeById(attribute.attribute_id);if(!this.getValueByIndex(attr,attribute.value_index)&&result.pricing&&result.pricing[attr.attribute_code]){attribute.is_percent=result.pricing[attr.attribute_code].is_percent;attribute.pricing_value=(result.pricing[attr.attribute_code].value==null?'':result.pricing[attr.attribute_code].value);}}.bind(this));this.attributes.each(function(attribute){if($('simple_product_'+attribute.attribute_code)){$('simple_product_'+attribute.attribute_code).value='';}}.bind(this));this.links.set(result.product_id,result.attributes);this.updateGrid();this.updateValues();this.grid.reload();},checkCreationUniqueAttributes:function(){var attributes=[];this.attributes.each(function(attribute){attributes.push({attribute_id:attribute.attribute_id,value_index:$('simple_product_'+attribute.attribute_code).value});}.bind(this));return this.checkAttributes(attributes);},getAttributeByCode:function(attributeCode){var attribute=null;this.attributes.each(function(item){if(item.attribute_code==attributeCode){attribute=item;throw $break;}});return attribute;},getAttributeById:function(attributeId){var attribute=null;this.attributes.each(function(item){if(item.attribute_id==attributeId){attribute=item;throw $break;}});return attribute;},getValueByIndex:function(attribute,valueIndex){var result=null;attribute.values.each(function(value){if(value.value_index==valueIndex){result=value;throw $break;}});return result;},showPricing:function(select,attributeCode){var attribute=this.getAttributeByCode(attributeCode);if(!attribute){return;}
185
- select=$(select);if(select.value&&!$('simple_product_'+attributeCode+'_pricing_container')){Element.insert(select,{after:'<div class="left"></div> <div id="simple_product_'+attributeCode+'_pricing_container" class="left"></div>'});var newContainer=select.next('div');select.parentNode.removeChild(select);newContainer.appendChild(select);$(this.idPrefix+'simple_form').down('.form-list').style.width='100%';}
186
- var container=$('simple_product_'+attributeCode+'_pricing_container');if(select.value){var value=this.getValueByIndex(attribute,select.value);if(!value){if(!container.down('.attribute-price')){if(value==null){value={};}
187
- container.update(this.pricingValueTemplate.evaluate(value));var priceValueField=container.down('.attribute-price');var priceTypeField=container.down('.attribute-price-type');priceValueField.attributeCode=attributeCode;priceValueField.priceField=priceValueField;priceValueField.typeField=priceTypeField;priceTypeField.attributeCode=attributeCode;priceTypeField.priceField=priceValueField;priceTypeField.typeField=priceTypeField;Event.observe(priceValueField,'change',this.updateSimplePricing.bindAsEventListener(this));Event.observe(priceValueField,'keyup',this.updateSimplePricing.bindAsEventListener(this));Event.observe(priceTypeField,'change',this.updateSimplePricing.bindAsEventListener(this));$('simple_product_'+attributeCode+'_pricing_value').value=null;$('simple_product_'+attributeCode+'_pricing_type').value=null;}}else if(!isNaN(parseFloat(value.pricing_value))){container.update(this.pricingValueViewTemplate.evaluate({'value':(parseFloat(value.pricing_value)>0?'+':'')
188
- +parseFloat(value.pricing_value)
189
- +(parseInt(value.is_percent)>0?'%':'')}));$('simple_product_'+attributeCode+'_pricing_value').value=value.pricing_value;$('simple_product_'+attributeCode+'_pricing_type').value=value.is_percent;}else{container.update('');$('simple_product_'+attributeCode+'_pricing_value').value=null;$('simple_product_'+attributeCode+'_pricing_type').value=null;}}else if(container){container.update('');$('simple_product_'+attributeCode+'_pricing_value').value=null;$('simple_product_'+attributeCode+'_pricing_type').value=null;}},updateSimplePricing:function(evt){var element=Event.element(evt);if(!element.priceField.value.blank()){$('simple_product_'+element.attributeCode+'_pricing_value').value=element.priceField.value;$('simple_product_'+element.attributeCode+'_pricing_type').value=element.typeField.value;}else{$('simple_product_'+element.attributeCode+'_pricing_value').value=null;$('simple_product_'+element.attributeCode+'_pricing_type').value=null;}},updateSimpleForm:function(){this.attributes.each(function(attribute){if($('simple_product_'+attribute.attribute_code)){this.showPricing($('simple_product_'+attribute.attribute_code),attribute.attribute_code);}}.bind(this));},showNoticeMessage:function(){$('assign_product_warrning').show();}}
190
- var onInitDisableFieldsList=[];function toogleFieldEditMode(toogleIdentifier,fieldContainer){if($(toogleIdentifier).checked){enableFieldEditMode(fieldContainer);}else{disableFieldEditMode(fieldContainer);}}
191
- function disableFieldEditMode(fieldContainer){$(fieldContainer).disabled=true;if($(fieldContainer+'_hidden')){$(fieldContainer+'_hidden').disabled=true;}}
192
- function enableFieldEditMode(fieldContainer){$(fieldContainer).disabled=false;if($(fieldContainer+'_hidden')){$(fieldContainer+'_hidden').disabled=false;}}
193
- function initDisableFields(fieldContainer){onInitDisableFieldsList.push(fieldContainer);}
194
- function onCompleteDisableInited(){onInitDisableFieldsList.each(function(item){disableFieldEditMode(item);});}
195
- Event.observe(window,'load',onCompleteDisableInited);;Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")
196
- Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}
197
- Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")
198
- Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}
199
- Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.is_gecko=navigator.userAgent.match(/gecko/i);Calendar.getStyle=function(element,style){if(element.currentStyle){var y=element.currentStyle[style];}else if(window.getComputedStyle){var y=document.defaultView.getComputedStyle(element,null).getPropertyValue(style);}
200
- return y;};Calendar.getAbsolutePos=function(element){var res=new Object();res.x=0;res.y=0;do{res.x+=element.offsetLeft||0;res.y+=element.offsetTop||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Calendar.getStyle(element,'position');if(p!=='static')break;}}while(element);return res;if(element!==null){res.x=element.offsetLeft;res.y=element.offsetTop;var offsetParent=element.offsetParent;var parentNode=element.parentNode;while(offsetParent!==null){res.x+=offsetParent.offsetLeft;res.y+=offsetParent.offsetTop;if(offsetParent!=document.body&&offsetParent!=document.documentElement){res.x-=offsetParent.scrollLeft;res.y-=offsetParent.scrollTop;}
201
- if(Calendar.is_gecko){while(offsetParent!=parentNode&&parentNode!==null){res.x-=parentNode.scrollLeft;res.y-=parentNode.scrollTop;parentNode=parentNode.parentNode;}}
202
- parentNode=offsetParent.parentNode;offsetParent=offsetParent.offsetParent;}}
203
- return res;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}
204
- while(related){if(related==el){return true;}
205
- related=related.parentNode;}
206
- return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}
207
- var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}
208
- el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))
209
- f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)
210
- f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}
211
- return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}
212
- if(typeof parent!="undefined"){parent.appendChild(el);}
213
- return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}
214
- return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}
215
- return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}
216
- var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
217
- if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}
218
- var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)
219
- s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")
220
- mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}
221
- s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}
222
- var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}
223
- if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}
224
- cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}
225
- yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}
226
- if(show){var s=yc.style;s.display="block";if(cd.navtype<0)
227
- s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")
228
- ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}
229
- s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}
230
- if(cal.timeout){clearTimeout(cal.timeout);}
231
- var el=cal.activeDiv;if(!el){return false;}
232
- var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}
233
- var mon=Calendar.findMonth(target);var date=null;if(mon){date=new CalendarDateObject(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new CalendarDateObject(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}
234
- with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}
235
- var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))
236
- Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}
237
- ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else
238
- dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)
239
- if(range[i]==current)
240
- break;while(count-->0)
241
- if(decrease){if(--i<0)
242
- i=range.length-1;}else if(++i>=range.length)
243
- i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}
244
- var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
245
- Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
246
- var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}
247
- Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}
248
- return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}
249
- var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}
250
- cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}
251
- cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}
252
- cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}
253
- var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else
254
- addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}
255
- if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}
256
- return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}
257
- if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}
258
- el.calendar.tooltips.innerHTML=el.ttip;}
259
- if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}
260
- return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)
261
- return false;removeClass(el,"hilite");if(el.caldate)
262
- removeClass(el.parentNode,"rowhilite");if(el.calendar)
263
- el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}
264
- cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)
265
- cal._toggleMultipleDate(new CalendarDateObject(date));else
266
- newdate=!el.disabled;if(other_month)
267
- cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}
268
- date=new CalendarDateObject(cal.date);if(el.navtype==0)
269
- date.setDateOnly(new CalendarDateObject());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}
270
- date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}
271
- alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}
272
- break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}
273
- break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}
274
- break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}
275
- break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)
276
- if(range[i]==current)
277
- break;if(ev&&ev.shiftKey){if(--i<0)
278
- i=range.length-1;}else if(++i>=range.length)
279
- i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}
280
- break;}
281
- if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)
282
- newdate=closing=true;}
283
- if(newdate){ev&&cal.callHandler();}
284
- if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}
285
- this.date=this.dateStr?new CalendarDateObject(this.dateStr):new CalendarDateObject();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}
286
- div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)
287
- cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("&#x00d7;",1,200).ttip=Calendar._TT["CLOSE"];}
288
- row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}
289
- for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}
290
- this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}
291
- for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}
292
- if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||"&nbsp;";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")
293
- part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}
294
- Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)
295
- AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else
296
- cell.innerHTML="&nbsp;";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}
297
- H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)
298
- h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)
299
- h=0;}
300
- var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}
301
- var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}
302
- this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}
303
- div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}
304
- this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)
305
- return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new CalendarDateObject(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new CalendarDateObject(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)
306
- ne=cal.ar_days[y][x];else{x=6;K=38;continue;}
307
- break;case 38:if(--y>=0)
308
- ne=cal.ar_days[y][x];else{prevMonth();setVars();}
309
- break;case 39:if(++x<7)
310
- ne=cal.ar_days[y][x];else{x=0;K=40;continue;}
311
- break;case 40:if(++y<cal.ar_days.length)
312
- ne=cal.ar_days[y][x];else{nextMonth();setVars();}
313
- break;}
314
- break;}
315
- if(ne){if(!ne.disabled)
316
- Calendar.cellClick(ne);else if(prev)
317
- prevMonth();else
318
- nextMonth();}}
319
- break;case 13:if(act)
320
- Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}
321
- return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new CalendarDateObject(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}
322
- this.firstDayOfWeek=firstDayOfWeek;this.date=new CalendarDateObject(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)
323
- day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}
324
- row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML="&nbsp;";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}
325
- cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)
326
- dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)
327
- cell.title=toolTip;}
328
- if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))
329
- cell.disabled=true;cell.className+=" "+status;}}
330
- if(!cell.disabled){cell.caldate=new CalendarDateObject(date);cell.ttip="_";if(!this.multiple&&current_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}
331
- if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}
332
- if(weekend.indexOf(wday.toString())!=-1)
333
- cell.className+=cell.otherMonth?" oweekend":" weekend";}}
334
- if(!(hasdays||this.showsOtherMonths))
335
- row.className="emptyrow";}
336
- this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)
337
- continue;if(cell)
338
- cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}
339
- this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}
340
- var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}
341
- this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}
342
- this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}
343
- this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}
344
- function fixPosition(box){if(box.x<0)
345
- box.x=0;if(box.y<0)
346
- box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}
347
- var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}
348
- switch(valign){case"T":p.y-=h;break;case"B":p.y+=el.offsetHeight;break;case"C":p.y+=(el.offsetHeight-h)/2;break;case"t":p.y+=el.offsetHeight-h;break;case"b":break;}
349
- switch(halign){case"L":p.x-=w;break;case"R":p.x+=el.offsetWidth;break;case"C":p.x+=(el.offsetWidth-w)/2;break;case"l":p.x+=el.offsetWidth-w;break;case"r":break;}
350
- p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)
351
- setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else
352
- Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)
353
- fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)
354
- return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)
355
- value=document.defaultView.getComputedStyle(obj,"").getPropertyValue("visibility");else
356
- value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else
357
- value='';}
358
- return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}
359
- cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}
360
- cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}
361
- if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}
362
- cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}
363
- this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}
364
- var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new CalendarDateObject();var y=0;var m=-1;var d=0;var a=str;var i;for(i=0;i<Calendar._MN.length;i++){a=a.replace(Calendar._MN[i],enUS.m.wide[i]);}
365
- for(i=0;i<Calendar._SMN.length;i++){a=a.replace(Calendar._SMN[i],enUS.m.abbr[i]);}
366
- a=a.replace(Calendar._am,'am');a=a.replace(Calendar._am.toLowerCase(),'am');a=a.replace(Calendar._pm,'pm');a=a.replace(Calendar._pm.toLowerCase(),'pm');a=a.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])
367
- continue;switch(b[i]){case"%d":case"%e":d=parseInt(a[i],10);break;case"%m":m=parseInt(a[i],10)-1;break;case"%Y":case"%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case"%b":for(j=0;j<12;++j){if(enUS.m.abbr[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}
368
- break;case"%B":for(j=0;j<12;++j){if(enUS.m.wide[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}
369
- break;case"%H":case"%I":case"%k":case"%l":hr=parseInt(a[i],10);break;case"%P":case"%p":if(/pm/i.test(a[i])&&hr<12)
370
- hr+=12;else if(/am/i.test(a[i])&&hr>=12)
371
- hr-=12;break;case"%M":min=parseInt(a[i],10);break;}}
372
- if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)
373
- return new CalendarDateObject(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}
374
- if(t!=-1){if(m!=-1){d=m+1;}
375
- m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}
376
- if(y==0)
377
- y=today.getFullYear();if(m!=-1&&d!=0)
378
- return new CalendarDateObject(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}
379
- if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new CalendarDateObject(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new CalendarDateObject(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new CalendarDateObject(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new CalendarDateObject(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)
380
- ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?Calendar._pm.toUpperCase():Calendar._am.toUpperCase();s["%P"]=pm?Calendar._pm.toLowerCase():Calendar._am.toLowerCase();s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)
381
- return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}
382
- return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new CalendarDateObject(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())
383
- this.setDate(28);this.__msh_oldSetFullYear(y);};CalendarDateObject.prototype=new Date();CalendarDateObject.prototype.constructor=CalendarDateObject;CalendarDateObject.prototype.parent=Date.prototype;function CalendarDateObject(){var dateObj;if(arguments.length>1){dateObj=eval("new this.parent.constructor("+Array.prototype.slice.call(arguments).join(",")+");");}else if(arguments.length>0){dateObj=new this.parent.constructor(arguments[0]);}else{dateObj=new this.parent.constructor();if(typeof(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS)!="undefined"){dateObj.setTime(dateObj.getTime()+(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS-dateObj.getTimezoneOffset())*1000);}}
384
- return dateObj;}
385
- window._dynarch_popupCalendar=null;;Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
var/minifycache/minify_1b6ee19a4c3855472c3e3dd57413cb65.gz DELETED
Binary file
var/minifycache/minify_268acb4da1a243c2c1434894bf7e5841 DELETED
@@ -1,209 +0,0 @@
1
- var widgetTools={getDivHtml:function(id,html){if(!html)html='';return'<div id="'+id+'">'+html+'</div>';},onAjaxSuccess:function(transport){if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
2
- if(response.error){throw response;}else if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}},openDialog:function(widgetUrl){if($('widget_window')&&typeof(Windows)!='undefined'){Windows.focus('widget_window');return;}
3
- this.dialogWindow=Dialog.info(null,{draggable:true,resizable:false,closable:true,className:'magento',title:'Insert widget...',top:50,width:950,height:800,zIndex:1000,recenterAuto:false,hideEffect:Element.hide,showEffect:Element.show,id:'widget_window',onClose:this.closeDialog.bind(this)});new Ajax.Updater('modal_dialog_message',widgetUrl,{evalScripts:true});},closeDialog:function(window){if(!window){window=this.dialogWindow;}
4
- if(window){WindowUtilities._showSelect();window.close();}}}
5
- var WysiwygWidget={};WysiwygWidget.Widget=Class.create();WysiwygWidget.Widget.prototype={initialize:function(formEl,widgetEl,widgetOptionsEl,optionsSourceUrl,widgetTargetId){$(formEl).insert({bottom:widgetTools.getDivHtml(widgetOptionsEl)});this.formEl=formEl;this.widgetEl=$(widgetEl);this.widgetOptionsEl=$(widgetOptionsEl);this.optionsUrl=optionsSourceUrl;this.optionValues=new Hash({});this.widgetTargetId=widgetTargetId;Event.observe(this.widgetEl,"change",this.loadOptions.bind(this));this.initOptionValues();},getOptionsContainerId:function(){return this.widgetOptionsEl.id+'_'+this.widgetEl.value.gsub(/\//,'_');},switchOptionsContainer:function(containerId){$$('#'+this.widgetOptionsEl.id+' div[id^='+this.widgetOptionsEl.id+']').each(function(e){this.disableOptionsContainer(e.id);}.bind(this));if(containerId!=undefined){this.enableOptionsContainer(containerId);}
6
- this._showWidgetDescription();},enableOptionsContainer:function(containerId){$$('#'+containerId+' .widget-option').each(function(e){e.removeClassName('skip-submit');if(e.hasClassName('obligatory')){e.removeClassName('obligatory');e.addClassName('required-entry');}});$(containerId).removeClassName('no-display');},disableOptionsContainer:function(containerId){if($(containerId).hasClassName('no-display')){return;}
7
- $$('#'+containerId+' .widget-option').each(function(e){if(!e.hasClassName('skip-submit')){e.addClassName('skip-submit');}
8
- if(e.hasClassName('required-entry')){e.removeClassName('required-entry');e.addClassName('obligatory');}});$(containerId).addClassName('no-display');},initOptionValues:function(){if(!this.wysiwygExists()){return false;}
9
- var e=this.getWysiwygNode();if(e!=undefined&&e.id){var widgetCode=Base64.idDecode(e.id);if(widgetCode.indexOf('{{widget')!=-1){this.optionValues=new Hash({});widgetCode.gsub(/([a-z0-9\_]+)\s*\=\s*[\"]{1}([^\"]+)[\"]{1}/i,function(match){if(match[1]=='type'){this.widgetEl.value=match[2];}else{this.optionValues.set(match[1],match[2]);}}.bind(this));this.loadOptions();}}},loadOptions:function(){if(!this.widgetEl.value){this.switchOptionsContainer();return;}
10
- var optionsContainerId=this.getOptionsContainerId();if($(optionsContainerId)!=undefined){this.switchOptionsContainer(optionsContainerId);return;}
11
- this._showWidgetDescription();var params={widget_type:this.widgetEl.value,values:this.optionValues};new Ajax.Request(this.optionsUrl,{parameters:{widget:Object.toJSON(params)},onSuccess:function(transport){try{widgetTools.onAjaxSuccess(transport);this.switchOptionsContainer();if($(optionsContainerId)==undefined){this.widgetOptionsEl.insert({bottom:widgetTools.getDivHtml(optionsContainerId,transport.responseText)});}else{this.switchOptionsContainer(optionsContainerId);}}catch(e){alert(e.message);}}.bind(this)});},_showWidgetDescription:function(){var noteCnt=this.widgetEl.next().down('small');var descrCnt=$('widget-description-'+this.widgetEl.selectedIndex);if(noteCnt!=undefined){var description=(descrCnt!=undefined?descrCnt.innerHTML:'');noteCnt.update(descrCnt.innerHTML);}},insertWidget:function(){widgetOptionsForm=new varienForm(this.formEl);if(widgetOptionsForm.validator&&widgetOptionsForm.validator.validate()||!widgetOptionsForm.validator){var formElements=[];var i=0;Form.getElements($(this.formEl)).each(function(e){if(!e.hasClassName('skip-submit')){formElements[i]=e;i++;}});var params=Form.serializeElements(formElements);if(!this.wysiwygExists()){params=params+'&as_is=1';}
12
- new Ajax.Request($(this.formEl).action,{parameters:params,onComplete:function(transport){try{widgetTools.onAjaxSuccess(transport);Windows.close("widget_window");this.updateContent(transport.responseText);}catch(e){alert(e.message);}}.bind(this)});}},updateContent:function(content){if(this.wysiwygExists()){this.getWysiwyg().execCommand("mceInsertContent",false,content);}else{var textarea=document.getElementById(this.widgetTargetId);updateElementAtCursor(textarea,content);varienGlobalEvents.fireEvent('tinymceChange');}},wysiwygExists:function(){return(typeof tinyMCE!='undefined')&&tinyMCE.get(this.widgetTargetId);},getWysiwyg:function(){return tinyMCE.activeEditor;},getWysiwygNode:function(){return tinyMCE.activeEditor.selection.getNode();}}
13
- WysiwygWidget.chooser=Class.create();WysiwygWidget.chooser.prototype={chooserId:null,chooserUrl:null,config:null,dialogWindow:null,dialogContent:null,overlayShowEffectOptions:null,overlayHideEffectOptions:null,initialize:function(chooserId,chooserUrl,config){this.chooserId=chooserId;this.chooserUrl=chooserUrl;this.config=config;},getResponseContainerId:function(){return'responseCnt'+this.chooserId;},getChooserControl:function(){return $(this.chooserId+'control');},getElement:function(){return $(this.chooserId+'value');},getElementLabel:function(){return $(this.chooserId+'label');},open:function(){$(this.getResponseContainerId()).show();},close:function(){$(this.getResponseContainerId()).hide();this.closeDialogWindow();},choose:function(event){if(this.dialogContent){this.openDialogWindow(this.dialogContent);return;}
14
- var responseContainerId=this.getResponseContainerId();new Ajax.Request(this.chooserUrl,{parameters:{element_value:this.getElementValue(),element_label:this.getElementLabelText()},onSuccess:function(transport){try{widgetTools.onAjaxSuccess(transport);this.dialogContent=widgetTools.getDivHtml(responseContainerId,transport.responseText);this.openDialogWindow(this.dialogContent);}catch(e){alert(e.message);}}.bind(this)});},openDialogWindow:function(content){this.overlayShowEffectOptions=Windows.overlayShowEffectOptions;this.overlayHideEffectOptions=Windows.overlayHideEffectOptions;Windows.overlayShowEffectOptions={duration:0};Windows.overlayHideEffectOptions={duration:0};this.dialogWindow=Dialog.info(content,{draggable:true,resizable:true,closable:true,className:"magento",title:this.config.buttons.open,width:700,height:500,zIndex:1000,recenterAuto:false,hideEffect:Element.hide,showEffect:Element.show,id:"widget-chooser",onClose:this.closeDialogWindow.bind(this)});content.evalScripts.bind(content).defer();},closeDialogWindow:function(dialogWindow){if(!dialogWindow){dialogWindow=this.dialogWindow;}
15
- if(dialogWindow){dialogWindow.close();Windows.overlayShowEffectOptions=this.overlayShowEffectOptions;Windows.overlayHideEffectOptions=this.overlayHideEffectOptions;}
16
- this.dialogWindow=null;},getElementValue:function(value){return this.getElement().value;},getElementLabelText:function(value){return this.getElementLabel().innerHTML;},setElementValue:function(value){this.getElement().value=value;},setElementLabel:function(value){this.getElementLabel().innerHTML=value;}};Flex={};Flex.currentID=0;Flex.uniqId=function(){return'flexMovieUID'+(++Flex.currentID);};Flex.checkFlashPlayerVersion=function(major,minor,revision){var version=Flex.getFlashPlayerVersion();if(version===false){return false;}
17
- var requestedVersion=Flex.transformVersionToFloat([major,minor,revision],5);var currentVersion=Flex.transformVersionToFloat(version,5);return requestedVersion<=currentVersion;};Flex._getFlashPlayerVersionAsActiveX=function(){var versions=[{'default':'7.0.0','code':'ShockwaveFlash.ShockwaveFlash.7','variable':true},{'default':'6.0.0','code':'ShockwaveFlash.ShockwaveFlash.6','variable':true,'acceess':true},{'default':'3.0.0','code':'ShockwaveFlash.ShockwaveFlash.3','variable':false},{'default':'2.0.0','code':'ShockwaveFlash.ShockwaveFlash','variable':false},];var detector=function(options){var activeXObject=new ActiveXObject(options.code);if(options.access&&options.variable){activeXObject.AllowScriptAccess='always';}
18
- if(options.variable){return activeXObject.GetVariable('$version');}
19
- return options['default'];}
20
- var version=false;for(var i=0,l=versions.length;i<l;i++){try{version=detector(versions[i]);return version;}catch(e){}}
21
- return false;};Flex.transformVersionToArray=function(version){if(!Object.isString(version)){return false;}
22
- var versions=version.match(/[\d]+/g);if(versions.length>3){return versions.slice(0,3);}else if(versions.length){return versions;}
23
- return false;};Flex.transformVersionToFloat=function(version,range){if(Object.isString(version)){version=Flex.transformVersionToArray(version)}
24
- if(Object.isArray(version)){var result=0;for(var i=0,l=version.length;i<l;i++){result+=parseFloat(version[i])/Math.pow(10,range*i);}
25
- return result;}
26
- return false;};Flex.getFlashPlayerVersion=function(){if(Flex.flashPlayerVersion){return Flex.flashPlayerVersion;}
27
- var version=false;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.mimeTypes&&navigator.mimeTypes.length>0){if(navigator.mimeTypes['application/x-shockwave-flash']&&!navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin){return false;}}
28
- var flashPlugin=navigator.plugins['Shockwave Flash']||navigator.plugins['Shockwave Flash 2.0'];version=Flex.transformVersionToArray(flashPlugin.description);}else{version=Flex.transformVersionToArray(Flex._getFlashPlayerVersionAsActiveX());}
29
- Flex.flashPlayerVersion=version;return version;};Flex.Object=Class.create({initialize:function(config){this.isIE=Prototype.Browser.IE;this.isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;this.attributes={quality:"high",pluginspage:"http://www.adobe.com/go/getflashplayer",type:"application/x-shockwave-flash",allowScriptAccess:"always",classid:"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"};this.bridgeName='';this.bridge=false;this.setAttributes(config);this.applied=false;var myTemplatesPattern=/(^|.|\r|\n)(\{(.*?)\})/;if(this.detectFlashVersion(9,0,28)){if(this.isIE){this.template=new Template('<object {objectAttributes}><param name="allowFullScreen" value="true"/>{objectParameters}</object>',myTemplatesPattern)}else{this.template=new Template('<embed {embedAttributes} allowfullscreen="true" />',myTemplatesPattern);}}else{this.template=new Template('This content requires the Adobe Flash Player. '
30
- +' <a href=http://www.adobe.com/go/getflash/>Get Flash</a>',myTemplatesPattern);}
31
- this.parametersTemplate=new Template('<param name="{name}" value="{value}" />',myTemplatesPattern);this.attributesTemplate=new Template(' {name}="{value}" ',myTemplatesPattern);},setAttribute:function(name,value){if(!this.applied){this.attributes[name]=value;}},getAttribute:function(name){return this.attributes[name];},setAttributes:function(attributesList){$H(attributesList).each(function(pair){this.setAttribute(pair.key,pair.value);}.bind(this));},getAttributes:function(){return this.attributes;},apply:function(container){if(!this.applied){this.setAttribute("id",Flex.uniqId());this.preInitBridge();var readyHTML=this.template.evaluate(this.generateTemplateValues());$(container).update(readyHTML);}
32
- this.applied=true;},applyWrite:function(){if(!this.applied){this.setAttribute("id",Flex.uniqId());this.preInitBridge();var readyHTML=this.template.evaluate(this.generateTemplateValues());document.write(readyHTML);}
33
- this.applied=true;},preInitBridge:function(){this.bridgeName=this.getAttribute('id')+'bridge';var flashVars=this.getAttribute('flashVars')||this.getAttribute('flashvars')||'';if(flashVars!=''){flashVars+='&';}
34
- flashVars+='bridgeName='+this.bridgeName;this.setAttribute('flashVars',flashVars);var scopeObj=this;FABridge.addInitializationCallback(this.bridgeName,function(){scopeObj.bridge=this.root();scopeObj.initBridge();});},initBridge:function(){if(this.onBridgeInit){this.onBridgeInit(this.getBridge());}},getBridge:function(){return this.bridge;},generateTemplateValues:function(){var attributesMap={embed:{'movie':'src','id':'name','flashvars':'flashVars','classid':false,'codebase':false},object:{'pluginspage':false,'src':'movie','flashvars':'flashVars','type':false,'inline':['type','classid','codebase','id','width','height','align','vspace','hspace','class','title','accesskey','name','tabindex']}};var embedAttributes={};var objectAttributes={};var parameters={};$H(this.attributes).each(function(pair){var attributeName=pair.key.toLowerCase();this.attributes[pair.key]=this.escapeAttributes(pair.value);var attributeNameInObject=(attributesMap.object[attributeName]?attributesMap.object[attributeName]:attributeName);var attributeNameInEmbed=(attributesMap.embed[attributeName]?attributesMap.embed[attributeName]:attributeName);if(attributesMap.object[attributeName]!==false){if(attributesMap.object.inline.indexOf(attributeNameInObject)!==-1){objectAttributes[attributeNameInObject]=this.attributes[pair.key];}else{parameters[attributeNameInObject]=this.attributes[pair.key];}}
35
- if(attributesMap.embed[attributeName]!==false){embedAttributes[attributeNameInEmbed]=this.attributes[pair.key];}}.bind(this));var result={objectAttributes:'',objectParameters:'',embedAttributes:''};$H(objectAttributes).each(function(pair){result.objectAttributes+=this.attributesTemplate.evaluate({name:pair.key,value:pair.value});}.bind(this));$H(embedAttributes).each(function(pair){result.embedAttributes+=this.attributesTemplate.evaluate({name:pair.key,value:pair.value});}.bind(this));$H(parameters).each(function(pair){result.objectParameters+=this.parametersTemplate.evaluate({name:pair.key,value:pair.value});}.bind(this));return result;},escapeAttributes:function(value){if(typeof value=='string'){return value.escapeHTML();}else{return value;}},detectFlashVersion:function(major,minor,revision){return Flex.checkFlashPlayerVersion(major,minor,revision);}});;function FABridge(target,bridgeName)
36
- {this.target=target;this.remoteTypeCache={};this.remoteInstanceCache={};this.remoteFunctionCache={};this.localFunctionCache={};this.bridgeID=FABridge.nextBridgeID++;this.name=bridgeName;this.nextLocalFuncID=0;FABridge.instances[this.name]=this;FABridge.idMap[this.bridgeID]=this;return this;}
37
- FABridge.TYPE_ASINSTANCE=1;FABridge.TYPE_ASFUNCTION=2;FABridge.TYPE_JSFUNCTION=3;FABridge.TYPE_ANONYMOUS=4;FABridge.initCallbacks={};FABridge.userTypes={};FABridge.addToUserTypes=function()
38
- {for(var i=0;i<arguments.length;i++)
39
- {FABridge.userTypes[arguments[i]]={'typeName':arguments[i],'enriched':false};}}
40
- FABridge.argsToArray=function(args)
41
- {var result=[];for(var i=0;i<args.length;i++)
42
- {result[i]=args[i];}
43
- return result;}
44
- function instanceFactory(objID)
45
- {this.fb_instance_id=objID;return this;}
46
- function FABridge__invokeJSFunction(args)
47
- {var funcID=args[0];var throughArgs=args.concat();throughArgs.shift();var bridge=FABridge.extractBridgeFromID(funcID);return bridge.invokeLocalFunction(funcID,throughArgs);}
48
- FABridge.addInitializationCallback=function(bridgeName,callback)
49
- {var inst=FABridge.instances[bridgeName];if(inst!=undefined)
50
- {callback.call(inst);return;}
51
- var callbackList=FABridge.initCallbacks[bridgeName];if(callbackList==null)
52
- {FABridge.initCallbacks[bridgeName]=callbackList=[];}
53
- callbackList.push(callback);}
54
- function FABridge__bridgeInitialized(bridgeName){var objects=document.getElementsByTagName("object");var ol=objects.length;var activeObjects=[];if(ol>0){for(var i=0;i<ol;i++){if(typeof objects[i].SetVariable!="undefined"){activeObjects[activeObjects.length]=objects[i];}}}
55
- var embeds=document.getElementsByTagName("embed");var el=embeds.length;var activeEmbeds=[];if(el>0){for(var j=0;j<el;j++){if(typeof embeds[j].SetVariable!="undefined"){activeEmbeds[activeEmbeds.length]=embeds[j];}}}
56
- var aol=activeObjects.length;var ael=activeEmbeds.length;var searchStr="bridgeName="+bridgeName;if((aol==1&&!ael)||(aol==1&&ael==1)){FABridge.attachBridge(activeObjects[0],bridgeName);}
57
- else if(ael==1&&!aol){FABridge.attachBridge(activeEmbeds[0],bridgeName);}
58
- else{var flash_found=false;if(aol>1){for(var k=0;k<aol;k++){var params=activeObjects[k].childNodes;for(var l=0;l<params.length;l++){var param=params[l];if(param.nodeType==1&&param.tagName.toLowerCase()=="param"&&param["name"].toLowerCase()=="flashvars"&&param["value"].indexOf(searchStr)>=0){FABridge.attachBridge(activeObjects[k],bridgeName);flash_found=true;break;}}
59
- if(flash_found){break;}}}
60
- if(!flash_found&&ael>1){for(var m=0;m<ael;m++){var flashVars=activeEmbeds[m].attributes.getNamedItem("flashVars").nodeValue;if(flashVars.indexOf(searchStr)>=0){FABridge.attachBridge(activeEmbeds[m],bridgeName);break;}}}}
61
- return true;}
62
- FABridge.nextBridgeID=0;FABridge.instances={};FABridge.idMap={};FABridge.refCount=0;FABridge.extractBridgeFromID=function(id)
63
- {var bridgeID=(id>>16);return FABridge.idMap[bridgeID];}
64
- FABridge.attachBridge=function(instance,bridgeName)
65
- {if(typeof FABridge[bridgeName]=='undefined'){FABridge[bridgeName]=new FABridge(instance,bridgeName);}
66
- var callbacks=FABridge.initCallbacks[bridgeName];if(callbacks==null)
67
- {return;}
68
- for(var i=0;i<callbacks.length;i++)
69
- {callbacks[i].call(FABridge[bridgeName]);}}
70
- FABridge.blockedMethods={toString:true,get:true,set:true,call:true};FABridge.prototype={root:function()
71
- {return this.deserialize(this.target.getRoot());},releaseASObjects:function()
72
- {return this.target.releaseASObjects();},releaseNamedASObject:function(value)
73
- {if(typeof(value)!="object")
74
- {return false;}
75
- else
76
- {var ret=this.target.releaseNamedASObject(value.fb_instance_id);return ret;}},create:function(className)
77
- {return this.deserialize(this.target.create(className));},makeID:function(token)
78
- {return(this.bridgeID<<16)+token;},getPropertyFromAS:function(objRef,propName)
79
- {if(FABridge.refCount>0)
80
- {throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");}
81
- else
82
- {FABridge.refCount++;retVal=this.target.getPropFromAS(objRef,propName);retVal=this.handleError(retVal);FABridge.refCount--;return retVal;}},setPropertyInAS:function(objRef,propName,value)
83
- {if(FABridge.refCount>0)
84
- {throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");}
85
- else
86
- {FABridge.refCount++;retVal=this.target.setPropInAS(objRef,propName,this.serialize(value));retVal=this.handleError(retVal);FABridge.refCount--;return retVal;}},callASFunction:function(funcID,args)
87
- {if(FABridge.refCount>0)
88
- {throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");}
89
- else
90
- {FABridge.refCount++;retVal=this.target.invokeASFunction(funcID,this.serialize(args));retVal=this.handleError(retVal);FABridge.refCount--;return retVal;}},callASMethod:function(objID,funcName,args)
91
- {if(FABridge.refCount>0)
92
- {throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");}
93
- else
94
- {FABridge.refCount++;args=this.serialize(args);retVal=this.target.invokeASMethod(objID,funcName,args);retVal=this.handleError(retVal);FABridge.refCount--;return retVal;}},invokeLocalFunction:function(funcID,args)
95
- {var result;var func=this.localFunctionCache[funcID];if(func!=undefined)
96
- {result=this.serialize(func.apply(null,this.deserialize(args)));}
97
- return result;},getTypeFromName:function(objTypeName)
98
- {return this.remoteTypeCache[objTypeName];},createProxy:function(objID,typeName)
99
- {var objType=this.getTypeFromName(typeName);instanceFactory.prototype=objType;var instance=new instanceFactory(objID);this.remoteInstanceCache[objID]=instance;return instance;},getProxy:function(objID)
100
- {return this.remoteInstanceCache[objID];},addTypeDataToCache:function(typeData)
101
- {newType=new ASProxy(this,typeData.name);var accessors=typeData.accessors;for(var i=0;i<accessors.length;i++)
102
- {this.addPropertyToType(newType,accessors[i]);}
103
- var methods=typeData.methods;for(var i=0;i<methods.length;i++)
104
- {if(FABridge.blockedMethods[methods[i]]==undefined)
105
- {this.addMethodToType(newType,methods[i]);}}
106
- this.remoteTypeCache[newType.typeName]=newType;return newType;},addPropertyToType:function(ty,propName)
107
- {var c=propName.charAt(0);var setterName;var getterName;if(c>="a"&&c<="z")
108
- {getterName="get"+c.toUpperCase()+propName.substr(1);setterName="set"+c.toUpperCase()+propName.substr(1);}
109
- else
110
- {getterName="get"+propName;setterName="set"+propName;}
111
- ty[setterName]=function(val)
112
- {this.bridge.setPropertyInAS(this.fb_instance_id,propName,val);}
113
- ty[getterName]=function()
114
- {return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,propName));}},addMethodToType:function(ty,methodName)
115
- {ty[methodName]=function()
116
- {return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id,methodName,FABridge.argsToArray(arguments)));}},getFunctionProxy:function(funcID)
117
- {var bridge=this;if(this.remoteFunctionCache[funcID]==null)
118
- {this.remoteFunctionCache[funcID]=function()
119
- {bridge.callASFunction(funcID,FABridge.argsToArray(arguments));}}
120
- return this.remoteFunctionCache[funcID];},getFunctionID:function(func)
121
- {if(func.__bridge_id__==undefined)
122
- {func.__bridge_id__=this.makeID(this.nextLocalFuncID++);this.localFunctionCache[func.__bridge_id__]=func;}
123
- return func.__bridge_id__;},serialize:function(value)
124
- {var result={};var t=typeof(value);if(t=="number"||t=="string"||t=="boolean"||t==null||t==undefined)
125
- {result=value;}
126
- else if(value instanceof Array)
127
- {result=[];for(var i=0;i<value.length;i++)
128
- {result[i]=this.serialize(value[i]);}}
129
- else if(t=="function")
130
- {result.type=FABridge.TYPE_JSFUNCTION;result.value=this.getFunctionID(value);}
131
- else if(value instanceof ASProxy)
132
- {result.type=FABridge.TYPE_ASINSTANCE;result.value=value.fb_instance_id;}
133
- else
134
- {result.type=FABridge.TYPE_ANONYMOUS;result.value=value;}
135
- return result;},deserialize:function(packedValue)
136
- {var result;var t=typeof(packedValue);if(t=="number"||t=="string"||t=="boolean"||packedValue==null||packedValue==undefined)
137
- {result=this.handleError(packedValue);}
138
- else if(packedValue instanceof Array)
139
- {result=[];for(var i=0;i<packedValue.length;i++)
140
- {result[i]=this.deserialize(packedValue[i]);}}
141
- else if(t=="object")
142
- {for(var i=0;i<packedValue.newTypes.length;i++)
143
- {this.addTypeDataToCache(packedValue.newTypes[i]);}
144
- for(var aRefID in packedValue.newRefs)
145
- {this.createProxy(aRefID,packedValue.newRefs[aRefID]);}
146
- if(packedValue.type==FABridge.TYPE_PRIMITIVE)
147
- {result=packedValue.value;}
148
- else if(packedValue.type==FABridge.TYPE_ASFUNCTION)
149
- {result=this.getFunctionProxy(packedValue.value);}
150
- else if(packedValue.type==FABridge.TYPE_ASINSTANCE)
151
- {result=this.getProxy(packedValue.value);}
152
- else if(packedValue.type==FABridge.TYPE_ANONYMOUS)
153
- {result=packedValue.value;}}
154
- return result;},addRef:function(obj)
155
- {this.target.incRef(obj.fb_instance_id);},release:function(obj)
156
- {this.target.releaseRef(obj.fb_instance_id);},handleError:function(value)
157
- {if(typeof(value)=="string"&&value.indexOf("__FLASHERROR")==0)
158
- {var myErrorMessage=value.split("||");if(FABridge.refCount>0)
159
- {FABridge.refCount--;}
160
- throw new Error(myErrorMessage[1]);return value;}
161
- else
162
- {return value;}}};ASProxy=function(bridge,typeName)
163
- {this.bridge=bridge;this.typeName=typeName;return this;};ASProxy.prototype={get:function(propName)
164
- {return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,propName));},set:function(propName,value)
165
- {this.bridge.setPropertyInAS(this.fb_instance_id,propName,value);},call:function(funcName,args)
166
- {this.bridge.callASMethod(this.fb_instance_id,funcName,args);},addRef:function(){this.bridge.addRef(this);},release:function(){this.bridge.release(this);}};;if(!window.Flex){alert('Flex library not loaded');}else{Flex.Uploader=Class.create();Flex.Uploader.prototype={flex:null,uploader:null,filters:null,containerId:null,flexContainerId:null,container:null,files:null,fileRowTemplate:null,fileProgressTemplate:null,templatesPattern:/(^|.|\r|\n)(\{\{(.*?)\}\})/,onFilesComplete:false,onFileProgress:true,onFileRemove:false,onContainerHideBefore:null,initialize:function(containerId,uploaderSrc,config){this.containerId=containerId;this.container=$(containerId);this.container.controller=this;this.config=config;this.flexContainerId=this.containerId+'-flash';Element.insert(this.containerId,{'before':'<div id="'+this.flexContainerId+'" class="flex" style="position:relative;float:right;"></div>'});flexWidth=230;if(this.config.width){flexWidth=this.config.width;}
167
- this.flex=new Flex.Object({left:100,top:300,width:flexWidth,height:20,src:uploaderSrc});this.fileRowTemplate=new Template(this.getInnerElement('template').innerHTML,this.templatesPattern);this.fileProgressTemplate=new Template(this.getInnerElement('template-progress').innerHTML,this.templatesPattern);this.flex.onBridgeInit=this.handleBridgeInit.bind(this);if(this.flex.detectFlashVersion(9,0,28)){this.flex.apply(this.flexContainerId);}else{this.getInnerElement('install-flash').show();}
168
- this.onContainerHideBefore=this.handleContainerHideBefore.bind(this);},getInnerElement:function(elementName){return $(this.containerId+'-'+elementName);},getFileId:function(file){var id;if(typeof file=='object'){id=file.id;}else{id=file;}
169
- return this.containerId+'-file-'+id;},getDeleteButton:function(file){return $(this.getFileId(file)+'-delete');},handleBridgeInit:function(){this.uploader=this.flex.getBridge().getUpload();if(this.config.filters){$H(this.config.filters).each(function(pair){this.uploader.addTypeFilter(pair.key,pair.value.label,pair.value.files);}.bind(this));delete(this.config.filters);this.uploader.setUseTypeFilter(true);}
170
- this.uploader.setConfig(this.config);this.uploader.addEventListener('select',this.handleSelect.bind(this));this.uploader.addEventListener('complete',this.handleComplete.bind(this));this.uploader.addEventListener('progress',this.handleProgress.bind(this));this.uploader.addEventListener('error',this.handleError.bind(this));this.uploader.addEventListener('removeall',this.handleRemoveAll.bind(this));},browse:function(){this.uploader.browse();},upload:function(){this.uploader.upload();this.files=this.uploader.getFilesInfo();this.updateFiles();},removeFile:function(id){this.uploader.removeFile(id);$(this.getFileId(id)).remove();if(this.onFileRemove){this.onFileRemove(id);}
171
- this.files=this.uploader.getFilesInfo();this.updateFiles();},removeAllFiles:function(){this.files.each(function(file){this.removeFile(file.id);}.bind(this));this.files=this.uploader.getFilesInfo();this.updateFiles();},handleSelect:function(event){this.files=event.getData().files;this.checkFileSize();this.updateFiles();this.getInnerElement('upload').show();if(this.onFileSelect){this.onFileSelect();}},handleProgress:function(event){var file=event.getData().file;this.updateFile(file);if(this.onFileProgress){this.onFileProgress(file);}},handleError:function(event){this.updateFile(event.getData().file);},handleComplete:function(event){this.files=event.getData().files;this.updateFiles();if(this.onFilesComplete){this.onFilesComplete(this.files);}},handleRemoveAll:function(event){this.files.each(function(file){$(this.getFileId(file.id)).remove();}.bind(this));if(this.onFileRemoveAll){this.onFileRemoveAll();}
172
- this.files=this.uploader.getFilesInfo();this.updateFiles();},handleRemove:function(event){this.files=this.uploader.getFilesInfo();this.updateFiles();},updateFiles:function(){this.files.each(function(file){this.updateFile(file);}.bind(this));},updateFile:function(file){if(!$(this.getFileId(file))){if(this.config.replace_browse_with_remove){$(this.containerId+'-new').show();$(this.containerId+'-new').innerHTML=this.fileRowTemplate.evaluate(this.getFileVars(file));$(this.containerId+'-old').hide();this.flex.getBridge().hideBrowseButton();}else{Element.insert(this.container,{bottom:this.fileRowTemplate.evaluate(this.getFileVars(file))});}}
173
- if(file.status=='full_complete'&&file.response.isJSON()){var response=file.response.evalJSON();if(typeof response=='object'){if(typeof response.cookie=='object'){var date=new Date();date.setTime(date.getTime()+(parseInt(response.cookie.lifetime)*1000));document.cookie=escape(response.cookie.name)+"="
174
- +escape(response.cookie.value)
175
- +"; expires="+date.toGMTString()
176
- +(response.cookie.path.blank()?"":"; path="+response.cookie.path)
177
- +(response.cookie.domain.blank()?"":"; domain="+response.cookie.domain);}
178
- if(typeof response.error!='undefined'&&response.error!=0){file.status='error';file.errorText=response.error;}}}
179
- if(file.status=='full_complete'&&!file.response.isJSON()){file.status='error';}
180
- var progress=$(this.getFileId(file)).getElementsByClassName('progress-text')[0];if((file.status=='progress')||(file.status=='complete')){$(this.getFileId(file)).addClassName('progress');$(this.getFileId(file)).removeClassName('new');$(this.getFileId(file)).removeClassName('error');if(file.progress&&file.progress.total){progress.update(this.fileProgressTemplate.evaluate(this.getFileProgressVars(file)));}else{progress.update('');}
181
- if(!this.config.replace_browse_with_remove){this.getDeleteButton(file).hide();}}else if(file.status=='error'){$(this.getFileId(file)).addClassName('error');$(this.getFileId(file)).removeClassName('progress');$(this.getFileId(file)).removeClassName('new');var errorText=file.errorText?file.errorText:this.errorText(file);if(this.config.replace_browse_with_remove){this.flex.getBridge().hideBrowseButton();}else{this.getDeleteButton(file).show();}
182
- progress.update(errorText);}else if(file.status=='full_complete'){$(this.getFileId(file)).addClassName('complete');$(this.getFileId(file)).removeClassName('progress');$(this.getFileId(file)).removeClassName('error');if(this.config.replace_browse_with_remove){this.flex.getBridge().hideRemoveButton();}
183
- progress.update(this.translate('Complete'));}},getDebugStr:function(obj){return Object.toJSON(obj).replace('&','&amp;').replace('>','&gt;').replace('<','&lt;');},getFileVars:function(file){return{id:this.getFileId(file),fileId:file.id,name:file.name,size:this.formatSize(file.size)};},getFileProgressVars:function(file){return{total:this.formatSize(file.progress.total),uploaded:this.formatSize(file.progress.loaded),percent:this.round((file.progress.loaded/file.progress.total)*100)};},formatSize:function(size){if(size>1024*1024*1024*1024){return this.round(size/(1024*1024*1024*1024))+' '+this.translate('Tb');}else if(size>1024*1024*1024){return this.round(size/(1024*1024*1024))+' '+this.translate('Gb');}else if(size>1024*1024){return this.round(size/(1024*1024))+' '+this.translate('Mb');}else if(size>1024){return this.round(size/(1024))+' '+this.translate('Kb');}
184
- return size+' '+this.translate('b');},round:function(number){return Math.round(number*100)/100;},checkFileSize:function(){newFiles=[];hasTooBigFiles=false;this.files.each(function(file){if(file.size>maxUploadFileSizeInBytes){hasTooBigFiles=true;this.uploader.removeFile(file.id)}else{newFiles.push(file)}}.bind(this));this.files=newFiles;if(hasTooBigFiles){alert(this.translate('Maximum allowed file size for upload is')+' '+maxUploadFileSize+".\n"+this.translate('Please check your server PHP settings.'));}},translate:function(text){try{if(Translator){return Translator.translate(text);}}
185
- catch(e){}
186
- return text;},errorText:function(file){var error='';switch(file.errorCode){case 1:error='File size should be more than 0 bytes';break;case 2:error='Upload HTTP Error';break;case 3:error='Upload I/O Error';break;case 4:error='Upload Security Error';break;case 5:error='SSL Error: Invalid or self-signed certificate';break;}
187
- if(error){return this.translate(error);}
188
- return error;},handleContainerHideBefore:function(container){if(container&&Element.descendantOf(this.container,container)&&!this.checkAllComplete()){if(!confirm('There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to continue ?')){return'cannotchange';}else{this.removeAllFiles();}}},checkAllComplete:function(){if(this.files){return!this.files.any(function(file){return(file.status!=='full_complete')});}
189
- return true;}}};MediabrowserUtility={openDialog:function(url,width,height,title){if($('browser_window')&&typeof(Windows)!='undefined'){Windows.focus('browser_window');return;}
190
- this.dialogWindow=Dialog.info(null,{closable:true,resizable:false,draggable:true,className:'magento',title:title||'Insert File...',top:50,width:width||950,height:height||800,zIndex:1000,recenterAuto:false,hideEffect:Element.hide,showEffect:Element.show,id:'browser_window',onClose:this.closeDialog.bind(this)});new Ajax.Updater('modal_dialog_message',url,{evalScripts:true});},closeDialog:function(window){if(!window){window=this.dialogWindow;}
191
- if(window){WindowUtilities._showSelect();window.close();}}};Mediabrowser=Class.create();Mediabrowser.prototype={targetElementId:null,contentsUrl:null,onInsertUrl:null,newFolderUrl:null,deleteFolderUrl:null,deleteFilesUrl:null,headerText:null,tree:null,currentNode:null,initialize:function(setup){this.newFolderPrompt=setup.newFolderPrompt;this.deleteFolderConfirmationMessage=setup.deleteFolderConfirmationMessage;this.deleteFileConfirmationMessage=setup.deleteFileConfirmationMessage;this.targetElementId=setup.targetElementId;this.contentsUrl=setup.contentsUrl;this.onInsertUrl=setup.onInsertUrl;this.newFolderUrl=setup.newFolderUrl;this.deleteFolderUrl=setup.deleteFolderUrl;this.deleteFilesUrl=setup.deleteFilesUrl;this.headerText=setup.headerText;},setTree:function(tree){this.tree=tree;this.currentNode=tree.getRootNode();},getTree:function(tree){return this.tree;},selectFolder:function(node,event){this.currentNode=node;this.hideFileButtons();this.activateBlock('contents');if(node.id=='root'){this.hideElement('button_delete_folder');}else{this.showElement('button_delete_folder');}
192
- this.updateHeader(this.currentNode);this.drawBreadcrumbs(this.currentNode);this.showElement('loading-mask');new Ajax.Request(this.contentsUrl,{parameters:{node:this.currentNode.id},evalJS:true,onSuccess:function(transport){try{this.currentNode.select();this.onAjaxSuccess(transport);this.hideElement('loading-mask');if($('contents')!=undefined){$('contents').update(transport.responseText);$$('div.filecnt').each(function(s){Event.observe(s.id,'click',this.selectFile.bind(this));Event.observe(s.id,'dblclick',this.insert.bind(this));}.bind(this));}}catch(e){alert(e.message);}}.bind(this)});},selectFolderById:function(nodeId){var node=this.tree.getNodeById(nodeId);if(node.id){this.selectFolder(node);}},selectFile:function(event){var div=Event.findElement(event,'DIV');$$('div.filecnt.selected[id!="'+div.id+'"]').each(function(e){e.removeClassName('selected');})
193
- div.toggleClassName('selected');if(div.hasClassName('selected')){this.showFileButtons();}else{this.hideFileButtons();}},showFileButtons:function(){this.showElement('button_delete_files');this.showElement('button_insert_files');},hideFileButtons:function(){this.hideElement('button_delete_files');this.hideElement('button_insert_files');},handleUploadComplete:function(files){$$('div[class*="file-row complete"]').each(function(e){$(e.id).remove();});this.selectFolder(this.currentNode);},insert:function(event){var div;if(event!=undefined){div=Event.findElement(event,'DIV');}else{$$('div.selected').each(function(e){div=$(e.id);});}
194
- if($(div.id)==undefined){return false;}
195
- var targetEl=this.getTargetElement();if(!targetEl){alert("Target element not found for content update");Windows.close('browser_window');return;}
196
- var params={filename:div.id,node:this.currentNode.id};if(targetEl.tagName.toLowerCase()=='textarea'){params.as_is=1;}
197
- new Ajax.Request(this.onInsertUrl,{parameters:params,onSuccess:function(transport){try{this.onAjaxSuccess(transport);if(this.getMediaBrowserOpener()){self.blur();}
198
- Windows.close('browser_window');if(targetEl.tagName.toLowerCase()=='input'){targetEl.value=transport.responseText;}else{updateElementAtCursor(targetEl,transport.responseText);if(varienGlobalEvents){varienGlobalEvents.fireEvent('tinymceChange');}}}catch(e){alert(e.message);}}.bind(this)});},getTargetElement:function(){if(typeof(tinyMCE)!='undefined'&&tinyMCE.get(this.targetElementId)){if((opener=this.getMediaBrowserOpener())){return opener.document.getElementById('src')||opener.document.getElementById('href');}else{return null;}}else{return document.getElementById(this.targetElementId);}},getMediaBrowserOpener:function(){if(typeof(tinyMCE)!='undefined'&&tinyMCE.get(this.targetElementId)&&typeof(tinyMceEditors)!='undefined'&&!tinyMceEditors.get(this.targetElementId).getMediaBrowserOpener().closed){return tinyMceEditors.get(this.targetElementId).getMediaBrowserOpener();}else{return null;}},newFolder:function(){var folderName=prompt(this.newFolderPrompt);if(!folderName){return false;}
199
- new Ajax.Request(this.newFolderUrl,{parameters:{name:folderName},onSuccess:function(transport){try{this.onAjaxSuccess(transport);if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
200
- var newNode=new Ext.tree.AsyncTreeNode({text:response.short_name,draggable:false,id:response.id,expanded:true});var child=this.currentNode.appendChild(newNode);this.tree.expandPath(child.getPath(),'',function(success,node){this.selectFolder(node);}.bind(this));}}catch(e){alert(e.message);}}.bind(this)})},deleteFolder:function(){if(!confirm(this.deleteFolderConfirmationMessage)){return false;}
201
- new Ajax.Request(this.deleteFolderUrl,{onSuccess:function(transport){try{this.onAjaxSuccess(transport);var parent=this.currentNode.parentNode;parent.removeChild(this.currentNode);this.selectFolder(parent);}
202
- catch(e){alert(e.message);}}.bind(this)})},deleteFiles:function(){if(!confirm(this.deleteFileConfirmationMessage)){return false;}
203
- var ids=[];var i=0;$$('div.selected').each(function(e){ids[i]=e.id;i++;});new Ajax.Request(this.deleteFilesUrl,{parameters:{files:ids.toJSON()},onSuccess:function(transport){try{this.onAjaxSuccess(transport);this.selectFolder(this.currentNode);}catch(e){alert(e.message);}}.bind(this)});},drawBreadcrumbs:function(node){if($('breadcrumbs')!=undefined){$('breadcrumbs').remove();}
204
- if(node.id=='root'){return;}
205
- var path=node.getPath().split('/');var breadcrumbs='';for(var i=0,length=path.length;i<length;i++){if(path[i]==''){continue;}
206
- var currNode=this.tree.getNodeById(path[i]);if(currNode.id){breadcrumbs+='<li>';breadcrumbs+='<a href="#" onclick="MediabrowserInstance.selectFolderById(\''+currNode.id+'\');">'+currNode.text+'</a>';if(i<(length-1)){breadcrumbs+=' <span>/</span>';}
207
- breadcrumbs+='</li>';}}
208
- if(breadcrumbs!=''){breadcrumbs='<ul class="breadcrumbs" id="breadcrumbs">'+breadcrumbs+'</ul>';$('content_header').insert({after:breadcrumbs});}},updateHeader:function(node){var header=(node.id=='root'?this.headerText:node.text);if($('content_header_text')!=undefined){$('content_header_text').innerHTML=header;}},activateBlock:function(id){this.showElement(id);},hideElement:function(id){if($(id)!=undefined){$(id).addClassName('no-display');$(id).hide();}},showElement:function(id){if($(id)!=undefined){$(id).removeClassName('no-display');$(id).show();}},onAjaxSuccess:function(transport){if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
209
- if(response.error){throw response;}else if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
var/minifycache/minify_268acb4da1a243c2c1434894bf7e5841.gz DELETED
Binary file
var/minifycache/minify_676fb2e38e9cb2203204bcf556430103 DELETED
@@ -1,1030 +0,0 @@
1
- var Prototype={Version:'1.6.0.3',Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),Opera:navigator.userAgent.indexOf('Opera')>-1,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div')['__proto__']&&document.createElement('div')['__proto__']!==document.createElement('form')['__proto__']},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)
2
- Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
3
- parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
4
- Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
5
- for(var i=0;i<properties.length;i++)
6
- klass.addMethods(properties[i]);if(!klass.prototype.initialize)
7
- klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
8
- properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
9
- this.prototype[property]=value;}
10
- return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
11
- destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
12
- if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
13
- results.push(property.toJSON()+': '+value);}
14
- return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
15
- keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
16
- values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return!!(object&&object.nodeType==1);},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},defer:function(){var args=[0.01].concat($A(arguments));return this.delay.apply(this,args);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+
17
- (this.getUTCMonth()+1).toPaddedString(2)+'-'+
18
- this.getUTCDate().toPaddedString(2)+'T'+
19
- this.getUTCHours().toPaddedString(2)+':'+
20
- this.getUTCMinutes().toPaddedString(2)+':'+
21
- this.getUTCSeconds().toPaddedString(2)+'Z"';};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
22
- return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}finally{this.currentlyExecuting=false;}}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
23
- return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=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=length||30;truncation=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=new RegExp(Prototype.ScriptFragment,'img');var matchOne=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=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=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=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
24
- else hash[key]=value;}
25
- return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
26
- String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
27
- camelized+=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}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(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=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
28
- throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},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,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
29
- object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
30
- return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
31
- return this;},eachSlice:function(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)
32
- slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))
33
- throw $break;});return result;},collect:function(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
34
- results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
35
- filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
36
- results.push(iterator.call(context,value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))
37
- if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=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){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
38
- result=value;});return result;},min:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)
39
- result=value;});return result;},partition:function(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
40
- results.push(value);});return results;},sortBy:function(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
41
- iterator=args.pop();var collections=[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'#<Enumerable:'+this.toArray().inspect()+'>';}};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=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
42
- if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(typeof iterable==='function'&&typeof iterable.length==='number'&&typeof iterable.item==='function')&&iterable.toArray)
43
- return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;};}
44
- Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)
45
- iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==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==index||(sorted?array.last()!=value:!array.include(value)))
46
- array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
47
- Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
48
- if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
49
- if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)
50
- array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
51
- return array;};}
52
- Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator,context){$R(0,this,true).each(iterator,context);return this;},toPaddedString:function(length,radix){var string=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]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
53
- return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){if(this._object[key]!==Object.prototype[key])
54
- return this._object[key];},unset:function(key){var value=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=this.detect(function(pair){return pair.value===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.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))
55
- return results.concat(values.map(toQueryPair.curry(key)));}else results.push(toQueryPair(key,values));return results;}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';},toJSON:function(){return Object.toJSON(this.toObject());},clone:function(){return new Hash(this);}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
56
- return false;if(this.exclusive)
57
- return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};var Ajax={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={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
58
- this.responders.push(responder);},unregister:function(responder){this.responders=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=Class.create({initialize:function(options){this.options={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=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))
59
- this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))
60
- this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
61
- this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
62
- this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
63
- params+='&_=';}
64
- try{var response=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).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
65
- this.onStateChange();}
66
- catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
67
- this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['Content-type']=this.options.contentType+
68
- (this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)
69
- headers['Connection']='close';}
70
- if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
71
- for(var i=0,length=extras.length;i<length;i+=2)
72
- headers[extras[i]]=extras[i+1];else
73
- $H(extras).each(function(pair){headers[pair.key]=pair.value});}
74
- for(var name in headers)
75
- this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
76
- var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
77
- this.evalResponse();}
78
- try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
79
- if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{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=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
80
- if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=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=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
81
- return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
82
- else options.insertion(receiver,responseText);}
83
- else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.responseText;}
84
- this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
85
- elements.push($(arguments[i]));return elements;}
86
- if(Object.isString(element))
87
- element=document.getElementById(element);return Element.extend(element);}
88
- if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
89
- results.push(Element.extend(query.snapshotItem(i)));return results;};}
90
- if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){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});}
91
- (function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
92
- if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
93
- element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
94
- insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
95
- content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
96
- return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
97
- $(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
98
- element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
99
- if(element.nodeType==1)
100
- elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;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=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
101
- selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
102
- return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
103
- element.removeAttribute(name);else if(value===true)
104
- element.setAttribute(name,name);else element.setAttribute(name,value);}
105
- 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=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))
106
- element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
107
- element.removeChild(node);node=nextNode;}
108
- return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
109
- return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
110
- return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
111
- if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}
112
- if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}
113
- for(var property in styles)
114
- if(property=='opacity')element.setOpacity(styles[property]);else
115
- elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=element.getStyle('display');if(display!='none'&&display!=null)
116
- return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
117
- return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
118
- return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')
119
- element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);if(element.tagName.toUpperCase()=='HTML')
120
- return $(document.body);while((element=element.parentNode)&&element!=document.body)
121
- if(Element.getStyle(element,'position')!='static')
122
- return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
123
- if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
124
- if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
125
- return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
126
- else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
127
- return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
128
- else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent}
129
- catch(e){return $(document.body)}
130
- var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent}
131
- catch(e){return Element._returnOffset(0,0)}
132
- var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
133
- offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}
134
- catch(e){return Element._returnOffset(0,0)}
135
- return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
136
- if(value[1])return parseFloat(value[1])/100;return 1.0;}
137
- if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))
138
- return element['offset'+style.capitalize()]+'px';return null;}
139
- return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
140
- element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
141
- element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=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={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=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);}
142
- else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
143
- else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
144
- if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
145
- return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
146
- if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}
147
- if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=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)});}
148
- else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
149
- if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
150
- content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
151
- fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
152
- fragments.each(function(node){parent.appendChild(node)});}
153
- else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
154
- Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={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:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</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={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement('div')['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=document.createElement('div')['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;}
155
- Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)
156
- return Prototype.K;var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase(),property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
157
- element[property]=value.methodize();}
158
- element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=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)});}
159
- if(arguments.length==2){var tagName=methods;methods=arguments[1];}
160
- if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
161
- function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
162
- Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
163
- function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
164
- destination[property]=value.methodize();}}
165
- function findDOMClass(tagName){var klass;var trans={"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='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName)['__proto__'];return window[klass];}
166
- if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}
167
- if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
168
- Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={},B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();if(B.WebKit&&!document.evaluate){dimensions[d]=self['inner'+D];}else if(B.Opera&&parseFloat(window.opera.version())<9.5){dimensions[d]=document.body['client'+D]}else{dimensions[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);}};var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))
169
- return false;if((/(\[[\w-]*?:|:checked)/).test(e))
170
- return false;return true;},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
171
- return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;}
172
- this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
173
- this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}
174
- this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
175
- this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();e="#"+id+" "+e;}
176
- results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root);}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}
177
- var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
178
- return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=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:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[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(*) = 0 and (count(text()) = 0)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
179
- 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]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
180
- return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c); c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c); c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
181
- a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
182
- node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
183
- node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
184
- if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
185
- if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
186
- return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
187
- h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,child;child=node.childNodes[j];j++)
188
- if(child.nodeType==1&&child.tagName!='!')results.push(child);}
189
- return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
190
- return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
191
- h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
192
- if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
193
- if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
194
- h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
195
- for(var i=0,node;node=nodes[i];i++)
196
- if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
197
- if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
198
- if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
199
- if(Selector.handlers.previousElementSibling(targetNode)==node)
200
- return[targetNode];}else nodes=h[combinator](nodes);}
201
- for(var i=0,node;node=nodes[i];i++)
202
- if(node==targetNode)return[targetNode];return[];}
203
- return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
204
- results.push(node);}
205
- return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
206
- if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
207
- return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
208
- return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
209
- return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
210
- if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
211
- 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=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
212
- if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
213
- if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
214
- if(node.nodeIndex==indices[j])results.push(node);}}
215
- h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||node.firstChild)continue;results.push(node);}
216
- return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
217
- if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
218
- if(!node.disabled&&(!node.type||node.type!=='hidden'))
219
- results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
220
- if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
221
- if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv==v||nv&&nv.startsWith(v);},'$=':function(nv,v){return nv==v||nv&&nv.endsWith(v);},'*=':function(nv,v){return nv==v||nv&&nv.include(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
222
- if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
223
- return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
224
- return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)
225
- if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
226
- node.removeAttribute('_countedByPrototype');return nodes;}});}
227
- function $$(){return Selector.findChildElements(document,$A(arguments));}
228
- var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
229
- else result[key]=value;}}
230
- return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={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()])
231
- elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
232
- continue;matchingInputs.push(Element.extend(input));}
233
- return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
234
- if(form.hasAttribute('method')&&!options.method)
235
- options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
236
- return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))
237
- element.select();}catch(e){}
238
- return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={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=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value))
239
- return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
240
- else opt.selected=value.include(currentValue);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(this.optionValue(opt));}
241
- return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=Class.create({initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
242
- this.registerFormCallbacks();else
243
- this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=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=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element);}});if(!window.Event)var Event={};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=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
244
- return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
245
- 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){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))
246
- node=currentTarget;}
247
- if(node){if(node.nodeType==Node.TEXT_NODE)node=node.parentNode;return Element.extend(node);}else return false;},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+
248
- (docElement.scrollLeft||body.scrollLeft)-
249
- (docElement.clientLeft||0)),y:event.pageY||(event.clientY+
250
- (docElement.scrollTop||body.scrollTop)-
251
- (docElement.clientTop||0))};},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=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=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=Event.prototype||document.createEvent("HTMLEvents")['__proto__'];Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){try{if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}catch(error){return false;}}
252
- function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;}
253
- function getCacheForID(id){return cache[id]=cache[id]||{};}
254
- function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
255
- function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
256
- return false;Event.extend(event);handler.call(element,event);};wrapper.handler=handler;c.push(wrapper);return wrapper;}
257
- function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
258
- function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
259
- function destroyCache(){for(var id in cache)
260
- for(var eventName in cache[id])
261
- cache[id][eventName]=null;}
262
- if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
263
- if(Prototype.Browser.WebKit){window.addEventListener('unload',Prototype.emptyFunction,false);}
264
- return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
265
- return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=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;}
266
- var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
267
- destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
268
- element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
269
- event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
270
- 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(){var timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");document.loaded=true;}
271
- if(document.addEventListener){if(Prototype.Browser.WebKit){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))
272
- fireContentLoadedEvent();},0);Event.observe(window,"load",fireContentLoadedEvent);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}};}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},within:function(element,x,y){if(this.includeScrollOffsets)
273
- return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
274
- return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
275
- return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
276
- instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
277
- elements.push(Element.extend(child));}
278
- return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();;var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!='undefined');Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var id;var optionIndex=0;if(arguments.length>0){if(typeof arguments[0]=="string"){id=arguments[0];optionIndex=1;}
279
- else
280
- id=arguments[0]?arguments[0].id:null;}
281
- if(!id)
282
- id="window_"+new Date().getTime();if($(id))
283
- alert("Window "+id+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor");this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeOnEsc:true,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[optionIndex]||{});if(this.options.blurClassName)
284
- this.options.focusClassName=this.options.className;if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined")
285
- this.options.top=this._round(Math.random()*500,this.options.gridY);if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined")
286
- this.options.left=this._round(Math.random()*500,this.options.gridX);if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear)
287
- this.options.showEffectOptions.to=this.options.opacity;}
288
- if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear)
289
- this.options.showEffectOptions.to=this.options.opacity;if(this.options.hideEffect==Effect.Fade)
290
- this.options.hideEffectOptions.from=this.options.opacity;}
291
- if(this.options.hideEffect==Element.hide)
292
- this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose)this.destroy();}.bind(this)
293
- if(this.options.parent!=document.body)
294
- this.options.parent=$(this.options.parent);this.element=this._createWindow(id);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.eventKeyUp=this._keyUp.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(document,"keyup",this.eventKeyUp);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var that=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(element){element.observe("mousedown",that.eventMouseDown);element.addClassName("top_draggable");});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(element){element.observe("mousedown",that.eventMouseDown);element.addClassName("bottom_draggable");});}
295
- if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown);}
296
- this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+'px'});this.useLeft=true;}
297
- else{this.element.setStyle({right:parseFloat(this.options.right)+'px'});this.useLeft=false;}
298
- if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+'px'});this.useTop=true;}
299
- else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+'px'});this.useTop=false;}
300
- this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex)
301
- this.setZIndex(this.options.zIndex)
302
- if(this.options.destroyOnClose)
303
- this.setDestroyOnClose(true);this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height)
304
- this.setSize(this.options.width,this.options.height);this.setTitle(this.options.title)
305
- Windows.register(this);},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);Event.stopObserving(document,"keyup",this.eventKeyUp);if(this._oldParent){var content=this.getContent();var originalContent=null;for(var i=0;i<content.childNodes.length;i++){originalContent=content.childNodes[i];if(originalContent.nodeType==1)
306
- break;originalContent=null;}
307
- if(originalContent)
308
- this._oldParent.appendChild(originalContent);this._oldParent=null;}
309
- if(this.sizer)
310
- Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown);if(this.options.url)
311
- this.content.src=null
312
- if(this.iefix)
313
- Element.remove(this.iefix);Element.remove(this.element);Windows.unregister(this);},setCloseCallback:function(callback){this.options.closeCallback=callback;},getContent:function(){return this.content;},setContent:function(id,autoresize,autoposition){var element=$(id);if(null==element)throw"Unable to find element '"+id+"' in DOM";this._oldParent=element.parentNode;var d=null;var p=null;if(autoresize)
314
- d=Element.getDimensions(element);if(autoposition)
315
- p=Position.cumulativeOffset(element);var content=this.getContent();this.setHTMLContent("");content=this.getContent();content.appendChild(element);element.show();if(autoresize)
316
- this.setSize(d.width,d.height);if(autoposition)
317
- this.setLocation(p[1]-this.heightN,p[0]-this.widthW);},setHTMLContent:function(html){if(this.options.url){this.content.src=null;this.options.url=null;var content="<div id=\""+this.getId()+"_content\" class=\""+this.options.className+"_content\"> </div>";$(this.getId()+"_table_content").innerHTML=content;this.content=$(this.element.id+"_content");}
318
- this.getContent().innerHTML=html;},setAjaxContent:function(url,options,showCentered,showModal){this.showFunction=showCentered?"showCenter":"show";this.showModal=showModal||false;options=options||{};this.setHTMLContent("");this.onComplete=options.onComplete;if(!this._onCompleteHandler)
319
- this._onCompleteHandler=this._setAjaxContent.bind(this);options.onComplete=this._onCompleteHandler;new Ajax.Request(url,options);options.onComplete=this.onComplete;},_setAjaxContent:function(originalRequest){Element.update(this.getContent(),originalRequest.responseText);if(this.onComplete)
320
- this.onComplete(originalRequest);this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(url){if(this.options.url)
321
- this.content.src=null;this.options.url=url;var content="<iframe frameborder='0' name='"+this.getId()+"_content' id='"+this.getId()+"_content' src='"+url+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=content;this.content=$(this.element.id+"_content");},getURL:function(){return this.options.url?this.options.url:null;},refresh:function(){if(this.options.url)
322
- $(this.element.getAttribute('id')+'_content').src=this.options.url;},setCookie:function(name,expires,path,domain,secure){name=name||this.element.id;this.cookie=[name,expires,path,domain,secure];var value=WindowUtilities.getCookie(name)
323
- if(value){var values=value.split(',');var x=values[0].split(':');var y=values[1].split(':');var w=parseFloat(values[2]),h=parseFloat(values[3]);var mini=values[4];var maxi=values[5];this.setSize(w,h);if(mini=="true")
324
- this.doMinimize=true;else if(maxi=="true")
325
- this.doMaximize=true;this.useLeft=x[0]=="l";this.useTop=y[0]=="t";this.element.setStyle(this.useLeft?{left:x[1]}:{right:x[1]});this.element.setStyle(this.useTop?{top:y[1]}:{bottom:y[1]});}},getId:function(){return this.element.id;},setDestroyOnClose:function(){this.options.destroyOnClose=true;},setConstraint:function(bool,padding){this.constraint=bool;this.constraintPad=Object.extend(this.constraintPad,padding||{});if(this.useTop&&this.useLeft)
326
- this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left));},_initDrag:function(event){if(Event.element(event)==this.sizer&&this.isMinimized())
327
- return;if(Event.element(event)!=this.sizer&&this.isMaximized())
328
- return;if(Prototype.Browser.IE&&this.heightN==0)
329
- this._getWindowBorderSize();this.pointer=[this._round(Event.pointerX(event),this.options.gridX),this._round(Event.pointerY(event),this.options.gridY)];if(this.options.wiredDrag)
330
- this.currentDrag=this._createWiredElement();else
331
- this.currentDrag=this.element;if(Event.element(event)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle('bottom'));this.rightOrg=parseFloat(this.element.getStyle('right'));this._notify("onStartResize");}
332
- else{this.doResize=false;var closeButton=$(this.getId()+'_close');if(closeButton&&Position.within(closeButton,this.pointer[0],this.pointer[1])){this.currentDrag=null;return;}
333
- this.toFront();if(!this.options.draggable)
334
- return;this._notify("onStartMove");}
335
- Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen('__invisible__','__invisible__',this.overlayOpacity);document.body.ondrag=function(){return false;};document.body.onselectstart=function(){return false;};this.currentDrag.show();Event.stop(event);},_round:function(val,round){return round==1?val:val=Math.floor(val/round)*round;},_updateDrag:function(event){var pointer=[this._round(Event.pointerX(event),this.options.gridX),this._round(Event.pointerY(event),this.options.gridY)];var dx=pointer[0]-this.pointer[0];var dy=pointer[1]-this.pointer[1];if(this.doResize){var w=this.widthOrg+dx;var h=this.heightOrg+dy;dx=this.width-this.widthOrg
336
- dy=this.height-this.heightOrg
337
- if(this.useLeft)
338
- w=this._updateWidthConstraint(w)
339
- else
340
- this.currentDrag.setStyle({right:(this.rightOrg-dx)+'px'});if(this.useTop)
341
- h=this._updateHeightConstraint(h)
342
- else
343
- this.currentDrag.setStyle({bottom:(this.bottomOrg-dy)+'px'});this.setSize(w,h);this._notify("onResize");}
344
- else{this.pointer=pointer;if(this.useLeft){var left=parseFloat(this.currentDrag.getStyle('left'))+dx;var newLeft=this._updateLeftConstraint(left);this.pointer[0]+=newLeft-left;this.currentDrag.setStyle({left:newLeft+'px'});}
345
- else
346
- this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle('right'))-dx+'px'});if(this.useTop){var top=parseFloat(this.currentDrag.getStyle('top'))+dy;var newTop=this._updateTopConstraint(top);this.pointer[1]+=newTop-top;this.currentDrag.setStyle({top:newTop+'px'});}
347
- else
348
- this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle('bottom'))-dy+'px'});this._notify("onMove");}
349
- if(this.iefix)
350
- this._fixIEOverlapping();this._removeStoreLocation();Event.stop(event);},_endDrag:function(event){WindowUtilities.enableScreen('__invisible__');if(this.doResize)
351
- this._notify("onEndResize");else
352
- this._notify("onEndMove");Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(event);this._hideWiredElement();this._saveCookie()
353
- document.body.ondrag=null;document.body.onselectstart=null;},_updateLeftConstraint:function(left){if(this.constraint&&this.useLeft&&this.useTop){var width=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(left<this.constraintPad.left)
354
- left=this.constraintPad.left;if(left+this.width+this.widthE+this.widthW>width-this.constraintPad.right)
355
- left=width-this.constraintPad.right-this.width-this.widthE-this.widthW;}
356
- return left;},_updateTopConstraint:function(top){if(this.constraint&&this.useLeft&&this.useTop){var height=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var h=this.height+this.heightN+this.heightS;if(top<this.constraintPad.top)
357
- top=this.constraintPad.top;if(top+h>height-this.constraintPad.bottom)
358
- top=height-this.constraintPad.bottom-h;}
359
- return top;},_updateWidthConstraint:function(w){if(this.constraint&&this.useLeft&&this.useTop){var width=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var left=parseFloat(this.element.getStyle("left"));if(left+w+this.widthE+this.widthW>width-this.constraintPad.right)
360
- w=width-this.constraintPad.right-left-this.widthE-this.widthW;}
361
- return w;},_updateHeightConstraint:function(h){if(this.constraint&&this.useLeft&&this.useTop){var height=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var top=parseFloat(this.element.getStyle("top"));if(top+h+this.heightN+this.heightS>height-this.constraintPad.bottom)
362
- h=height-this.constraintPad.bottom-top-this.heightN-this.heightS;}
363
- return h;},_createWindow:function(id){var className=this.options.className;var win=document.createElement("div");win.setAttribute('id',id);win.className="dialog";var content;if(this.options.url)
364
- content="<iframe frameborder=\"0\" name=\""+id+"_content\" id=\""+id+"_content\" src=\""+this.options.url+"\"> </iframe>";else
365
- content="<div id=\""+id+"_content\" class=\""+className+"_content\"> </div>";var closeDiv=this.options.closable?"<div class='"+className+"_close' id='"+id+"_close' onclick='Windows.close(\""+id+"\", event)'> </div>":"";var minDiv=this.options.minimizable?"<div class='"+className+"_minimize' id='"+id+"_minimize' onclick='Windows.minimize(\""+id+"\", event)'> </div>":"";var maxDiv=this.options.maximizable?"<div class='"+className+"_maximize' id='"+id+"_maximize' onclick='Windows.maximize(\""+id+"\", event)'> </div>":"";var seAttributes=this.options.resizable?"class='"+className+"_sizer' id='"+id+"_sizer'":"class='"+className+"_se'";var blank="../themes/default/blank.gif";win.innerHTML=closeDiv+minDiv+maxDiv+"\
366
- <a href='#' id='"+id+"_focus_anchor'><!-- --></a>\
367
- <table id='"+id+"_row1' class=\"top table_window\">\
368
- <tr>\
369
- <td class='"+className+"_nw'></td>\
370
- <td class='"+className+"_n'><div id='"+id+"_top' class='"+className+"_title title_window'>"+this.options.title+"</div></td>\
371
- <td class='"+className+"_ne'></td>\
372
- </tr>\
373
- </table>\
374
- <table id='"+id+"_row2' class=\"mid table_window\">\
375
- <tr>\
376
- <td class='"+className+"_w'></td>\
377
- <td id='"+id+"_table_content' class='"+className+"_content' valign='top'>"+content+"</td>\
378
- <td class='"+className+"_e'></td>\
379
- </tr>\
380
- </table>\
381
- <table id='"+id+"_row3' class=\"bot table_window\">\
382
- <tr>\
383
- <td class='"+className+"_sw'></td>\
384
- <td class='"+className+"_s'><div id='"+id+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>\
385
- <td "+seAttributes+"></td>\
386
- </tr>\
387
- </table>\
388
- ";Element.hide(win);this.options.parent.insertBefore(win,this.options.parent.firstChild);Event.observe($(id+"_content"),"load",this.options.onload);return win;},changeClassName:function(newClassName){var className=this.options.className;var id=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(value){this._toggleClassName($(id+value),className+value,newClassName+value)}.bind(this));this._toggleClassName($(id+"_top"),className+"_title",newClassName+"_title");$$("#"+id+" td").each(function(td){td.className=td.className.sub(className,newClassName);});this.options.className=newClassName;},_toggleClassName:function(element,oldClassName,newClassName){if(element){element.removeClassName(oldClassName);element.addClassName(newClassName);}},setLocation:function(top,left){top=this._updateTopConstraint(top);left=this._updateLeftConstraint(left);var e=this.currentDrag||this.element;e.setStyle({top:top+'px'});e.setStyle({left:left+'px'});this.useLeft=true;this.useTop=true;},getLocation:function(){var location={};if(this.useTop)
389
- location=Object.extend(location,{top:this.element.getStyle("top")});else
390
- location=Object.extend(location,{bottom:this.element.getStyle("bottom")});if(this.useLeft)
391
- location=Object.extend(location,{left:this.element.getStyle("left")});else
392
- location=Object.extend(location,{right:this.element.getStyle("right")});return location;},getSize:function(){return{width:this.width,height:this.height};},setSize:function(width,height,useEffect){width=parseFloat(width);height=parseFloat(height);if(!this.minimized&&width<this.options.minWidth)
393
- width=this.options.minWidth;if(!this.minimized&&height<this.options.minHeight)
394
- height=this.options.minHeight;if(this.options.maxHeight&&height>this.options.maxHeight)
395
- height=this.options.maxHeight;if(this.options.maxWidth&&width>this.options.maxWidth)
396
- width=this.options.maxWidth;if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&useEffect){new Effect.ResizeWindow(this,null,null,width,height,{duration:Window.resizeEffectDuration});}else{this.width=width;this.height=height;var e=this.currentDrag?this.currentDrag:this.element;e.setStyle({width:width+this.widthW+this.widthE+"px"})
397
- e.setStyle({height:height+this.heightN+this.heightS+"px"})
398
- if(!this.currentDrag||this.currentDrag==this.element){var content=$(this.element.id+'_content');content.setStyle({height:height+'px'});content.setStyle({width:width+'px'});}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true);},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true);},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex)
399
- this.setZIndex(Windows.maxZIndex+1);if(this.iefix)
400
- this._fixIEOverlapping();},getBounds:function(insideOnly){if(!this.width||!this.height||!this.visible)
401
- this.computeBounds();var w=this.width;var h=this.height;if(!insideOnly){w+=this.widthW+this.widthE;h+=this.heightN+this.heightS;}
402
- var bounds=Object.extend(this.getLocation(),{width:w+"px",height:h+"px"});return bounds;},computeBounds:function(){if(!this.width||!this.height){var size=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className)
403
- if(this.height)
404
- this.width=size+5
405
- else
406
- this.height=size+5}
407
- this.setSize(this.width,this.height);if(this.centered)
408
- this._center(this.centerTop,this.centerLeft);},show:function(modal){this.visible=true;if(modal){if(typeof this.overlayOpacity=="undefined"){var that=this;setTimeout(function(){that.show(modal)},10);return;}
409
- Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this);}
410
- else
411
- if(!this.element.style.zIndex)
412
- this.setZIndex(Windows.maxZIndex+1);if(this.oldStyle)
413
- this.getContent().setStyle({overflow:this.oldStyle});this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions)
414
- this.options.showEffect(this.element,this.options.showEffectOptions);else
415
- this.options.showEffect(this.element);this._checkIEOverlapping();WindowUtilities.focusedWindow=this
416
- this._notify("onShow");$(this.element.id+'_focus_anchor').focus();},showCenter:function(modal,top,left){this.centered=true;this.centerTop=top;this.centerLeft=left;this.show(modal);},isVisible:function(){return this.visible;},_center:function(top,left){var windowScroll=WindowUtilities.getWindowScroll(this.options.parent);var pageSize=WindowUtilities.getPageSize(this.options.parent);if(typeof top=="undefined")
417
- top=(pageSize.windowHeight-(this.height+this.heightN+this.heightS))/2;top+=windowScroll.top
418
- if(typeof left=="undefined")
419
- left=(pageSize.windowWidth-(this.width+this.widthW+this.widthE))/2;left+=windowScroll.left
420
- this.setLocation(top,left);this.toFront();},_recenter:function(event){if(this.centered){var pageSize=WindowUtilities.getPageSize(this.options.parent);var windowScroll=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==pageSize.windowWidth&&this.pageSize.windowHeight==pageSize.windowHeight&&this.windowScroll.left==windowScroll.left&&this.windowScroll.top==windowScroll.top)
421
- return;this.pageSize=pageSize;this.windowScroll=windowScroll;if($('overlay_modal'))
422
- $('overlay_modal').setStyle({height:(pageSize.pageHeight+'px')});if(this.options.recenterAuto)
423
- this._center(this.centerTop,this.centerLeft);}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow();}
424
- this.oldStyle=this.getContent().getStyle('overflow')||"auto"
425
- this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix)
426
- this.iefix.hide();if(!this.doNotNotifyHide)
427
- this._notify("onHide");},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this))
428
- return;if(this.options.destroyOnClose){var destroyFunc=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var func=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){func();destroyFunc()}}
429
- else
430
- this.options.hideEffectOptions.afterFinish=function(){destroyFunc()}}
431
- Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose");}},minimize:function(){if(this.resizing)
432
- return;var r2=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var dh=r2.getDimensions().height;this.r2Height=dh;var h=this.element.getHeight()-dh;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-dh,{duration:Window.resizeEffectDuration});}else{this.height-=dh;this.element.setStyle({height:h+"px"});r2.hide();}
433
- if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom+dh)+'px'});}}
434
- else{this.minimized=false;var dh=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+dh,{duration:Window.resizeEffectDuration});}
435
- else{var h=this.element.getHeight()+dh;this.height+=dh;this.element.setStyle({height:h+"px"})
436
- r2.show();}
437
- if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom-dh)+'px'});}
438
- this.toFront();}
439
- this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing)
440
- return;if(Prototype.Browser.IE&&this.heightN==0)
441
- this._getWindowBorderSize();if(this.storedLocation!=null){this._restoreLocation();if(this.iefix)
442
- this.iefix.hide();}
443
- else{this._storeLocation();Windows.unsetOverflow(this);var windowScroll=WindowUtilities.getWindowScroll(this.options.parent);var pageSize=WindowUtilities.getPageSize(this.options.parent);var left=windowScroll.left;var top=windowScroll.top;if(this.options.parent!=document.body){windowScroll={top:0,left:0,bottom:0,right:0};var dim=this.options.parent.getDimensions();pageSize.windowWidth=dim.width;pageSize.windowHeight=dim.height;top=0;left=0;}
444
- if(this.constraint){pageSize.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);pageSize.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);left+=Math.max(0,this.constraintPad.left);top+=Math.max(0,this.constraintPad.top);}
445
- var width=pageSize.windowWidth-this.widthW-this.widthE;var height=pageSize.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,top,left,width,height,{duration:Window.resizeEffectDuration});}
446
- else{this.setSize(width,height);this.element.setStyle(this.useLeft?{left:left}:{right:left});this.element.setStyle(this.useTop?{top:top}:{bottom:top});}
447
- this.toFront();if(this.iefix)
448
- this._fixIEOverlapping();}
449
- this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized;},isMaximized:function(){return(this.storedLocation!=null);},setOpacity:function(opacity){if(Element.setOpacity)
450
- Element.setOpacity(this.element,opacity);},setZIndex:function(zindex){this.element.setStyle({zIndex:zindex});Windows.updateZindex(zindex,this);},setTitle:function(newTitle){if(!newTitle||newTitle=="")
451
- newTitle="&nbsp;";Element.update(this.element.id+'_top',newTitle);},getTitle:function(){return $(this.element.id+'_top').innerHTML;},setStatusBar:function(element){var statusBar=$(this.getId()+"_bottom");if(typeof(element)=="object"){if(this.bottombar.firstChild)
452
- this.bottombar.replaceChild(element,this.bottombar.firstChild);else
453
- this.bottombar.appendChild(element);}
454
- else
455
- this.bottombar.innerHTML=element;},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&(navigator.userAgent.indexOf('Opera')<0)&&(this.element.getStyle('position')=='absolute')){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+'_iefix');}
456
- if(this.iefix)
457
- setTimeout(this._fixIEOverlapping.bind(this),50);},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show();},_keyUp:function(event){if(27==event.keyCode&&this.options.closeOnEsc){this.close();}},_getWindowBorderSize:function(event){var div=this._createHiddenDiv(this.options.className+"_n")
458
- this.heightN=Element.getDimensions(div).height;div.parentNode.removeChild(div)
459
- var div=this._createHiddenDiv(this.options.className+"_s")
460
- this.heightS=Element.getDimensions(div).height;div.parentNode.removeChild(div)
461
- var div=this._createHiddenDiv(this.options.className+"_e")
462
- this.widthE=Element.getDimensions(div).width;div.parentNode.removeChild(div)
463
- var div=this._createHiddenDiv(this.options.className+"_w")
464
- this.widthW=Element.getDimensions(div).width;div.parentNode.removeChild(div);var div=document.createElement("div");div.className="overlay_"+this.options.className;document.body.appendChild(div);var that=this;setTimeout(function(){that.overlayOpacity=($(div).getStyle("opacity"));div.parentNode.removeChild(div);},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height;}
465
- if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420)
466
- this.setSize(this.width,this.height);if(this.doMaximize)
467
- this.maximize();if(this.doMinimize)
468
- this.minimize();},_createHiddenDiv:function(className){var objBody=document.body;var win=document.createElement("div");win.setAttribute('id',this.element.id+"_tmp");win.className=className;win.style.display='none';win.innerHTML='';objBody.insertBefore(win,objBody.firstChild);return win;},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle('top'),bottom:this.element.getStyle('bottom'),left:this.element.getStyle('left'),right:this.element.getStyle('right'),width:this.width,height:this.height};}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow)
469
- new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration});else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height);}
470
- Windows.resetOverflow();this._removeStoreLocation();}},_removeStoreLocation:function(){this.storedLocation=null;},_saveCookie:function(){if(this.cookie){var value="";if(this.useLeft)
471
- value+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle('left'))
472
- else
473
- value+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle('right'))
474
- if(this.useTop)
475
- value+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle('top'))
476
- else
477
- value+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle('bottom'))
478
- value+=","+(this.storedLocation?this.storedLocation.width:this.width);value+=","+(this.storedLocation?this.storedLocation.height:this.height);value+=","+this.isMinimized();value+=","+this.isMaximized();WindowUtilities.setCookie(value,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE)
479
- this._getWindowBorderSize();var div=document.createElement("div");div.className="wired_frame "+this.options.className+"_wired_frame";div.style.position='absolute';this.options.parent.insertBefore(div,this.options.parent.firstChild);this.wiredElement=$(div);}
480
- if(this.useLeft)
481
- this.wiredElement.setStyle({left:this.element.getStyle('left')});else
482
- this.wiredElement.setStyle({right:this.element.getStyle('right')});if(this.useTop)
483
- this.wiredElement.setStyle({top:this.element.getStyle('top')});else
484
- this.wiredElement.setStyle({bottom:this.element.getStyle('bottom')});var dim=this.element.getDimensions();this.wiredElement.setStyle({width:dim.width+"px",height:dim.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement;},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag)
485
- return;if(this.currentDrag==this.element)
486
- this.currentDrag=null;else{if(this.useLeft)
487
- this.element.setStyle({left:this.currentDrag.getStyle('left')});else
488
- this.element.setStyle({right:this.currentDrag.getStyle('right')});if(this.useTop)
489
- this.element.setStyle({top:this.currentDrag.getStyle('top')});else
490
- this.element.setStyle({bottom:this.currentDrag.getStyle('bottom')});this.currentDrag.hide();this.currentDrag=null;if(this.doResize)
491
- this.setSize(this.width,this.height);}},_notify:function(eventName){if(this.options[eventName])
492
- this.options[eventName](this);else
493
- Windows.notify(eventName,this);}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(observer){this.removeObserver(observer);this.observers.push(observer);},removeObserver:function(observer){this.observers=this.observers.reject(function(o){return o==observer});},notify:function(eventName,win){this.observers.each(function(o){if(o[eventName])o[eventName](eventName,win);});},getWindow:function(id){return this.windows.detect(function(d){return d.getId()==id});},getFocusedWindow:function(){return this.focusedWindow;},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null;},register:function(win){this.windows.push(win);},addModalWindow:function(win){if(this.modalWindows.length==0){WindowUtilities.disableScreen(win.options.className,'overlay_modal',win.overlayOpacity,win.getId(),win.options.parent);}
494
- else{if(Window.keepMultiModalWindow){$('overlay_modal').style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId());}
495
- else
496
- this.modalWindows.last().element.hide();WindowUtilities._showSelect(win.getId());}
497
- this.modalWindows.push(win);},removeModalWindow:function(win){this.modalWindows.pop();if(this.modalWindows.length==0)
498
- WindowUtilities.enableScreen();else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId());}
499
- else
500
- this.modalWindows.last().element.show();}},register:function(win){this.windows.push(win);},unregister:function(win){this.windows=this.windows.reject(function(d){return d==win});},closeAll:function(){this.windows.each(function(w){Windows.close(w.getId())});},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(win){if(win)win.close()});},minimize:function(id,event){var win=this.getWindow(id)
501
- if(win&&win.visible)
502
- win.minimize();Event.stop(event);},maximize:function(id,event){var win=this.getWindow(id)
503
- if(win&&win.visible)
504
- win.maximize();Event.stop(event);},close:function(id,event){var win=this.getWindow(id);if(win)
505
- win.close();if(event)
506
- Event.stop(event);},blur:function(id){var win=this.getWindow(id);if(!win)
507
- return;if(win.options.blurClassName)
508
- win.changeClassName(win.options.blurClassName);if(this.focusedWindow==win)
509
- this.focusedWindow=null;win._notify("onBlur");},focus:function(id){var win=this.getWindow(id);if(!win)
510
- return;if(this.focusedWindow)
511
- this.blur(this.focusedWindow.getId())
512
- if(win.options.focusClassName)
513
- win.changeClassName(win.options.focusClassName);this.focusedWindow=win;win._notify("onFocus");},unsetOverflow:function(except){this.windows.each(function(d){d.oldOverflow=d.getContent().getStyle("overflow")||"auto";d.getContent().setStyle({overflow:"hidden"})});if(except&&except.oldOverflow)
514
- except.getContent().setStyle({overflow:except.oldOverflow});},resetOverflow:function(){this.windows.each(function(d){if(d.oldOverflow)d.getContent().setStyle({overflow:d.oldOverflow})});},updateZindex:function(zindex,win){if(zindex>this.maxZIndex){this.maxZIndex=zindex;if(this.focusedWindow)
515
- this.blur(this.focusedWindow.getId())}
516
- this.focusedWindow=win;if(this.focusedWindow)
517
- this.focus(this.focusedWindow.getId())}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.confirm);return}
518
- content=content||"";parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";var cancelLabel=parameters.cancelLabel?parameters.cancelLabel:"Cancel";parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'"
519
- var cancelButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" cancel_button'"
520
- var content="\
521
- <div class='"+parameters.className+"_message'>"+content+"</div>\
522
- <div class='"+parameters.className+"_buttons'>\
523
- <input type='button' value='"+okLabel+"' onclick='Dialog.okCallback()' "+okButtonClass+"/>\
524
- <input type='button' value='"+cancelLabel+"' onclick='Dialog.cancelCallback()' "+cancelButtonClass+"/>\
525
- </div>\
526
- ";return this._openDialog(content,parameters)},alert:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.alert);return}
527
- content=content||"";parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'"
528
- var content="\
529
- <div class='"+parameters.className+"_message'>"+content+"</div>\
530
- <div class='"+parameters.className+"_buttons'>\
531
- <input type='button' value='"+okLabel+"' onclick='Dialog.okCallback()' "+okButtonClass+"/>\
532
- </div>";return this._openDialog(content,parameters)},info:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.info);return}
533
- content=content||"";parameters=parameters||{};parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var content="<div id='modal_dialog_message' class='"+parameters.className+"_message'>"+content+"</div>";if(parameters.showProgress)
534
- content+="<div id='modal_dialog_progress' class='"+parameters.className+"_progress'> </div>";parameters.ok=null;parameters.cancel=null;return this._openDialog(content,parameters)},setInfoMessage:function(message){$('modal_dialog_message').update(message);},closeInfo:function(){Windows.close(this.dialogId);},_openDialog:function(content,parameters){var className=parameters.className;if(!parameters.height&&!parameters.width){parameters.width=WindowUtilities.getPageSize(parameters.options.parent||document.body).pageWidth/2;}
535
- if(parameters.id)
536
- this.dialogId=parameters.id;else{var t=new Date();this.dialogId='modal_dialog_'+t.getTime();parameters.id=this.dialogId;}
537
- if(!parameters.height||!parameters.width){var size=WindowUtilities._computeSize(content,this.dialogId,parameters.width,parameters.height,5,className)
538
- if(parameters.height)
539
- parameters.width=size+5
540
- else
541
- parameters.height=size+5}
542
- parameters.effectOptions=parameters.effectOptions;parameters.resizable=parameters.resizable||false;parameters.minimizable=parameters.minimizable||false;parameters.maximizable=parameters.maximizable||false;parameters.draggable=parameters.draggable||false;parameters.closable=parameters.closable||false;var win=new Window(parameters);win.getContent().innerHTML=content;win.showCenter(true,parameters.top,parameters.left);win.setDestroyOnClose();win.cancelCallback=parameters.onCancel||parameters.cancel;win.okCallback=parameters.onOk||parameters.ok;return win;},_getAjaxContent:function(originalRequest){Dialog.callFunc(originalRequest.responseText,Dialog.parameters)},_runAjaxRequest:function(message,parameters,callFunc){if(message.options==null)
543
- message.options={}
544
- Dialog.onCompleteFunc=message.options.onComplete;Dialog.parameters=parameters;Dialog.callFunc=callFunc;message.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(message.url,message.options);},okCallback:function(){var win=Windows.focusedWindow;if(!win.okCallback||win.okCallback(win)){$$("#"+win.getId()+" input").each(function(element){element.onclick=null;})
545
- win.close();}},cancelCallback:function(){var win=Windows.focusedWindow;$$("#"+win.getId()+" input").each(function(element){element.onclick=null})
546
- win.close();if(win.cancelCallback)
547
- win.cancelCallback(win);}}
548
- if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1]);}
549
- var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight;}
550
- else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
551
- if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight}}}
552
- return{top:T,left:L,width:W,height:H};},getPageSize:function(parent){parent=parent||document.body;var windowWidth,windowHeight;var pageHeight,pageWidth;if(parent!=document.body){windowWidth=parent.getWidth();windowHeight=parent.getHeight();pageWidth=parent.scrollWidth;pageHeight=parent.scrollHeight;}
553
- else{var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
554
- if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
555
- if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
556
- if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}}
557
- return{pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:windowWidth,windowHeight:windowHeight};},disableScreen:function(className,overlayId,overlayOpacity,contentId,parent){WindowUtilities.initLightbox(overlayId,className,function(){this._disableScreen(className,overlayId,overlayOpacity,contentId)}.bind(this),parent||document.body);},_disableScreen:function(className,overlayId,overlayOpacity,contentId){var objOverlay=$(overlayId);var pageSize=WindowUtilities.getPageSize(objOverlay.parentNode);if(contentId&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(contentId);}
558
- objOverlay.style.height=(pageSize.pageHeight+'px');objOverlay.style.display='none';if(overlayId=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){objOverlay.overlayOpacity=overlayOpacity;new Effect.Appear(objOverlay,Object.extend({from:0,to:overlayOpacity},Windows.overlayShowEffectOptions));}
559
- else
560
- objOverlay.style.display="block";},enableScreen:function(id){id=id||'overlay_modal';var objOverlay=$(id);if(objOverlay){if(id=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions)
561
- new Effect.Fade(objOverlay,Object.extend({from:objOverlay.overlayOpacity,to:0},Windows.overlayHideEffectOptions));else{objOverlay.style.display='none';objOverlay.parentNode.removeChild(objOverlay);}
562
- if(id!="__invisible__")
563
- WindowUtilities._showSelect();}},_hideSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+'select').each(function(element){if(!WindowUtilities.isDefined(element.oldVisibility)){element.oldVisibility=element.style.visibility?element.style.visibility:"visible";element.style.visibility="hidden";}});}},_showSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+'select').each(function(element){if(WindowUtilities.isDefined(element.oldVisibility)){try{element.style.visibility=element.oldVisibility;}catch(e){element.style.visibility="visible";}
564
- element.oldVisibility=null;}
565
- else{if(element.style.visibility)
566
- element.style.visibility="visible";}});}},isDefined:function(object){return typeof(object)!="undefined"&&object!=null;},initLightbox:function(id,className,doneHandler,parent){if($(id)){Element.setStyle(id,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;doneHandler();}
567
- else{var objOverlay=document.createElement("div");objOverlay.setAttribute('id',id);objOverlay.className="overlay_"+className
568
- objOverlay.style.display='none';objOverlay.style.position='absolute';objOverlay.style.top='0';objOverlay.style.left='0';objOverlay.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;objOverlay.style.width='100%';parent.insertBefore(objOverlay,parent.firstChild);if(Prototype.Browser.WebKit&&id=="overlay_modal"){setTimeout(function(){doneHandler()},10);}
569
- else
570
- doneHandler();}},setCookie:function(value,parameters){document.cookie=parameters[0]+"="+escape(value)+
571
- ((parameters[1])?"; expires="+parameters[1].toGMTString():"")+
572
- ((parameters[2])?"; path="+parameters[2]:"")+
573
- ((parameters[3])?"; domain="+parameters[3]:"")+
574
- ((parameters[4])?"; secure":"");},getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else{begin+=2;}
575
- var end=document.cookie.indexOf(";",begin);if(end==-1){end=dc.length;}
576
- return unescape(dc.substring(begin+prefix.length,end));},_computeSize:function(content,id,width,height,margin,className){var objBody=document.body;var tmpObj=document.createElement("div");tmpObj.setAttribute('id',id);tmpObj.className=className+"_content";if(height)
577
- tmpObj.style.height=height+"px"
578
- else
579
- tmpObj.style.width=width+"px"
580
- tmpObj.style.position='absolute';tmpObj.style.top='0';tmpObj.style.left='0';tmpObj.style.display='none';tmpObj.innerHTML=content;objBody.insertBefore(tmpObj,objBody.firstChild);var size;if(height)
581
- size=$(tmpObj).getDimensions().width+margin;else
582
- size=$(tmpObj).getDimensions().height+margin;objBody.removeChild(tmpObj);return size;}};var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName){elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try{parentElement.innerHTML="<"+elementName+"></"+elementName+">";}catch(e){}
583
- var element=parentElement.firstChild||null;if(element&&(element.tagName.toUpperCase()!=elementName))
584
- element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1])
585
- if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)||arguments[1].tagName){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+
586
- attrs+"></"+elementName+">";}catch(e){}
587
- element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1])
588
- element[attr=='class'?'className':attr]=arguments[1][attr];}
589
- if(element.tagName.toUpperCase()!=elementName)
590
- element=parentElement.getElementsByTagName(elementName)[0];}}
591
- if(arguments[2])
592
- this._children(element,arguments[2]);return $(element);},_text:function(text){return document.createTextNode(text);},ATTR_MAP:{'className':'class','htmlFor':'for'},_attributes:function(attributes){var attrs=[];for(attribute in attributes)
593
- attrs.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;')+'"');return attrs.join(" ");},_children:function(element,children){if(children.tagName){element.appendChild(children);return;}
594
- if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object')
595
- element.appendChild(e);else
596
- if(Builder._isStringOrNumber(e))
597
- element.appendChild(Builder._text(e));});}else
598
- if(Builder._isStringOrNumber(children))
599
- element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');},build:function(html){var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope){if(typeof scope!='object'&&typeof scope!='function')scope=window;var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));};});}};;String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
600
- return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
601
- elements=element;else
602
- elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
603
- effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
604
- this.effects.push(effect);if(!this.interval)
605
- this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
606
- this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
607
- (options[eventName]?'this.options.'+eventName+'(this);':''));}
608
- if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function dispatch(effect,eventName){if(effect.options[eventName+'Internal'])
609
- effect.options[eventName+'Internal'](effect);if(effect.options[eventName])
610
- effect.options[eventName](effect);}
611
- return function(pos){if(this.state==="idle"){this.state="running";dispatch(this,'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');}
612
- if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+this.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update)this.update(pos);dispatch(this,'afterUpdate');}};})();this.event('beforeStart');if(!this.options.sync)
613
- Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
614
- var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
615
- Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
616
- if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
617
- this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
618
- this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
619
- this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
620
- this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
621
- this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
622
- this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
623
- this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
624
- if(!this.options.endcolor)
625
- this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
626
- this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
627
- return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
628
- return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{},oldOpacity=element.getInlineOpacity(),transition=options.transition||Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
629
- this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
630
- this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16);});}
631
- this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
632
- this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
633
- var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
634
- style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
635
- (Math.round(transform.originalValue[0]+
636
- (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
637
- (Math.round(transform.originalValue[1]+
638
- (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
639
- (Math.round(transform.originalValue[2]+
640
- (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
641
- (transform.targetValue-transform.originalValue)*position).toFixed(3)+
642
- (transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
643
- style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
644
- Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
645
- styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};}
646
- Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);;if(Object.isUndefined(Effect))
647
- throw("dragdrop.js requires including script.aculo.us' effects.js library");var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if(Object.isArray(containment)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
648
- if(options.accept)options.accept=[options.accept].flatten();Element.makePositioned(element);options.element=element;this.drops.push(options);},findDeepestChild:function(drops){deepest=drops[0];for(i=1;i<drops.length;++i)
649
- if(Element.isParent(drops[i].element,deepest.element))
650
- deepest=drops[i];return deepest;},isContained:function(element,drop){var containmentNode;if(drop.tree){containmentNode=element.treeNode;}else{containmentNode=element.parentNode;}
651
- return drop._containers.detect(function(c){return containmentNode==c});},isAffected:function(point,element,drop){return((drop.element!=element)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&Position.within(drop.element,point[0],point[1]));},deactivate:function(drop){if(drop.hoverclass)
652
- Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(drop.hoverclass)
653
- Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(point,element){if(!this.drops.length)return;var drop,affected=[];this.drops.each(function(drop){if(Droppables.isAffected(point,element,drop))
654
- affected.push(drop);});if(affected.length>0)
655
- drop=Droppables.findDeepestChild(affected);if(this.last_active&&this.last_active!=drop)this.deactivate(this.last_active);if(drop){Position.within(drop.element,point[0],point[1]);if(drop.onHover)
656
- drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));if(drop!=this.last_active)Droppables.activate(drop);}},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(event),Event.pointerY(event)],element,this.last_active))
657
- if(this.last_active.onDrop){this.last_active.onDrop(element,this.last_active.element,event);return true;}},reset:function(){if(this.last_active)
658
- this.deactivate(this.last_active);}};var Draggables={drags:[],observers:[],register:function(draggable){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(draggable.element,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}
659
- this.drags.push(draggable);},unregister:function(draggable){this.drags=this.drags.reject(function(d){return d==draggable});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(draggable.element,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(draggable){if(draggable.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=draggable;}.bind(this),draggable.options.delay);}else{window.focus();this.activeDraggable=draggable;}},deactivate:function(){this.activeDraggable=null;},updateDrag:function(event){if(!this.activeDraggable)return;var pointer=[Event.pointerX(event),Event.pointerY(event)];if(this._lastPointer&&(this._lastPointer.inspect()==pointer.inspect()))return;this._lastPointer=pointer;this.activeDraggable.updateDrag(event,pointer);},endDrag:function(event){if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}
660
- if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(event);this.activeDraggable=null;},keyPress:function(event){if(this.activeDraggable)
661
- this.activeDraggable.keyPress(event);},addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
662
- this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});if(draggable.options[eventName])draggable.options[eventName](draggable,event);},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}};var Draggable=Class.create({initialize:function(element){var defaults={handle:false,reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;new Effect.Move(element,{x:-left_offset,y:-top_offset,duration:dur,queue:{scope:'_draggable',position:'end'}});},endeffect:function(element){var toOpacity=Object.isNumber(element._opacity)?element._opacity:1.0;new Effect.Opacity(element,{duration:0.2,from:0.7,to:toOpacity,queue:{scope:'_draggable',position:'end'},afterFinish:function(){Draggable._dragging[element]=false}});},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect))
663
- Object.extend(defaults,{starteffect:function(element){element._opacity=Element.getOpacity(element);Draggable._dragging[element]=true;new Effect.Opacity(element,{duration:0.2,from:element._opacity,to:0.7});}});var options=Object.extend(defaults,arguments[1]||{});this.element=$(element);if(options.handle&&Object.isString(options.handle))
664
- this.handle=this.element.down('.'+options.handle,0);if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;if(options.scroll&&!options.scroll.scrollTo&&!options.scroll.outerHTML){options.scroll=$(options.scroll);this._isScrollChild=Element.childOf(this.element,options.scroll);}
665
- Element.makePositioned(this.element);this.options=options;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')]);},initDrag:function(event){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(event)){var src=Event.element(event);if((tag_name=src.tagName.toUpperCase())&&(tag_name=='INPUT'||tag_name=='SELECT'||tag_name=='OPTION'||tag_name=='BUTTON'||tag_name=='TEXTAREA'))return;var pointer=[Event.pointerX(event),Event.pointerY(event)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(pointer[i]-pos[i])});Draggables.activate(this);Event.stop(event);}},startDrag:function(event){this.dragging=true;if(!this.delta)
666
- this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex;}
667
- if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=(this.element.getStyle('position')=='absolute');if(!this._originallyAbsolute)
668
- Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
669
- if(this.options.scroll){if(this.options.scroll==window){var where=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=where.left;this.originalScrollTop=where.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}
670
- Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element);}
671
- Draggables.notify('onDrag',this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}
672
- var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity))speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<(p[1]+this.options.scrollSensitivity))speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>(p[2]-this.options.scrollSensitivity))speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>(p[3]-this.options.scrollSensitivity))speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed);}
673
- if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);},finishDrag:function(event,success){this.dragging=false;if(this.options.quiet){Position.prepare();var pointer=[Event.pointerX(event),Event.pointerY(event)];Droppables.show(pointer,this.element);}
674
- if(this.options.ghosting){if(!this._originallyAbsolute)
675
- Position.relativize(this.element);delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null;}
676
- var dropped=false;if(success){dropped=Droppables.fire(event,this.element);if(!dropped)dropped=false;}
677
- if(dropped&&this.options.onDropped)this.options.onDropped(this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&Object.isFunction(revert))revert=revert(this.element);var d=this.currentDelta();if(revert&&this.options.reverteffect){if(dropped==0||revert!='failure')
678
- this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}else{this.delta=d;}
679
- if(this.options.zindex)
680
- this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
681
- this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset();},keyPress:function(event){if(event.keyCode!=Event.KEY_ESC)return;this.finishDrag(event,false);Event.stop(event);},endDrag:function(event){if(!this.dragging)return;this.stopScrolling();this.finishDrag(event,true);Event.stop(event);},draw:function(point){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}
682
- var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
683
- var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){p=this.options.snap(p[0],p[1],this);}else{if(Object.isArray(this.options.snap)){p=p.map(function(v,i){return(v/this.options.snap[i]).round()*this.options.snap[i]}.bind(this));}else{p=p.map(function(v){return(v/this.options.snap).round()*this.options.snap}.bind(this));}}}
684
- var style=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))
685
- style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
686
- style.top=p[1]+"px";if(style.visibility=="hidden")style.visibility="";},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(speed){if(!(speed[0]||speed[1]))return;this.scrollSpeed=[speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000;}
687
- Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0)
688
- Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)
689
- Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer);}
690
- if(this.options.change)this.options.change(this);},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
691
- if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight;}}
692
- return{top:T,left:L,width:W,height:H};}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
693
- this.observer(this.element)}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(element){while(element.tagName.toUpperCase()!="BODY"){if(element.id&&Sortable.sortables[element.id])return element;element=element.parentNode;}},options:function(element){element=Sortable._findRootElement($(element));if(!element)return;return Sortable.sortables[element.id];},destroy:function(element){element=$(element);var s=Sortable.sortables[element.id];if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id];}},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,quiet:options.quiet,scroll:options.scroll,scrollSpeed:options.scrollSpeed,scrollSensitivity:options.scrollSensitivity,delay:options.delay,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
694
- options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
695
- options_for_draggable.reverteffect=options.reverteffect;else
696
- if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
697
- options_for_draggable.endeffect=options.endeffect;if(options.zindex)
698
- options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,tree:options.tree,hoverclass:options.hoverclass,onHover:Sortable.onHover};var options_for_tree={onHover:Sortable.onEmptyHover,overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass};Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty||options.tree){Droppables.add(element,options_for_tree);options.droppables.push(element);}
699
- (options.elements||this.findElements(element,options)||[]).each(function(e,i){var handle=options.handles?$(options.handles[i]):(options.handle?$(e).select('.'+options.handle)[0]:e);options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);if(options.tree)e.treeNode=element;options.droppables.push(e);});if(options.tree){(Sortable.findTreeElements(element,options)||[]).each(function(e){Droppables.add(e,options_for_tree);e.treeNode=element;options.droppables.push(e);});}
700
- this.sortables[element.id]=options;Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.tag);},findTreeElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.treeTag);},onHover:function(element,dropon,overlap){if(Element.isParent(dropon,element))return;if(overlap>.33&&overlap<.66&&Sortable.options(dropon).tree){return;}else if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
701
- Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
702
- Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon,overlap){var oldParentNode=element.parentNode;var droponOptions=Sortable.options(dropon);if(!Element.isParent(dropon,element)){var index;var children=Sortable.findElements(dropon,{tag:droponOptions.tag,only:droponOptions.only});var child=null;if(children){var offset=Element.offsetSize(dropon,droponOptions.overlap)*(1.0-overlap);for(index=0;index<children.length;index+=1){if(offset-Element.offsetSize(children[index],droponOptions.overlap)>=0){offset-=Element.offsetSize(children[index],droponOptions.overlap);}else if(offset-(Element.offsetSize(children[index],droponOptions.overlap)/2)>=0){child=index+1<children.length?children[index+1]:null;break;}else{child=children[index];break;}}}
703
- dropon.insertBefore(element,child);Sortable.options(oldParentNode).onChange(element);droponOptions.onChange(element);}},unmark:function(){if(Sortable._marker)Sortable._marker.hide();},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=($('dropmarker')||Element.extend(document.createElement('DIV'))).hide().addClassName('dropmarker').setStyle({position:'absolute'});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
704
- var offsets=Position.cumulativeOffset(dropon);Sortable._marker.setStyle({left:offsets[0]+'px',top:offsets[1]+'px'});if(position=='after')
705
- if(sortable.overlap=='horizontal')
706
- Sortable._marker.setStyle({left:(offsets[0]+dropon.clientWidth)+'px'});else
707
- Sortable._marker.setStyle({top:(offsets[1]+dropon.clientHeight)+'px'});Sortable._marker.show();},_tree:function(element,options,parent){var children=Sortable.findElements(element,options)||[];for(var i=0;i<children.length;++i){var match=children[i].id.match(options.format);if(!match)continue;var child={id:encodeURIComponent(match?match[1]:null),element:element,parent:parent,children:[],position:parent.children.length,container:$(children[i]).down(options.treeTag)};if(child.container)
708
- this._tree(child.container,options,child);parent.children.push(child);}
709
- return parent;},tree:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,treeTag:sortableOptions.treeTag,only:sortableOptions.only,name:element.id,format:sortableOptions.format},arguments[1]||{});var root={id:null,parent:null,children:[],container:element,position:0};return Sortable._tree(element,options,root);},_constructIndex:function(node){var index='';do{if(node.id)index='['+node.position+']'+index;}while((node=node.parent)!=null);return index;},sequence:function(element){element=$(element);var options=Object.extend(this.options(element),arguments[1]||{});return $(this.findElements(element,options)||[]).map(function(item){return item.id.match(options.format)?item.id.match(options.format)[1]:'';});},setSequence:function(element,new_sequence){element=$(element);var options=Object.extend(this.options(element),arguments[2]||{});var nodeMap={};this.findElements(element,options).each(function(n){if(n.id.match(options.format))
710
- nodeMap[n.id.match(options.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n);});new_sequence.each(function(ident){var n=nodeMap[ident];if(n){n[1].appendChild(n[0]);delete nodeMap[ident];}});},serialize:function(element){element=$(element);var options=Object.extend(Sortable.options(element),arguments[1]||{});var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:element.id);if(options.tree){return Sortable.tree(element,arguments[1]).children.map(function(item){return[name+Sortable._constructIndex(item)+"[id]="+
711
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));}).flatten().join('&');}else{return Sortable.sequence(element,arguments[1]).map(function(item){return name+"[]="+encodeURIComponent(item);}).join('&');}}};Element.isParent=function(child,element){if(!child.parentNode||child==element)return false;if(child.parentNode==element)return true;return Element.isParent(child.parentNode,element);};Element.findChildren=function(element,only,recursive,tagName){if(!element.hasChildNodes())return null;tagName=tagName.toUpperCase();if(only)only=[only].flatten();var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==tagName&&(!only||(Element.classNames(e).detect(function(v){return only.include(v)}))))
712
- elements.push(e);if(recursive){var grandchildren=Element.findChildren(e,only,recursive,tagName);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():[]);};Element.offsetSize=function(element,type){return element['offset'+((type=='vertical'||type=='height')?'Height':'Width')];};;if(typeof Effect=='undefined')
713
- throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element);this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
714
- this.setOptions(options);else
715
- this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
716
- Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
717
- this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
718
- this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keydown',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
719
- if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
720
- switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
721
- else
722
- if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
723
- {this.index=element.autocompleteIndex;this.render();}
724
- Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
725
- this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1;},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;this.getEntry(this.index).scrollIntoView(false);},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
726
- var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
727
- value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
728
- newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
729
- this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
730
- this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
731
- this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
732
- this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
733
- return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
734
- if(newS[index]!=oldS[index])
735
- return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
736
- encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
737
- this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
738
- elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
739
- elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
740
- foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
741
- if(partial.length)
742
- ret=ret.concat(partial.slice(0,instance.options.choices-ret.length));return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);};Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId))
743
- this.options.formId='';}
744
- if(this.options.externalControl)
745
- this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)
746
- this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
747
- this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
748
- this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
749
- btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses)
750
- link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
751
- fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur)
752
- fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
753
- this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase())
754
- this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization)
755
- this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
756
- this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl)
757
- this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)
758
- this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName)
759
- this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML.unescapeHTML();},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
760
- params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
761
- if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)
762
- this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName)
763
- this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
764
- text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
765
- $(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
766
- this.element.observe(pair.key,listener);if(this.options.externalControl)
767
- this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
768
- this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
769
- this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)
770
- this.loadCollection();else
771
- this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))
772
- throw('Server returned an invalid collection representation.');this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
773
- tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)
774
- this.loadExternalText();else
775
- this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
776
- ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});;if(!Control)var Control={};Control.Slider=Class.create({initialize:function(handle,track,options){var slider=this;if(Object.isArray(handle)){this.handles=handle.collect(function(e){return $(e)});}else{this.handles=[$(handle)];}
777
- this.track=$(track);this.options=options||{};this.axis=this.options.axis||'horizontal';this.increment=this.options.increment||1;this.step=parseInt(this.options.step||'1');this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(s){return $(s)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||'0');this.alignY=parseInt(this.options.alignY||'0');this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled)this.setDisabled();this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max();}
778
- this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(h,i){i=slider.handles.length-1-i;slider.setValue(parseFloat((Object.isArray(slider.options.sliderValue)?slider.options.sliderValue[i]:slider.options.sliderValue)||slider.range.start),i);h.makePositioned().observe("mousedown",slider.eventMouseDown);});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);$(this.track.parentNode.parentNode).observe("mousemove",this.eventMouseMove);this.initialized=true;},dispose:function(){var slider=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(this.track.parentNode.parentNode,"mousemove",this.eventMouseMove);this.handles.each(function(h){Event.stopObserving(h,"mousedown",slider.eventMouseDown);});},setDisabled:function(){this.disabled=true;this.track.parentNode.className=this.track.parentNode.className+' disabled';},setEnabled:function(){this.disabled=false;},getNearestValue:function(value){if(this.allowedValues){if(value>=this.allowedValues.max())return(this.allowedValues.max());if(value<=this.allowedValues.min())return(this.allowedValues.min());var offset=Math.abs(this.allowedValues[0]-value);var newValue=this.allowedValues[0];this.allowedValues.each(function(v){var currentOffset=Math.abs(v-value);if(currentOffset<=offset){newValue=v;offset=currentOffset;}});return newValue;}
779
- if(value>this.range.end)return this.range.end;if(value<this.range.start)return this.range.start;return value;},setValue:function(sliderValue,handleIdx){if(!this.active){this.activeHandleIdx=handleIdx||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles();}
780
- handleIdx=handleIdx||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((handleIdx>0)&&(sliderValue<this.values[handleIdx-1]))
781
- sliderValue=this.values[handleIdx-1];if((handleIdx<(this.handles.length-1))&&(sliderValue>this.values[handleIdx+1]))
782
- sliderValue=this.values[handleIdx+1];}
783
- sliderValue=this.getNearestValue(sliderValue);this.values[handleIdx]=sliderValue;this.value=this.values[0];this.handles[handleIdx].style[this.isVertical()?'top':'left']=this.translateToPx(sliderValue);this.drawSpans();if(!this.dragging||!this.event)this.updateFinished();},setValueBy:function(delta,handleIdx){this.setValue(this.values[handleIdx||this.activeHandleIdx||0]+delta,handleIdx||this.activeHandleIdx||0);},translateToPx:function(value){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(value-this.range.start))+"px";},translateToValue:function(offset){return((offset/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start);},getRange:function(range){var v=this.values.sortBy(Prototype.K);range=range||0;return $R(v[range],v[range+1]);},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX);},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX);},isVertical:function(){return(this.axis=='vertical');},drawSpans:function(){var slider=this;if(this.spans)
784
- $R(0,this.spans.length-1).each(function(r){slider.setSpan(slider.spans[r],slider.getRange(r))});if(this.options.startSpan)
785
- this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value));if(this.options.endSpan)
786
- this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum));},setSpan:function(span,range){if(this.isVertical()){span.style.top=this.translateToPx(range.start);span.style.height=this.translateToPx(range.end-range.start+this.range.start);}else{span.style.left=this.translateToPx(range.start);span.style.width=this.translateToPx(range.end-range.start+this.range.start);}},updateStyles:function(){this.handles.each(function(h){Element.removeClassName(h,'selected')});Element.addClassName(this.activeHandle,'selected');},startDrag:function(event){if(Event.isLeftClick(event)){if(!this.disabled){this.active=true;var handle=Event.element(event);var pointer=[Event.pointerX(event),Event.pointerY(event)];var track=handle;if(track==this.track){var offsets=Position.cumulativeOffset(this.track);this.event=event;this.setValue(this.translateToValue((this.isVertical()?pointer[1]-offsets[1]:pointer[0]-offsets[0])-(this.handleLength/2)));var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}else{while((this.handles.indexOf(handle)==-1)&&handle.parentNode)
787
- handle=handle.parentNode;if(this.handles.indexOf(handle)!=-1){this.activeHandle=handle;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}}}
788
- Event.stop(event);}},update:function(event){if(this.active){if(!this.dragging)this.dragging=true;this.draw(event);if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);}},draw:function(event){var pointer=[Event.pointerX(event),Event.pointerY(event)];var offsets=Position.cumulativeOffset(this.track);pointer[0]-=this.offsetX+offsets[0];pointer[1]-=this.offsetY+offsets[1];this.event=event;this.setValue(this.translateToValue(this.isVertical()?pointer[1]:pointer[0]));if(this.initialized&&this.options.onSlide)
789
- this.options.onSlide(this.values.length>1?this.values:this.value,this);},endDrag:function(event){if(this.active&&this.dragging){this.finishDrag(event,true);Event.stop(event);}
790
- this.active=false;this.dragging=false;},finishDrag:function(event,success){this.active=false;this.dragging=false;this.updateFinished();},updateFinished:function(){if(this.initialized&&this.options.onChange)
791
- this.options.onChange(this.values.length>1?this.values:this.value,this);this.event=null;}});;var Validator=Class.create();Validator.prototype={initialize:function(className,error,test,options){if(typeof test=='function'){this.options=$H(options);this._test=test;}else{this.options=$H(test);this._test=function(){return true};}
792
- this.error=error||'Validation failed.';this.className=className;},test:function(v,elm){return(this._test(v,elm)&&this.options.all(function(p){return Validator.methods[p.key]?Validator.methods[p.key](v,elm,p.value):true;}));}}
793
- Validator.methods={pattern:function(v,elm,opt){return Validation.get('IsEmpty').test(v)||opt.test(v)},minLength:function(v,elm,opt){return v.length>=opt},maxLength:function(v,elm,opt){return v.length<=opt},min:function(v,elm,opt){return v>=parseFloat(opt)},max:function(v,elm,opt){return v<=parseFloat(opt)},notOneOf:function(v,elm,opt){return $A(opt).all(function(value){return v!=value;})},oneOf:function(v,elm,opt){return $A(opt).any(function(value){return v==value;})},is:function(v,elm,opt){return v==opt},isNot:function(v,elm,opt){return v!=opt},equalToField:function(v,elm,opt){return v==$F(opt)},notEqualToField:function(v,elm,opt){return v!=$F(opt)},include:function(v,elm,opt){return $A(opt).all(function(value){return Validation.get(value).test(v,elm);})}}
794
- var Validation=Class.create();Validation.defaultOptions={onSubmit:true,stopOnFirst:false,immediate:false,focusOnError:true,useTitles:false,addClassNameToContainer:false,containerClassName:'.input-box',onFormValidate:function(result,form){},onElementValidate:function(result,elm){}};Validation.prototype={initialize:function(form,options){this.form=$(form);if(!this.form){return;}
795
- this.options=Object.extend({onSubmit:Validation.defaultOptions.onSubmit,stopOnFirst:Validation.defaultOptions.stopOnFirst,immediate:Validation.defaultOptions.immediate,focusOnError:Validation.defaultOptions.focusOnError,useTitles:Validation.defaultOptions.useTitles,onFormValidate:Validation.defaultOptions.onFormValidate,onElementValidate:Validation.defaultOptions.onElementValidate},options||{});if(this.options.onSubmit)Event.observe(this.form,'submit',this.onSubmit.bind(this),false);if(this.options.immediate){Form.getElements(this.form).each(function(input){if(input.tagName.toLowerCase()=='select'){Event.observe(input,'blur',this.onChange.bindAsEventListener(this));}
796
- if(input.type.toLowerCase()=='radio'||input.type.toLowerCase()=='checkbox'){Event.observe(input,'click',this.onChange.bindAsEventListener(this));}else{Event.observe(input,'change',this.onChange.bindAsEventListener(this));}},this);}},onChange:function(ev){Validation.isOnChange=true;Validation.validate(Event.element(ev),{useTitle:this.options.useTitles,onElementValidate:this.options.onElementValidate});Validation.isOnChange=false;},onSubmit:function(ev){if(!this.validate())Event.stop(ev);},validate:function(){var result=false;var useTitles=this.options.useTitles;var callback=this.options.onElementValidate;try{if(this.options.stopOnFirst){result=Form.getElements(this.form).all(function(elm){if(elm.hasClassName('local-validation')&&!this.isElementInForm(elm,this.form)){return true;}
797
- return Validation.validate(elm,{useTitle:useTitles,onElementValidate:callback});},this);}else{result=Form.getElements(this.form).collect(function(elm){if(elm.hasClassName('local-validation')&&!this.isElementInForm(elm,this.form)){return true;}
798
- return Validation.validate(elm,{useTitle:useTitles,onElementValidate:callback});},this).all();}}catch(e){}
799
- if(!result&&this.options.focusOnError){try{Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()}
800
- catch(e){}}
801
- this.options.onFormValidate(result,this.form);return result;},reset:function(){Form.getElements(this.form).each(Validation.reset);},isElementInForm:function(elm,form){var domForm=elm.up('form');if(domForm==form){return true;}
802
- return false;}}
803
- Object.extend(Validation,{validate:function(elm,options){options=Object.extend({useTitle:false,onElementValidate:function(result,elm){}},options||{});elm=$(elm);var cn=$w(elm.className);return result=cn.all(function(value){var test=Validation.test(value,elm,options.useTitle);options.onElementValidate(test,elm);return test;});},insertAdvice:function(elm,advice){var container=$(elm).up('.field-row');if(container){Element.insert(container,{after:advice});}else if(elm.up('td.value')){elm.up('td.value').insert({bottom:advice});}else if(elm.advaiceContainer&&$(elm.advaiceContainer)){$(elm.advaiceContainer).update(advice);}
804
- else{switch(elm.type.toLowerCase()){case'checkbox':case'radio':var p=elm.parentNode;if(p){Element.insert(p,{'bottom':advice});}else{Element.insert(elm,{'after':advice});}
805
- break;default:Element.insert(elm,{'after':advice});}}},showAdvice:function(elm,advice,adviceName){if(!elm.advices){elm.advices=new Hash();}
806
- else{elm.advices.each(function(pair){this.hideAdvice(elm,pair.value);}.bind(this));}
807
- elm.advices.set(adviceName,advice);if(typeof Effect=='undefined'){advice.style.display='block';}else{if(!advice._adviceAbsolutize){new Effect.Appear(advice,{duration:1});}else{Position.absolutize(advice);advice.show();advice.setStyle({'top':advice._adviceTop,'left':advice._adviceLeft,'width':advice._adviceWidth,'z-index':1000});advice.addClassName('advice-absolute');}}},hideAdvice:function(elm,advice){if(advice!=null)advice.hide();},updateCallback:function(elm,status){if(typeof elm.callbackFunction!='undefined'){eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')');}},ajaxError:function(elm,errorMsg){var name='validate-ajax';var advice=Validation.getAdvice(name,elm);if(advice==null){advice=this.createAdvice(name,elm,false,errorMsg);}
808
- this.showAdvice(elm,advice,'validate-ajax');this.updateCallback(elm,'failed');elm.addClassName('validation-failed');elm.addClassName('validate-ajax');if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container&&this.allowContainerClassName(elm)){container.removeClassName('validation-passed');container.addClassName('validation-error');}}},allowContainerClassName:function(elm){if(elm.type=='radio'||elm.type=='checkbox'){return elm.hasClassName('change-container-classname');}
809
- return true;},test:function(name,elm,useTitle){var v=Validation.get(name);var prop='__advice'+name.camelize();try{if(Validation.isVisible(elm)&&!v.test($F(elm),elm)){var advice=Validation.getAdvice(name,elm);if(advice==null){advice=this.createAdvice(name,elm,useTitle);}
810
- this.showAdvice(elm,advice,name);this.updateCallback(elm,'failed');elm[prop]=1;if(!elm.advaiceContainer){elm.removeClassName('validation-passed');elm.addClassName('validation-failed');}
811
- if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container&&this.allowContainerClassName(elm)){container.removeClassName('validation-passed');container.addClassName('validation-error');}}
812
- return false;}else{var advice=Validation.getAdvice(name,elm);this.hideAdvice(elm,advice);this.updateCallback(elm,'passed');elm[prop]='';elm.removeClassName('validation-failed');elm.addClassName('validation-passed');if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container&&!container.down('.validation-failed')&&this.allowContainerClassName(elm)){if(!Validation.get('IsEmpty').test(elm.value)||!this.isVisible(elm)){container.addClassName('validation-passed');}else{container.removeClassName('validation-passed');}
813
- container.removeClassName('validation-error');}}
814
- return true;}}catch(e){throw(e)}},isVisible:function(elm){while(elm.tagName!='BODY'){if(!$(elm).visible())return false;elm=elm.parentNode;}
815
- return true;},getAdvice:function(name,elm){return $('advice-'+name+'-'+Validation.getElmID(elm))||$('advice-'+Validation.getElmID(elm));},createAdvice:function(name,elm,useTitle,customError){var v=Validation.get(name);var errorMsg=useTitle?((elm&&elm.title)?elm.title:v.error):v.error;if(customError){errorMsg=customError;}
816
- try{if(Translator){errorMsg=Translator.translate(errorMsg);}}
817
- catch(e){}
818
- advice='<div class="validation-advice" id="advice-'+name+'-'+Validation.getElmID(elm)+'" style="display:none">'+errorMsg+'</div>'
819
- Validation.insertAdvice(elm,advice);advice=Validation.getAdvice(name,elm);if($(elm).hasClassName('absolute-advice')){var dimensions=$(elm).getDimensions();var originalPosition=Position.cumulativeOffset(elm);advice._adviceTop=(originalPosition[1]+dimensions.height)+'px';advice._adviceLeft=(originalPosition[0])+'px';advice._adviceWidth=(dimensions.width)+'px';advice._adviceAbsolutize=true;}
820
- return advice;},getElmID:function(elm){return elm.id?elm.id:elm.name;},reset:function(elm){elm=$(elm);var cn=$w(elm.className);cn.each(function(value){var prop='__advice'+value.camelize();if(elm[prop]){var advice=Validation.getAdvice(value,elm);if(advice){advice.hide();}
821
- elm[prop]='';}
822
- elm.removeClassName('validation-failed');elm.removeClassName('validation-passed');if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container){container.removeClassName('validation-passed');container.removeClassName('validation-error');}}});},add:function(className,error,test,options){var nv={};nv[className]=new Validator(className,error,test,options);Object.extend(Validation.methods,nv);},addAllThese:function(validators){var nv={};$A(validators).each(function(value){nv[value[0]]=new Validator(value[0],value[1],value[2],(value.length>3?value[3]:{}));});Object.extend(Validation.methods,nv);},get:function(name){return Validation.methods[name]?Validation.methods[name]:Validation.methods['_LikeNoIDIEverSaw_'];},methods:{'_LikeNoIDIEverSaw_':new Validator('_LikeNoIDIEverSaw_','',{})}});Validation.add('IsEmpty','',function(v){return(v==''||(v==null)||(v.length==0)||/^\s+$/.test(v));});Validation.addAllThese([['validate-select','Please select an option.',function(v){return((v!="none")&&(v!=null)&&(v.length!=0));}],['required-entry','This is a required field.',function(v){return!Validation.get('IsEmpty').test(v);}],['validate-number','Please enter a valid number in this field.',function(v){return Validation.get('IsEmpty').test(v)||(!isNaN(parseNumber(v))&&!/^\s+$/.test(parseNumber(v)));}],['validate-digits','Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.',function(v){return Validation.get('IsEmpty').test(v)||!/[^\d]/.test(v);}],['validate-alpha','Please use letters only (a-z or A-Z) in this field.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-zA-Z]+$/.test(v)}],['validate-code','Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-z]+[a-z0-9_]+$/.test(v)}],['validate-alphanum','Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-zA-Z0-9]+$/.test(v)
823
- /*/\W/.test(v)*/
824
- }],['validate-street','Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.',function(v){return Validation.get('IsEmpty').test(v)||/^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v)}],['validate-phoneStrict','Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.',function(v){return Validation.get('IsEmpty').test(v)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);}],['validate-phoneLax','Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.',function(v){return Validation.get('IsEmpty').test(v)||/^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);}],['validate-fax','Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.',function(v){return Validation.get('IsEmpty').test(v)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);}],['validate-date','Please enter a valid date.',function(v){var test=new Date(v);return Validation.get('IsEmpty').test(v)||!isNaN(test);}],['validate-email','Please enter a valid email address. For example johndoe@domain.com.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})/i.test(v)}],['validate-emailSender','Please use only visible characters and spaces.',function(v){return Validation.get('IsEmpty').test(v)||/^[\S ]+$/.test(v)}],['validate-password','Please enter 6 or more characters. Leading or trailing spaces will be ignored.',function(v){var pass=v.strip();return!(pass.length>0&&pass.length<6);}],['validate-admin-password','Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.',function(v){var pass=v.strip();if(0==pass.length){return true;}
825
- if(!(/[a-z]/i.test(v))||!(/[0-9]/.test(v))){return false;}
826
- return!(pass.length<7);}],['validate-cpassword','Please make sure your passwords match.',function(v){var conf=$('confirmation')?$('confirmation'):$$('.validate-cpassword')[0];var pass=false;if($('password')){pass=$('password');}
827
- var passwordElements=$$('.validate-password');for(var i=0;i<passwordElements.size();i++){var passwordElement=passwordElements[i];if(passwordElement.up('form').id==conf.up('form').id){pass=passwordElement;}}
828
- if($$('.validate-admin-password').size()){pass=$$('.validate-admin-password')[0];}
829
- return(pass.value==conf.value);}],['validate-url','Please enter a valid URL. http:// is required',function(v){return Validation.get('IsEmpty').test(v)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)}],['validate-clean-url','Please enter a valid URL. For example http://www.example.com or www.example.com',function(v){return Validation.get('IsEmpty').test(v)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)||/^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)}],['validate-identifier','Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page"',function(v){return Validation.get('IsEmpty').test(v)||/^[A-Z0-9][A-Z0-9_\/-]+(\.[A-Z0-9_-]+)*$/i.test(v)}],['validate-xml-identifier','Please enter a valid XML-identifier. For example something_1, block5, id-4',function(v){return Validation.get('IsEmpty').test(v)||/^[A-Z][A-Z0-9_\/-]*$/i.test(v)}],['validate-ssn','Please enter a valid social security number. For example 123-45-6789.',function(v){return Validation.get('IsEmpty').test(v)||/^\d{3}-?\d{2}-?\d{4}$/.test(v);}],['validate-zip','Please enter a valid zip code. For example 90602 or 90602-1234.',function(v){return Validation.get('IsEmpty').test(v)||/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v);}],['validate-zip-international','Please enter a valid zip code.',function(v){return true;}],['validate-date-au','Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.',function(v){if(Validation.get('IsEmpty').test(v))return true;var regex=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!regex.test(v))return false;var d=new Date(v.replace(regex,'$2/$1/$3'));return(parseInt(RegExp.$2,10)==(1+d.getMonth()))&&(parseInt(RegExp.$1,10)==d.getDate())&&(parseInt(RegExp.$3,10)==d.getFullYear());}],['validate-currency-dollar','Please enter a valid $ amount. For example $100.00.',function(v){return Validation.get('IsEmpty').test(v)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)}],['validate-one-required','Please select one of the above options.',function(v,elm){var p=elm.parentNode;var options=p.getElementsByTagName('INPUT');return $A(options).any(function(elm){return $F(elm);});}],['validate-one-required-by-name','Please select one of the options.',function(v,elm){var inputs=$$('input[name="'+elm.name.replace(/([\\"])/g,'\\$1')+'"]');var error=1;for(var i=0;i<inputs.length;i++){if((inputs[i].type=='checkbox'||inputs[i].type=='radio')&&inputs[i].checked==true){error=0;}
830
- if(Validation.isOnChange&&(inputs[i].type=='checkbox'||inputs[i].type=='radio')){Validation.reset(inputs[i]);}}
831
- if(error==0){return true;}else{return false;}}],['validate-not-negative-number','Please enter a valid number in this field.',function(v){v=parseNumber(v);return(!isNaN(v)&&v>=0);}],['validate-state','Please select State/Province.',function(v){return(v!=0||v=='');}],['validate-new-password','Please enter 6 or more characters. Leading or trailing spaces will be ignored.',function(v){if(!Validation.get('validate-password').test(v))return false;if(Validation.get('IsEmpty').test(v)&&v!='')return false;return true;}],['validate-greater-than-zero','Please enter a number greater than 0 in this field.',function(v){if(v.length)
832
- return parseFloat(v)>0;else
833
- return true;}],['validate-zero-or-greater','Please enter a number 0 or greater in this field.',function(v){if(v.length)
834
- return parseFloat(v)>=0;else
835
- return true;}],['validate-cc-number','Please enter a valid credit card number.',function(v,elm){var ccTypeContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_number'))+'_cc_type');if(ccTypeContainer&&typeof Validation.creditCartTypes.get(ccTypeContainer.value)!='undefined'&&Validation.creditCartTypes.get(ccTypeContainer.value)[2]==false){if(!Validation.get('IsEmpty').test(v)&&Validation.get('validate-digits').test(v)){return true;}else{return false;}}
836
- return validateCreditCard(v);}],['validate-cc-type','Credit card number doesn\'t match credit card type',function(v,elm){elm.value=removeDelimiters(elm.value);v=removeDelimiters(v);var ccTypeContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_number'))+'_cc_type');if(!ccTypeContainer){return true;}
837
- var ccType=ccTypeContainer.value;if(typeof Validation.creditCartTypes.get(ccType)=='undefined'){return false;}
838
- if(Validation.creditCartTypes.get(ccType)[0]==false){return true;}
839
- var ccMatchedType='';Validation.creditCartTypes.each(function(pair){if(pair.value[0]&&v.match(pair.value[0])){ccMatchedType=pair.key;throw $break;}});if(ccMatchedType!=ccType){return false;}
840
- if(ccTypeContainer.hasClassName('validation-failed')&&Validation.isOnChange){Validation.validate(ccTypeContainer);}
841
- return true;}],['validate-cc-type-select','Card type doesn\'t match credit card number',function(v,elm){var ccNumberContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_type'))+'_cc_number');if(Validation.isOnChange&&Validation.get('IsEmpty').test(ccNumberContainer.value)){return true;}
842
- if(Validation.get('validate-cc-type').test(ccNumberContainer.value,ccNumberContainer)){Validation.validate(ccNumberContainer);}
843
- return Validation.get('validate-cc-type').test(ccNumberContainer.value,ccNumberContainer);}],['validate-cc-exp','Incorrect credit card expiration date',function(v,elm){var ccExpMonth=v;var ccExpYear=$(elm.id.substr(0,elm.id.indexOf('_expiration'))+'_expiration_yr').value;var currentTime=new Date();var currentMonth=currentTime.getMonth()+1;var currentYear=currentTime.getFullYear();if(ccExpMonth<currentMonth&&ccExpYear==currentYear){return false;}
844
- return true;}],['validate-cc-cvn','Please enter a valid credit card verification number.',function(v,elm){var ccTypeContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_cid'))+'_cc_type');if(!ccTypeContainer){return true;}
845
- var ccType=ccTypeContainer.value;if(typeof Validation.creditCartTypes.get(ccType)=='undefined'){return false;}
846
- var re=Validation.creditCartTypes.get(ccType)[1];if(v.match(re)){return true;}
847
- return false;}],['validate-ajax','',function(v,elm){return true;}],['validate-data','Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.',function(v){if(v!=''&&v){return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v);}
848
- return true;}],['validate-css-length','Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%',function(v){if(v!=''&&v){return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v)&&(!(/\..*\./.test(v)))&&!(/\.$/.test(v));}
849
- return true;}],['validate-length','Maximum length exceeded.',function(v,elm){var re=new RegExp(/^maximum-length-[0-9]+$/);var result=true;$w(elm.className).each(function(name,index){if(name.match(re)&&result){var length=name.split('-')[2];result=(v.length<=length);}});return result;}],['validate-percents','Please enter a number lower than 100',{max:100}]]);function validateCreditCard(s){var v="0123456789";var w="";for(i=0;i<s.length;i++){x=s.charAt(i);if(v.indexOf(x,0)!=-1)
850
- w+=x;}
851
- j=w.length/2;k=Math.floor(j);m=Math.ceil(j)-k;c=0;for(i=0;i<k;i++){a=w.charAt(i*2+m)*2;c+=a>9?Math.floor(a/10+a%10):a;}
852
- for(i=0;i<k+m;i++)c+=w.charAt(i*2+1-m)*1;return(c%10==0);}
853
- function removeDelimiters(v){v=v.replace(/\s/g,'');v=v.replace(/\-/g,'');return v;}
854
- function parseNumber(v)
855
- {if(typeof v!='string'){return parseFloat(v);}
856
- var isDot=v.indexOf('.');var isComa=v.indexOf(',');if(isDot!=-1&&isComa!=-1){if(isComa>isDot){v=v.replace('.','').replace(',','.');}
857
- else{v=v.replace(',','');}}
858
- else if(isComa!=-1){v=v.replace(',','.');}
859
- return parseFloat(v);}
860
- Validation.creditCartTypes=$H({'VI':[new RegExp('^4[0-9]{12}([0-9]{3})?$'),new RegExp('^[0-9]{3}$'),true],'MC':[new RegExp('^5[1-5][0-9]{14}$'),new RegExp('^[0-9]{3}$'),true],'AE':[new RegExp('^3[47][0-9]{13}$'),new RegExp('^[0-9]{4}$'),true],'DI':[new RegExp('^6011[0-9]{12}$'),new RegExp('^[0-9]{3}$'),true],'SS':[new RegExp('^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$'),new RegExp('^([0-9]{3}|[0-9]{4})?$'),true],'OT':[false,new RegExp('^([0-9]{3}|[0-9]{4})?$'),false]});;function popWin(url,win,para){var win=window.open(url,win,para);win.focus();}
861
- function setLocation(url){window.location.href=url;}
862
- function setPLocation(url,setFocus){if(setFocus){window.opener.focus();}
863
- window.opener.location.href=url;}
864
- function setLanguageCode(code,fromCode){var href=window.location.href;var after='',dash;if(dash=href.match(/\#(.*)$/)){href=href.replace(/\#(.*)$/,'');after=dash[0];}
865
- if(href.match(/[?]/)){var re=/([?&]store=)[a-z0-9_]*/;if(href.match(re)){href=href.replace(re,'$1'+code);}else{href+='&store='+code;}
866
- var re=/([?&]from_store=)[a-z0-9_]*/;if(href.match(re)){href=href.replace(re,'');}}else{href+='?store='+code;}
867
- if(typeof(fromCode)!='undefined'){href+='&from_store='+fromCode;}
868
- href+=after;setLocation(href);}
869
- function decorateGeneric(elements,decorateParams)
870
- {var allSupportedParams=['odd','even','first','last'];var _decorateParams={};var total=elements.length;if(total){if(typeof(decorateParams)=='undefined'){decorateParams=allSupportedParams;}
871
- if(!decorateParams.length){return;}
872
- for(var k in allSupportedParams){_decorateParams[allSupportedParams[k]]=false;}
873
- for(var k in decorateParams){_decorateParams[decorateParams[k]]=true;}
874
- if(_decorateParams.first){Element.addClassName(elements[0],'first');}
875
- if(_decorateParams.last){Element.addClassName(elements[total-1],'last');}
876
- for(var i=0;i<total;i++){if((i+1)%2==0){if(_decorateParams.even){Element.addClassName(elements[i],'even');}}
877
- else{if(_decorateParams.odd){Element.addClassName(elements[i],'odd');}}}}}
878
- function decorateTable(table,options){var table=$(table);if(table){var _options={'tbody':false,'tbody tr':['odd','even','first','last'],'thead tr':['first','last'],'tfoot tr':['first','last'],'tr td':['last']};if(typeof(options)!='undefined'){for(var k in options){_options[k]=options[k];}}
879
- if(_options['tbody']){decorateGeneric(table.select('tbody'),_options['tbody']);}
880
- if(_options['tbody tr']){decorateGeneric(table.select('tbody tr'),_options['tbody tr']);}
881
- if(_options['thead tr']){decorateGeneric(table.select('thead tr'),_options['thead tr']);}
882
- if(_options['tfoot tr']){decorateGeneric(table.select('tfoot tr'),_options['tfoot tr']);}
883
- if(_options['tr td']){var allRows=table.select('tr');if(allRows.length){for(var i=0;i<allRows.length;i++){decorateGeneric(allRows[i].getElementsByTagName('TD'),_options['tr td']);}}}}}
884
- function decorateList(list,nonRecursive){if($(list)){if(typeof(nonRecursive)=='undefined'){var items=$(list).select('li')}
885
- else{var items=$(list).childElements();}
886
- decorateGeneric(items,['odd','even','last']);}}
887
- function decorateDataList(list){list=$(list);if(list){decorateGeneric(list.select('dt'),['odd','even','last']);decorateGeneric(list.select('dd'),['odd','even','last']);}}
888
- function parseSidUrl(baseUrl,urlExt){sidPos=baseUrl.indexOf('/?SID=');sid='';urlExt=(urlExt!=undefined)?urlExt:'';if(sidPos>-1){sid='?'+baseUrl.substring(sidPos+2);baseUrl=baseUrl.substring(0,sidPos+1);}
889
- return baseUrl+urlExt+sid;}
890
- function formatCurrency(price,format,showPlus){precision=isNaN(format.precision=Math.abs(format.precision))?2:format.precision;requiredPrecision=isNaN(format.requiredPrecision=Math.abs(format.requiredPrecision))?2:format.requiredPrecision;precision=requiredPrecision;integerRequired=isNaN(format.integerRequired=Math.abs(format.integerRequired))?1:format.integerRequired;decimalSymbol=format.decimalSymbol==undefined?",":format.decimalSymbol;groupSymbol=format.groupSymbol==undefined?".":format.groupSymbol;groupLength=format.groupLength==undefined?3:format.groupLength;if(showPlus==undefined||showPlus==true){s=price<0?"-":(showPlus?"+":"");}else if(showPlus==false){s='';}
891
- i=parseInt(price=Math.abs(+price||0).toFixed(precision))+"";pad=(i.length<integerRequired)?(integerRequired-i.length):0;while(pad){i='0'+i;pad--;}
892
- j=(j=i.length)>groupLength?j%groupLength:0;re=new RegExp("(\\d{"+groupLength+"})(?=\\d)","g");r=(j?i.substr(0,j)+groupSymbol:"")+i.substr(j).replace(re,"$1"+groupSymbol)+(precision?decimalSymbol+Math.abs(price-i).toFixed(precision).replace(/-/,0).slice(2):"")
893
- if(format.pattern.indexOf('{sign}')==-1){pattern=s+format.pattern;}else{pattern=format.pattern.replace('{sign}',s);}
894
- return pattern.replace('%s',r).replace(/^\s\s*/,'').replace(/\s\s*$/,'');};function expandDetails(el,childClass){if(Element.hasClassName(el,'show-details')){$$(childClass).each(function(item){item.hide()});Element.removeClassName(el,'show-details');}
895
- else{$$(childClass).each(function(item){item.show()});Element.addClassName(el,'show-details');}}
896
- var isIE=navigator.appVersion.match(/MSIE/)=="MSIE";if(!window.Varien)
897
- var Varien=new Object();Varien.showLoading=function(){Element.show('loading-process');}
898
- Varien.hideLoading=function(){Element.hide('loading-process');}
899
- Varien.GlobalHandlers={onCreate:function(){Varien.showLoading();},onComplete:function(){if(Ajax.activeRequestCount==0){Varien.hideLoading();}}};Ajax.Responders.register(Varien.GlobalHandlers);Varien.searchForm=Class.create();Varien.searchForm.prototype={initialize:function(form,field,emptyText){this.form=$(form);this.field=$(field);this.emptyText=emptyText;Event.observe(this.form,'submit',this.submit.bind(this));Event.observe(this.field,'focus',this.focus.bind(this));Event.observe(this.field,'blur',this.blur.bind(this));this.blur();},submit:function(event){if(this.field.value==this.emptyText||this.field.value==''){Event.stop(event);return false;}
900
- return true;},focus:function(event){if(this.field.value==this.emptyText){this.field.value='';}},blur:function(event){if(this.field.value==''){this.field.value=this.emptyText;}},initAutocomplete:function(url,destinationElement){new Ajax.Autocompleter(this.field,destinationElement,url,{paramName:this.field.name,method:'get',minChars:2,updateElement:this._selectAutocompleteItem.bind(this),onShow:function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
901
- Effect.Appear(update,{duration:0});}});},_selectAutocompleteItem:function(element){if(element.title){this.field.value=element.title;}
902
- this.form.submit();}}
903
- Varien.Tabs=Class.create();Varien.Tabs.prototype={initialize:function(selector){var self=this;$$(selector+' a').each(this.initTab.bind(this));},initTab:function(el){el.href='javascript:void(0)';if($(el.parentNode).hasClassName('active')){this.showContent(el);}
904
- el.observe('click',this.showContent.bind(this,el));},showContent:function(a){var li=$(a.parentNode),ul=$(li.parentNode);ul.getElementsBySelector('li','ol').each(function(el){var contents=$(el.id+'_contents');if(el==li){el.addClassName('active');contents.show();}else{el.removeClassName('active');contents.hide();}});}}
905
- Varien.DOB=Class.create();Varien.DOB.prototype={initialize:function(selector,required,format){var el=$$(selector)[0];this.day=Element.select($(el),'.dob-day input')[0];this.month=Element.select($(el),'.dob-month input')[0];this.year=Element.select($(el),'.dob-year input')[0];this.dob=Element.select($(el),'.dob-full input')[0];this.advice=Element.select($(el),'.validation-advice')[0];this.required=required;this.format=format;this.day.validate=this.validate.bind(this);this.month.validate=this.validate.bind(this);this.year.validate=this.validate.bind(this);this.advice.hide();},validate:function(){var error=false;if(this.day.value==''&&this.month.value==''&&this.year.value==''){if(this.required){error='This date is a required value.';}else{this.dob.value='';}}else if(this.day.value==''||this.month.value==''||this.year.value==''){error='Please enter a valid full date.';}else{var date=new Date();if(this.day.value<1||this.day.value>31){error='Please enter a valid day (1-31).';}else if(this.month.value<1||this.month.value>12){error='Please enter a valid month (1-12).';}else if(this.year.value<1900||this.year.value>date.getFullYear()){error='Please enter a valid year (1900-'+date.getFullYear()+').';}else{this.dob.value=this.format.replace(/(%m|%b)/i,this.month.value).replace(/(%d|%e)/i,this.day.value).replace(/%y/i,this.year.value);var testDOB=this.month.value+'/'+this.day.value+'/'+this.year.value;var test=new Date(testDOB);if(isNaN(test)){error='Please enter a valid date.';}}}
906
- if(error!==false){try{this.advice.innerHTML=Translator.translate(error);}
907
- catch(e){this.advice.innerHTML=error;}
908
- this.advice.show();return false;}
909
- this.advice.hide();return true;}}
910
- Validation.addAllThese([['validate-custom',' ',function(v,elm){return elm.validate();}]]);function truncateOptions(){$$('.truncated').each(function(element){Event.observe(element,'mouseover',function(){if(element.down('div.truncated_full_value')){element.down('div.truncated_full_value').addClassName('show')}});Event.observe(element,'mouseout',function(){if(element.down('div.truncated_full_value')){element.down('div.truncated_full_value').removeClassName('show')}});});}
911
- Event.observe(window,'load',function(){truncateOptions();});Element.addMethods({getInnerText:function(element)
912
- {element=$(element);if(element.innerText&&!Prototype.Browser.Opera){return element.innerText}
913
- return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g,' ');}});if(!("console"in window)||!("firebug"in console))
914
- {var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i)
915
- window.console[names[i]]=function(){}};var Translate=Class.create();Translate.prototype={initialize:function(data){this.data=$H(data);},translate:function(){var args=arguments;var text=arguments[0];if(this.data.get(text)){return this.data.get(text);}
916
- return text;},add:function(){if(arguments.length>1){this.data.set(arguments[0],arguments[1]);}else if(typeof arguments[0]=='object'){$H(arguments[0]).each(function(pair){this.data.set(pair.key,pair.value);}.bind(this));}}};function encode_base64(what)
917
- {var base64_encodetable="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var result="";var len=what.length;var x,y;var ptr=0;while(len-->0)
918
- {x=what.charCodeAt(ptr++);result+=base64_encodetable.charAt((x>>2)&63);if(len--<=0)
919
- {result+=base64_encodetable.charAt((x<<4)&63);result+="==";break;}
920
- y=what.charCodeAt(ptr++);result+=base64_encodetable.charAt(((x<<4)|((y>>4)&15))&63);if(len--<=0)
921
- {result+=base64_encodetable.charAt((y<<2)&63);result+="=";break;}
922
- x=what.charCodeAt(ptr++);result+=base64_encodetable.charAt(((y<<2)|((x>>6)&3))&63);result+=base64_encodetable.charAt(x&63);}
923
- return result;}
924
- function decode_base64(what)
925
- {var base64_decodetable=new Array(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,255,255,255,255,255);var result="";var len=what.length;var x,y;var ptr=0;while(!isNaN(x=what.charCodeAt(ptr++)))
926
- {if(x==13||x==10)
927
- continue;if((x>127)||((x=base64_decodetable[x])==255))
928
- return false;if((isNaN(y=what.charCodeAt(ptr++)))||((y=base64_decodetable[y])==255))
929
- return false;result+=String.fromCharCode((x<<2)|(y>>4));if((x=what.charCodeAt(ptr++))==61)
930
- {if((what.charCodeAt(ptr++)!=61)||(!isNaN(what.charCodeAt(ptr))))
931
- return false;}
932
- else
933
- {if((x>127)||((x=base64_decodetable[x])==255))
934
- return false;result+=String.fromCharCode((y<<4)|(x>>2));if((y=what.charCodeAt(ptr++))==61)
935
- {if(!isNaN(what.charCodeAt(ptr)))
936
- return false;}
937
- else
938
- {if((y>127)||((y=base64_decodetable[y])==255))
939
- return false;result+=String.fromCharCode((x<<6)|y);}}}
940
- return result;}
941
- function wrap76(what)
942
- {var result="";var i;for(i=0;i<what.length;i+=76)
943
- {result+=what.substring(i,i+76)+String.fromCharCode(13)+String.fromCharCode(10);}
944
- return result;};varienEvents=Class.create();varienEvents.prototype={initialize:function(){this.arrEvents={};this.eventPrefix='';},attachEventHandler:function(eventName,handler){if((typeof handler=='undefined')||(handler==null)){return;}
945
- eventName=eventName+this.eventPrefix;if(this.arrEvents[eventName]==null){this.arrEvents[eventName]=[];}
946
- var asynchVar=arguments.length>2?arguments[2]:false;var handlerObj={method:handler,asynch:asynchVar};this.arrEvents[eventName].push(handlerObj);},removeEventHandler:function(eventName,handler){eventName=eventName+this.eventPrefix;if(this.arrEvents[eventName]!=null){this.arrEvents[eventName]=this.arrEvents[eventName].reject(function(obj){return obj.method==handler;});}},clearEventHandlers:function(eventName){eventName=eventName+this.eventPrefix;this.arrEvents[eventName]=null;},clearAllEventHandlers:function(){this.arrEvents={};},fireEvent:function(eventName){var evtName=eventName+this.eventPrefix;var results=[];var result;if(this.arrEvents[evtName]!=null){var len=this.arrEvents[evtName].length;for(var i=0;i<len;i++){try{if(arguments.length>1){if(this.arrEvents[evtName][i].asynch){var eventArgs=arguments[1];var method=this.arrEvents[evtName][i].method.bind(this);setTimeout(function(){method(eventArgs)}.bind(this),10);}
947
- else{result=this.arrEvents[evtName][i].method(arguments[1]);}}
948
- else{if(this.arrEvents[evtName][i].asynch){var eventHandler=this.arrEvents[evtName][i].method;setTimeout(eventHandler,1);}
949
- else if(this.arrEvents&&this.arrEvents[evtName]&&this.arrEvents[evtName][i]&&this.arrEvents[evtName][i].method){result=this.arrEvents[evtName][i].method();}}
950
- results.push(result);}
951
- catch(e){if(this.id){alert("error: error in "+this.id+".fireEvent():\n\nevent name: "+eventName+"\n\nerror message: "+e.message);}
952
- else{alert("error: error in [unknown object].fireEvent():\n\nevent name: "+eventName+"\n\nerror message: "+e.message);}}}}
953
- return results;}};varienGlobalEvents=new varienEvents();;var SessionError=Class.create();SessionError.prototype={initialize:function(errorText){this.errorText=errorText;},toString:function()
954
- {return'Session Error:'+this.errorText;}};Ajax.Request.addMethods({initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();if(!url.match(new RegExp('[?&]isAjax=true',''))){url=url.match(new RegExp('\\?',"g"))?url+'&isAjax=true':url+'?isAjax=true';}
955
- if(!this.options.parameters){this.options.parameters={form_key:FORM_KEY};}
956
- if(!this.options.parameters.form_key){this.options.parameters.form_key=FORM_KEY;}
957
- this.request(url);},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;if(response.responseText.isJSON()){var jsonObject=response.responseText.evalJSON();if(jsonObject.ajaxExpired&&jsonObject.ajaxRedirect){window.location.replace(jsonObject.ajaxRedirect);throw new SessionError('session expired');}}
958
- (this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);if(e instanceof SessionError){return;}}
959
- var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse();}}
960
- try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
961
- if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}}});Ajax.Updater.respondToReadyState=Ajax.Request.respondToReadyState;var varienLoader=new Class.create();varienLoader.prototype={initialize:function(caching){this.callback=false;this.cache=$H();this.caching=caching||false;this.url=false;},getCache:function(url){if(this.cache.get(url)){return this.cache.get(url)}
962
- return false;},load:function(url,params,callback){this.url=url;this.callback=callback;if(this.caching){var transport=this.getCache(url);if(transport){this.processResult(transport);return;}}
963
- if(typeof(params.updaterId)!='undefined'){new varienUpdater(params.updaterId,url,{evalScripts:true,onComplete:this.processResult.bind(this),onFailure:this._processFailure.bind(this)});}
964
- else{new Ajax.Request(url,{method:'post',parameters:params||{},onComplete:this.processResult.bind(this),onFailure:this._processFailure.bind(this)});}},_processFailure:function(transport){location.href=BASE_URL;},processResult:function(transport){if(this.caching){this.cache.set(this.url,transport);}
965
- if(this.callback){this.callback(transport.responseText);}}}
966
- if(!window.varienLoaderHandler)
967
- var varienLoaderHandler=new Object();varienLoaderHandler.handler={onCreate:function(request){if(request.options.loaderArea===false){return;}
968
- request.options.loaderArea=$$('#html-body .wrapper')[0];if(request&&request.options.loaderArea){Element.clonePosition($('loading-mask'),$(request.options.loaderArea),{offsetLeft:-2})
969
- toggleSelectsUnderBlock($('loading-mask'),false);Element.show('loading-mask');setLoaderPosition();if(request.options.loaderArea=='html-body'){}}
970
- else{}},onComplete:function(transport){if(Ajax.activeRequestCount==0){toggleSelectsUnderBlock($('loading-mask'),true);Element.hide('loading-mask');}}};function setLoaderPosition(){var elem=$('loading_mask_loader');if(elem&&Prototype.Browser.IE){var middle=parseInt(document.body.clientHeight/2)+document.body.scrollTop;elem.style.position='absolute';elem.style.top=middle;}}
971
- function toggleSelectsUnderBlock(block,flag){if(Prototype.Browser.IE){var selects=document.getElementsByTagName("select");for(var i=0;i<selects.length;i++){if(flag){if(selects[i].needShowOnSuccess){selects[i].needShowOnSuccess=false;selects[i].style.visibility='';}}
972
- else{if(Element.visible(selects[i])){selects[i].style.visibility='hidden';selects[i].needShowOnSuccess=true;}}}}}
973
- Ajax.Responders.register(varienLoaderHandler.handler);var varienUpdater=Class.create(Ajax.Updater,{updateContent:function($super,responseText){if(responseText.isJSON()){var responseJSON=responseText.evalJSON();if(responseJSON.ajaxExpired&&responseJSON.ajaxRedirect){window.location.replace(responseJSON.ajaxRedirect);}}else{$super(responseText);}}});;var varienGrid=new Class.create();varienGrid.prototype={initialize:function(containerId,url,pageVar,sortVar,dirVar,filterVar){this.containerId=containerId;this.url=url;this.pageVar=pageVar||false;this.sortVar=sortVar||false;this.dirVar=dirVar||false;this.filterVar=filterVar||false;this.tableSufix='_table';this.useAjax=false;this.rowClickCallback=false;this.checkboxCheckCallback=false;this.preInitCallback=false;this.initCallback=false;this.initRowCallback=false;this.doFilterCallback=false;this.reloadParams=false;this.trOnMouseOver=this.rowMouseOver.bindAsEventListener(this);this.trOnMouseOut=this.rowMouseOut.bindAsEventListener(this);this.trOnClick=this.rowMouseClick.bindAsEventListener(this);this.trOnDblClick=this.rowMouseDblClick.bindAsEventListener(this);this.trOnKeyPress=this.keyPress.bindAsEventListener(this);this.thLinkOnClick=this.doSort.bindAsEventListener(this);this.initGrid();},initGrid:function(){if(this.preInitCallback){this.preInitCallback(this);}
974
- if($(this.containerId+this.tableSufix)){this.rows=$$('#'+this.containerId+this.tableSufix+' tbody tr');for(var row=0;row<this.rows.length;row++){if(row%2==0){Element.addClassName(this.rows[row],'even');}
975
- Event.observe(this.rows[row],'mouseover',this.trOnMouseOver);Event.observe(this.rows[row],'mouseout',this.trOnMouseOut);Event.observe(this.rows[row],'click',this.trOnClick);Event.observe(this.rows[row],'dblclick',this.trOnDblClick);}}
976
- if(this.sortVar&&this.dirVar){var columns=$$('#'+this.containerId+this.tableSufix+' thead a');for(var col=0;col<columns.length;col++){Event.observe(columns[col],'click',this.thLinkOnClick);}}
977
- this.bindFilterFields();this.bindFieldsChange();if(this.initCallback){try{this.initCallback(this);}
978
- catch(e){if(console){console.log(e);}}}},initGridAjax:function(){this.initGrid();this.initGridRows();},initGridRows:function(){if(this.initRowCallback){for(var row=0;row<this.rows.length;row++){try{this.initRowCallback(this,this.rows[row]);}catch(e){if(console){console.log(e);}}}}},getContainerId:function(){return this.containerId;},rowMouseOver:function(event){var element=Event.findElement(event,'tr');if(!element.title)return;Element.addClassName(element,'on-mouse');if(!Element.hasClassName('pointer')&&(this.rowClickCallback!==openGridRow||element.title)){if(element.title){Element.addClassName(element,'pointer');}}},rowMouseOut:function(event){var element=Event.findElement(event,'tr');Element.removeClassName(element,'on-mouse');},rowMouseClick:function(event){if(this.rowClickCallback){try{this.rowClickCallback(this,event);}
979
- catch(e){}}
980
- varienGlobalEvents.fireEvent('gridRowClick',event);},rowMouseDblClick:function(event){varienGlobalEvents.fireEvent('gridRowDblClick',event);},keyPress:function(event){},doSort:function(event){var element=Event.findElement(event,'a');if(element.name&&element.title){this.addVarToUrl(this.sortVar,element.name);this.addVarToUrl(this.dirVar,element.title);this.reload(this.url);}
981
- Event.stop(event);return false;},loadByElement:function(element){if(element&&element.name){this.reload(this.addVarToUrl(element.name,element.value));}},reload:function(url){if(!this.reloadParams){this.reloadParams={form_key:FORM_KEY};}
982
- else{this.reloadParams.form_key=FORM_KEY;}
983
- url=url||this.url;if(this.useAjax){new Ajax.Request(url+(url.match(new RegExp('\\?'))?'&ajax=true':'?ajax=true'),{loaderArea:this.containerId,parameters:this.reloadParams||{},evalScripts:true,onFailure:this._processFailure.bind(this),onComplete:this.initGridAjax.bind(this),onSuccess:function(transport){try{if(transport.responseText.isJSON()){var response=transport.responseText.evalJSON()
984
- if(response.error){alert(response.message);}
985
- if(response.ajaxExpired&&response.ajaxRedirect){setLocation(response.ajaxRedirect);}}else{$(this.containerId).update(transport.responseText);}}
986
- catch(e){$(this.containerId).update(transport.responseText);}}.bind(this)});return;}
987
- else{if(this.reloadParams){$H(this.reloadParams).each(function(pair){url=this.addVarToUrl(pair.key,pair.value);}.bind(this));}
988
- location.href=url;}},_processFailure:function(transport){location.href=BASE_URL;},addVarToUrl:function(varName,varValue){var re=new RegExp('\/('+varName+'\/.*?\/)');var parts=this.url.split(new RegExp('\\?'));this.url=parts[0].replace(re,'/');this.url+=varName+'/'+varValue+'/';if(parts.size()>1){this.url+='?'+parts[1];}
989
- return this.url;},doExport:function(){if($(this.containerId+'_export')){location.href=$(this.containerId+'_export').value;}},bindFilterFields:function(){var filters=$$('#'+this.containerId+' .filter input','#'+this.containerId+' .filter select');for(var i=0;i<filters.length;i++){Event.observe(filters[i],'keypress',this.filterKeyPress.bind(this));}},bindFieldsChange:function(){if(!$(this.containerId)){return;}
990
- var dataElements=$(this.containerId+this.tableSufix).down('tbody').select('input','select');for(var i=0;i<dataElements.length;i++){Event.observe(dataElements[i],'change',dataElements[i].setHasChanges.bind(dataElements[i]));}},filterKeyPress:function(event){if(event.keyCode==Event.KEY_RETURN){this.doFilter();}},doFilter:function(){var filters=$$('#'+this.containerId+' .filter input','#'+this.containerId+' .filter select');var elements=[];for(var i in filters){if(filters[i].value&&filters[i].value.length)elements.push(filters[i]);}
991
- if(!this.doFilterCallback||(this.doFilterCallback&&this.doFilterCallback())){this.reload(this.addVarToUrl(this.filterVar,encode_base64(Form.serializeElements(elements))));}},resetFilter:function(){this.reload(this.addVarToUrl(this.filterVar,''));},checkCheckboxes:function(element){elements=Element.select($(this.containerId),'input[name="'+element.name+'"]');for(var i=0;i<elements.length;i++){this.setCheckboxChecked(elements[i],element.checked);}},setCheckboxChecked:function(element,checked){element.checked=checked;element.setHasChanges({});if(this.checkboxCheckCallback){this.checkboxCheckCallback(this,element,checked);}},inputPage:function(event,maxNum){var element=Event.element(event);var keyCode=event.keyCode||event.which;if(keyCode==Event.KEY_RETURN){this.setPage(element.value);}},setPage:function(pageNumber){this.reload(this.addVarToUrl(this.pageVar,pageNumber));}};function openGridRow(grid,event){var element=Event.findElement(event,'tr');if(['a','input','select','option'].indexOf(Event.element(event).tagName.toLowerCase())!=-1){return;}
992
- if(element.title){setLocation(element.title);}}
993
- var varienGridMassaction=Class.create();varienGridMassaction.prototype={checkedValues:$H({}),checkedString:'',oldCallbacks:{},errorText:'',items:{},gridIds:[],currentItem:false,fieldTemplate:new Template('<input type="hidden" name="#{name}" value="#{value}" />'),initialize:function(containerId,grid,checkedValues,formFieldNameInternal,formFieldName){this.setOldCallback('row_click',grid.rowClickCallback);this.setOldCallback('init',grid.initCallback);this.setOldCallback('init_row',grid.initRowCallback);this.setOldCallback('pre_init',grid.preInitCallback);this.useAjax=false;this.grid=grid;this.containerId=containerId;this.initMassactionElements();this.checkedString=checkedValues;this.formFieldName=formFieldName;this.formFieldNameInternal=formFieldNameInternal;this.grid.initCallback=this.onGridInit.bind(this);this.grid.preInitCallback=this.onGridPreInit.bind(this);this.grid.initRowCallback=this.onGridRowInit.bind(this);this.grid.rowClickCallback=this.onGridRowClick.bind(this);this.initCheckboxes();this.checkCheckboxes();},setUseAjax:function(flag){this.useAjax=flag;},initMassactionElements:function(){this.container=$(this.containerId);this.form=$(this.containerId+'-form');this.count=$(this.containerId+'-count');this.validator=new Validation(this.form);this.formHiddens=$(this.containerId+'-form-hiddens');this.formAdditional=$(this.containerId+'-form-additional');this.select=$(this.containerId+'-select');this.select.observe('change',this.onSelectChange.bindAsEventListener(this));},setGridIds:function(gridIds){this.gridIds=gridIds;this.updateCount();},getGridIds:function(){return this.gridIds;},setItems:function(items){this.items=items;this.updateCount();},getItems:function(){return this.items;},getItem:function(itemId){if(this.items[itemId]){return this.items[itemId];}
994
- return false;},getOldCallback:function(callbackName){return this.oldCallbacks[callbackName]?this.oldCallbacks[callbackName]:Prototype.emptyFunction;},setOldCallback:function(callbackName,callback){this.oldCallbacks[callbackName]=callback;},onGridPreInit:function(grid){this.initMassactionElements();this.getOldCallback('pre_init')(grid);},onGridInit:function(grid){this.initCheckboxes();this.checkCheckboxes();this.updateCount();this.getOldCallback('init')(grid);},onGridRowInit:function(grid,row){this.getOldCallback('init_row')(grid,row);},onGridRowClick:function(grid,evt){var tdElement=Event.findElement(evt,'td');var trElement=Event.findElement(evt,'tr');if(!$(tdElement).down('input')){if($(tdElement).down('a')||$(tdElement).down('select')){return;}
995
- if(trElement.title){setLocation(trElement.title);}
996
- else{var checkbox=Element.select(trElement,'input');var isInput=Event.element(evt).tagName=='input';var checked=isInput?checkbox[0].checked:!checkbox[0].checked;if(checked){this.checkedString=varienStringArray.add(checkbox[0].value,this.checkedString);}else{this.checkedString=varienStringArray.remove(checkbox[0].value,this.checkedString);}
997
- this.grid.setCheckboxChecked(checkbox[0],checked);this.updateCount();}
998
- return;}
999
- if(Event.element(evt).isMassactionCheckbox){this.setCheckbox(Event.element(evt));}else if(checkbox=this.findCheckbox(evt)){checkbox.checked=!checkbox.checked;this.setCheckbox(checkbox);}},onSelectChange:function(evt){var item=this.getSelectedItem();if(item){this.formAdditional.update($(this.containerId+'-item-'+item.id+'-block').innerHTML);}else{this.formAdditional.update('');}
1000
- this.validator.reset();},findCheckbox:function(evt){if(['a','input','select'].indexOf(Event.element(evt).tagName.toLowerCase())!==-1){return false;}
1001
- checkbox=false;Event.findElement(evt,'tr').select('.massaction-checkbox').each(function(element){if(element.isMassactionCheckbox){checkbox=element;}}.bind(this));return checkbox;},initCheckboxes:function(){this.getCheckboxes().each(function(checkbox){checkbox.isMassactionCheckbox=true;}.bind(this));},checkCheckboxes:function(){this.getCheckboxes().each(function(checkbox){checkbox.checked=varienStringArray.has(checkbox.value,this.checkedString);}.bind(this));},selectAll:function(){this.setCheckedValues(this.getGridIds());this.checkCheckboxes();this.updateCount();return false;},unselectAll:function(){this.setCheckedValues('');this.checkCheckboxes();this.updateCount();return false;},selectVisible:function(){this.setCheckedValues(this.getCheckboxesValuesAsString());this.checkCheckboxes();this.updateCount();return false;},unselectVisible:function(){this.getCheckboxesValues().each(function(key){this.checkedString=varienStringArray.remove(key,this.checkedString);}.bind(this));this.checkCheckboxes();this.updateCount();return false;},setCheckedValues:function(values){this.checkedString=values;},getCheckedValues:function(){return this.checkedString;},getCheckboxes:function(){var result=[];this.grid.rows.each(function(row){var checkboxes=row.select('.massaction-checkbox');checkboxes.each(function(checkbox){result.push(checkbox);});});return result;},getCheckboxesValues:function(){var result=[];this.getCheckboxes().each(function(checkbox){result.push(checkbox.value);}.bind(this));return result;},getCheckboxesValuesAsString:function()
1002
- {return this.getCheckboxesValues().join(',');},setCheckbox:function(checkbox){if(checkbox.checked){this.checkedString=varienStringArray.add(checkbox.value,this.checkedString);}else{this.checkedString=varienStringArray.remove(checkbox.value,this.checkedString);}
1003
- this.updateCount();},updateCount:function(){this.count.update(varienStringArray.count(this.checkedString));if(!this.grid.reloadParams){this.grid.reloadParams={};}
1004
- this.grid.reloadParams[this.formFieldNameInternal]=this.checkedString;},getSelectedItem:function(){if(this.getItem(this.select.value)){return this.getItem(this.select.value);}else{return false;}},apply:function(){if(varienStringArray.count(this.checkedString)==0){alert(this.errorText);return;}
1005
- var item=this.getSelectedItem();if(!item){this.validator.validate();return;}
1006
- this.currentItem=item;var fieldName=(item.field?item.field:this.formFieldName);var fieldsHtml='';if(this.currentItem.confirm&&!window.confirm(this.currentItem.confirm)){return;}
1007
- this.formHiddens.update('');new Insertion.Bottom(this.formHiddens,this.fieldTemplate.evaluate({name:fieldName,value:this.checkedString}));new Insertion.Bottom(this.formHiddens,this.fieldTemplate.evaluate({name:'massaction_prepare_key',value:fieldName}));if(!this.validator.validate()){return;}
1008
- if(this.useAjax&&item.url){new Ajax.Request(item.url,{'method':'post','parameters':this.form.serialize(true),'onComplete':this.onMassactionComplete.bind(this)});}else if(item.url){this.form.action=item.url;this.form.submit();}},onMassactionComplete:function(transport){if(this.currentItem.complete){try{var listener=this.getListener(this.currentItem.complete)||Prototype.emptyFunction;listener(grid,this,transport);}catch(e){}}},getListener:function(strValue){return eval(strValue);}};var varienGridAction={execute:function(select){if(!select.value||!select.value.isJSON()){return;}
1009
- var config=select.value.evalJSON();if(config.confirm&&!window.confirm(config.confirm)){select.options[0].selected=true;return;}
1010
- if(config.popup){var win=window.open(config.href,'action_window','width=500,height=600,resizable=1,scrollbars=1');win.focus();select.options[0].selected=true;}else{setLocation(config.href);}}};var varienStringArray={remove:function(str,haystack)
1011
- {haystack=','+haystack+',';haystack=haystack.replace(new RegExp(','+str+',','g'),',');return this.trimComma(haystack);},add:function(str,haystack)
1012
- {haystack=','+haystack+',';if(haystack.search(new RegExp(','+str+',','g'),haystack)===-1){haystack+=str+',';}
1013
- return this.trimComma(haystack);},has:function(str,haystack)
1014
- {haystack=','+haystack+',';if(haystack.search(new RegExp(','+str+',','g'),haystack)===-1){return false;}
1015
- return true;},count:function(haystack)
1016
- {if(typeof haystack!='string'){return 0;}
1017
- if(match=haystack.match(new RegExp(',','g'))){return match.length+1;}else if(haystack.length!=0){return 1;}
1018
- return 0;},each:function(haystack,fnc)
1019
- {var haystack=haystack.split(',');for(var i=0;i<haystack.length;i++){fnc(haystack[i]);}},trimComma:function(string)
1020
- {string=string.replace(new RegExp('^(,+)','i'),'');string=string.replace(new RegExp('(,+)$','i'),'');return string;}};var serializerController=Class.create();serializerController.prototype={oldCallbacks:{},initialize:function(hiddenDataHolder,predefinedData,inputsToManage,grid,reloadParamName){this.tabIndex=1000;this.inputsToManage=inputsToManage;this.multidimensionalMode=inputsToManage.length>0;this.gridData=this.getGridDataHash(predefinedData);this.hiddenDataHolder=$(hiddenDataHolder);this.hiddenDataHolder.value=this.serializeObject();this.grid=grid;this.setOldCallback('row_click',this.grid.rowClickCallback);this.setOldCallback('init_row',this.grid.initRowCallback);this.setOldCallback('checkbox_check',this.grid.checkboxCheckCallback);this.reloadParamName=reloadParamName;this.grid.reloadParams={};this.grid.reloadParams[this.reloadParamName+'[]']=this.getDataForReloadParam();this.grid.rowClickCallback=this.rowClick.bind(this);this.grid.initRowCallback=this.rowInit.bind(this);this.grid.checkboxCheckCallback=this.registerData.bind(this);this.grid.rows.each(this.eachRow.bind(this));},setOldCallback:function(callbackName,callback){this.oldCallbacks[callbackName]=callback;},getOldCallback:function(callbackName){return this.oldCallbacks[callbackName]?this.oldCallbacks[callbackName]:Prototype.emptyFunction;},registerData:function(grid,element,checked){if(this.multidimensionalMode){if(checked){if(element.inputElements){this.gridData.set(element.value,{});for(var i=0;i<element.inputElements.length;i++){element.inputElements[i].disabled=false;this.gridData.get(element.value)[element.inputElements[i].name]=element.inputElements[i].value;}}}
1021
- else{if(element.inputElements){for(var i=0;i<element.inputElements.length;i++){element.inputElements[i].disabled=true;}}
1022
- this.gridData.unset(element.value);}}
1023
- else{if(checked){this.gridData.set(element.value,element.value);}
1024
- else{this.gridData.unset(element.value);}}
1025
- this.hiddenDataHolder.value=this.serializeObject();this.grid.reloadParams={};this.grid.reloadParams[this.reloadParamName+'[]']=this.getDataForReloadParam();this.getOldCallback('checkbox_check')(grid,element,checked);},eachRow:function(row){this.rowInit(this.grid,row);},rowClick:function(grid,event){var trElement=Event.findElement(event,'tr');var isInput=Event.element(event).tagName=='INPUT';if(trElement){var checkbox=Element.select(trElement,'input');if(checkbox[0]){var checked=isInput?checkbox[0].checked:!checkbox[0].checked;this.grid.setCheckboxChecked(checkbox[0],checked);}}
1026
- this.getOldCallback('row_click')(grid,event);},inputChange:function(event){var element=Event.element(event);if(element&&element.checkboxElement&&element.checkboxElement.checked){this.gridData.get(element.checkboxElement.value)[element.name]=element.value;this.hiddenDataHolder.value=this.serializeObject();}},rowInit:function(grid,row){if(this.multidimensionalMode){var checkbox=$(row).select('.checkbox')[0];var selectors=this.inputsToManage.map(function(name){return'input[name="'+name+'"]'});var inputs=$(row).select.apply($(row),selectors);if(checkbox&&inputs.length>0){checkbox.inputElements=inputs;for(var i=0;i<inputs.length;i++){inputs[i].checkboxElement=checkbox;if(this.gridData.get(checkbox.value)&&this.gridData.get(checkbox.value)[inputs[i].name]){inputs[i].value=this.gridData.get(checkbox.value)[inputs[i].name];}
1027
- inputs[i].disabled=!checkbox.checked;inputs[i].tabIndex=this.tabIndex++;Event.observe(inputs[i],'keyup',this.inputChange.bind(this));Event.observe(inputs[i],'change',this.inputChange.bind(this));}}}
1028
- this.getOldCallback('init_row')(grid,row);},getGridDataHash:function(_object){return $H(this.multidimensionalMode?_object:this.convertArrayToObject(_object))},getDataForReloadParam:function(){return this.multidimensionalMode?this.gridData.keys():this.gridData.values();},serializeObject:function(){if(this.multidimensionalMode){var clone=this.gridData.clone();clone.each(function(pair){clone.set(pair.key,encode_base64(Object.toQueryString(pair.value)));});return clone.toQueryString();}
1029
- else{return this.gridData.values().join('&');}},convertArrayToObject:function(_array){var _object={};for(var i=0,l=_array.length;i<l;i++){_object[_array[i]]=_array[i];}
1030
- return _object;}};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
var/minifycache/minify_676fb2e38e9cb2203204bcf556430103.gz DELETED
Binary file
var/minifycache/minify_900559c432c691b50ba33f48b4909a4f DELETED
@@ -1,656 +0,0 @@
1
- var Prototype={Version:'1.6.0.3',Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),Opera:navigator.userAgent.indexOf('Opera')>-1,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div')['__proto__']&&document.createElement('div')['__proto__']!==document.createElement('form')['__proto__']},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)
2
- Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
3
- parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
4
- Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
5
- for(var i=0;i<properties.length;i++)
6
- klass.addMethods(properties[i]);if(!klass.prototype.initialize)
7
- klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
8
- properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
9
- this.prototype[property]=value;}
10
- return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
11
- destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
12
- if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
13
- results.push(property.toJSON()+': '+value);}
14
- return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
15
- keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
16
- values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return!!(object&&object.nodeType==1);},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},defer:function(){var args=[0.01].concat($A(arguments));return this.delay.apply(this,args);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+
17
- (this.getUTCMonth()+1).toPaddedString(2)+'-'+
18
- this.getUTCDate().toPaddedString(2)+'T'+
19
- this.getUTCHours().toPaddedString(2)+':'+
20
- this.getUTCMinutes().toPaddedString(2)+':'+
21
- this.getUTCSeconds().toPaddedString(2)+'Z"';};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
22
- return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}finally{this.currentlyExecuting=false;}}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
23
- return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=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=length||30;truncation=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=new RegExp(Prototype.ScriptFragment,'img');var matchOne=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=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=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=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
24
- else hash[key]=value;}
25
- return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
26
- String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
27
- camelized+=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}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(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=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
28
- throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},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,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
29
- object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
30
- return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
31
- return this;},eachSlice:function(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)
32
- slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))
33
- throw $break;});return result;},collect:function(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
34
- results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
35
- filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
36
- results.push(iterator.call(context,value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))
37
- if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=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){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
38
- result=value;});return result;},min:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)
39
- result=value;});return result;},partition:function(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
40
- results.push(value);});return results;},sortBy:function(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
41
- iterator=args.pop();var collections=[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'#<Enumerable:'+this.toArray().inspect()+'>';}};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=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
42
- if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(typeof iterable==='function'&&typeof iterable.length==='number'&&typeof iterable.item==='function')&&iterable.toArray)
43
- return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;};}
44
- Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)
45
- iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==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==index||(sorted?array.last()!=value:!array.include(value)))
46
- array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
47
- Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
48
- if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
49
- if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)
50
- array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
51
- return array;};}
52
- Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator,context){$R(0,this,true).each(iterator,context);return this;},toPaddedString:function(length,radix){var string=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]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
53
- return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){if(this._object[key]!==Object.prototype[key])
54
- return this._object[key];},unset:function(key){var value=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=this.detect(function(pair){return pair.value===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.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))
55
- return results.concat(values.map(toQueryPair.curry(key)));}else results.push(toQueryPair(key,values));return results;}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';},toJSON:function(){return Object.toJSON(this.toObject());},clone:function(){return new Hash(this);}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
56
- return false;if(this.exclusive)
57
- return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};var Ajax={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={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
58
- this.responders.push(responder);},unregister:function(responder){this.responders=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=Class.create({initialize:function(options){this.options={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=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))
59
- this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))
60
- this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
61
- this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
62
- this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
63
- params+='&_=';}
64
- try{var response=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).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
65
- this.onStateChange();}
66
- catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
67
- this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['Content-type']=this.options.contentType+
68
- (this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)
69
- headers['Connection']='close';}
70
- if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
71
- for(var i=0,length=extras.length;i<length;i+=2)
72
- headers[extras[i]]=extras[i+1];else
73
- $H(extras).each(function(pair){headers[pair.key]=pair.value});}
74
- for(var name in headers)
75
- this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
76
- var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
77
- this.evalResponse();}
78
- try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
79
- if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{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=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
80
- if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=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=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
81
- return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
82
- else options.insertion(receiver,responseText);}
83
- else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.responseText;}
84
- this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
85
- elements.push($(arguments[i]));return elements;}
86
- if(Object.isString(element))
87
- element=document.getElementById(element);return Element.extend(element);}
88
- if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
89
- results.push(Element.extend(query.snapshotItem(i)));return results;};}
90
- if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){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});}
91
- (function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
92
- if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
93
- element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
94
- insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
95
- content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
96
- return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
97
- $(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
98
- element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
99
- if(element.nodeType==1)
100
- elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;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=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
101
- selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
102
- return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
103
- element.removeAttribute(name);else if(value===true)
104
- element.setAttribute(name,name);else element.setAttribute(name,value);}
105
- 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=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))
106
- element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
107
- element.removeChild(node);node=nextNode;}
108
- return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
109
- return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
110
- return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
111
- if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}
112
- if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}
113
- for(var property in styles)
114
- if(property=='opacity')element.setOpacity(styles[property]);else
115
- elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=element.getStyle('display');if(display!='none'&&display!=null)
116
- return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
117
- return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
118
- return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')
119
- element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);if(element.tagName.toUpperCase()=='HTML')
120
- return $(document.body);while((element=element.parentNode)&&element!=document.body)
121
- if(Element.getStyle(element,'position')!='static')
122
- return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
123
- if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
124
- if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
125
- return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
126
- else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
127
- return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
128
- else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent}
129
- catch(e){return $(document.body)}
130
- var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent}
131
- catch(e){return Element._returnOffset(0,0)}
132
- var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
133
- offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}
134
- catch(e){return Element._returnOffset(0,0)}
135
- return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
136
- if(value[1])return parseFloat(value[1])/100;return 1.0;}
137
- if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))
138
- return element['offset'+style.capitalize()]+'px';return null;}
139
- return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
140
- element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
141
- element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=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={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=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);}
142
- else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
143
- else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
144
- if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
145
- return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
146
- if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}
147
- if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=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)});}
148
- else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
149
- if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
150
- content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
151
- fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
152
- fragments.each(function(node){parent.appendChild(node)});}
153
- else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
154
- Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={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:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</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={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement('div')['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=document.createElement('div')['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;}
155
- Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)
156
- return Prototype.K;var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase(),property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
157
- element[property]=value.methodize();}
158
- element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=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)});}
159
- if(arguments.length==2){var tagName=methods;methods=arguments[1];}
160
- if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
161
- function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
162
- Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
163
- function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
164
- destination[property]=value.methodize();}}
165
- function findDOMClass(tagName){var klass;var trans={"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='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName)['__proto__'];return window[klass];}
166
- if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}
167
- if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
168
- Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={},B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();if(B.WebKit&&!document.evaluate){dimensions[d]=self['inner'+D];}else if(B.Opera&&parseFloat(window.opera.version())<9.5){dimensions[d]=document.body['client'+D]}else{dimensions[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);}};var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))
169
- return false;if((/(\[[\w-]*?:|:checked)/).test(e))
170
- return false;return true;},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
171
- return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;}
172
- this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
173
- this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}
174
- this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
175
- this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();e="#"+id+" "+e;}
176
- results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root);}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}
177
- var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
178
- return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=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:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[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(*) = 0 and (count(text()) = 0)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
179
- 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]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
180
- return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c); c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c); c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
181
- a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
182
- node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
183
- node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
184
- if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
185
- if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
186
- return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
187
- h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,child;child=node.childNodes[j];j++)
188
- if(child.nodeType==1&&child.tagName!='!')results.push(child);}
189
- return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
190
- return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
191
- h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
192
- if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
193
- if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
194
- h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
195
- for(var i=0,node;node=nodes[i];i++)
196
- if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
197
- if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
198
- if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
199
- if(Selector.handlers.previousElementSibling(targetNode)==node)
200
- return[targetNode];}else nodes=h[combinator](nodes);}
201
- for(var i=0,node;node=nodes[i];i++)
202
- if(node==targetNode)return[targetNode];return[];}
203
- return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
204
- results.push(node);}
205
- return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
206
- if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
207
- return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
208
- return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
209
- return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
210
- if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
211
- 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=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
212
- if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
213
- if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
214
- if(node.nodeIndex==indices[j])results.push(node);}}
215
- h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||node.firstChild)continue;results.push(node);}
216
- return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
217
- if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
218
- if(!node.disabled&&(!node.type||node.type!=='hidden'))
219
- results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
220
- if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
221
- if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv==v||nv&&nv.startsWith(v);},'$=':function(nv,v){return nv==v||nv&&nv.endsWith(v);},'*=':function(nv,v){return nv==v||nv&&nv.include(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
222
- if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
223
- return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
224
- return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)
225
- if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
226
- node.removeAttribute('_countedByPrototype');return nodes;}});}
227
- function $$(){return Selector.findChildElements(document,$A(arguments));}
228
- var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
229
- else result[key]=value;}}
230
- return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={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()])
231
- elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
232
- continue;matchingInputs.push(Element.extend(input));}
233
- return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
234
- if(form.hasAttribute('method')&&!options.method)
235
- options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
236
- return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))
237
- element.select();}catch(e){}
238
- return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={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=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value))
239
- return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
240
- else opt.selected=value.include(currentValue);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(this.optionValue(opt));}
241
- return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=Class.create({initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
242
- this.registerFormCallbacks();else
243
- this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=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=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element);}});if(!window.Event)var Event={};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=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
244
- return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
245
- 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){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))
246
- node=currentTarget;}
247
- if(node){if(node.nodeType==Node.TEXT_NODE)node=node.parentNode;return Element.extend(node);}else return false;},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+
248
- (docElement.scrollLeft||body.scrollLeft)-
249
- (docElement.clientLeft||0)),y:event.pageY||(event.clientY+
250
- (docElement.scrollTop||body.scrollTop)-
251
- (docElement.clientTop||0))};},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=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=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=Event.prototype||document.createEvent("HTMLEvents")['__proto__'];Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){try{if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}catch(error){return false;}}
252
- function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;}
253
- function getCacheForID(id){return cache[id]=cache[id]||{};}
254
- function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
255
- function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
256
- return false;Event.extend(event);handler.call(element,event);};wrapper.handler=handler;c.push(wrapper);return wrapper;}
257
- function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
258
- function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
259
- function destroyCache(){for(var id in cache)
260
- for(var eventName in cache[id])
261
- cache[id][eventName]=null;}
262
- if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
263
- if(Prototype.Browser.WebKit){window.addEventListener('unload',Prototype.emptyFunction,false);}
264
- return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
265
- return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=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;}
266
- var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
267
- destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
268
- element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
269
- event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
270
- 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(){var timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");document.loaded=true;}
271
- if(document.addEventListener){if(Prototype.Browser.WebKit){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))
272
- fireContentLoadedEvent();},0);Event.observe(window,"load",fireContentLoadedEvent);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}};}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},within:function(element,x,y){if(this.includeScrollOffsets)
273
- return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
274
- return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
275
- return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
276
- instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
277
- elements.push(Element.extend(child));}
278
- return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();;var Validator=Class.create();Validator.prototype={initialize:function(className,error,test,options){if(typeof test=='function'){this.options=$H(options);this._test=test;}else{this.options=$H(test);this._test=function(){return true};}
279
- this.error=error||'Validation failed.';this.className=className;},test:function(v,elm){return(this._test(v,elm)&&this.options.all(function(p){return Validator.methods[p.key]?Validator.methods[p.key](v,elm,p.value):true;}));}}
280
- Validator.methods={pattern:function(v,elm,opt){return Validation.get('IsEmpty').test(v)||opt.test(v)},minLength:function(v,elm,opt){return v.length>=opt},maxLength:function(v,elm,opt){return v.length<=opt},min:function(v,elm,opt){return v>=parseFloat(opt)},max:function(v,elm,opt){return v<=parseFloat(opt)},notOneOf:function(v,elm,opt){return $A(opt).all(function(value){return v!=value;})},oneOf:function(v,elm,opt){return $A(opt).any(function(value){return v==value;})},is:function(v,elm,opt){return v==opt},isNot:function(v,elm,opt){return v!=opt},equalToField:function(v,elm,opt){return v==$F(opt)},notEqualToField:function(v,elm,opt){return v!=$F(opt)},include:function(v,elm,opt){return $A(opt).all(function(value){return Validation.get(value).test(v,elm);})}}
281
- var Validation=Class.create();Validation.defaultOptions={onSubmit:true,stopOnFirst:false,immediate:false,focusOnError:true,useTitles:false,addClassNameToContainer:false,containerClassName:'.input-box',onFormValidate:function(result,form){},onElementValidate:function(result,elm){}};Validation.prototype={initialize:function(form,options){this.form=$(form);if(!this.form){return;}
282
- this.options=Object.extend({onSubmit:Validation.defaultOptions.onSubmit,stopOnFirst:Validation.defaultOptions.stopOnFirst,immediate:Validation.defaultOptions.immediate,focusOnError:Validation.defaultOptions.focusOnError,useTitles:Validation.defaultOptions.useTitles,onFormValidate:Validation.defaultOptions.onFormValidate,onElementValidate:Validation.defaultOptions.onElementValidate},options||{});if(this.options.onSubmit)Event.observe(this.form,'submit',this.onSubmit.bind(this),false);if(this.options.immediate){Form.getElements(this.form).each(function(input){if(input.tagName.toLowerCase()=='select'){Event.observe(input,'blur',this.onChange.bindAsEventListener(this));}
283
- if(input.type.toLowerCase()=='radio'||input.type.toLowerCase()=='checkbox'){Event.observe(input,'click',this.onChange.bindAsEventListener(this));}else{Event.observe(input,'change',this.onChange.bindAsEventListener(this));}},this);}},onChange:function(ev){Validation.isOnChange=true;Validation.validate(Event.element(ev),{useTitle:this.options.useTitles,onElementValidate:this.options.onElementValidate});Validation.isOnChange=false;},onSubmit:function(ev){if(!this.validate())Event.stop(ev);},validate:function(){var result=false;var useTitles=this.options.useTitles;var callback=this.options.onElementValidate;try{if(this.options.stopOnFirst){result=Form.getElements(this.form).all(function(elm){if(elm.hasClassName('local-validation')&&!this.isElementInForm(elm,this.form)){return true;}
284
- return Validation.validate(elm,{useTitle:useTitles,onElementValidate:callback});},this);}else{result=Form.getElements(this.form).collect(function(elm){if(elm.hasClassName('local-validation')&&!this.isElementInForm(elm,this.form)){return true;}
285
- return Validation.validate(elm,{useTitle:useTitles,onElementValidate:callback});},this).all();}}catch(e){}
286
- if(!result&&this.options.focusOnError){try{Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()}
287
- catch(e){}}
288
- this.options.onFormValidate(result,this.form);return result;},reset:function(){Form.getElements(this.form).each(Validation.reset);},isElementInForm:function(elm,form){var domForm=elm.up('form');if(domForm==form){return true;}
289
- return false;}}
290
- Object.extend(Validation,{validate:function(elm,options){options=Object.extend({useTitle:false,onElementValidate:function(result,elm){}},options||{});elm=$(elm);var cn=$w(elm.className);return result=cn.all(function(value){var test=Validation.test(value,elm,options.useTitle);options.onElementValidate(test,elm);return test;});},insertAdvice:function(elm,advice){var container=$(elm).up('.field-row');if(container){Element.insert(container,{after:advice});}else if(elm.up('td.value')){elm.up('td.value').insert({bottom:advice});}else if(elm.advaiceContainer&&$(elm.advaiceContainer)){$(elm.advaiceContainer).update(advice);}
291
- else{switch(elm.type.toLowerCase()){case'checkbox':case'radio':var p=elm.parentNode;if(p){Element.insert(p,{'bottom':advice});}else{Element.insert(elm,{'after':advice});}
292
- break;default:Element.insert(elm,{'after':advice});}}},showAdvice:function(elm,advice,adviceName){if(!elm.advices){elm.advices=new Hash();}
293
- else{elm.advices.each(function(pair){this.hideAdvice(elm,pair.value);}.bind(this));}
294
- elm.advices.set(adviceName,advice);if(typeof Effect=='undefined'){advice.style.display='block';}else{if(!advice._adviceAbsolutize){new Effect.Appear(advice,{duration:1});}else{Position.absolutize(advice);advice.show();advice.setStyle({'top':advice._adviceTop,'left':advice._adviceLeft,'width':advice._adviceWidth,'z-index':1000});advice.addClassName('advice-absolute');}}},hideAdvice:function(elm,advice){if(advice!=null)advice.hide();},updateCallback:function(elm,status){if(typeof elm.callbackFunction!='undefined'){eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')');}},ajaxError:function(elm,errorMsg){var name='validate-ajax';var advice=Validation.getAdvice(name,elm);if(advice==null){advice=this.createAdvice(name,elm,false,errorMsg);}
295
- this.showAdvice(elm,advice,'validate-ajax');this.updateCallback(elm,'failed');elm.addClassName('validation-failed');elm.addClassName('validate-ajax');if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container&&this.allowContainerClassName(elm)){container.removeClassName('validation-passed');container.addClassName('validation-error');}}},allowContainerClassName:function(elm){if(elm.type=='radio'||elm.type=='checkbox'){return elm.hasClassName('change-container-classname');}
296
- return true;},test:function(name,elm,useTitle){var v=Validation.get(name);var prop='__advice'+name.camelize();try{if(Validation.isVisible(elm)&&!v.test($F(elm),elm)){var advice=Validation.getAdvice(name,elm);if(advice==null){advice=this.createAdvice(name,elm,useTitle);}
297
- this.showAdvice(elm,advice,name);this.updateCallback(elm,'failed');elm[prop]=1;if(!elm.advaiceContainer){elm.removeClassName('validation-passed');elm.addClassName('validation-failed');}
298
- if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container&&this.allowContainerClassName(elm)){container.removeClassName('validation-passed');container.addClassName('validation-error');}}
299
- return false;}else{var advice=Validation.getAdvice(name,elm);this.hideAdvice(elm,advice);this.updateCallback(elm,'passed');elm[prop]='';elm.removeClassName('validation-failed');elm.addClassName('validation-passed');if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container&&!container.down('.validation-failed')&&this.allowContainerClassName(elm)){if(!Validation.get('IsEmpty').test(elm.value)||!this.isVisible(elm)){container.addClassName('validation-passed');}else{container.removeClassName('validation-passed');}
300
- container.removeClassName('validation-error');}}
301
- return true;}}catch(e){throw(e)}},isVisible:function(elm){while(elm.tagName!='BODY'){if(!$(elm).visible())return false;elm=elm.parentNode;}
302
- return true;},getAdvice:function(name,elm){return $('advice-'+name+'-'+Validation.getElmID(elm))||$('advice-'+Validation.getElmID(elm));},createAdvice:function(name,elm,useTitle,customError){var v=Validation.get(name);var errorMsg=useTitle?((elm&&elm.title)?elm.title:v.error):v.error;if(customError){errorMsg=customError;}
303
- try{if(Translator){errorMsg=Translator.translate(errorMsg);}}
304
- catch(e){}
305
- advice='<div class="validation-advice" id="advice-'+name+'-'+Validation.getElmID(elm)+'" style="display:none">'+errorMsg+'</div>'
306
- Validation.insertAdvice(elm,advice);advice=Validation.getAdvice(name,elm);if($(elm).hasClassName('absolute-advice')){var dimensions=$(elm).getDimensions();var originalPosition=Position.cumulativeOffset(elm);advice._adviceTop=(originalPosition[1]+dimensions.height)+'px';advice._adviceLeft=(originalPosition[0])+'px';advice._adviceWidth=(dimensions.width)+'px';advice._adviceAbsolutize=true;}
307
- return advice;},getElmID:function(elm){return elm.id?elm.id:elm.name;},reset:function(elm){elm=$(elm);var cn=$w(elm.className);cn.each(function(value){var prop='__advice'+value.camelize();if(elm[prop]){var advice=Validation.getAdvice(value,elm);if(advice){advice.hide();}
308
- elm[prop]='';}
309
- elm.removeClassName('validation-failed');elm.removeClassName('validation-passed');if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=''){var container=elm.up(Validation.defaultOptions.containerClassName);if(container){container.removeClassName('validation-passed');container.removeClassName('validation-error');}}});},add:function(className,error,test,options){var nv={};nv[className]=new Validator(className,error,test,options);Object.extend(Validation.methods,nv);},addAllThese:function(validators){var nv={};$A(validators).each(function(value){nv[value[0]]=new Validator(value[0],value[1],value[2],(value.length>3?value[3]:{}));});Object.extend(Validation.methods,nv);},get:function(name){return Validation.methods[name]?Validation.methods[name]:Validation.methods['_LikeNoIDIEverSaw_'];},methods:{'_LikeNoIDIEverSaw_':new Validator('_LikeNoIDIEverSaw_','',{})}});Validation.add('IsEmpty','',function(v){return(v==''||(v==null)||(v.length==0)||/^\s+$/.test(v));});Validation.addAllThese([['validate-select','Please select an option.',function(v){return((v!="none")&&(v!=null)&&(v.length!=0));}],['required-entry','This is a required field.',function(v){return!Validation.get('IsEmpty').test(v);}],['validate-number','Please enter a valid number in this field.',function(v){return Validation.get('IsEmpty').test(v)||(!isNaN(parseNumber(v))&&!/^\s+$/.test(parseNumber(v)));}],['validate-digits','Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.',function(v){return Validation.get('IsEmpty').test(v)||!/[^\d]/.test(v);}],['validate-alpha','Please use letters only (a-z or A-Z) in this field.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-zA-Z]+$/.test(v)}],['validate-code','Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-z]+[a-z0-9_]+$/.test(v)}],['validate-alphanum','Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-zA-Z0-9]+$/.test(v)
310
- /*/\W/.test(v)*/
311
- }],['validate-street','Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.',function(v){return Validation.get('IsEmpty').test(v)||/^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v)}],['validate-phoneStrict','Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.',function(v){return Validation.get('IsEmpty').test(v)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);}],['validate-phoneLax','Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.',function(v){return Validation.get('IsEmpty').test(v)||/^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);}],['validate-fax','Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.',function(v){return Validation.get('IsEmpty').test(v)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);}],['validate-date','Please enter a valid date.',function(v){var test=new Date(v);return Validation.get('IsEmpty').test(v)||!isNaN(test);}],['validate-email','Please enter a valid email address. For example johndoe@domain.com.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})/i.test(v)}],['validate-emailSender','Please use only visible characters and spaces.',function(v){return Validation.get('IsEmpty').test(v)||/^[\S ]+$/.test(v)}],['validate-password','Please enter 6 or more characters. Leading or trailing spaces will be ignored.',function(v){var pass=v.strip();return!(pass.length>0&&pass.length<6);}],['validate-admin-password','Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.',function(v){var pass=v.strip();if(0==pass.length){return true;}
312
- if(!(/[a-z]/i.test(v))||!(/[0-9]/.test(v))){return false;}
313
- return!(pass.length<7);}],['validate-cpassword','Please make sure your passwords match.',function(v){var conf=$('confirmation')?$('confirmation'):$$('.validate-cpassword')[0];var pass=false;if($('password')){pass=$('password');}
314
- var passwordElements=$$('.validate-password');for(var i=0;i<passwordElements.size();i++){var passwordElement=passwordElements[i];if(passwordElement.up('form').id==conf.up('form').id){pass=passwordElement;}}
315
- if($$('.validate-admin-password').size()){pass=$$('.validate-admin-password')[0];}
316
- return(pass.value==conf.value);}],['validate-url','Please enter a valid URL. http:// is required',function(v){return Validation.get('IsEmpty').test(v)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)}],['validate-clean-url','Please enter a valid URL. For example http://www.example.com or www.example.com',function(v){return Validation.get('IsEmpty').test(v)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)||/^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)}],['validate-identifier','Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page"',function(v){return Validation.get('IsEmpty').test(v)||/^[A-Z0-9][A-Z0-9_\/-]+(\.[A-Z0-9_-]+)*$/i.test(v)}],['validate-xml-identifier','Please enter a valid XML-identifier. For example something_1, block5, id-4',function(v){return Validation.get('IsEmpty').test(v)||/^[A-Z][A-Z0-9_\/-]*$/i.test(v)}],['validate-ssn','Please enter a valid social security number. For example 123-45-6789.',function(v){return Validation.get('IsEmpty').test(v)||/^\d{3}-?\d{2}-?\d{4}$/.test(v);}],['validate-zip','Please enter a valid zip code. For example 90602 or 90602-1234.',function(v){return Validation.get('IsEmpty').test(v)||/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v);}],['validate-zip-international','Please enter a valid zip code.',function(v){return true;}],['validate-date-au','Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.',function(v){if(Validation.get('IsEmpty').test(v))return true;var regex=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!regex.test(v))return false;var d=new Date(v.replace(regex,'$2/$1/$3'));return(parseInt(RegExp.$2,10)==(1+d.getMonth()))&&(parseInt(RegExp.$1,10)==d.getDate())&&(parseInt(RegExp.$3,10)==d.getFullYear());}],['validate-currency-dollar','Please enter a valid $ amount. For example $100.00.',function(v){return Validation.get('IsEmpty').test(v)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)}],['validate-one-required','Please select one of the above options.',function(v,elm){var p=elm.parentNode;var options=p.getElementsByTagName('INPUT');return $A(options).any(function(elm){return $F(elm);});}],['validate-one-required-by-name','Please select one of the options.',function(v,elm){var inputs=$$('input[name="'+elm.name.replace(/([\\"])/g,'\\$1')+'"]');var error=1;for(var i=0;i<inputs.length;i++){if((inputs[i].type=='checkbox'||inputs[i].type=='radio')&&inputs[i].checked==true){error=0;}
317
- if(Validation.isOnChange&&(inputs[i].type=='checkbox'||inputs[i].type=='radio')){Validation.reset(inputs[i]);}}
318
- if(error==0){return true;}else{return false;}}],['validate-not-negative-number','Please enter a valid number in this field.',function(v){v=parseNumber(v);return(!isNaN(v)&&v>=0);}],['validate-state','Please select State/Province.',function(v){return(v!=0||v=='');}],['validate-new-password','Please enter 6 or more characters. Leading or trailing spaces will be ignored.',function(v){if(!Validation.get('validate-password').test(v))return false;if(Validation.get('IsEmpty').test(v)&&v!='')return false;return true;}],['validate-greater-than-zero','Please enter a number greater than 0 in this field.',function(v){if(v.length)
319
- return parseFloat(v)>0;else
320
- return true;}],['validate-zero-or-greater','Please enter a number 0 or greater in this field.',function(v){if(v.length)
321
- return parseFloat(v)>=0;else
322
- return true;}],['validate-cc-number','Please enter a valid credit card number.',function(v,elm){var ccTypeContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_number'))+'_cc_type');if(ccTypeContainer&&typeof Validation.creditCartTypes.get(ccTypeContainer.value)!='undefined'&&Validation.creditCartTypes.get(ccTypeContainer.value)[2]==false){if(!Validation.get('IsEmpty').test(v)&&Validation.get('validate-digits').test(v)){return true;}else{return false;}}
323
- return validateCreditCard(v);}],['validate-cc-type','Credit card number doesn\'t match credit card type',function(v,elm){elm.value=removeDelimiters(elm.value);v=removeDelimiters(v);var ccTypeContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_number'))+'_cc_type');if(!ccTypeContainer){return true;}
324
- var ccType=ccTypeContainer.value;if(typeof Validation.creditCartTypes.get(ccType)=='undefined'){return false;}
325
- if(Validation.creditCartTypes.get(ccType)[0]==false){return true;}
326
- var ccMatchedType='';Validation.creditCartTypes.each(function(pair){if(pair.value[0]&&v.match(pair.value[0])){ccMatchedType=pair.key;throw $break;}});if(ccMatchedType!=ccType){return false;}
327
- if(ccTypeContainer.hasClassName('validation-failed')&&Validation.isOnChange){Validation.validate(ccTypeContainer);}
328
- return true;}],['validate-cc-type-select','Card type doesn\'t match credit card number',function(v,elm){var ccNumberContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_type'))+'_cc_number');if(Validation.isOnChange&&Validation.get('IsEmpty').test(ccNumberContainer.value)){return true;}
329
- if(Validation.get('validate-cc-type').test(ccNumberContainer.value,ccNumberContainer)){Validation.validate(ccNumberContainer);}
330
- return Validation.get('validate-cc-type').test(ccNumberContainer.value,ccNumberContainer);}],['validate-cc-exp','Incorrect credit card expiration date',function(v,elm){var ccExpMonth=v;var ccExpYear=$(elm.id.substr(0,elm.id.indexOf('_expiration'))+'_expiration_yr').value;var currentTime=new Date();var currentMonth=currentTime.getMonth()+1;var currentYear=currentTime.getFullYear();if(ccExpMonth<currentMonth&&ccExpYear==currentYear){return false;}
331
- return true;}],['validate-cc-cvn','Please enter a valid credit card verification number.',function(v,elm){var ccTypeContainer=$(elm.id.substr(0,elm.id.indexOf('_cc_cid'))+'_cc_type');if(!ccTypeContainer){return true;}
332
- var ccType=ccTypeContainer.value;if(typeof Validation.creditCartTypes.get(ccType)=='undefined'){return false;}
333
- var re=Validation.creditCartTypes.get(ccType)[1];if(v.match(re)){return true;}
334
- return false;}],['validate-ajax','',function(v,elm){return true;}],['validate-data','Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.',function(v){if(v!=''&&v){return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v);}
335
- return true;}],['validate-css-length','Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%',function(v){if(v!=''&&v){return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v)&&(!(/\..*\./.test(v)))&&!(/\.$/.test(v));}
336
- return true;}],['validate-length','Maximum length exceeded.',function(v,elm){var re=new RegExp(/^maximum-length-[0-9]+$/);var result=true;$w(elm.className).each(function(name,index){if(name.match(re)&&result){var length=name.split('-')[2];result=(v.length<=length);}});return result;}],['validate-percents','Please enter a number lower than 100',{max:100}]]);function validateCreditCard(s){var v="0123456789";var w="";for(i=0;i<s.length;i++){x=s.charAt(i);if(v.indexOf(x,0)!=-1)
337
- w+=x;}
338
- j=w.length/2;k=Math.floor(j);m=Math.ceil(j)-k;c=0;for(i=0;i<k;i++){a=w.charAt(i*2+m)*2;c+=a>9?Math.floor(a/10+a%10):a;}
339
- for(i=0;i<k+m;i++)c+=w.charAt(i*2+1-m)*1;return(c%10==0);}
340
- function removeDelimiters(v){v=v.replace(/\s/g,'');v=v.replace(/\-/g,'');return v;}
341
- function parseNumber(v)
342
- {if(typeof v!='string'){return parseFloat(v);}
343
- var isDot=v.indexOf('.');var isComa=v.indexOf(',');if(isDot!=-1&&isComa!=-1){if(isComa>isDot){v=v.replace('.','').replace(',','.');}
344
- else{v=v.replace(',','');}}
345
- else if(isComa!=-1){v=v.replace(',','.');}
346
- return parseFloat(v);}
347
- Validation.creditCartTypes=$H({'VI':[new RegExp('^4[0-9]{12}([0-9]{3})?$'),new RegExp('^[0-9]{3}$'),true],'MC':[new RegExp('^5[1-5][0-9]{14}$'),new RegExp('^[0-9]{3}$'),true],'AE':[new RegExp('^3[47][0-9]{13}$'),new RegExp('^[0-9]{4}$'),true],'DI':[new RegExp('^6011[0-9]{12}$'),new RegExp('^[0-9]{3}$'),true],'SS':[new RegExp('^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$'),new RegExp('^([0-9]{3}|[0-9]{4})?$'),true],'OT':[false,new RegExp('^([0-9]{3}|[0-9]{4})?$'),false]});;var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName){elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try{parentElement.innerHTML="<"+elementName+"></"+elementName+">";}catch(e){}
348
- var element=parentElement.firstChild||null;if(element&&(element.tagName.toUpperCase()!=elementName))
349
- element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1])
350
- if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)||arguments[1].tagName){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+
351
- attrs+"></"+elementName+">";}catch(e){}
352
- element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1])
353
- element[attr=='class'?'className':attr]=arguments[1][attr];}
354
- if(element.tagName.toUpperCase()!=elementName)
355
- element=parentElement.getElementsByTagName(elementName)[0];}}
356
- if(arguments[2])
357
- this._children(element,arguments[2]);return $(element);},_text:function(text){return document.createTextNode(text);},ATTR_MAP:{'className':'class','htmlFor':'for'},_attributes:function(attributes){var attrs=[];for(attribute in attributes)
358
- attrs.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;')+'"');return attrs.join(" ");},_children:function(element,children){if(children.tagName){element.appendChild(children);return;}
359
- if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object')
360
- element.appendChild(e);else
361
- if(Builder._isStringOrNumber(e))
362
- element.appendChild(Builder._text(e));});}else
363
- if(Builder._isStringOrNumber(children))
364
- element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');},build:function(html){var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope){if(typeof scope!='object'&&typeof scope!='function')scope=window;var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));};});}};;String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
365
- return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
366
- elements=element;else
367
- elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
368
- effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
369
- this.effects.push(effect);if(!this.interval)
370
- this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
371
- this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
372
- (options[eventName]?'this.options.'+eventName+'(this);':''));}
373
- if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function dispatch(effect,eventName){if(effect.options[eventName+'Internal'])
374
- effect.options[eventName+'Internal'](effect);if(effect.options[eventName])
375
- effect.options[eventName](effect);}
376
- return function(pos){if(this.state==="idle"){this.state="running";dispatch(this,'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');}
377
- if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+this.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update)this.update(pos);dispatch(this,'afterUpdate');}};})();this.event('beforeStart');if(!this.options.sync)
378
- Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
379
- var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
380
- Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
381
- if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
382
- this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
383
- this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
384
- this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
385
- this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
386
- this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
387
- this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
388
- this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
389
- if(!this.options.endcolor)
390
- this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
391
- this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
392
- return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
393
- return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{},oldOpacity=element.getInlineOpacity(),transition=options.transition||Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
394
- this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
395
- this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16);});}
396
- this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
397
- this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
398
- var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
399
- style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
400
- (Math.round(transform.originalValue[0]+
401
- (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
402
- (Math.round(transform.originalValue[1]+
403
- (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
404
- (Math.round(transform.originalValue[2]+
405
- (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
406
- (transform.targetValue-transform.originalValue)*position).toFixed(3)+
407
- (transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
408
- style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
409
- Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
410
- styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};}
411
- Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);;if(Object.isUndefined(Effect))
412
- throw("dragdrop.js requires including script.aculo.us' effects.js library");var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if(Object.isArray(containment)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
413
- if(options.accept)options.accept=[options.accept].flatten();Element.makePositioned(element);options.element=element;this.drops.push(options);},findDeepestChild:function(drops){deepest=drops[0];for(i=1;i<drops.length;++i)
414
- if(Element.isParent(drops[i].element,deepest.element))
415
- deepest=drops[i];return deepest;},isContained:function(element,drop){var containmentNode;if(drop.tree){containmentNode=element.treeNode;}else{containmentNode=element.parentNode;}
416
- return drop._containers.detect(function(c){return containmentNode==c});},isAffected:function(point,element,drop){return((drop.element!=element)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&Position.within(drop.element,point[0],point[1]));},deactivate:function(drop){if(drop.hoverclass)
417
- Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(drop.hoverclass)
418
- Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(point,element){if(!this.drops.length)return;var drop,affected=[];this.drops.each(function(drop){if(Droppables.isAffected(point,element,drop))
419
- affected.push(drop);});if(affected.length>0)
420
- drop=Droppables.findDeepestChild(affected);if(this.last_active&&this.last_active!=drop)this.deactivate(this.last_active);if(drop){Position.within(drop.element,point[0],point[1]);if(drop.onHover)
421
- drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));if(drop!=this.last_active)Droppables.activate(drop);}},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(event),Event.pointerY(event)],element,this.last_active))
422
- if(this.last_active.onDrop){this.last_active.onDrop(element,this.last_active.element,event);return true;}},reset:function(){if(this.last_active)
423
- this.deactivate(this.last_active);}};var Draggables={drags:[],observers:[],register:function(draggable){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(draggable.element,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}
424
- this.drags.push(draggable);},unregister:function(draggable){this.drags=this.drags.reject(function(d){return d==draggable});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(draggable.element,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(draggable){if(draggable.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=draggable;}.bind(this),draggable.options.delay);}else{window.focus();this.activeDraggable=draggable;}},deactivate:function(){this.activeDraggable=null;},updateDrag:function(event){if(!this.activeDraggable)return;var pointer=[Event.pointerX(event),Event.pointerY(event)];if(this._lastPointer&&(this._lastPointer.inspect()==pointer.inspect()))return;this._lastPointer=pointer;this.activeDraggable.updateDrag(event,pointer);},endDrag:function(event){if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}
425
- if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(event);this.activeDraggable=null;},keyPress:function(event){if(this.activeDraggable)
426
- this.activeDraggable.keyPress(event);},addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
427
- this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});if(draggable.options[eventName])draggable.options[eventName](draggable,event);},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}};var Draggable=Class.create({initialize:function(element){var defaults={handle:false,reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;new Effect.Move(element,{x:-left_offset,y:-top_offset,duration:dur,queue:{scope:'_draggable',position:'end'}});},endeffect:function(element){var toOpacity=Object.isNumber(element._opacity)?element._opacity:1.0;new Effect.Opacity(element,{duration:0.2,from:0.7,to:toOpacity,queue:{scope:'_draggable',position:'end'},afterFinish:function(){Draggable._dragging[element]=false}});},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect))
428
- Object.extend(defaults,{starteffect:function(element){element._opacity=Element.getOpacity(element);Draggable._dragging[element]=true;new Effect.Opacity(element,{duration:0.2,from:element._opacity,to:0.7});}});var options=Object.extend(defaults,arguments[1]||{});this.element=$(element);if(options.handle&&Object.isString(options.handle))
429
- this.handle=this.element.down('.'+options.handle,0);if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;if(options.scroll&&!options.scroll.scrollTo&&!options.scroll.outerHTML){options.scroll=$(options.scroll);this._isScrollChild=Element.childOf(this.element,options.scroll);}
430
- Element.makePositioned(this.element);this.options=options;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')]);},initDrag:function(event){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(event)){var src=Event.element(event);if((tag_name=src.tagName.toUpperCase())&&(tag_name=='INPUT'||tag_name=='SELECT'||tag_name=='OPTION'||tag_name=='BUTTON'||tag_name=='TEXTAREA'))return;var pointer=[Event.pointerX(event),Event.pointerY(event)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(pointer[i]-pos[i])});Draggables.activate(this);Event.stop(event);}},startDrag:function(event){this.dragging=true;if(!this.delta)
431
- this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex;}
432
- if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=(this.element.getStyle('position')=='absolute');if(!this._originallyAbsolute)
433
- Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
434
- if(this.options.scroll){if(this.options.scroll==window){var where=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=where.left;this.originalScrollTop=where.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}
435
- Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element);}
436
- Draggables.notify('onDrag',this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}
437
- var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity))speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<(p[1]+this.options.scrollSensitivity))speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>(p[2]-this.options.scrollSensitivity))speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>(p[3]-this.options.scrollSensitivity))speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed);}
438
- if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);},finishDrag:function(event,success){this.dragging=false;if(this.options.quiet){Position.prepare();var pointer=[Event.pointerX(event),Event.pointerY(event)];Droppables.show(pointer,this.element);}
439
- if(this.options.ghosting){if(!this._originallyAbsolute)
440
- Position.relativize(this.element);delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null;}
441
- var dropped=false;if(success){dropped=Droppables.fire(event,this.element);if(!dropped)dropped=false;}
442
- if(dropped&&this.options.onDropped)this.options.onDropped(this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&Object.isFunction(revert))revert=revert(this.element);var d=this.currentDelta();if(revert&&this.options.reverteffect){if(dropped==0||revert!='failure')
443
- this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}else{this.delta=d;}
444
- if(this.options.zindex)
445
- this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
446
- this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset();},keyPress:function(event){if(event.keyCode!=Event.KEY_ESC)return;this.finishDrag(event,false);Event.stop(event);},endDrag:function(event){if(!this.dragging)return;this.stopScrolling();this.finishDrag(event,true);Event.stop(event);},draw:function(point){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}
447
- var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
448
- var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){p=this.options.snap(p[0],p[1],this);}else{if(Object.isArray(this.options.snap)){p=p.map(function(v,i){return(v/this.options.snap[i]).round()*this.options.snap[i]}.bind(this));}else{p=p.map(function(v){return(v/this.options.snap).round()*this.options.snap}.bind(this));}}}
449
- var style=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))
450
- style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
451
- style.top=p[1]+"px";if(style.visibility=="hidden")style.visibility="";},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(speed){if(!(speed[0]||speed[1]))return;this.scrollSpeed=[speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000;}
452
- Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0)
453
- Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)
454
- Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer);}
455
- if(this.options.change)this.options.change(this);},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
456
- if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight;}}
457
- return{top:T,left:L,width:W,height:H};}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
458
- this.observer(this.element)}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(element){while(element.tagName.toUpperCase()!="BODY"){if(element.id&&Sortable.sortables[element.id])return element;element=element.parentNode;}},options:function(element){element=Sortable._findRootElement($(element));if(!element)return;return Sortable.sortables[element.id];},destroy:function(element){element=$(element);var s=Sortable.sortables[element.id];if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id];}},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,quiet:options.quiet,scroll:options.scroll,scrollSpeed:options.scrollSpeed,scrollSensitivity:options.scrollSensitivity,delay:options.delay,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
459
- options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
460
- options_for_draggable.reverteffect=options.reverteffect;else
461
- if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
462
- options_for_draggable.endeffect=options.endeffect;if(options.zindex)
463
- options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,tree:options.tree,hoverclass:options.hoverclass,onHover:Sortable.onHover};var options_for_tree={onHover:Sortable.onEmptyHover,overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass};Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty||options.tree){Droppables.add(element,options_for_tree);options.droppables.push(element);}
464
- (options.elements||this.findElements(element,options)||[]).each(function(e,i){var handle=options.handles?$(options.handles[i]):(options.handle?$(e).select('.'+options.handle)[0]:e);options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);if(options.tree)e.treeNode=element;options.droppables.push(e);});if(options.tree){(Sortable.findTreeElements(element,options)||[]).each(function(e){Droppables.add(e,options_for_tree);e.treeNode=element;options.droppables.push(e);});}
465
- this.sortables[element.id]=options;Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.tag);},findTreeElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.treeTag);},onHover:function(element,dropon,overlap){if(Element.isParent(dropon,element))return;if(overlap>.33&&overlap<.66&&Sortable.options(dropon).tree){return;}else if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
466
- Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
467
- Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon,overlap){var oldParentNode=element.parentNode;var droponOptions=Sortable.options(dropon);if(!Element.isParent(dropon,element)){var index;var children=Sortable.findElements(dropon,{tag:droponOptions.tag,only:droponOptions.only});var child=null;if(children){var offset=Element.offsetSize(dropon,droponOptions.overlap)*(1.0-overlap);for(index=0;index<children.length;index+=1){if(offset-Element.offsetSize(children[index],droponOptions.overlap)>=0){offset-=Element.offsetSize(children[index],droponOptions.overlap);}else if(offset-(Element.offsetSize(children[index],droponOptions.overlap)/2)>=0){child=index+1<children.length?children[index+1]:null;break;}else{child=children[index];break;}}}
468
- dropon.insertBefore(element,child);Sortable.options(oldParentNode).onChange(element);droponOptions.onChange(element);}},unmark:function(){if(Sortable._marker)Sortable._marker.hide();},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=($('dropmarker')||Element.extend(document.createElement('DIV'))).hide().addClassName('dropmarker').setStyle({position:'absolute'});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
469
- var offsets=Position.cumulativeOffset(dropon);Sortable._marker.setStyle({left:offsets[0]+'px',top:offsets[1]+'px'});if(position=='after')
470
- if(sortable.overlap=='horizontal')
471
- Sortable._marker.setStyle({left:(offsets[0]+dropon.clientWidth)+'px'});else
472
- Sortable._marker.setStyle({top:(offsets[1]+dropon.clientHeight)+'px'});Sortable._marker.show();},_tree:function(element,options,parent){var children=Sortable.findElements(element,options)||[];for(var i=0;i<children.length;++i){var match=children[i].id.match(options.format);if(!match)continue;var child={id:encodeURIComponent(match?match[1]:null),element:element,parent:parent,children:[],position:parent.children.length,container:$(children[i]).down(options.treeTag)};if(child.container)
473
- this._tree(child.container,options,child);parent.children.push(child);}
474
- return parent;},tree:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,treeTag:sortableOptions.treeTag,only:sortableOptions.only,name:element.id,format:sortableOptions.format},arguments[1]||{});var root={id:null,parent:null,children:[],container:element,position:0};return Sortable._tree(element,options,root);},_constructIndex:function(node){var index='';do{if(node.id)index='['+node.position+']'+index;}while((node=node.parent)!=null);return index;},sequence:function(element){element=$(element);var options=Object.extend(this.options(element),arguments[1]||{});return $(this.findElements(element,options)||[]).map(function(item){return item.id.match(options.format)?item.id.match(options.format)[1]:'';});},setSequence:function(element,new_sequence){element=$(element);var options=Object.extend(this.options(element),arguments[2]||{});var nodeMap={};this.findElements(element,options).each(function(n){if(n.id.match(options.format))
475
- nodeMap[n.id.match(options.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n);});new_sequence.each(function(ident){var n=nodeMap[ident];if(n){n[1].appendChild(n[0]);delete nodeMap[ident];}});},serialize:function(element){element=$(element);var options=Object.extend(Sortable.options(element),arguments[1]||{});var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:element.id);if(options.tree){return Sortable.tree(element,arguments[1]).children.map(function(item){return[name+Sortable._constructIndex(item)+"[id]="+
476
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));}).flatten().join('&');}else{return Sortable.sequence(element,arguments[1]).map(function(item){return name+"[]="+encodeURIComponent(item);}).join('&');}}};Element.isParent=function(child,element){if(!child.parentNode||child==element)return false;if(child.parentNode==element)return true;return Element.isParent(child.parentNode,element);};Element.findChildren=function(element,only,recursive,tagName){if(!element.hasChildNodes())return null;tagName=tagName.toUpperCase();if(only)only=[only].flatten();var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==tagName&&(!only||(Element.classNames(e).detect(function(v){return only.include(v)}))))
477
- elements.push(e);if(recursive){var grandchildren=Element.findChildren(e,only,recursive,tagName);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():[]);};Element.offsetSize=function(element,type){return element['offset'+((type=='vertical'||type=='height')?'Height':'Width')];};;if(typeof Effect=='undefined')
478
- throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element);this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
479
- this.setOptions(options);else
480
- this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
481
- Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
482
- this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
483
- this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keydown',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
484
- if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
485
- switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
486
- else
487
- if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
488
- {this.index=element.autocompleteIndex;this.render();}
489
- Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
490
- this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1;},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;this.getEntry(this.index).scrollIntoView(false);},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
491
- var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
492
- value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
493
- newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
494
- this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
495
- this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
496
- this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
497
- this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
498
- return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
499
- if(newS[index]!=oldS[index])
500
- return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
501
- encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
502
- this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
503
- elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
504
- elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
505
- foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
506
- if(partial.length)
507
- ret=ret.concat(partial.slice(0,instance.options.choices-ret.length));return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);};Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId))
508
- this.options.formId='';}
509
- if(this.options.externalControl)
510
- this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)
511
- this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
512
- this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
513
- this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
514
- btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses)
515
- link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
516
- fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur)
517
- fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
518
- this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase())
519
- this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization)
520
- this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
521
- this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl)
522
- this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)
523
- this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName)
524
- this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML.unescapeHTML();},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
525
- params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
526
- if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)
527
- this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName)
528
- this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
529
- text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
530
- $(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
531
- this.element.observe(pair.key,listener);if(this.options.externalControl)
532
- this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
533
- this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
534
- this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)
535
- this.loadCollection();else
536
- this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))
537
- throw('Server returned an invalid collection representation.');this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
538
- tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)
539
- this.loadExternalText();else
540
- this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
541
- ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});;if(!Control)var Control={};Control.Slider=Class.create({initialize:function(handle,track,options){var slider=this;if(Object.isArray(handle)){this.handles=handle.collect(function(e){return $(e)});}else{this.handles=[$(handle)];}
542
- this.track=$(track);this.options=options||{};this.axis=this.options.axis||'horizontal';this.increment=this.options.increment||1;this.step=parseInt(this.options.step||'1');this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(s){return $(s)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||'0');this.alignY=parseInt(this.options.alignY||'0');this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled)this.setDisabled();this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max();}
543
- this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(h,i){i=slider.handles.length-1-i;slider.setValue(parseFloat((Object.isArray(slider.options.sliderValue)?slider.options.sliderValue[i]:slider.options.sliderValue)||slider.range.start),i);h.makePositioned().observe("mousedown",slider.eventMouseDown);});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);$(this.track.parentNode.parentNode).observe("mousemove",this.eventMouseMove);this.initialized=true;},dispose:function(){var slider=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(this.track.parentNode.parentNode,"mousemove",this.eventMouseMove);this.handles.each(function(h){Event.stopObserving(h,"mousedown",slider.eventMouseDown);});},setDisabled:function(){this.disabled=true;this.track.parentNode.className=this.track.parentNode.className+' disabled';},setEnabled:function(){this.disabled=false;},getNearestValue:function(value){if(this.allowedValues){if(value>=this.allowedValues.max())return(this.allowedValues.max());if(value<=this.allowedValues.min())return(this.allowedValues.min());var offset=Math.abs(this.allowedValues[0]-value);var newValue=this.allowedValues[0];this.allowedValues.each(function(v){var currentOffset=Math.abs(v-value);if(currentOffset<=offset){newValue=v;offset=currentOffset;}});return newValue;}
544
- if(value>this.range.end)return this.range.end;if(value<this.range.start)return this.range.start;return value;},setValue:function(sliderValue,handleIdx){if(!this.active){this.activeHandleIdx=handleIdx||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles();}
545
- handleIdx=handleIdx||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((handleIdx>0)&&(sliderValue<this.values[handleIdx-1]))
546
- sliderValue=this.values[handleIdx-1];if((handleIdx<(this.handles.length-1))&&(sliderValue>this.values[handleIdx+1]))
547
- sliderValue=this.values[handleIdx+1];}
548
- sliderValue=this.getNearestValue(sliderValue);this.values[handleIdx]=sliderValue;this.value=this.values[0];this.handles[handleIdx].style[this.isVertical()?'top':'left']=this.translateToPx(sliderValue);this.drawSpans();if(!this.dragging||!this.event)this.updateFinished();},setValueBy:function(delta,handleIdx){this.setValue(this.values[handleIdx||this.activeHandleIdx||0]+delta,handleIdx||this.activeHandleIdx||0);},translateToPx:function(value){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(value-this.range.start))+"px";},translateToValue:function(offset){return((offset/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start);},getRange:function(range){var v=this.values.sortBy(Prototype.K);range=range||0;return $R(v[range],v[range+1]);},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX);},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX);},isVertical:function(){return(this.axis=='vertical');},drawSpans:function(){var slider=this;if(this.spans)
549
- $R(0,this.spans.length-1).each(function(r){slider.setSpan(slider.spans[r],slider.getRange(r))});if(this.options.startSpan)
550
- this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value));if(this.options.endSpan)
551
- this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum));},setSpan:function(span,range){if(this.isVertical()){span.style.top=this.translateToPx(range.start);span.style.height=this.translateToPx(range.end-range.start+this.range.start);}else{span.style.left=this.translateToPx(range.start);span.style.width=this.translateToPx(range.end-range.start+this.range.start);}},updateStyles:function(){this.handles.each(function(h){Element.removeClassName(h,'selected')});Element.addClassName(this.activeHandle,'selected');},startDrag:function(event){if(Event.isLeftClick(event)){if(!this.disabled){this.active=true;var handle=Event.element(event);var pointer=[Event.pointerX(event),Event.pointerY(event)];var track=handle;if(track==this.track){var offsets=Position.cumulativeOffset(this.track);this.event=event;this.setValue(this.translateToValue((this.isVertical()?pointer[1]-offsets[1]:pointer[0]-offsets[0])-(this.handleLength/2)));var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}else{while((this.handles.indexOf(handle)==-1)&&handle.parentNode)
552
- handle=handle.parentNode;if(this.handles.indexOf(handle)!=-1){this.activeHandle=handle;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}}}
553
- Event.stop(event);}},update:function(event){if(this.active){if(!this.dragging)this.dragging=true;this.draw(event);if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);}},draw:function(event){var pointer=[Event.pointerX(event),Event.pointerY(event)];var offsets=Position.cumulativeOffset(this.track);pointer[0]-=this.offsetX+offsets[0];pointer[1]-=this.offsetY+offsets[1];this.event=event;this.setValue(this.translateToValue(this.isVertical()?pointer[1]:pointer[0]));if(this.initialized&&this.options.onSlide)
554
- this.options.onSlide(this.values.length>1?this.values:this.value,this);},endDrag:function(event){if(this.active&&this.dragging){this.finishDrag(event,true);Event.stop(event);}
555
- this.active=false;this.dragging=false;},finishDrag:function(event,success){this.active=false;this.dragging=false;this.updateFinished();},updateFinished:function(){if(this.initialized&&this.options.onChange)
556
- this.options.onChange(this.values.length>1?this.values:this.value,this);this.event=null;}});;function popWin(url,win,para){var win=window.open(url,win,para);win.focus();}
557
- function setLocation(url){window.location.href=url;}
558
- function setPLocation(url,setFocus){if(setFocus){window.opener.focus();}
559
- window.opener.location.href=url;}
560
- function setLanguageCode(code,fromCode){var href=window.location.href;var after='',dash;if(dash=href.match(/\#(.*)$/)){href=href.replace(/\#(.*)$/,'');after=dash[0];}
561
- if(href.match(/[?]/)){var re=/([?&]store=)[a-z0-9_]*/;if(href.match(re)){href=href.replace(re,'$1'+code);}else{href+='&store='+code;}
562
- var re=/([?&]from_store=)[a-z0-9_]*/;if(href.match(re)){href=href.replace(re,'');}}else{href+='?store='+code;}
563
- if(typeof(fromCode)!='undefined'){href+='&from_store='+fromCode;}
564
- href+=after;setLocation(href);}
565
- function decorateGeneric(elements,decorateParams)
566
- {var allSupportedParams=['odd','even','first','last'];var _decorateParams={};var total=elements.length;if(total){if(typeof(decorateParams)=='undefined'){decorateParams=allSupportedParams;}
567
- if(!decorateParams.length){return;}
568
- for(var k in allSupportedParams){_decorateParams[allSupportedParams[k]]=false;}
569
- for(var k in decorateParams){_decorateParams[decorateParams[k]]=true;}
570
- if(_decorateParams.first){Element.addClassName(elements[0],'first');}
571
- if(_decorateParams.last){Element.addClassName(elements[total-1],'last');}
572
- for(var i=0;i<total;i++){if((i+1)%2==0){if(_decorateParams.even){Element.addClassName(elements[i],'even');}}
573
- else{if(_decorateParams.odd){Element.addClassName(elements[i],'odd');}}}}}
574
- function decorateTable(table,options){var table=$(table);if(table){var _options={'tbody':false,'tbody tr':['odd','even','first','last'],'thead tr':['first','last'],'tfoot tr':['first','last'],'tr td':['last']};if(typeof(options)!='undefined'){for(var k in options){_options[k]=options[k];}}
575
- if(_options['tbody']){decorateGeneric(table.select('tbody'),_options['tbody']);}
576
- if(_options['tbody tr']){decorateGeneric(table.select('tbody tr'),_options['tbody tr']);}
577
- if(_options['thead tr']){decorateGeneric(table.select('thead tr'),_options['thead tr']);}
578
- if(_options['tfoot tr']){decorateGeneric(table.select('tfoot tr'),_options['tfoot tr']);}
579
- if(_options['tr td']){var allRows=table.select('tr');if(allRows.length){for(var i=0;i<allRows.length;i++){decorateGeneric(allRows[i].getElementsByTagName('TD'),_options['tr td']);}}}}}
580
- function decorateList(list,nonRecursive){if($(list)){if(typeof(nonRecursive)=='undefined'){var items=$(list).select('li')}
581
- else{var items=$(list).childElements();}
582
- decorateGeneric(items,['odd','even','last']);}}
583
- function decorateDataList(list){list=$(list);if(list){decorateGeneric(list.select('dt'),['odd','even','last']);decorateGeneric(list.select('dd'),['odd','even','last']);}}
584
- function parseSidUrl(baseUrl,urlExt){sidPos=baseUrl.indexOf('/?SID=');sid='';urlExt=(urlExt!=undefined)?urlExt:'';if(sidPos>-1){sid='?'+baseUrl.substring(sidPos+2);baseUrl=baseUrl.substring(0,sidPos+1);}
585
- return baseUrl+urlExt+sid;}
586
- function formatCurrency(price,format,showPlus){precision=isNaN(format.precision=Math.abs(format.precision))?2:format.precision;requiredPrecision=isNaN(format.requiredPrecision=Math.abs(format.requiredPrecision))?2:format.requiredPrecision;precision=requiredPrecision;integerRequired=isNaN(format.integerRequired=Math.abs(format.integerRequired))?1:format.integerRequired;decimalSymbol=format.decimalSymbol==undefined?",":format.decimalSymbol;groupSymbol=format.groupSymbol==undefined?".":format.groupSymbol;groupLength=format.groupLength==undefined?3:format.groupLength;if(showPlus==undefined||showPlus==true){s=price<0?"-":(showPlus?"+":"");}else if(showPlus==false){s='';}
587
- i=parseInt(price=Math.abs(+price||0).toFixed(precision))+"";pad=(i.length<integerRequired)?(integerRequired-i.length):0;while(pad){i='0'+i;pad--;}
588
- j=(j=i.length)>groupLength?j%groupLength:0;re=new RegExp("(\\d{"+groupLength+"})(?=\\d)","g");r=(j?i.substr(0,j)+groupSymbol:"")+i.substr(j).replace(re,"$1"+groupSymbol)+(precision?decimalSymbol+Math.abs(price-i).toFixed(precision).replace(/-/,0).slice(2):"")
589
- if(format.pattern.indexOf('{sign}')==-1){pattern=s+format.pattern;}else{pattern=format.pattern.replace('{sign}',s);}
590
- return pattern.replace('%s',r).replace(/^\s\s*/,'').replace(/\s\s*$/,'');};function expandDetails(el,childClass){if(Element.hasClassName(el,'show-details')){$$(childClass).each(function(item){item.hide()});Element.removeClassName(el,'show-details');}
591
- else{$$(childClass).each(function(item){item.show()});Element.addClassName(el,'show-details');}}
592
- var isIE=navigator.appVersion.match(/MSIE/)=="MSIE";if(!window.Varien)
593
- var Varien=new Object();Varien.showLoading=function(){Element.show('loading-process');}
594
- Varien.hideLoading=function(){Element.hide('loading-process');}
595
- Varien.GlobalHandlers={onCreate:function(){Varien.showLoading();},onComplete:function(){if(Ajax.activeRequestCount==0){Varien.hideLoading();}}};Ajax.Responders.register(Varien.GlobalHandlers);Varien.searchForm=Class.create();Varien.searchForm.prototype={initialize:function(form,field,emptyText){this.form=$(form);this.field=$(field);this.emptyText=emptyText;Event.observe(this.form,'submit',this.submit.bind(this));Event.observe(this.field,'focus',this.focus.bind(this));Event.observe(this.field,'blur',this.blur.bind(this));this.blur();},submit:function(event){if(this.field.value==this.emptyText||this.field.value==''){Event.stop(event);return false;}
596
- return true;},focus:function(event){if(this.field.value==this.emptyText){this.field.value='';}},blur:function(event){if(this.field.value==''){this.field.value=this.emptyText;}},initAutocomplete:function(url,destinationElement){new Ajax.Autocompleter(this.field,destinationElement,url,{paramName:this.field.name,method:'get',minChars:2,updateElement:this._selectAutocompleteItem.bind(this),onShow:function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
597
- Effect.Appear(update,{duration:0});}});},_selectAutocompleteItem:function(element){if(element.title){this.field.value=element.title;}
598
- this.form.submit();}}
599
- Varien.Tabs=Class.create();Varien.Tabs.prototype={initialize:function(selector){var self=this;$$(selector+' a').each(this.initTab.bind(this));},initTab:function(el){el.href='javascript:void(0)';if($(el.parentNode).hasClassName('active')){this.showContent(el);}
600
- el.observe('click',this.showContent.bind(this,el));},showContent:function(a){var li=$(a.parentNode),ul=$(li.parentNode);ul.getElementsBySelector('li','ol').each(function(el){var contents=$(el.id+'_contents');if(el==li){el.addClassName('active');contents.show();}else{el.removeClassName('active');contents.hide();}});}}
601
- Varien.DOB=Class.create();Varien.DOB.prototype={initialize:function(selector,required,format){var el=$$(selector)[0];this.day=Element.select($(el),'.dob-day input')[0];this.month=Element.select($(el),'.dob-month input')[0];this.year=Element.select($(el),'.dob-year input')[0];this.dob=Element.select($(el),'.dob-full input')[0];this.advice=Element.select($(el),'.validation-advice')[0];this.required=required;this.format=format;this.day.validate=this.validate.bind(this);this.month.validate=this.validate.bind(this);this.year.validate=this.validate.bind(this);this.advice.hide();},validate:function(){var error=false;if(this.day.value==''&&this.month.value==''&&this.year.value==''){if(this.required){error='This date is a required value.';}else{this.dob.value='';}}else if(this.day.value==''||this.month.value==''||this.year.value==''){error='Please enter a valid full date.';}else{var date=new Date();if(this.day.value<1||this.day.value>31){error='Please enter a valid day (1-31).';}else if(this.month.value<1||this.month.value>12){error='Please enter a valid month (1-12).';}else if(this.year.value<1900||this.year.value>date.getFullYear()){error='Please enter a valid year (1900-'+date.getFullYear()+').';}else{this.dob.value=this.format.replace(/(%m|%b)/i,this.month.value).replace(/(%d|%e)/i,this.day.value).replace(/%y/i,this.year.value);var testDOB=this.month.value+'/'+this.day.value+'/'+this.year.value;var test=new Date(testDOB);if(isNaN(test)){error='Please enter a valid date.';}}}
602
- if(error!==false){try{this.advice.innerHTML=Translator.translate(error);}
603
- catch(e){this.advice.innerHTML=error;}
604
- this.advice.show();return false;}
605
- this.advice.hide();return true;}}
606
- Validation.addAllThese([['validate-custom',' ',function(v,elm){return elm.validate();}]]);function truncateOptions(){$$('.truncated').each(function(element){Event.observe(element,'mouseover',function(){if(element.down('div.truncated_full_value')){element.down('div.truncated_full_value').addClassName('show')}});Event.observe(element,'mouseout',function(){if(element.down('div.truncated_full_value')){element.down('div.truncated_full_value').removeClassName('show')}});});}
607
- Event.observe(window,'load',function(){truncateOptions();});Element.addMethods({getInnerText:function(element)
608
- {element=$(element);if(element.innerText&&!Prototype.Browser.Opera){return element.innerText}
609
- return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g,' ');}});if(!("console"in window)||!("firebug"in console))
610
- {var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i)
611
- window.console[names[i]]=function(){}};VarienForm=Class.create();VarienForm.prototype={initialize:function(formId,firstFieldFocus){this.form=$(formId);if(!this.form){return;}
612
- this.cache=$A();this.currLoader=false;this.currDataIndex=false;this.validator=new Validation(this.form);this.elementFocus=this.elementOnFocus.bindAsEventListener(this);this.elementBlur=this.elementOnBlur.bindAsEventListener(this);this.childLoader=this.onChangeChildLoad.bindAsEventListener(this);this.highlightClass='highlight';this.extraChildParams='';this.firstFieldFocus=firstFieldFocus||false;this.bindElements();if(this.firstFieldFocus){try{Form.Element.focus(Form.findFirstElement(this.form))}
613
- catch(e){}}},submit:function(url){if(this.validator&&this.validator.validate()){this.form.submit();}
614
- return false;},bindElements:function(){var elements=Form.getElements(this.form);for(var row in elements){if(elements[row].id){Event.observe(elements[row],'focus',this.elementFocus);Event.observe(elements[row],'blur',this.elementBlur);}}},elementOnFocus:function(event){var element=Event.findElement(event,'fieldset');if(element){Element.addClassName(element,this.highlightClass);}},elementOnBlur:function(event){var element=Event.findElement(event,'fieldset');if(element){Element.removeClassName(element,this.highlightClass);}},setElementsRelation:function(parent,child,dataUrl,first){if(parent=$(parent)){if(!this.cache[parent.id]){this.cache[parent.id]=$A();this.cache[parent.id]['child']=child;this.cache[parent.id]['dataUrl']=dataUrl;this.cache[parent.id]['data']=$A();this.cache[parent.id]['first']=first||false;}
615
- Event.observe(parent,'change',this.childLoader);}},onChangeChildLoad:function(event){element=Event.element(event);this.elementChildLoad(element);},elementChildLoad:function(element,callback){this.callback=callback||false;if(element.value){this.currLoader=element.id;this.currDataIndex=element.value;if(this.cache[element.id]['data'][element.value]){this.setDataToChild(this.cache[element.id]['data'][element.value]);}
616
- else{new Ajax.Request(this.cache[this.currLoader]['dataUrl'],{method:'post',parameters:{"parent":element.value},onComplete:this.reloadChildren.bind(this)});}}},reloadChildren:function(transport){var data=eval('('+transport.responseText+')');this.cache[this.currLoader]['data'][this.currDataIndex]=data;this.setDataToChild(data);},setDataToChild:function(data){if(data.length){var child=$(this.cache[this.currLoader]['child']);if(child){var html='<select name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>';if(this.cache[this.currLoader]['first']){html+='<option value="">'+this.cache[this.currLoader]['first']+'</option>';}
617
- for(var i in data){if(data[i].value){html+='<option value="'+data[i].value+'"';if(child.value&&(child.value==data[i].value||child.value==data[i].label)){html+=' selected';}
618
- html+='>'+data[i].label+'</option>';}}
619
- html+='</select>';Element.insert(child,{before:html});Element.remove(child);}}
620
- else{var child=$(this.cache[this.currLoader]['child']);if(child){var html='<input type="text" name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>';Element.insert(child,{before:html});Element.remove(child);}}
621
- this.bindElements();if(this.callback){this.callback();}}}
622
- RegionUpdater=Class.create();RegionUpdater.prototype={initialize:function(countryEl,regionTextEl,regionSelectEl,regions,disableAction,zipEl)
623
- {this.countryEl=$(countryEl);this.regionTextEl=$(regionTextEl);this.regionSelectEl=$(regionSelectEl);this.zipEl=$(zipEl);this.regions=regions;this.disableAction=(typeof disableAction=='undefined')?'hide':disableAction;this.zipOptions=(typeof zipOptions=='undefined')?false:zipOptions;if(this.regionSelectEl.options.length<=1){this.update();}
624
- Event.observe(this.countryEl,'change',this.update.bind(this));},update:function()
625
- {if(this.regions[this.countryEl.value]){var i,option,region,def;if(this.regionTextEl){def=this.regionTextEl.value.toLowerCase();this.regionTextEl.value='';}
626
- if(!def){def=this.regionSelectEl.getAttribute('defaultValue');}
627
- this.regionSelectEl.options.length=1;for(regionId in this.regions[this.countryEl.value]){region=this.regions[this.countryEl.value][regionId];option=document.createElement('OPTION');option.value=regionId;option.text=region.name;if(this.regionSelectEl.options.add){this.regionSelectEl.options.add(option);}else{this.regionSelectEl.appendChild(option);}
628
- if(regionId==def||region.name.toLowerCase()==def||region.code.toLowerCase()==def){this.regionSelectEl.value=regionId;}}
629
- if(this.disableAction=='hide'){if(this.regionTextEl){this.regionTextEl.style.display='none';}
630
- this.regionSelectEl.style.display='';}else if(this.disableAction=='disable'){if(this.regionTextEl){this.regionTextEl.disabled=true;}
631
- this.regionSelectEl.disabled=false;}
632
- this.setMarkDisplay(this.regionSelectEl,true);}else{if(this.disableAction=='hide'){if(this.regionTextEl){this.regionTextEl.style.display='';}
633
- this.regionSelectEl.style.display='none';Validation.reset(this.regionSelectEl);}else if(this.disableAction=='disable'){if(this.regionTextEl){this.regionTextEl.disabled=false;}
634
- this.regionSelectEl.disabled=true;}else if(this.disableAction=='nullify'){this.regionSelectEl.options.length=1;this.regionSelectEl.value='';this.regionSelectEl.selectedIndex=0;this.lastCountryId='';}
635
- this.setMarkDisplay(this.regionSelectEl,false);}
636
- var zipUpdater=new ZipUpdater(this.countryEl.value,this.zipEl);zipUpdater.update();},setMarkDisplay:function(elem,display){elem=$(elem);var labelElement=elem.up(0).down('label > span.required')||elem.up(1).down('label > span.required')||elem.up(0).down('label.required > em')||elem.up(1).down('label.required > em');if(labelElement){inputElement=labelElement.up().next('input');if(display){labelElement.show();if(inputElement){inputElement.addClassName('required-entry');}}else{labelElement.hide();if(inputElement){inputElement.removeClassName('required-entry');}}}}}
637
- ZipUpdater=Class.create();ZipUpdater.prototype={initialize:function(country,zipElement)
638
- {this.country=country;this.zipElement=$(zipElement);},update:function()
639
- {if(typeof optionalZipCountries=='undefined'){return false;}
640
- if(this.zipElement!=undefined){this._setPostcodeOptional();}else{Event.observe(window,"load",this._setPostcodeOptional.bind(this));}},_setPostcodeOptional:function()
641
- {this.zipElement=$(this.zipElement);if(this.zipElement==undefined){return false;}
642
- var label=$$('label[for="'+this.zipElement.id+'"]')[0];if(label!=undefined){var wildCard=label.down('em')||label.down('span.required');}
643
- if(optionalZipCountries.indexOf(this.country)!=-1){while(this.zipElement.hasClassName('required-entry')){this.zipElement.removeClassName('required-entry');}
644
- if(wildCard!=undefined){wildCard.hide();}}else{this.zipElement.addClassName('required-entry');if(wildCard!=undefined){wildCard.show();}}}};function toggleMenu(el,over)
645
- {if(over){Element.addClassName(el,'over');}
646
- else{Element.removeClassName(el,'over');}};var Translate=Class.create();Translate.prototype={initialize:function(data){this.data=$H(data);},translate:function(){var args=arguments;var text=arguments[0];if(this.data.get(text)){return this.data.get(text);}
647
- return text;},add:function(){if(arguments.length>1){this.data.set(arguments[0],arguments[1]);}else if(typeof arguments[0]=='object'){$H(arguments[0]).each(function(pair){this.data.set(pair.key,pair.value);}.bind(this));}}};if(!window.Mage)var Mage={};Mage.Cookies={};Mage.Cookies.expires=null;Mage.Cookies.path='/';Mage.Cookies.domain=null;Mage.Cookies.secure=false;Mage.Cookies.set=function(name,value){var argv=arguments;var argc=arguments.length;var expires=(argc>2)?argv[2]:Mage.Cookies.expires;var path=(argc>3)?argv[3]:Mage.Cookies.path;var domain=(argc>4)?argv[4]:Mage.Cookies.domain;var secure=(argc>5)?argv[5]:Mage.Cookies.secure;document.cookie=name+"="+escape(value)+
648
- ((expires==null)?"":("; expires="+expires.toGMTString()))+
649
- ((path==null)?"":("; path="+path))+
650
- ((domain==null)?"":("; domain="+domain))+
651
- ((secure==true)?"; secure":"");};Mage.Cookies.get=function(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;var j=0;while(i<clen){j=i+alen;if(document.cookie.substring(i,j)==arg)
652
- return Mage.Cookies.getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)
653
- break;}
654
- return null;};Mage.Cookies.clear=function(name){if(Mage.Cookies.get(name)){document.cookie=name+"="+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}};Mage.Cookies.getCookieVal=function(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1){endstr=document.cookie.length;}
655
- return unescape(document.cookie.substring(offset,endstr));};;function taxToggle(details,switcher,expandedClassName)
656
- {if($(details).style.display=='none'){$(details).show();$(switcher).addClassName(expandedClassName);}else{$(details).hide();$(switcher).removeClassName(expandedClassName);}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
var/minifycache/minify_900559c432c691b50ba33f48b4909a4f.gz DELETED
Binary file
var/minifycache/minify_95afbee78c0f49b564250d655add1ca9 DELETED
@@ -1,655 +0,0 @@
1
- var Prototype={Version:'1.6.0.3',Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),Opera:navigator.userAgent.indexOf('Opera')>-1,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div')['__proto__']&&document.createElement('div')['__proto__']!==document.createElement('form')['__proto__']},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)
2
- Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
3
- parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
4
- Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
5
- for(var i=0;i<properties.length;i++)
6
- klass.addMethods(properties[i]);if(!klass.prototype.initialize)
7
- klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
8
- properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
9
- this.prototype[property]=value;}
10
- return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
11
- destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
12
- if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
13
- results.push(property.toJSON()+': '+value);}
14
- return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
15
- keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
16
- values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return!!(object&&object.nodeType==1);},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},defer:function(){var args=[0.01].concat($A(arguments));return this.delay.apply(this,args);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+
17
- (this.getUTCMonth()+1).toPaddedString(2)+'-'+
18
- this.getUTCDate().toPaddedString(2)+'T'+
19
- this.getUTCHours().toPaddedString(2)+':'+
20
- this.getUTCMinutes().toPaddedString(2)+':'+
21
- this.getUTCSeconds().toPaddedString(2)+'Z"';};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
22
- return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}finally{this.currentlyExecuting=false;}}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
23
- return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=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=length||30;truncation=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=new RegExp(Prototype.ScriptFragment,'img');var matchOne=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=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=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=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
24
- else hash[key]=value;}
25
- return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
26
- String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
27
- camelized+=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}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(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=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
28
- throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},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,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
29
- object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
30
- return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
31
- return this;},eachSlice:function(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)
32
- slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))
33
- throw $break;});return result;},collect:function(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
34
- results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
35
- filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
36
- results.push(iterator.call(context,value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))
37
- if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=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){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
38
- result=value;});return result;},min:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)
39
- result=value;});return result;},partition:function(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
40
- results.push(value);});return results;},sortBy:function(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
41
- iterator=args.pop();var collections=[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'#<Enumerable:'+this.toArray().inspect()+'>';}};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=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
42
- if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(typeof iterable==='function'&&typeof iterable.length==='number'&&typeof iterable.item==='function')&&iterable.toArray)
43
- return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;};}
44
- Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)
45
- iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==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==index||(sorted?array.last()!=value:!array.include(value)))
46
- array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
47
- Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
48
- if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
49
- if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)
50
- array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
51
- return array;};}
52
- Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator,context){$R(0,this,true).each(iterator,context);return this;},toPaddedString:function(length,radix){var string=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]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
53
- return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){if(this._object[key]!==Object.prototype[key])
54
- return this._object[key];},unset:function(key){var value=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=this.detect(function(pair){return pair.value===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.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))
55
- return results.concat(values.map(toQueryPair.curry(key)));}else results.push(toQueryPair(key,values));return results;}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';},toJSON:function(){return Object.toJSON(this.toObject());},clone:function(){return new Hash(this);}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
56
- return false;if(this.exclusive)
57
- return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};var Ajax={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={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
58
- this.responders.push(responder);},unregister:function(responder){this.responders=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=Class.create({initialize:function(options){this.options={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=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))
59
- this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))
60
- this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
61
- this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
62
- this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
63
- params+='&_=';}
64
- try{var response=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).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
65
- this.onStateChange();}
66
- catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
67
- this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['Content-type']=this.options.contentType+
68
- (this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)
69
- headers['Connection']='close';}
70
- if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
71
- for(var i=0,length=extras.length;i<length;i+=2)
72
- headers[extras[i]]=extras[i+1];else
73
- $H(extras).each(function(pair){headers[pair.key]=pair.value});}
74
- for(var name in headers)
75
- this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
76
- var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
77
- this.evalResponse();}
78
- try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
79
- if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{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=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
80
- if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=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=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
81
- return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
82
- else options.insertion(receiver,responseText);}
83
- else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.responseText;}
84
- this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
85
- elements.push($(arguments[i]));return elements;}
86
- if(Object.isString(element))
87
- element=document.getElementById(element);return Element.extend(element);}
88
- if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
89
- results.push(Element.extend(query.snapshotItem(i)));return results;};}
90
- if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){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});}
91
- (function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
92
- if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
93
- element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
94
- insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
95
- content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
96
- return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
97
- $(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
98
- element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
99
- if(element.nodeType==1)
100
- elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;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=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
101
- selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
102
- return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
103
- element.removeAttribute(name);else if(value===true)
104
- element.setAttribute(name,name);else element.setAttribute(name,value);}
105
- 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=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))
106
- element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
107
- element.removeChild(node);node=nextNode;}
108
- return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
109
- return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
110
- return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
111
- if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}
112
- if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}
113
- for(var property in styles)
114
- if(property=='opacity')element.setOpacity(styles[property]);else
115
- elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=element.getStyle('display');if(display!='none'&&display!=null)
116
- return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
117
- return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
118
- return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')
119
- element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);if(element.tagName.toUpperCase()=='HTML')
120
- return $(document.body);while((element=element.parentNode)&&element!=document.body)
121
- if(Element.getStyle(element,'position')!='static')
122
- return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
123
- if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
124
- if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
125
- return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
126
- else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
127
- return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
128
- else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent}
129
- catch(e){return $(document.body)}
130
- var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent}
131
- catch(e){return Element._returnOffset(0,0)}
132
- var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
133
- offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}
134
- catch(e){return Element._returnOffset(0,0)}
135
- return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
136
- if(value[1])return parseFloat(value[1])/100;return 1.0;}
137
- if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))
138
- return element['offset'+style.capitalize()]+'px';return null;}
139
- return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
140
- element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
141
- element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=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={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=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);}
142
- else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
143
- else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
144
- if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
145
- return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
146
- if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}
147
- if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=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)});}
148
- else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
149
- if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
150
- content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
151
- fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
152
- fragments.each(function(node){parent.appendChild(node)});}
153
- else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
154
- Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={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:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</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={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement('div')['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=document.createElement('div')['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;}
155
- Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)
156
- return Prototype.K;var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase(),property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
157
- element[property]=value.methodize();}
158
- element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=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)});}
159
- if(arguments.length==2){var tagName=methods;methods=arguments[1];}
160
- if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
161
- function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
162
- Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
163
- function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
164
- destination[property]=value.methodize();}}
165
- function findDOMClass(tagName){var klass;var trans={"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='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName)['__proto__'];return window[klass];}
166
- if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}
167
- if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
168
- Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={},B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();if(B.WebKit&&!document.evaluate){dimensions[d]=self['inner'+D];}else if(B.Opera&&parseFloat(window.opera.version())<9.5){dimensions[d]=document.body['client'+D]}else{dimensions[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);}};var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))
169
- return false;if((/(\[[\w-]*?:|:checked)/).test(e))
170
- return false;return true;},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
171
- return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;}
172
- this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
173
- this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}
174
- this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
175
- this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();e="#"+id+" "+e;}
176
- results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root);}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}
177
- var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
178
- return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=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:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[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(*) = 0 and (count(text()) = 0)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
179
- 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]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
180
- return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c); c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c); c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
181
- a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
182
- node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
183
- node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
184
- if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
185
- if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
186
- return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
187
- h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,child;child=node.childNodes[j];j++)
188
- if(child.nodeType==1&&child.tagName!='!')results.push(child);}
189
- return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
190
- return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
191
- h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
192
- if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
193
- if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
194
- h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
195
- for(var i=0,node;node=nodes[i];i++)
196
- if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
197
- if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
198
- if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
199
- if(Selector.handlers.previousElementSibling(targetNode)==node)
200
- return[targetNode];}else nodes=h[combinator](nodes);}
201
- for(var i=0,node;node=nodes[i];i++)
202
- if(node==targetNode)return[targetNode];return[];}
203
- return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
204
- results.push(node);}
205
- return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
206
- if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
207
- return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
208
- return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
209
- return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
210
- if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
211
- 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=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
212
- if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
213
- if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
214
- if(node.nodeIndex==indices[j])results.push(node);}}
215
- h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||node.firstChild)continue;results.push(node);}
216
- return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
217
- if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
218
- if(!node.disabled&&(!node.type||node.type!=='hidden'))
219
- results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
220
- if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
221
- if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv==v||nv&&nv.startsWith(v);},'$=':function(nv,v){return nv==v||nv&&nv.endsWith(v);},'*=':function(nv,v){return nv==v||nv&&nv.include(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
222
- if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
223
- return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
224
- return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)
225
- if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
226
- node.removeAttribute('_countedByPrototype');return nodes;}});}
227
- function $$(){return Selector.findChildElements(document,$A(arguments));}
228
- var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
229
- else result[key]=value;}}
230
- return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={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()])
231
- elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
232
- continue;matchingInputs.push(Element.extend(input));}
233
- return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
234
- if(form.hasAttribute('method')&&!options.method)
235
- options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
236
- return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))
237
- element.select();}catch(e){}
238
- return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={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=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value))
239
- return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
240
- else opt.selected=value.include(currentValue);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(this.optionValue(opt));}
241
- return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=Class.create({initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
242
- this.registerFormCallbacks();else
243
- this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=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=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element);}});if(!window.Event)var Event={};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=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
244
- return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
245
- 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){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))
246
- node=currentTarget;}
247
- if(node){if(node.nodeType==Node.TEXT_NODE)node=node.parentNode;return Element.extend(node);}else return false;},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+
248
- (docElement.scrollLeft||body.scrollLeft)-
249
- (docElement.clientLeft||0)),y:event.pageY||(event.clientY+
250
- (docElement.scrollTop||body.scrollTop)-
251
- (do