responsive - Version 0.0.3

Version Notes

- Fix the complict between prototype and
- more config theme at the backend

Download this release

Release Info

Developer tony vu
Extension responsive
Version 0.0.3
Comparing to
See all releases


Code changes from version 0.0.2 to 0.0.3

app/code/local/Tvcom/Themecustom/Model/Background/Repeat.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * define the background repeat status
5
+ *
6
+ */
7
+ class Tvcom_Themecustom_Model_Background_Repeat
8
+ {
9
+ public function toOptionArray()
10
+ {
11
+ return array(
12
+ array('value'=>'repeat' , 'label'=>'repeat'),
13
+ array('value'=>'repeat-x' , 'label'=>'repeat-x'),
14
+ array('value'=>'repeat-y' , 'label'=>'repeat-y'),
15
+ array('value'=>'no-repeat' , 'label'=>'no-repeat'),
16
+ array('value'=>'inherit' , 'label'=>'inherit'),
17
+ );
18
+ }
19
+ }
app/code/local/Tvcom/Themecustom/etc/system.xml CHANGED
@@ -29,23 +29,53 @@
29
  <bgcolor translate="label">
30
  <label>Background color</label>
31
  <frontend_type>text</frontend_type>
32
- <validate>color</validate>
33
- <!-- <source_model></source_model>-->
34
  <sort_order>1</sort_order>
35
  <show_in_default>1</show_in_default>
36
  <show_in_website>1</show_in_website>
37
  <show_in_store>1</show_in_store>
38
  </bgcolor>
39
 
40
- <!-- <bgimage translate="label">
41
- <label>Background image</label>
42
- <frontend_type>file</frontend_type>
 
 
 
43
  <sort_order>2</sort_order>
44
  <show_in_default>1</show_in_default>
45
  <show_in_website>1</show_in_website>
46
  <show_in_store>1</show_in_store>
47
- </bgimage> -->
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  </fields>
50
  </themebg>
51
 
@@ -64,7 +94,7 @@
64
  <show_in_default>1</show_in_default>
65
  <show_in_website>1</show_in_website>
66
  <show_in_store>1</show_in_store>
67
- <comment>Example:</comment>
68
  </goofont>
69
 
70
  <fontfamily translate="label">
@@ -105,6 +135,28 @@
105
  <show_in_default>1</show_in_default>
106
  <show_in_website>1</show_in_website>
107
  <show_in_store>0</show_in_store>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  </header>
109
 
110
  <footer translate="label"> <!-- footer -->
29
  <bgcolor translate="label">
30
  <label>Background color</label>
31
  <frontend_type>text</frontend_type>
32
+ <validate>color</validate>
 
33
  <sort_order>1</sort_order>
34
  <show_in_default>1</show_in_default>
35
  <show_in_website>1</show_in_website>
36
  <show_in_store>1</show_in_store>
37
  </bgcolor>
38
 
39
+ <bgimage translate="label"> <!-- body background image -->
40
+ <label>Background image</label>
41
+ <frontend_type>image</frontend_type>
42
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
43
+ <upload_dir config="system/filesystem/media" scope_info="1">bgimage</upload_dir>
44
+ <base_url type="media" scope_info="1">bgimage</base_url>
45
  <sort_order>2</sort_order>
46
  <show_in_default>1</show_in_default>
47
  <show_in_website>1</show_in_website>
48
  <show_in_store>1</show_in_store>
49
+ </bgimage>
50
 
51
+ <bgpositionx translate="label"> <!-- background position x -->
52
+ <label>Background position x</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>3</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </bgpositionx>
59
+
60
+ <bgpositiony translate="label"> <!-- background position y -->
61
+ <label>Background position y</label>
62
+ <fronend_type>text</fronend_type>
63
+ <sort_order>4</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </bgpositiony>
68
+
69
+ <bgrepeat translate="label"> <!-- background repeat -->
70
+ <label>Background repeat</label>
71
+ <frontend_type>select</frontend_type>
72
+ <source_model>themecustom/background_repeat</source_model>
73
+ <sort_order>5</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </bgrepeat>
78
+
79
  </fields>
80
  </themebg>
81
 
94
  <show_in_default>1</show_in_default>
95
  <show_in_website>1</show_in_website>
96
  <show_in_store>1</show_in_store>
97
+ <comment><![CDATA[Example: <br/> &lt;link href='http://fonts.googleapis.com/css?family=Alegreya+Sans' rel='stylesheet' type='text/css'&gt;]]></comment>
98
  </goofont>
99
 
100
  <fontfamily translate="label">
135
  <show_in_default>1</show_in_default>
136
  <show_in_website>1</show_in_website>
137
  <show_in_store>0</show_in_store>
138
+ <fields>
139
+ <logo translate="label">
140
+ <label>Company Logo</label>
141
+ <frontend_type>image</frontend_type>
142
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
143
+ <upload_dir config="system/filesystem/media" scope_info="1">logo</upload_dir>
144
+ <base_url type="media" scope_info="1">logo</base_url>
145
+ <sort_order>1</sort_order>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>1</show_in_store>
149
+ </logo>
150
+
151
+ <logoalt translate="label">
152
+ <label>Logo Alt</label>
153
+ <frontend_type>text</frontend_type>
154
+ <sort_order>2</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ </logoalt>
159
+ </fields>
160
  </header>
161
 
162
  <footer translate="label"> <!-- footer -->
app/design/frontend/default/responsive/template/page/html/topmenu.phtml CHANGED
@@ -42,7 +42,12 @@
42
  <span class="icon-bar"></span>
43
  <span class="icon-bar"></span>
44
  </button>
45
- <a class="navbar-brand" href="<?php echo $this->getBaseUrl(); ?>">freemarket</a>
 
 
 
 
 
46
  </div>
47
  <div class="nav-container collapse navbar-collapse" id="bs-example-navbar-collapse-1">
48
  <ul id="nav" class="nav navbar-nav">
42
  <span class="icon-bar"></span>
43
  <span class="icon-bar"></span>
44
  </button>
45
+ <!-- company logo -->
46
+ <?php if(Mage::getStoreConfig('setting/header/logo') != ''): ?>
47
+ <a class="navbar-brand" href="<?php echo $this->getBaseUrl(); ?>"><img height="50px" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'logo/' . Mage::getStoreConfig('setting/header/logo') ?>" alt="<?php echo Mage::getStoreConfig('setting/header/logoalt') ?>"></a>
48
+ <?php else: ?>
49
+ <a class="navbar-brand" href="<?php echo $this->getBaseUrl(); ?>">freemarket</a>
50
+ <?endif; ?>
51
  </div>
52
  <div class="nav-container collapse navbar-collapse" id="bs-example-navbar-collapse-1">
53
  <ul id="nav" class="nav navbar-nav">
js/prototype/prototype.js ADDED
@@ -0,0 +1,6097 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Prototype JavaScript framework, version 1.7
2
+ * (c) 2005-2010 Sam Stephenson
3
+ *
4
+ * Prototype is freely distributable under the terms of an MIT-style license.
5
+ * For details, see the Prototype web site: http://www.prototypejs.org/
6
+ *
7
+ *--------------------------------------------------------------------------*/
8
+
9
+ var isBootstrapEvent = false;
10
+ if (window.jQuery) {
11
+ jQuery('*').on('hide.bs.dropdown', function( event ) {
12
+ isBootstrapEvent = true;
13
+ });
14
+ jQuery('*').on('hide.bs.collapse', function( event ) {
15
+ isBootstrapEvent = true;
16
+ });
17
+ jQuery('*').on('hide.bs.modal', function( event ) {
18
+ isBootstrapEvent = true;
19
+ });
20
+ }
21
+
22
+ var Prototype = {
23
+
24
+ Version: '1.7',
25
+
26
+ Browser: (function(){
27
+ var ua = navigator.userAgent;
28
+ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
29
+ return {
30
+ IE: !!window.attachEvent && !isOpera,
31
+ Opera: isOpera,
32
+ WebKit: ua.indexOf('AppleWebKit/') > -1,
33
+ Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
34
+ MobileSafari: /Apple.*Mobile/.test(ua)
35
+ }
36
+ })(),
37
+
38
+ BrowserFeatures: {
39
+ XPath: !!document.evaluate,
40
+
41
+ SelectorsAPI: !!document.querySelector,
42
+
43
+ ElementExtensions: (function() {
44
+ var constructor = window.Element || window.HTMLElement;
45
+ return !!(constructor && constructor.prototype);
46
+ })(),
47
+ SpecificElementExtensions: (function() {
48
+ if (typeof window.HTMLDivElement !== 'undefined')
49
+ return true;
50
+
51
+ var div = document.createElement('div'),
52
+ form = document.createElement('form'),
53
+ isSupported = false;
54
+
55
+ if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
56
+ isSupported = true;
57
+ }
58
+
59
+ div = form = null;
60
+
61
+ return isSupported;
62
+ })()
63
+ },
64
+
65
+ ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
66
+ JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
67
+
68
+ emptyFunction: function() { },
69
+
70
+ K: function(x) { return x }
71
+ };
72
+
73
+ if (Prototype.Browser.MobileSafari)
74
+ Prototype.BrowserFeatures.SpecificElementExtensions = false;
75
+
76
+
77
+ var Abstract = { };
78
+
79
+
80
+ var Try = {
81
+ these: function() {
82
+ var returnValue;
83
+
84
+ for (var i = 0, length = arguments.length; i < length; i++) {
85
+ var lambda = arguments[i];
86
+ try {
87
+ returnValue = lambda();
88
+ break;
89
+ } catch (e) { }
90
+ }
91
+
92
+ return returnValue;
93
+ }
94
+ };
95
+
96
+ /* Based on Alex Arnell's inheritance implementation. */
97
+
98
+ var Class = (function() {
99
+
100
+ var IS_DONTENUM_BUGGY = (function(){
101
+ for (var p in { toString: 1 }) {
102
+ if (p === 'toString') return false;
103
+ }
104
+ return true;
105
+ })();
106
+
107
+ function subclass() {};
108
+ function create() {
109
+ var parent = null, properties = $A(arguments);
110
+ if (Object.isFunction(properties[0]))
111
+ parent = properties.shift();
112
+
113
+ function klass() {
114
+ this.initialize.apply(this, arguments);
115
+ }
116
+
117
+ Object.extend(klass, Class.Methods);
118
+ klass.superclass = parent;
119
+ klass.subclasses = [];
120
+
121
+ if (parent) {
122
+ subclass.prototype = parent.prototype;
123
+ klass.prototype = new subclass;
124
+ parent.subclasses.push(klass);
125
+ }
126
+
127
+ for (var i = 0, length = properties.length; i < length; i++)
128
+ klass.addMethods(properties[i]);
129
+
130
+ if (!klass.prototype.initialize)
131
+ klass.prototype.initialize = Prototype.emptyFunction;
132
+
133
+ klass.prototype.constructor = klass;
134
+ return klass;
135
+ }
136
+
137
+ function addMethods(source) {
138
+ var ancestor = this.superclass && this.superclass.prototype,
139
+ properties = Object.keys(source);
140
+
141
+ if (IS_DONTENUM_BUGGY) {
142
+ if (source.toString != Object.prototype.toString)
143
+ properties.push("toString");
144
+ if (source.valueOf != Object.prototype.valueOf)
145
+ properties.push("valueOf");
146
+ }
147
+
148
+ for (var i = 0, length = properties.length; i < length; i++) {
149
+ var property = properties[i], value = source[property];
150
+ if (ancestor && Object.isFunction(value) &&
151
+ value.argumentNames()[0] == "$super") {
152
+ var method = value;
153
+ value = (function(m) {
154
+ return function() { return ancestor[m].apply(this, arguments); };
155
+ })(property).wrap(method);
156
+
157
+ value.valueOf = method.valueOf.bind(method);
158
+ value.toString = method.toString.bind(method);
159
+ }
160
+ this.prototype[property] = value;
161
+ }
162
+
163
+ return this;
164
+ }
165
+
166
+ return {
167
+ create: create,
168
+ Methods: {
169
+ addMethods: addMethods
170
+ }
171
+ };
172
+ })();
173
+ (function() {
174
+
175
+ var _toString = Object.prototype.toString,
176
+ NULL_TYPE = 'Null',
177
+ UNDEFINED_TYPE = 'Undefined',
178
+ BOOLEAN_TYPE = 'Boolean',
179
+ NUMBER_TYPE = 'Number',
180
+ STRING_TYPE = 'String',
181
+ OBJECT_TYPE = 'Object',
182
+ FUNCTION_CLASS = '[object Function]',
183
+ BOOLEAN_CLASS = '[object Boolean]',
184
+ NUMBER_CLASS = '[object Number]',
185
+ STRING_CLASS = '[object String]',
186
+ ARRAY_CLASS = '[object Array]',
187
+ DATE_CLASS = '[object Date]',
188
+ NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON &&
189
+ typeof JSON.stringify === 'function' &&
190
+ JSON.stringify(0) === '0' &&
191
+ typeof JSON.stringify(Prototype.K) === 'undefined';
192
+
193
+ function Type(o) {
194
+ switch(o) {
195
+ case null: return NULL_TYPE;
196
+ case (void 0): return UNDEFINED_TYPE;
197
+ }
198
+ var type = typeof o;
199
+ switch(type) {
200
+ case 'boolean': return BOOLEAN_TYPE;
201
+ case 'number': return NUMBER_TYPE;
202
+ case 'string': return STRING_TYPE;
203
+ }
204
+ return OBJECT_TYPE;
205
+ }
206
+
207
+ function extend(destination, source) {
208
+ for (var property in source)
209
+ destination[property] = source[property];
210
+ return destination;
211
+ }
212
+
213
+ function inspect(object) {
214
+ try {
215
+ if (isUndefined(object)) return 'undefined';
216
+ if (object === null) return 'null';
217
+ return object.inspect ? object.inspect() : String(object);
218
+ } catch (e) {
219
+ if (e instanceof RangeError) return '...';
220
+ throw e;
221
+ }
222
+ }
223
+
224
+ function toJSON(value) {
225
+ return Str('', { '': value }, []);
226
+ }
227
+
228
+ function Str(key, holder, stack) {
229
+ var value = holder[key],
230
+ type = typeof value;
231
+
232
+ if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
233
+ value = value.toJSON(key);
234
+ }
235
+
236
+ var _class = _toString.call(value);
237
+
238
+ switch (_class) {
239
+ case NUMBER_CLASS:
240
+ case BOOLEAN_CLASS:
241
+ case STRING_CLASS:
242
+ value = value.valueOf();
243
+ }
244
+
245
+ switch (value) {
246
+ case null: return 'null';
247
+ case true: return 'true';
248
+ case false: return 'false';
249
+ }
250
+
251
+ type = typeof value;
252
+ switch (type) {
253
+ case 'string':
254
+ return value.inspect(true);
255
+ case 'number':
256
+ return isFinite(value) ? String(value) : 'null';
257
+ case 'object':
258
+
259
+ for (var i = 0, length = stack.length; i < length; i++) {
260
+ if (stack[i] === value) { throw new TypeError(); }
261
+ }
262
+ stack.push(value);
263
+
264
+ var partial = [];
265
+ if (_class === ARRAY_CLASS) {
266
+ for (var i = 0, length = value.length; i < length; i++) {
267
+ var str = Str(i, value, stack);
268
+ partial.push(typeof str === 'undefined' ? 'null' : str);
269
+ }
270
+ partial = '[' + partial.join(',') + ']';
271
+ } else {
272
+ var keys = Object.keys(value);
273
+ for (var i = 0, length = keys.length; i < length; i++) {
274
+ var key = keys[i], str = Str(key, value, stack);
275
+ if (typeof str !== "undefined") {
276
+ partial.push(key.inspect(true)+ ':' + str);
277
+ }
278
+ }
279
+ partial = '{' + partial.join(',') + '}';
280
+ }
281
+ stack.pop();
282
+ return partial;
283
+ }
284
+ }
285
+
286
+ function stringify(object) {
287
+ return JSON.stringify(object);
288
+ }
289
+
290
+ function toQueryString(object) {
291
+ return $H(object).toQueryString();
292
+ }
293
+
294
+ function toHTML(object) {
295
+ return object && object.toHTML ? object.toHTML() : String.interpret(object);
296
+ }
297
+
298
+ function keys(object) {
299
+ if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); }
300
+ var results = [];
301
+ for (var property in object) {
302
+ if (object.hasOwnProperty(property)) {
303
+ results.push(property);
304
+ }
305
+ }
306
+ return results;
307
+ }
308
+
309
+ function values(object) {
310
+ var results = [];
311
+ for (var property in object)
312
+ results.push(object[property]);
313
+ return results;
314
+ }
315
+
316
+ function clone(object) {
317
+ return extend({ }, object);
318
+ }
319
+
320
+ function isElement(object) {
321
+ return !!(object && object.nodeType == 1);
322
+ }
323
+
324
+ function isArray(object) {
325
+ return _toString.call(object) === ARRAY_CLASS;
326
+ }
327
+
328
+ var hasNativeIsArray = (typeof Array.isArray == 'function')
329
+ && Array.isArray([]) && !Array.isArray({});
330
+
331
+ if (hasNativeIsArray) {
332
+ isArray = Array.isArray;
333
+ }
334
+
335
+ function isHash(object) {
336
+ return object instanceof Hash;
337
+ }
338
+
339
+ function isFunction(object) {
340
+ return _toString.call(object) === FUNCTION_CLASS;
341
+ }
342
+
343
+ function isString(object) {
344
+ return _toString.call(object) === STRING_CLASS;
345
+ }
346
+
347
+ function isNumber(object) {
348
+ return _toString.call(object) === NUMBER_CLASS;
349
+ }
350
+
351
+ function isDate(object) {
352
+ return _toString.call(object) === DATE_CLASS;
353
+ }
354
+
355
+ function isUndefined(object) {
356
+ return typeof object === "undefined";
357
+ }
358
+
359
+ extend(Object, {
360
+ extend: extend,
361
+ inspect: inspect,
362
+ toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON,
363
+ toQueryString: toQueryString,
364
+ toHTML: toHTML,
365
+ keys: Object.keys || keys,
366
+ values: values,
367
+ clone: clone,
368
+ isElement: isElement,
369
+ isArray: isArray,
370
+ isHash: isHash,
371
+ isFunction: isFunction,
372
+ isString: isString,
373
+ isNumber: isNumber,
374
+ isDate: isDate,
375
+ isUndefined: isUndefined
376
+ });
377
+ })();
378
+ Object.extend(Function.prototype, (function() {
379
+ var slice = Array.prototype.slice;
380
+
381
+ function update(array, args) {
382
+ var arrayLength = array.length, length = args.length;
383
+ while (length--) array[arrayLength + length] = args[length];
384
+ return array;
385
+ }
386
+
387
+ function merge(array, args) {
388
+ array = slice.call(array, 0);
389
+ return update(array, args);
390
+ }
391
+
392
+ function argumentNames() {
393
+ var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
394
+ .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
395
+ .replace(/\s+/g, '').split(',');
396
+ return names.length == 1 && !names[0] ? [] : names;
397
+ }
398
+
399
+ function bind(context) {
400
+ if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
401
+ var __method = this, args = slice.call(arguments, 1);
402
+ return function() {
403
+ var a = merge(args, arguments);
404
+ return __method.apply(context, a);
405
+ }
406
+ }
407
+
408
+ function bindAsEventListener(context) {
409
+ var __method = this, args = slice.call(arguments, 1);
410
+ return function(event) {
411
+ var a = update([event || window.event], args);
412
+ return __method.apply(context, a);
413
+ }
414
+ }
415
+
416
+ function curry() {
417
+ if (!arguments.length) return this;
418
+ var __method = this, args = slice.call(arguments, 0);
419
+ return function() {
420
+ var a = merge(args, arguments);
421
+ return __method.apply(this, a);
422
+ }
423
+ }
424
+
425
+ function delay(timeout) {
426
+ var __method = this, args = slice.call(arguments, 1);
427
+ timeout = timeout * 1000;
428
+ return window.setTimeout(function() {
429
+ return __method.apply(__method, args);
430
+ }, timeout);
431
+ }
432
+
433
+ function defer() {
434
+ var args = update([0.01], arguments);
435
+ return this.delay.apply(this, args);
436
+ }
437
+
438
+ function wrap(wrapper) {
439
+ var __method = this;
440
+ return function() {
441
+ var a = update([__method.bind(this)], arguments);
442
+ return wrapper.apply(this, a);
443
+ }
444
+ }
445
+
446
+ function methodize() {
447
+ if (this._methodized) return this._methodized;
448
+ var __method = this;
449
+ return this._methodized = function() {
450
+ var a = update([this], arguments);
451
+ return __method.apply(null, a);
452
+ };
453
+ }
454
+
455
+ return {
456
+ argumentNames: argumentNames,
457
+ bind: bind,
458
+ bindAsEventListener: bindAsEventListener,
459
+ curry: curry,
460
+ delay: delay,
461
+ defer: defer,
462
+ wrap: wrap,
463
+ methodize: methodize
464
+ }
465
+ })());
466
+
467
+
468
+
469
+ (function(proto) {
470
+
471
+
472
+ function toISOString() {
473
+ return this.getUTCFullYear() + '-' +
474
+ (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
475
+ this.getUTCDate().toPaddedString(2) + 'T' +
476
+ this.getUTCHours().toPaddedString(2) + ':' +
477
+ this.getUTCMinutes().toPaddedString(2) + ':' +
478
+ this.getUTCSeconds().toPaddedString(2) + 'Z';
479
+ }
480
+
481
+
482
+ function toJSON() {
483
+ return this.toISOString();
484
+ }
485
+
486
+ if (!proto.toISOString) proto.toISOString = toISOString;
487
+ if (!proto.toJSON) proto.toJSON = toJSON;
488
+
489
+ })(Date.prototype);
490
+
491
+
492
+ RegExp.prototype.match = RegExp.prototype.test;
493
+
494
+ RegExp.escape = function(str) {
495
+ return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
496
+ };
497
+ var PeriodicalExecuter = Class.create({
498
+ initialize: function(callback, frequency) {
499
+ this.callback = callback;
500
+ this.frequency = frequency;
501
+ this.currentlyExecuting = false;
502
+
503
+ this.registerCallback();
504
+ },
505
+
506
+ registerCallback: function() {
507
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
508
+ },
509
+
510
+ execute: function() {
511
+ this.callback(this);
512
+ },
513
+
514
+ stop: function() {
515
+ if (!this.timer) return;
516
+ clearInterval(this.timer);
517
+ this.timer = null;
518
+ },
519
+
520
+ onTimerEvent: function() {
521
+ if (!this.currentlyExecuting) {
522
+ try {
523
+ this.currentlyExecuting = true;
524
+ this.execute();
525
+ this.currentlyExecuting = false;
526
+ } catch(e) {
527
+ this.currentlyExecuting = false;
528
+ throw e;
529
+ }
530
+ }
531
+ }
532
+ });
533
+ Object.extend(String, {
534
+ interpret: function(value) {
535
+ return value == null ? '' : String(value);
536
+ },
537
+ specialChar: {
538
+ '\b': '\\b',
539
+ '\t': '\\t',
540
+ '\n': '\\n',
541
+ '\f': '\\f',
542
+ '\r': '\\r',
543
+ '\\': '\\\\'
544
+ }
545
+ });
546
+
547
+ Object.extend(String.prototype, (function() {
548
+ var NATIVE_JSON_PARSE_SUPPORT = window.JSON &&
549
+ typeof JSON.parse === 'function' &&
550
+ JSON.parse('{"test": true}').test;
551
+
552
+ function prepareReplacement(replacement) {
553
+ if (Object.isFunction(replacement)) return replacement;
554
+ var template = new Template(replacement);
555
+ return function(match) { return template.evaluate(match) };
556
+ }
557
+
558
+ function gsub(pattern, replacement) {
559
+ var result = '', source = this, match;
560
+ replacement = prepareReplacement(replacement);
561
+
562
+ if (Object.isString(pattern))
563
+ pattern = RegExp.escape(pattern);
564
+
565
+ if (!(pattern.length || pattern.source)) {
566
+ replacement = replacement('');
567
+ return replacement + source.split('').join(replacement) + replacement;
568
+ }
569
+
570
+ while (source.length > 0) {
571
+ if (match = source.match(pattern)) {
572
+ result += source.slice(0, match.index);
573
+ result += String.interpret(replacement(match));
574
+ source = source.slice(match.index + match[0].length);
575
+ } else {
576
+ result += source, source = '';
577
+ }
578
+ }
579
+ return result;
580
+ }
581
+
582
+ function sub(pattern, replacement, count) {
583
+ replacement = prepareReplacement(replacement);
584
+ count = Object.isUndefined(count) ? 1 : count;
585
+
586
+ return this.gsub(pattern, function(match) {
587
+ if (--count < 0) return match[0];
588
+ return replacement(match);
589
+ });
590
+ }
591
+
592
+ function scan(pattern, iterator) {
593
+ this.gsub(pattern, iterator);
594
+ return String(this);
595
+ }
596
+
597
+ function truncate(length, truncation) {
598
+ length = length || 30;
599
+ truncation = Object.isUndefined(truncation) ? '...' : truncation;
600
+ return this.length > length ?
601
+ this.slice(0, length - truncation.length) + truncation : String(this);
602
+ }
603
+
604
+ function strip() {
605
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
606
+ }
607
+
608
+ function stripTags() {
609
+ return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '');
610
+ }
611
+
612
+ function stripScripts() {
613
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
614
+ }
615
+
616
+ function extractScripts() {
617
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img'),
618
+ matchOne = new RegExp(Prototype.ScriptFragment, 'im');
619
+ return (this.match(matchAll) || []).map(function(scriptTag) {
620
+ return (scriptTag.match(matchOne) || ['', ''])[1];
621
+ });
622
+ }
623
+
624
+ function evalScripts() {
625
+ return this.extractScripts().map(function(script) { return eval(script) });
626
+ }
627
+
628
+ function escapeHTML() {
629
+ return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
630
+ }
631
+
632
+ function unescapeHTML() {
633
+ return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
634
+ }
635
+
636
+
637
+ function toQueryParams(separator) {
638
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
639
+ if (!match) return { };
640
+
641
+ return match[1].split(separator || '&').inject({ }, function(hash, pair) {
642
+ if ((pair = pair.split('='))[0]) {
643
+ var key = decodeURIComponent(pair.shift()),
644
+ value = pair.length > 1 ? pair.join('=') : pair[0];
645
+
646
+ if (value != undefined) value = decodeURIComponent(value);
647
+
648
+ if (key in hash) {
649
+ if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
650
+ hash[key].push(value);
651
+ }
652
+ else hash[key] = value;
653
+ }
654
+ return hash;
655
+ });
656
+ }
657
+
658
+ function toArray() {
659
+ return this.split('');
660
+ }
661
+
662
+ function succ() {
663
+ return this.slice(0, this.length - 1) +
664
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
665
+ }
666
+
667
+ function times(count) {
668
+ return count < 1 ? '' : new Array(count + 1).join(this);
669
+ }
670
+
671
+ function camelize() {
672
+ return this.replace(/-+(.)?/g, function(match, chr) {
673
+ return chr ? chr.toUpperCase() : '';
674
+ });
675
+ }
676
+
677
+ function capitalize() {
678
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
679
+ }
680
+
681
+ function underscore() {
682
+ return this.replace(/::/g, '/')
683
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
684
+ .replace(/([a-z\d])([A-Z])/g, '$1_$2')
685
+ .replace(/-/g, '_')
686
+ .toLowerCase();
687
+ }
688
+
689
+ function dasherize() {
690
+ return this.replace(/_/g, '-');
691
+ }
692
+
693
+ function inspect(useDoubleQuotes) {
694
+ var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
695
+ if (character in String.specialChar) {
696
+ return String.specialChar[character];
697
+ }
698
+ return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
699
+ });
700
+ if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
701
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
702
+ }
703
+
704
+ function unfilterJSON(filter) {
705
+ return this.replace(filter || Prototype.JSONFilter, '$1');
706
+ }
707
+
708
+ function isJSON() {
709
+ var str = this;
710
+ if (str.blank()) return false;
711
+ str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@');
712
+ str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
713
+ str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
714
+ return (/^[\],:{}\s]*$/).test(str);
715
+ }
716
+
717
+ function evalJSON(sanitize) {
718
+ var json = this.unfilterJSON(),
719
+ cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
720
+ if (cx.test(json)) {
721
+ json = json.replace(cx, function (a) {
722
+ return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
723
+ });
724
+ }
725
+ try {
726
+ if (!sanitize || json.isJSON()) return eval('(' + json + ')');
727
+ } catch (e) { }
728
+ throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
729
+ }
730
+
731
+ function parseJSON() {
732
+ var json = this.unfilterJSON();
733
+ return JSON.parse(json);
734
+ }
735
+
736
+ function include(pattern) {
737
+ return this.indexOf(pattern) > -1;
738
+ }
739
+
740
+ function startsWith(pattern) {
741
+ return this.lastIndexOf(pattern, 0) === 0;
742
+ }
743
+
744
+ function endsWith(pattern) {
745
+ var d = this.length - pattern.length;
746
+ return d >= 0 && this.indexOf(pattern, d) === d;
747
+ }
748
+
749
+ function empty() {
750
+ return this == '';
751
+ }
752
+
753
+ function blank() {
754
+ return /^\s*$/.test(this);
755
+ }
756
+
757
+ function interpolate(object, pattern) {
758
+ return new Template(this, pattern).evaluate(object);
759
+ }
760
+
761
+ return {
762
+ gsub: gsub,
763
+ sub: sub,
764
+ scan: scan,
765
+ truncate: truncate,
766
+ strip: String.prototype.trim || strip,
767
+ stripTags: stripTags,
768
+ stripScripts: stripScripts,
769
+ extractScripts: extractScripts,
770
+ evalScripts: evalScripts,
771
+ escapeHTML: escapeHTML,
772
+ unescapeHTML: unescapeHTML,
773
+ toQueryParams: toQueryParams,
774
+ parseQuery: toQueryParams,
775
+ toArray: toArray,
776
+ succ: succ,
777
+ times: times,
778
+ camelize: camelize,
779
+ capitalize: capitalize,
780
+ underscore: underscore,
781
+ dasherize: dasherize,
782
+ inspect: inspect,
783
+ unfilterJSON: unfilterJSON,
784
+ isJSON: isJSON,
785
+ evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON,
786
+ include: include,
787
+ startsWith: startsWith,
788
+ endsWith: endsWith,
789
+ empty: empty,
790
+ blank: blank,
791
+ interpolate: interpolate
792
+ };
793
+ })());
794
+
795
+ var Template = Class.create({
796
+ initialize: function(template, pattern) {
797
+ this.template = template.toString();
798
+ this.pattern = pattern || Template.Pattern;
799
+ },
800
+
801
+ evaluate: function(object) {
802
+ if (object && Object.isFunction(object.toTemplateReplacements))
803
+ object = object.toTemplateReplacements();
804
+
805
+ return this.template.gsub(this.pattern, function(match) {
806
+ if (object == null) return (match[1] + '');
807
+
808
+ var before = match[1] || '';
809
+ if (before == '\\') return match[2];
810
+
811
+ var ctx = object, expr = match[3],
812
+ pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
813
+
814
+ match = pattern.exec(expr);
815
+ if (match == null) return before;
816
+
817
+ while (match != null) {
818
+ var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
819
+ ctx = ctx[comp];
820
+ if (null == ctx || '' == match[3]) break;
821
+ expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
822
+ match = pattern.exec(expr);
823
+ }
824
+
825
+ return before + String.interpret(ctx);
826
+ });
827
+ }
828
+ });
829
+ Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
830
+
831
+ var $break = { };
832
+
833
+ var Enumerable = (function() {
834
+ function each(iterator, context) {
835
+ var index = 0;
836
+ try {
837
+ this._each(function(value) {
838
+ iterator.call(context, value, index++);
839
+ });
840
+ } catch (e) {
841
+ if (e != $break) throw e;
842
+ }
843
+ return this;
844
+ }
845
+
846
+ function eachSlice(number, iterator, context) {
847
+ var index = -number, slices = [], array = this.toArray();
848
+ if (number < 1) return array;
849
+ while ((index += number) < array.length)
850
+ slices.push(array.slice(index, index+number));
851
+ return slices.collect(iterator, context);
852
+ }
853
+
854
+ function all(iterator, context) {
855
+ iterator = iterator || Prototype.K;
856
+ var result = true;
857
+ this.each(function(value, index) {
858
+ result = result && !!iterator.call(context, value, index);
859
+ if (!result) throw $break;
860
+ });
861
+ return result;
862
+ }
863
+
864
+ function any(iterator, context) {
865
+ iterator = iterator || Prototype.K;
866
+ var result = false;
867
+ this.each(function(value, index) {
868
+ if (result = !!iterator.call(context, value, index))
869
+ throw $break;
870
+ });
871
+ return result;
872
+ }
873
+
874
+ function collect(iterator, context) {
875
+ iterator = iterator || Prototype.K;
876
+ var results = [];
877
+ this.each(function(value, index) {
878
+ results.push(iterator.call(context, value, index));
879
+ });
880
+ return results;
881
+ }
882
+
883
+ function detect(iterator, context) {
884
+ var result;
885
+ this.each(function(value, index) {
886
+ if (iterator.call(context, value, index)) {
887
+ result = value;
888
+ throw $break;
889
+ }
890
+ });
891
+ return result;
892
+ }
893
+
894
+ function findAll(iterator, context) {
895
+ var results = [];
896
+ this.each(function(value, index) {
897
+ if (iterator.call(context, value, index))
898
+ results.push(value);
899
+ });
900
+ return results;
901
+ }
902
+
903
+ function grep(filter, iterator, context) {
904
+ iterator = iterator || Prototype.K;
905
+ var results = [];
906
+
907
+ if (Object.isString(filter))
908
+ filter = new RegExp(RegExp.escape(filter));
909
+
910
+ this.each(function(value, index) {
911
+ if (filter.match(value))
912
+ results.push(iterator.call(context, value, index));
913
+ });
914
+ return results;
915
+ }
916
+
917
+ function include(object) {
918
+ if (Object.isFunction(this.indexOf))
919
+ if (this.indexOf(object) != -1) return true;
920
+
921
+ var found = false;
922
+ this.each(function(value) {
923
+ if (value == object) {
924
+ found = true;
925
+ throw $break;
926
+ }
927
+ });
928
+ return found;
929
+ }
930
+
931
+ function inGroupsOf(number, fillWith) {
932
+ fillWith = Object.isUndefined(fillWith) ? null : fillWith;
933
+ return this.eachSlice(number, function(slice) {
934
+ while(slice.length < number) slice.push(fillWith);
935
+ return slice;
936
+ });
937
+ }
938
+
939
+ function inject(memo, iterator, context) {
940
+ this.each(function(value, index) {
941
+ memo = iterator.call(context, memo, value, index);
942
+ });
943
+ return memo;
944
+ }
945
+
946
+ function invoke(method) {
947
+ var args = $A(arguments).slice(1);
948
+ return this.map(function(value) {
949
+ return value[method].apply(value, args);
950
+ });
951
+ }
952
+
953
+ function max(iterator, context) {
954
+ iterator = iterator || Prototype.K;
955
+ var result;
956
+ this.each(function(value, index) {
957
+ value = iterator.call(context, value, index);
958
+ if (result == null || value >= result)
959
+ result = value;
960
+ });
961
+ return result;
962
+ }
963
+
964
+ function min(iterator, context) {
965
+ iterator = iterator || Prototype.K;
966
+ var result;
967
+ this.each(function(value, index) {
968
+ value = iterator.call(context, value, index);
969
+ if (result == null || value < result)
970
+ result = value;
971
+ });
972
+ return result;
973
+ }
974
+
975
+ function partition(iterator, context) {
976
+ iterator = iterator || Prototype.K;
977
+ var trues = [], falses = [];
978
+ this.each(function(value, index) {
979
+ (iterator.call(context, value, index) ?
980
+ trues : falses).push(value);
981
+ });
982
+ return [trues, falses];
983
+ }
984
+
985
+ function pluck(property) {
986
+ var results = [];
987
+ this.each(function(value) {
988
+ results.push(value[property]);
989
+ });
990
+ return results;
991
+ }
992
+
993
+ function reject(iterator, context) {
994
+ var results = [];
995
+ this.each(function(value, index) {
996
+ if (!iterator.call(context, value, index))
997
+ results.push(value);
998
+ });
999
+ return results;
1000
+ }
1001
+
1002
+ function sortBy(iterator, context) {
1003
+ return this.map(function(value, index) {
1004
+ return {
1005
+ value: value,
1006
+ criteria: iterator.call(context, value, index)
1007
+ };
1008
+ }).sort(function(left, right) {
1009
+ var a = left.criteria, b = right.criteria;
1010
+ return a < b ? -1 : a > b ? 1 : 0;
1011
+ }).pluck('value');
1012
+ }
1013
+
1014
+ function toArray() {
1015
+ return this.map();
1016
+ }
1017
+
1018
+ function zip() {
1019
+ var iterator = Prototype.K, args = $A(arguments);
1020
+ if (Object.isFunction(args.last()))
1021
+ iterator = args.pop();
1022
+
1023
+ var collections = [this].concat(args).map($A);
1024
+ return this.map(function(value, index) {
1025
+ return iterator(collections.pluck(index));
1026
+ });
1027
+ }
1028
+
1029
+ function size() {
1030
+ return this.toArray().length;
1031
+ }
1032
+
1033
+ function inspect() {
1034
+ return '#<Enumerable:' + this.toArray().inspect() + '>';
1035
+ }
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
1044
+
1045
+ return {
1046
+ each: each,
1047
+ eachSlice: eachSlice,
1048
+ all: all,
1049
+ every: all,
1050
+ any: any,
1051
+ some: any,
1052
+ collect: collect,
1053
+ map: collect,
1054
+ detect: detect,
1055
+ findAll: findAll,
1056
+ select: findAll,
1057
+ filter: findAll,
1058
+ grep: grep,
1059
+ include: include,
1060
+ member: include,
1061
+ inGroupsOf: inGroupsOf,
1062
+ inject: inject,
1063
+ invoke: invoke,
1064
+ max: max,
1065
+ min: min,
1066
+ partition: partition,
1067
+ pluck: pluck,
1068
+ reject: reject,
1069
+ sortBy: sortBy,
1070
+ toArray: toArray,
1071
+ entries: toArray,
1072
+ zip: zip,
1073
+ size: size,
1074
+ inspect: inspect,
1075
+ find: detect
1076
+ };
1077
+ })();
1078
+
1079
+ function $A(iterable) {
1080
+ if (!iterable) return [];
1081
+ if ('toArray' in Object(iterable)) return iterable.toArray();
1082
+ var length = iterable.length || 0, results = new Array(length);
1083
+ while (length--) results[length] = iterable[length];
1084
+ return results;
1085
+ }
1086
+
1087
+
1088
+ function $w(string) {
1089
+ if (!Object.isString(string)) return [];
1090
+ string = string.strip();
1091
+ return string ? string.split(/\s+/) : [];
1092
+ }
1093
+
1094
+ Array.from = $A;
1095
+
1096
+
1097
+ (function() {
1098
+ var arrayProto = Array.prototype,
1099
+ slice = arrayProto.slice,
1100
+ _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available
1101
+
1102
+ function each(iterator, context) {
1103
+ for (var i = 0, length = this.length >>> 0; i < length; i++) {
1104
+ if (i in this) iterator.call(context, this[i], i, this);
1105
+ }
1106
+ }
1107
+ if (!_each) _each = each;
1108
+
1109
+ function clear() {
1110
+ this.length = 0;
1111
+ return this;
1112
+ }
1113
+
1114
+ function first() {
1115
+ return this[0];
1116
+ }
1117
+
1118
+ function last() {
1119
+ return this[this.length - 1];
1120
+ }
1121
+
1122
+ function compact() {
1123
+ return this.select(function(value) {
1124
+ return value != null;
1125
+ });
1126
+ }
1127
+
1128
+ function flatten() {
1129
+ return this.inject([], function(array, value) {
1130
+ if (Object.isArray(value))
1131
+ return array.concat(value.flatten());
1132
+ array.push(value);
1133
+ return array;
1134
+ });
1135
+ }
1136
+
1137
+ function without() {
1138
+ var values = slice.call(arguments, 0);
1139
+ return this.select(function(value) {
1140
+ return !values.include(value);
1141
+ });
1142
+ }
1143
+
1144
+ function reverse(inline) {
1145
+ return (inline === false ? this.toArray() : this)._reverse();
1146
+ }
1147
+
1148
+ function uniq(sorted) {
1149
+ return this.inject([], function(array, value, index) {
1150
+ if (0 == index || (sorted ? array.last() != value : !array.include(value)))
1151
+ array.push(value);
1152
+ return array;
1153
+ });
1154
+ }
1155
+
1156
+ function intersect(array) {
1157
+ return this.uniq().findAll(function(item) {
1158
+ return array.detect(function(value) { return item === value });
1159
+ });
1160
+ }
1161
+
1162
+
1163
+ function clone() {
1164
+ return slice.call(this, 0);
1165
+ }
1166
+
1167
+ function size() {
1168
+ return this.length;
1169
+ }
1170
+
1171
+ function inspect() {
1172
+ return '[' + this.map(Object.inspect).join(', ') + ']';
1173
+ }
1174
+
1175
+ function indexOf(item, i) {
1176
+ i || (i = 0);
1177
+ var length = this.length;
1178
+ if (i < 0) i = length + i;
1179
+ for (; i < length; i++)
1180
+ if (this[i] === item) return i;
1181
+ return -1;
1182
+ }
1183
+
1184
+ function lastIndexOf(item, i) {
1185
+ i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
1186
+ var n = this.slice(0, i).reverse().indexOf(item);
1187
+ return (n < 0) ? n : i - n - 1;
1188
+ }
1189
+
1190
+ function concat() {
1191
+ var array = slice.call(this, 0), item;
1192
+ for (var i = 0, length = arguments.length; i < length; i++) {
1193
+ item = arguments[i];
1194
+ if (Object.isArray(item) && !('callee' in item)) {
1195
+ for (var j = 0, arrayLength = item.length; j < arrayLength; j++)
1196
+ array.push(item[j]);
1197
+ } else {
1198
+ array.push(item);
1199
+ }
1200
+ }
1201
+ return array;
1202
+ }
1203
+
1204
+ Object.extend(arrayProto, Enumerable);
1205
+
1206
+ if (!arrayProto._reverse)
1207
+ arrayProto._reverse = arrayProto.reverse;
1208
+
1209
+ Object.extend(arrayProto, {
1210
+ _each: _each,
1211
+ clear: clear,
1212
+ first: first,
1213
+ last: last,
1214
+ compact: compact,
1215
+ flatten: flatten,
1216
+ without: without,
1217
+ reverse: reverse,
1218
+ uniq: uniq,
1219
+ intersect: intersect,
1220
+ clone: clone,
1221
+ toArray: clone,
1222
+ size: size,
1223
+ inspect: inspect
1224
+ });
1225
+
1226
+ var CONCAT_ARGUMENTS_BUGGY = (function() {
1227
+ return [].concat(arguments)[0][0] !== 1;
1228
+ })(1,2)
1229
+
1230
+ if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;
1231
+
1232
+ if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
1233
+ if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
1234
+ })();
1235
+ function $H(object) {
1236
+ return new Hash(object);
1237
+ };
1238
+
1239
+ var Hash = Class.create(Enumerable, (function() {
1240
+ function initialize(object) {
1241
+ this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
1242
+ }
1243
+
1244
+
1245
+ function _each(iterator) {
1246
+ for (var key in this._object) {
1247
+ var value = this._object[key], pair = [key, value];
1248
+ pair.key = key;
1249
+ pair.value = value;
1250
+ iterator(pair);
1251
+ }
1252
+ }
1253
+
1254
+ function set(key, value) {
1255
+ return this._object[key] = value;
1256
+ }
1257
+
1258
+ function get(key) {
1259
+ if (this._object[key] !== Object.prototype[key])
1260
+ return this._object[key];
1261
+ }
1262
+
1263
+ function unset(key) {
1264
+ var value = this._object[key];
1265
+ delete this._object[key];
1266
+ return value;
1267
+ }
1268
+
1269
+ function toObject() {
1270
+ return Object.clone(this._object);
1271
+ }
1272
+
1273
+
1274
+
1275
+ function keys() {
1276
+ return this.pluck('key');
1277
+ }
1278
+
1279
+ function values() {
1280
+ return this.pluck('value');
1281
+ }
1282
+
1283
+ function index(value) {
1284
+ var match = this.detect(function(pair) {
1285
+ return pair.value === value;
1286
+ });
1287
+ return match && match.key;
1288
+ }
1289
+
1290
+ function merge(object) {
1291
+ return this.clone().update(object);
1292
+ }
1293
+
1294
+ function update(object) {
1295
+ return new Hash(object).inject(this, function(result, pair) {
1296
+ result.set(pair.key, pair.value);
1297
+ return result;
1298
+ });
1299
+ }
1300
+
1301
+ function toQueryPair(key, value) {
1302
+ if (Object.isUndefined(value)) return key;
1303
+ return key + '=' + encodeURIComponent(String.interpret(value));
1304
+ }
1305
+
1306
+ function toQueryString() {
1307
+ return this.inject([], function(results, pair) {
1308
+ var key = encodeURIComponent(pair.key), values = pair.value;
1309
+
1310
+ if (values && typeof values == 'object') {
1311
+ if (Object.isArray(values)) {
1312
+ var queryValues = [];
1313
+ for (var i = 0, len = values.length, value; i < len; i++) {
1314
+ value = values[i];
1315
+ queryValues.push(toQueryPair(key, value));
1316
+ }
1317
+ return results.concat(queryValues);
1318
+ }
1319
+ } else results.push(toQueryPair(key, values));
1320
+ return results;
1321
+ }).join('&');
1322
+ }
1323
+
1324
+ function inspect() {
1325
+ return '#<Hash:{' + this.map(function(pair) {
1326
+ return pair.map(Object.inspect).join(': ');
1327
+ }).join(', ') + '}>';
1328
+ }
1329
+
1330
+ function clone() {
1331
+ return new Hash(this);
1332
+ }
1333
+
1334
+ return {
1335
+ initialize: initialize,
1336
+ _each: _each,
1337
+ set: set,
1338
+ get: get,
1339
+ unset: unset,
1340
+ toObject: toObject,
1341
+ toTemplateReplacements: toObject,
1342
+ keys: keys,
1343
+ values: values,
1344
+ index: index,
1345
+ merge: merge,
1346
+ update: update,
1347
+ toQueryString: toQueryString,
1348
+ inspect: inspect,
1349
+ toJSON: toObject,
1350
+ clone: clone
1351
+ };
1352
+ })());
1353
+
1354
+ Hash.from = $H;
1355
+ Object.extend(Number.prototype, (function() {
1356
+ function toColorPart() {
1357
+ return this.toPaddedString(2, 16);
1358
+ }
1359
+
1360
+ function succ() {
1361
+ return this + 1;
1362
+ }
1363
+
1364
+ function times(iterator, context) {
1365
+ $R(0, this, true).each(iterator, context);
1366
+ return this;
1367
+ }
1368
+
1369
+ function toPaddedString(length, radix) {
1370
+ var string = this.toString(radix || 10);
1371
+ return '0'.times(length - string.length) + string;
1372
+ }
1373
+
1374
+ function abs() {
1375
+ return Math.abs(this);
1376
+ }
1377
+
1378
+ function round() {
1379
+ return Math.round(this);
1380
+ }
1381
+
1382
+ function ceil() {
1383
+ return Math.ceil(this);
1384
+ }
1385
+
1386
+ function floor() {
1387
+ return Math.floor(this);
1388
+ }
1389
+
1390
+ return {
1391
+ toColorPart: toColorPart,
1392
+ succ: succ,
1393
+ times: times,
1394
+ toPaddedString: toPaddedString,
1395
+ abs: abs,
1396
+ round: round,
1397
+ ceil: ceil,
1398
+ floor: floor
1399
+ };
1400
+ })());
1401
+
1402
+ function $R(start, end, exclusive) {
1403
+ return new ObjectRange(start, end, exclusive);
1404
+ }
1405
+
1406
+ var ObjectRange = Class.create(Enumerable, (function() {
1407
+ function initialize(start, end, exclusive) {
1408
+ this.start = start;
1409
+ this.end = end;
1410
+ this.exclusive = exclusive;
1411
+ }
1412
+
1413
+ function _each(iterator) {
1414
+ var value = this.start;
1415
+ while (this.include(value)) {
1416
+ iterator(value);
1417
+ value = value.succ();
1418
+ }
1419
+ }
1420
+
1421
+ function include(value) {
1422
+ if (value < this.start)
1423
+ return false;
1424
+ if (this.exclusive)
1425
+ return value < this.end;
1426
+ return value <= this.end;
1427
+ }
1428
+
1429
+ return {
1430
+ initialize: initialize,
1431
+ _each: _each,
1432
+ include: include
1433
+ };
1434
+ })());
1435
+
1436
+
1437
+
1438
+ var Ajax = {
1439
+ getTransport: function() {
1440
+ return Try.these(
1441
+ function() {return new XMLHttpRequest()},
1442
+ function() {return new ActiveXObject('Msxml2.XMLHTTP')},
1443
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')}
1444
+ ) || false;
1445
+ },
1446
+
1447
+ activeRequestCount: 0
1448
+ };
1449
+
1450
+ Ajax.Responders = {
1451
+ responders: [],
1452
+
1453
+ _each: function(iterator) {
1454
+ this.responders._each(iterator);
1455
+ },
1456
+
1457
+ register: function(responder) {
1458
+ if (!this.include(responder))
1459
+ this.responders.push(responder);
1460
+ },
1461
+
1462
+ unregister: function(responder) {
1463
+ this.responders = this.responders.without(responder);
1464
+ },
1465
+
1466
+ dispatch: function(callback, request, transport, json) {
1467
+ this.each(function(responder) {
1468
+ if (Object.isFunction(responder[callback])) {
1469
+ try {
1470
+ responder[callback].apply(responder, [request, transport, json]);
1471
+ } catch (e) { }
1472
+ }
1473
+ });
1474
+ }
1475
+ };
1476
+
1477
+ Object.extend(Ajax.Responders, Enumerable);
1478
+
1479
+ Ajax.Responders.register({
1480
+ onCreate: function() { Ajax.activeRequestCount++ },
1481
+ onComplete: function() { Ajax.activeRequestCount-- }
1482
+ });
1483
+ Ajax.Base = Class.create({
1484
+ initialize: function(options) {
1485
+ this.options = {
1486
+ method: 'post',
1487
+ asynchronous: true,
1488
+ contentType: 'application/x-www-form-urlencoded',
1489
+ encoding: 'UTF-8',
1490
+ parameters: '',
1491
+ evalJSON: true,
1492
+ evalJS: true
1493
+ };
1494
+ Object.extend(this.options, options || { });
1495
+
1496
+ this.options.method = this.options.method.toLowerCase();
1497
+
1498
+ if (Object.isHash(this.options.parameters))
1499
+ this.options.parameters = this.options.parameters.toObject();
1500
+ }
1501
+ });
1502
+ Ajax.Request = Class.create(Ajax.Base, {
1503
+ _complete: false,
1504
+
1505
+ initialize: function($super, url, options) {
1506
+ $super(options);
1507
+ this.transport = Ajax.getTransport();
1508
+ this.request(url);
1509
+ },
1510
+
1511
+ request: function(url) {
1512
+ this.url = url;
1513
+ this.method = this.options.method;
1514
+ var params = Object.isString(this.options.parameters) ?
1515
+ this.options.parameters :
1516
+ Object.toQueryString(this.options.parameters);
1517
+
1518
+ if (!['get', 'post'].include(this.method)) {
1519
+ params += (params ? '&' : '') + "_method=" + this.method;
1520
+ this.method = 'post';
1521
+ }
1522
+
1523
+ if (params && this.method === 'get') {
1524
+ this.url += (this.url.include('?') ? '&' : '?') + params;
1525
+ }
1526
+
1527
+ this.parameters = params.toQueryParams();
1528
+
1529
+ try {
1530
+ var response = new Ajax.Response(this);
1531
+ if (this.options.onCreate) this.options.onCreate(response);
1532
+ Ajax.Responders.dispatch('onCreate', this, response);
1533
+
1534
+ this.transport.open(this.method.toUpperCase(), this.url,
1535
+ this.options.asynchronous);
1536
+
1537
+ if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
1538
+
1539
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
1540
+ this.setRequestHeaders();
1541
+
1542
+ this.body = this.method == 'post' ? (this.options.postBody || params) : null;
1543
+ this.transport.send(this.body);
1544
+
1545
+ /* Force Firefox to handle ready state 4 for synchronous requests */
1546
+ if (!this.options.asynchronous && this.transport.overrideMimeType)
1547
+ this.onStateChange();
1548
+
1549
+ }
1550
+ catch (e) {
1551
+ this.dispatchException(e);
1552
+ }
1553
+ },
1554
+
1555
+ onStateChange: function() {
1556
+ var readyState = this.transport.readyState;
1557
+ if (readyState > 1 && !((readyState == 4) && this._complete))
1558
+ this.respondToReadyState(this.transport.readyState);
1559
+ },
1560
+
1561
+ setRequestHeaders: function() {
1562
+ var headers = {
1563
+ 'X-Requested-With': 'XMLHttpRequest',
1564
+ 'X-Prototype-Version': Prototype.Version,
1565
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
1566
+ };
1567
+
1568
+ if (this.method == 'post') {
1569
+ headers['Content-type'] = this.options.contentType +
1570
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
1571
+
1572
+ /* Force "Connection: close" for older Mozilla browsers to work
1573
+ * around a bug where XMLHttpRequest sends an incorrect
1574
+ * Content-length header. See Mozilla Bugzilla #246651.
1575
+ */
1576
+ if (this.transport.overrideMimeType &&
1577
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
1578
+ headers['Connection'] = 'close';
1579
+ }
1580
+
1581
+ if (typeof this.options.requestHeaders == 'object') {
1582
+ var extras = this.options.requestHeaders;
1583
+
1584
+ if (Object.isFunction(extras.push))
1585
+ for (var i = 0, length = extras.length; i < length; i += 2)
1586
+ headers[extras[i]] = extras[i+1];
1587
+ else
1588
+ $H(extras).each(function(pair) { headers[pair.key] = pair.value });
1589
+ }
1590
+
1591
+ for (var name in headers)
1592
+ this.transport.setRequestHeader(name, headers[name]);
1593
+ },
1594
+
1595
+ success: function() {
1596
+ var status = this.getStatus();
1597
+ return !status || (status >= 200 && status < 300) || status == 304;
1598
+ },
1599
+
1600
+ getStatus: function() {
1601
+ try {
1602
+ if (this.transport.status === 1223) return 204;
1603
+ return this.transport.status || 0;
1604
+ } catch (e) { return 0 }
1605
+ },
1606
+
1607
+ respondToReadyState: function(readyState) {
1608
+ var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
1609
+
1610
+ if (state == 'Complete') {
1611
+ try {
1612
+ this._complete = true;
1613
+ (this.options['on' + response.status]
1614
+ || this.options['on' + (this.success() ? 'Success' : 'Failure')]
1615
+ || Prototype.emptyFunction)(response, response.headerJSON);
1616
+ } catch (e) {
1617
+ this.dispatchException(e);
1618
+ }
1619
+
1620
+ var contentType = response.getHeader('Content-type');
1621
+ if (this.options.evalJS == 'force'
1622
+ || (this.options.evalJS && this.isSameOrigin() && contentType
1623
+ && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
1624
+ this.evalResponse();
1625
+ }
1626
+
1627
+ try {
1628
+ (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
1629
+ Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
1630
+ } catch (e) {
1631
+ this.dispatchException(e);
1632
+ }
1633
+
1634
+ if (state == 'Complete') {
1635
+ this.transport.onreadystatechange = Prototype.emptyFunction;
1636
+ }
1637
+ },
1638
+
1639
+ isSameOrigin: function() {
1640
+ var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
1641
+ return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
1642
+ protocol: location.protocol,
1643
+ domain: document.domain,
1644
+ port: location.port ? ':' + location.port : ''
1645
+ }));
1646
+ },
1647
+
1648
+ getHeader: function(name) {
1649
+ try {
1650
+ return this.transport.getResponseHeader(name) || null;
1651
+ } catch (e) { return null; }
1652
+ },
1653
+
1654
+ evalResponse: function() {
1655
+ try {
1656
+ return eval((this.transport.responseText || '').unfilterJSON());
1657
+ } catch (e) {
1658
+ this.dispatchException(e);
1659
+ }
1660
+ },
1661
+
1662
+ dispatchException: function(exception) {
1663
+ (this.options.onException || Prototype.emptyFunction)(this, exception);
1664
+ Ajax.Responders.dispatch('onException', this, exception);
1665
+ }
1666
+ });
1667
+
1668
+ Ajax.Request.Events =
1669
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
1670
+
1671
+
1672
+
1673
+
1674
+
1675
+
1676
+
1677
+
1678
+ Ajax.Response = Class.create({
1679
+ initialize: function(request){
1680
+ this.request = request;
1681
+ var transport = this.transport = request.transport,
1682
+ readyState = this.readyState = transport.readyState;
1683
+
1684
+ if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
1685
+ this.status = this.getStatus();
1686
+ this.statusText = this.getStatusText();
1687
+ this.responseText = String.interpret(transport.responseText);
1688
+ this.headerJSON = this._getHeaderJSON();
1689
+ }
1690
+
1691
+ if (readyState == 4) {
1692
+ var xml = transport.responseXML;
1693
+ this.responseXML = Object.isUndefined(xml) ? null : xml;
1694
+ this.responseJSON = this._getResponseJSON();
1695
+ }
1696
+ },
1697
+
1698
+ status: 0,
1699
+
1700
+ statusText: '',
1701
+
1702
+ getStatus: Ajax.Request.prototype.getStatus,
1703
+
1704
+ getStatusText: function() {
1705
+ try {
1706
+ return this.transport.statusText || '';
1707
+ } catch (e) { return '' }
1708
+ },
1709
+
1710
+ getHeader: Ajax.Request.prototype.getHeader,
1711
+
1712
+ getAllHeaders: function() {
1713
+ try {
1714
+ return this.getAllResponseHeaders();
1715
+ } catch (e) { return null }
1716
+ },
1717
+
1718
+ getResponseHeader: function(name) {
1719
+ return this.transport.getResponseHeader(name);
1720
+ },
1721
+
1722
+ getAllResponseHeaders: function() {
1723
+ return this.transport.getAllResponseHeaders();
1724
+ },
1725
+
1726
+ _getHeaderJSON: function() {
1727
+ var json = this.getHeader('X-JSON');
1728
+ if (!json) return null;
1729
+ json = decodeURIComponent(escape(json));
1730
+ try {
1731
+ return json.evalJSON(this.request.options.sanitizeJSON ||
1732
+ !this.request.isSameOrigin());
1733
+ } catch (e) {
1734
+ this.request.dispatchException(e);
1735
+ }
1736
+ },
1737
+
1738
+ _getResponseJSON: function() {
1739
+ var options = this.request.options;
1740
+ if (!options.evalJSON || (options.evalJSON != 'force' &&
1741
+ !(this.getHeader('Content-type') || '').include('application/json')) ||
1742
+ this.responseText.blank())
1743
+ return null;
1744
+ try {
1745
+ return this.responseText.evalJSON(options.sanitizeJSON ||
1746
+ !this.request.isSameOrigin());
1747
+ } catch (e) {
1748
+ this.request.dispatchException(e);
1749
+ }
1750
+ }
1751
+ });
1752
+
1753
+ Ajax.Updater = Class.create(Ajax.Request, {
1754
+ initialize: function($super, container, url, options) {
1755
+ this.container = {
1756
+ success: (container.success || container),
1757
+ failure: (container.failure || (container.success ? null : container))
1758
+ };
1759
+
1760
+ options = Object.clone(options);
1761
+ var onComplete = options.onComplete;
1762
+ options.onComplete = (function(response, json) {
1763
+ this.updateContent(response.responseText);
1764
+ if (Object.isFunction(onComplete)) onComplete(response, json);
1765
+ }).bind(this);
1766
+
1767
+ $super(url, options);
1768
+ },
1769
+
1770
+ updateContent: function(responseText) {
1771
+ var receiver = this.container[this.success() ? 'success' : 'failure'],
1772
+ options = this.options;
1773
+
1774
+ if (!options.evalScripts) responseText = responseText.stripScripts();
1775
+
1776
+ if (receiver = $(receiver)) {
1777
+ if (options.insertion) {
1778
+ if (Object.isString(options.insertion)) {
1779
+ var insertion = { }; insertion[options.insertion] = responseText;
1780
+ receiver.insert(insertion);
1781
+ }
1782
+ else options.insertion(receiver, responseText);
1783
+ }
1784
+ else receiver.update(responseText);
1785
+ }
1786
+ }
1787
+ });
1788
+
1789
+ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
1790
+ initialize: function($super, container, url, options) {
1791
+ $super(options);
1792
+ this.onComplete = this.options.onComplete;
1793
+
1794
+ this.frequency = (this.options.frequency || 2);
1795
+ this.decay = (this.options.decay || 1);
1796
+
1797
+ this.updater = { };
1798
+ this.container = container;
1799
+ this.url = url;
1800
+
1801
+ this.start();
1802
+ },
1803
+
1804
+ start: function() {
1805
+ this.options.onComplete = this.updateComplete.bind(this);
1806
+ this.onTimerEvent();
1807
+ },
1808
+
1809
+ stop: function() {
1810
+ this.updater.options.onComplete = undefined;
1811
+ clearTimeout(this.timer);
1812
+ (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
1813
+ },
1814
+
1815
+ updateComplete: function(response) {
1816
+ if (this.options.decay) {
1817
+ this.decay = (response.responseText == this.lastText ?
1818
+ this.decay * this.options.decay : 1);
1819
+
1820
+ this.lastText = response.responseText;
1821
+ }
1822
+ this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
1823
+ },
1824
+
1825
+ onTimerEvent: function() {
1826
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
1827
+ }
1828
+ });
1829
+
1830
+
1831
+ function $(element) {
1832
+ if (arguments.length > 1) {
1833
+ for (var i = 0, elements = [], length = arguments.length; i < length; i++)
1834
+ elements.push($(arguments[i]));
1835
+ return elements;
1836
+ }
1837
+ if (Object.isString(element))
1838
+ element = document.getElementById(element);
1839
+ return Element.extend(element);
1840
+ }
1841
+
1842
+ if (Prototype.BrowserFeatures.XPath) {
1843
+ document._getElementsByXPath = function(expression, parentElement) {
1844
+ var results = [];
1845
+ var query = document.evaluate(expression, $(parentElement) || document,
1846
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
1847
+ for (var i = 0, length = query.snapshotLength; i < length; i++)
1848
+ results.push(Element.extend(query.snapshotItem(i)));
1849
+ return results;
1850
+ };
1851
+ }
1852
+
1853
+ /*--------------------------------------------------------------------------*/
1854
+
1855
+ if (!Node) var Node = { };
1856
+
1857
+ if (!Node.ELEMENT_NODE) {
1858
+ Object.extend(Node, {
1859
+ ELEMENT_NODE: 1,
1860
+ ATTRIBUTE_NODE: 2,
1861
+ TEXT_NODE: 3,
1862
+ CDATA_SECTION_NODE: 4,
1863
+ ENTITY_REFERENCE_NODE: 5,
1864
+ ENTITY_NODE: 6,
1865
+ PROCESSING_INSTRUCTION_NODE: 7,
1866
+ COMMENT_NODE: 8,
1867
+ DOCUMENT_NODE: 9,
1868
+ DOCUMENT_TYPE_NODE: 10,
1869
+ DOCUMENT_FRAGMENT_NODE: 11,
1870
+ NOTATION_NODE: 12
1871
+ });
1872
+ }
1873
+
1874
+
1875
+
1876
+ (function(global) {
1877
+ function shouldUseCache(tagName, attributes) {
1878
+ if (tagName === 'select') return false;
1879
+ if ('type' in attributes) return false;
1880
+ return true;
1881
+ }
1882
+
1883
+ var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){
1884
+ try {
1885
+ var el = document.createElement('<input name="x">');
1886
+ return el.tagName.toLowerCase() === 'input' && el.name === 'x';
1887
+ }
1888
+ catch(err) {
1889
+ return false;
1890
+ }
1891
+ })();
1892
+
1893
+ var element = global.Element;
1894
+
1895
+ global.Element = function(tagName, attributes) {
1896
+ attributes = attributes || { };
1897
+ tagName = tagName.toLowerCase();
1898
+ var cache = Element.cache;
1899
+
1900
+ if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) {
1901
+ tagName = '<' + tagName + ' name="' + attributes.name + '">';
1902
+ delete attributes.name;
1903
+ return Element.writeAttribute(document.createElement(tagName), attributes);
1904
+ }
1905
+
1906
+ if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
1907
+
1908
+ var node = shouldUseCache(tagName, attributes) ?
1909
+ cache[tagName].cloneNode(false) : document.createElement(tagName);
1910
+
1911
+ return Element.writeAttribute(node, attributes);
1912
+ };
1913
+
1914
+ Object.extend(global.Element, element || { });
1915
+ if (element) global.Element.prototype = element.prototype;
1916
+
1917
+ })(this);
1918
+
1919
+ Element.idCounter = 1;
1920
+ Element.cache = { };
1921
+
1922
+ Element._purgeElement = function(element) {
1923
+ var uid = element._prototypeUID;
1924
+ if (uid) {
1925
+ Element.stopObserving(element);
1926
+ element._prototypeUID = void 0;
1927
+ delete Element.Storage[uid];
1928
+ }
1929
+ }
1930
+
1931
+ Element.Methods = {
1932
+ visible: function(element) {
1933
+ return $(element).style.display != 'none';
1934
+ },
1935
+
1936
+ toggle: function(element) {
1937
+ element = $(element);
1938
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
1939
+ return element;
1940
+ },
1941
+
1942
+ hide: function(element) {
1943
+ element = $(element);
1944
+ if(!isBootstrapEvent){
1945
+ element.style.display = 'none';
1946
+ }
1947
+ return element;
1948
+ },
1949
+
1950
+ show: function(element) {
1951
+ element = $(element);
1952
+ element.style.display = '';
1953
+ return element;
1954
+ },
1955
+
1956
+ remove: function(element) {
1957
+ element = $(element);
1958
+ element.parentNode.removeChild(element);
1959
+ return element;
1960
+ },
1961
+
1962
+ update: (function(){
1963
+
1964
+ var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
1965
+ var el = document.createElement("select"),
1966
+ isBuggy = true;
1967
+ el.innerHTML = "<option value=\"test\">test</option>";
1968
+ if (el.options && el.options[0]) {
1969
+ isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
1970
+ }
1971
+ el = null;
1972
+ return isBuggy;
1973
+ })();
1974
+
1975
+ var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
1976
+ try {
1977
+ var el = document.createElement("table");
1978
+ if (el && el.tBodies) {
1979
+ el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>";
1980
+ var isBuggy = typeof el.tBodies[0] == "undefined";
1981
+ el = null;
1982
+ return isBuggy;
1983
+ }
1984
+ } catch (e) {
1985
+ return true;
1986
+ }
1987
+ })();
1988
+
1989
+ var LINK_ELEMENT_INNERHTML_BUGGY = (function() {
1990
+ try {
1991
+ var el = document.createElement('div');
1992
+ el.innerHTML = "<link>";
1993
+ var isBuggy = (el.childNodes.length === 0);
1994
+ el = null;
1995
+ return isBuggy;
1996
+ } catch(e) {
1997
+ return true;
1998
+ }
1999
+ })();
2000
+
2001
+ var ANY_INNERHTML_BUGGY = SELECT_ELEMENT_INNERHTML_BUGGY ||
2002
+ TABLE_ELEMENT_INNERHTML_BUGGY || LINK_ELEMENT_INNERHTML_BUGGY;
2003
+
2004
+ var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () {
2005
+ var s = document.createElement("script"),
2006
+ isBuggy = false;
2007
+ try {
2008
+ s.appendChild(document.createTextNode(""));
2009
+ isBuggy = !s.firstChild ||
2010
+ s.firstChild && s.firstChild.nodeType !== 3;
2011
+ } catch (e) {
2012
+ isBuggy = true;
2013
+ }
2014
+ s = null;
2015
+ return isBuggy;
2016
+ })();
2017
+
2018
+
2019
+ function update(element, content) {
2020
+ element = $(element);
2021
+ var purgeElement = Element._purgeElement;
2022
+
2023
+ var descendants = element.getElementsByTagName('*'),
2024
+ i = descendants.length;
2025
+ while (i--) purgeElement(descendants[i]);
2026
+
2027
+ if (content && content.toElement)
2028
+ content = content.toElement();
2029
+
2030
+ if (Object.isElement(content))
2031
+ return element.update().insert(content);
2032
+
2033
+ content = Object.toHTML(content);
2034
+
2035
+ var tagName = element.tagName.toUpperCase();
2036
+
2037
+ if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
2038
+ element.text = content;
2039
+ return element;
2040
+ }
2041
+
2042
+ if (ANY_INNERHTML_BUGGY) {
2043
+ if (tagName in Element._insertionTranslations.tags) {
2044
+ while (element.firstChild) {
2045
+ element.removeChild(element.firstChild);
2046
+ }
2047
+ Element._getContentFromAnonymousElement(tagName, content.stripScripts())
2048
+ .each(function(node) {
2049
+ element.appendChild(node)
2050
+ });
2051
+ } else if (LINK_ELEMENT_INNERHTML_BUGGY && Object.isString(content) && content.indexOf('<link') > -1) {
2052
+ while (element.firstChild) {
2053
+ element.removeChild(element.firstChild);
2054
+ }
2055
+ var nodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts(), true);
2056
+ nodes.each(function(node) { element.appendChild(node) });
2057
+ }
2058
+ else {
2059
+ element.innerHTML = content.stripScripts();
2060
+ }
2061
+ }
2062
+ else {
2063
+ element.innerHTML = content.stripScripts();
2064
+ }
2065
+
2066
+ content.evalScripts.bind(content).defer();
2067
+ return element;
2068
+ }
2069
+
2070
+ return update;
2071
+ })(),
2072
+
2073
+ replace: function(element, content) {
2074
+ element = $(element);
2075
+ if (content && content.toElement) content = content.toElement();
2076
+ else if (!Object.isElement(content)) {
2077
+ content = Object.toHTML(content);
2078
+ var range = element.ownerDocument.createRange();
2079
+ range.selectNode(element);
2080
+ content.evalScripts.bind(content).defer();
2081
+ content = range.createContextualFragment(content.stripScripts());
2082
+ }
2083
+ element.parentNode.replaceChild(content, element);
2084
+ return element;
2085
+ },
2086
+
2087
+ insert: function(element, insertions) {
2088
+ element = $(element);
2089
+
2090
+ if (Object.isString(insertions) || Object.isNumber(insertions) ||
2091
+ Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
2092
+ insertions = {bottom:insertions};
2093
+
2094
+ var content, insert, tagName, childNodes;
2095
+
2096
+ for (var position in insertions) {
2097
+ content = insertions[position];
2098
+ position = position.toLowerCase();
2099
+ insert = Element._insertionTranslations[position];
2100
+
2101
+ if (content && content.toElement) content = content.toElement();
2102
+ if (Object.isElement(content)) {
2103
+ insert(element, content);
2104
+ continue;
2105
+ }
2106
+
2107
+ content = Object.toHTML(content);
2108
+
2109
+ tagName = ((position == 'before' || position == 'after')
2110
+ ? element.parentNode : element).tagName.toUpperCase();
2111
+
2112
+ childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
2113
+
2114
+ if (position == 'top' || position == 'after') childNodes.reverse();
2115
+ childNodes.each(insert.curry(element));
2116
+
2117
+ content.evalScripts.bind(content).defer();
2118
+ }
2119
+
2120
+ return element;
2121
+ },
2122
+
2123
+ wrap: function(element, wrapper, attributes) {
2124
+ element = $(element);
2125
+ if (Object.isElement(wrapper))
2126
+ $(wrapper).writeAttribute(attributes || { });
2127
+ else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
2128
+ else wrapper = new Element('div', wrapper);
2129
+ if (element.parentNode)
2130
+ element.parentNode.replaceChild(wrapper, element);
2131
+ wrapper.appendChild(element);
2132
+ return wrapper;
2133
+ },
2134
+
2135
+ inspect: function(element) {
2136
+ element = $(element);
2137
+ var result = '<' + element.tagName.toLowerCase();
2138
+ $H({'id': 'id', 'className': 'class'}).each(function(pair) {
2139
+ var property = pair.first(),
2140
+ attribute = pair.last(),
2141
+ value = (element[property] || '').toString();
2142
+ if (value) result += ' ' + attribute + '=' + value.inspect(true);
2143
+ });
2144
+ return result + '>';
2145
+ },
2146
+
2147
+ recursivelyCollect: function(element, property, maximumLength) {
2148
+ element = $(element);
2149
+ maximumLength = maximumLength || -1;
2150
+ var elements = [];
2151
+
2152
+ while (element = element[property]) {
2153
+ if (element.nodeType == 1)
2154
+ elements.push(Element.extend(element));
2155
+ if (elements.length == maximumLength)
2156
+ break;
2157
+ }
2158
+
2159
+ return elements;
2160
+ },
2161
+
2162
+ ancestors: function(element) {
2163
+ return Element.recursivelyCollect(element, 'parentNode');
2164
+ },
2165
+
2166
+ descendants: function(element) {
2167
+ return Element.select(element, "*");
2168
+ },
2169
+
2170
+ firstDescendant: function(element) {
2171
+ element = $(element).firstChild;
2172
+ while (element && element.nodeType != 1) element = element.nextSibling;
2173
+ return $(element);
2174
+ },
2175
+
2176
+ immediateDescendants: function(element) {
2177
+ var results = [], child = $(element).firstChild;
2178
+ while (child) {
2179
+ if (child.nodeType === 1) {
2180
+ results.push(Element.extend(child));
2181
+ }
2182
+ child = child.nextSibling;
2183
+ }
2184
+ return results;
2185
+ },
2186
+
2187
+ previousSiblings: function(element, maximumLength) {
2188
+ return Element.recursivelyCollect(element, 'previousSibling');
2189
+ },
2190
+
2191
+ nextSiblings: function(element) {
2192
+ return Element.recursivelyCollect(element, 'nextSibling');
2193
+ },
2194
+
2195
+ siblings: function(element) {
2196
+ element = $(element);
2197
+ return Element.previousSiblings(element).reverse()
2198
+ .concat(Element.nextSiblings(element));
2199
+ },
2200
+
2201
+ match: function(element, selector) {
2202
+ element = $(element);
2203
+ if (Object.isString(selector))
2204
+ return Prototype.Selector.match(element, selector);
2205
+ return selector.match(element);
2206
+ },
2207
+
2208
+ up: function(element, expression, index) {
2209
+ element = $(element);
2210
+ if (arguments.length == 1) return $(element.parentNode);
2211
+ var ancestors = Element.ancestors(element);
2212
+ return Object.isNumber(expression) ? ancestors[expression] :
2213
+ Prototype.Selector.find(ancestors, expression, index);
2214
+ },
2215
+
2216
+ down: function(element, expression, index) {
2217
+ element = $(element);
2218
+ if (arguments.length == 1) return Element.firstDescendant(element);
2219
+ return Object.isNumber(expression) ? Element.descendants(element)[expression] :
2220
+ Element.select(element, expression)[index || 0];
2221
+ },
2222
+
2223
+ previous: function(element, expression, index) {
2224
+ element = $(element);
2225
+ if (Object.isNumber(expression)) index = expression, expression = false;
2226
+ if (!Object.isNumber(index)) index = 0;
2227
+
2228
+ if (expression) {
2229
+ return Prototype.Selector.find(element.previousSiblings(), expression, index);
2230
+ } else {
2231
+ return element.recursivelyCollect("previousSibling", index + 1)[index];
2232
+ }
2233
+ },
2234
+
2235
+ next: function(element, expression, index) {
2236
+ element = $(element);
2237
+ if (Object.isNumber(expression)) index = expression, expression = false;
2238
+ if (!Object.isNumber(index)) index = 0;
2239
+
2240
+ if (expression) {
2241
+ return Prototype.Selector.find(element.nextSiblings(), expression, index);
2242
+ } else {
2243
+ var maximumLength = Object.isNumber(index) ? index + 1 : 1;
2244
+ return element.recursivelyCollect("nextSibling", index + 1)[index];
2245
+ }
2246
+ },
2247
+
2248
+
2249
+ select: function(element) {
2250
+ element = $(element);
2251
+ var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
2252
+ return Prototype.Selector.select(expressions, element);
2253
+ },
2254
+
2255
+ adjacent: function(element) {
2256
+ element = $(element);
2257
+ var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
2258
+ return Prototype.Selector.select(expressions, element.parentNode).without(element);
2259
+ },
2260
+
2261
+ identify: function(element) {
2262
+ element = $(element);
2263
+ var id = Element.readAttribute(element, 'id');
2264
+ if (id) return id;
2265
+ do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
2266
+ Element.writeAttribute(element, 'id', id);
2267
+ return id;
2268
+ },
2269
+
2270
+ readAttribute: function(element, name) {
2271
+ element = $(element);
2272
+ if (Prototype.Browser.IE) {
2273
+ var t = Element._attributeTranslations.read;
2274
+ if (t.values[name]) return t.values[name](element, name);
2275
+ if (t.names[name]) name = t.names[name];
2276
+ if (name.include(':')) {
2277
+ return (!element.attributes || !element.attributes[name]) ? null :
2278
+ element.attributes[name].value;
2279
+ }
2280
+ }
2281
+ return element.getAttribute(name);
2282
+ },
2283
+
2284
+ writeAttribute: function(element, name, value) {
2285
+ element = $(element);
2286
+ var attributes = { }, t = Element._attributeTranslations.write;
2287
+
2288
+ if (typeof name == 'object') attributes = name;
2289
+ else attributes[name] = Object.isUndefined(value) ? true : value;
2290
+
2291
+ for (var attr in attributes) {
2292
+ name = t.names[attr] || attr;
2293
+ value = attributes[attr];
2294
+ if (t.values[attr]) name = t.values[attr](element, value);
2295
+ if (value === false || value === null)
2296
+ element.removeAttribute(name);
2297
+ else if (value === true)
2298
+ element.setAttribute(name, name);
2299
+ else element.setAttribute(name, value);
2300
+ }
2301
+ return element;
2302
+ },
2303
+
2304
+ getHeight: function(element) {
2305
+ return Element.getDimensions(element).height;
2306
+ },
2307
+
2308
+ getWidth: function(element) {
2309
+ return Element.getDimensions(element).width;
2310
+ },
2311
+
2312
+ classNames: function(element) {
2313
+ return new Element.ClassNames(element);
2314
+ },
2315
+
2316
+ hasClassName: function(element, className) {
2317
+ if (!(element = $(element))) return;
2318
+ var elementClassName = element.className;
2319
+ return (elementClassName.length > 0 && (elementClassName == className ||
2320
+ new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
2321
+ },
2322
+
2323
+ addClassName: function(element, className) {
2324
+ if (!(element = $(element))) return;
2325
+ if (!Element.hasClassName(element, className))
2326
+ element.className += (element.className ? ' ' : '') + className;
2327
+ return element;
2328
+ },
2329
+
2330
+ removeClassName: function(element, className) {
2331
+ if (!(element = $(element))) return;
2332
+ element.className = element.className.replace(
2333
+ new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
2334
+ return element;
2335
+ },
2336
+
2337
+ toggleClassName: function(element, className) {
2338
+ if (!(element = $(element))) return;
2339
+ return Element[Element.hasClassName(element, className) ?
2340
+ 'removeClassName' : 'addClassName'](element, className);
2341
+ },
2342
+
2343
+ cleanWhitespace: function(element) {
2344
+ element = $(element);
2345
+ var node = element.firstChild;
2346
+ while (node) {
2347
+ var nextNode = node.nextSibling;
2348
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
2349
+ element.removeChild(node);
2350
+ node = nextNode;
2351
+ }
2352
+ return element;
2353
+ },
2354
+
2355
+ empty: function(element) {
2356
+ return $(element).innerHTML.blank();
2357
+ },
2358
+
2359
+ descendantOf: function(element, ancestor) {
2360
+ element = $(element), ancestor = $(ancestor);
2361
+
2362
+ if (element.compareDocumentPosition)
2363
+ return (element.compareDocumentPosition(ancestor) & 8) === 8;
2364
+
2365
+ if (ancestor.contains)
2366
+ return ancestor.contains(element) && ancestor !== element;
2367
+
2368
+ while (element = element.parentNode)
2369
+ if (element == ancestor) return true;
2370
+
2371
+ return false;
2372
+ },
2373
+
2374
+ scrollTo: function(element) {
2375
+ element = $(element);
2376
+ var pos = Element.cumulativeOffset(element);
2377
+ window.scrollTo(pos[0], pos[1]);
2378
+ return element;
2379
+ },
2380
+
2381
+ getStyle: function(element, style) {
2382
+ element = $(element);
2383
+ style = style == 'float' ? 'cssFloat' : style.camelize();
2384
+ var value = element.style[style];
2385
+ if (!value || value == 'auto') {
2386
+ var css = document.defaultView.getComputedStyle(element, null);
2387
+ value = css ? css[style] : null;
2388
+ }
2389
+ if (style == 'opacity') return value ? parseFloat(value) : 1.0;
2390
+ return value == 'auto' ? null : value;
2391
+ },
2392
+
2393
+ getOpacity: function(element) {
2394
+ return $(element).getStyle('opacity');
2395
+ },
2396
+
2397
+ setStyle: function(element, styles) {
2398
+ element = $(element);
2399
+ var elementStyle = element.style, match;
2400
+ if (Object.isString(styles)) {
2401
+ element.style.cssText += ';' + styles;
2402
+ return styles.include('opacity') ?
2403
+ element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
2404
+ }
2405
+ for (var property in styles)
2406
+ if (property == 'opacity') element.setOpacity(styles[property]);
2407
+ else
2408
+ elementStyle[(property == 'float' || property == 'cssFloat') ?
2409
+ (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
2410
+ property] = styles[property];
2411
+
2412
+ return element;
2413
+ },
2414
+
2415
+ setOpacity: function(element, value) {
2416
+ element = $(element);
2417
+ element.style.opacity = (value == 1 || value === '') ? '' :
2418
+ (value < 0.00001) ? 0 : value;
2419
+ return element;
2420
+ },
2421
+
2422
+ makePositioned: function(element) {
2423
+ element = $(element);
2424
+ var pos = Element.getStyle(element, 'position');
2425
+ if (pos == 'static' || !pos) {
2426
+ element._madePositioned = true;
2427
+ element.style.position = 'relative';
2428
+ if (Prototype.Browser.Opera) {
2429
+ element.style.top = 0;
2430
+ element.style.left = 0;
2431
+ }
2432
+ }
2433
+ return element;
2434
+ },
2435
+
2436
+ undoPositioned: function(element) {
2437
+ element = $(element);
2438
+ if (element._madePositioned) {
2439
+ element._madePositioned = undefined;
2440
+ element.style.position =
2441
+ element.style.top =
2442
+ element.style.left =
2443
+ element.style.bottom =
2444
+ element.style.right = '';
2445
+ }
2446
+ return element;
2447
+ },
2448
+
2449
+ makeClipping: function(element) {
2450
+ element = $(element);
2451
+ if (element._overflow) return element;
2452
+ element._overflow = Element.getStyle(element, 'overflow') || 'auto';
2453
+ if (element._overflow !== 'hidden')
2454
+ element.style.overflow = 'hidden';
2455
+ return element;
2456
+ },
2457
+
2458
+ undoClipping: function(element) {
2459
+ element = $(element);
2460
+ if (!element._overflow) return element;
2461
+ element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
2462
+ element._overflow = null;
2463
+ return element;
2464
+ },
2465
+
2466
+ clonePosition: function(element, source) {
2467
+ var options = Object.extend({
2468
+ setLeft: true,
2469
+ setTop: true,
2470
+ setWidth: true,
2471
+ setHeight: true,
2472
+ offsetTop: 0,
2473
+ offsetLeft: 0
2474
+ }, arguments[2] || { });
2475
+
2476
+ source = $(source);
2477
+ var p = Element.viewportOffset(source), delta = [0, 0], parent = null;
2478
+
2479
+ element = $(element);
2480
+
2481
+ if (Element.getStyle(element, 'position') == 'absolute') {
2482
+ parent = Element.getOffsetParent(element);
2483
+ delta = Element.viewportOffset(parent);
2484
+ }
2485
+
2486
+ if (parent == document.body) {
2487
+ delta[0] -= document.body.offsetLeft;
2488
+ delta[1] -= document.body.offsetTop;
2489
+ }
2490
+
2491
+ if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
2492
+ if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
2493
+ if (options.setWidth) element.style.width = source.offsetWidth + 'px';
2494
+ if (options.setHeight) element.style.height = source.offsetHeight + 'px';
2495
+ return element;
2496
+ }
2497
+ };
2498
+
2499
+ Object.extend(Element.Methods, {
2500
+ getElementsBySelector: Element.Methods.select,
2501
+
2502
+ childElements: Element.Methods.immediateDescendants
2503
+ });
2504
+
2505
+ Element._attributeTranslations = {
2506
+ write: {
2507
+ names: {
2508
+ className: 'class',
2509
+ htmlFor: 'for'
2510
+ },
2511
+ values: { }
2512
+ }
2513
+ };
2514
+
2515
+ if (Prototype.Browser.Opera) {
2516
+ Element.Methods.getStyle = Element.Methods.getStyle.wrap(
2517
+ function(proceed, element, style) {
2518
+ switch (style) {
2519
+ case 'height': case 'width':
2520
+ if (!Element.visible(element)) return null;
2521
+
2522
+ var dim = parseInt(proceed(element, style), 10);
2523
+
2524
+ if (dim !== element['offset' + style.capitalize()])
2525
+ return dim + 'px';
2526
+
2527
+ var properties;
2528
+ if (style === 'height') {
2529
+ properties = ['border-top-width', 'padding-top',
2530
+ 'padding-bottom', 'border-bottom-width'];
2531
+ }
2532
+ else {
2533
+ properties = ['border-left-width', 'padding-left',
2534
+ 'padding-right', 'border-right-width'];
2535
+ }
2536
+ return properties.inject(dim, function(memo, property) {
2537
+ var val = proceed(element, property);
2538
+ return val === null ? memo : memo - parseInt(val, 10);
2539
+ }) + 'px';
2540
+ default: return proceed(element, style);
2541
+ }
2542
+ }
2543
+ );
2544
+
2545
+ Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
2546
+ function(proceed, element, attribute) {
2547
+ if (attribute === 'title') return element.title;
2548
+ return proceed(element, attribute);
2549
+ }
2550
+ );
2551
+ }
2552
+
2553
+ else if (Prototype.Browser.IE) {
2554
+ Element.Methods.getStyle = function(element, style) {
2555
+ element = $(element);
2556
+ style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
2557
+ var value = element.style[style];
2558
+ if (!value && element.currentStyle) value = element.currentStyle[style];
2559
+
2560
+ if (style == 'opacity') {
2561
+ if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
2562
+ if (value[1]) return parseFloat(value[1]) / 100;
2563
+ return 1.0;
2564
+ }
2565
+
2566
+ if (value == 'auto') {
2567
+ if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
2568
+ return element['offset' + style.capitalize()] + 'px';
2569
+ return null;
2570
+ }
2571
+ return value;
2572
+ };
2573
+
2574
+ Element.Methods.setOpacity = function(element, value) {
2575
+ function stripAlpha(filter){
2576
+ return filter.replace(/alpha\([^\)]*\)/gi,'');
2577
+ }
2578
+ element = $(element);
2579
+ var currentStyle = element.currentStyle;
2580
+ if ((currentStyle && !currentStyle.hasLayout) ||
2581
+ (!currentStyle && element.style.zoom == 'normal'))
2582
+ element.style.zoom = 1;
2583
+
2584
+ var filter = element.getStyle('filter'), style = element.style;
2585
+ if (value == 1 || value === '') {
2586
+ (filter = stripAlpha(filter)) ?
2587
+ style.filter = filter : style.removeAttribute('filter');
2588
+ return element;
2589
+ } else if (value < 0.00001) value = 0;
2590
+ style.filter = stripAlpha(filter) +
2591
+ 'alpha(opacity=' + (value * 100) + ')';
2592
+ return element;
2593
+ };
2594
+
2595
+ Element._attributeTranslations = (function(){
2596
+
2597
+ var classProp = 'className',
2598
+ forProp = 'for',
2599
+ el = document.createElement('div');
2600
+
2601
+ el.setAttribute(classProp, 'x');
2602
+
2603
+ if (el.className !== 'x') {
2604
+ el.setAttribute('class', 'x');
2605
+ if (el.className === 'x') {
2606
+ classProp = 'class';
2607
+ }
2608
+ }
2609
+ el = null;
2610
+
2611
+ el = document.createElement('label');
2612
+ el.setAttribute(forProp, 'x');
2613
+ if (el.htmlFor !== 'x') {
2614
+ el.setAttribute('htmlFor', 'x');
2615
+ if (el.htmlFor === 'x') {
2616
+ forProp = 'htmlFor';
2617
+ }
2618
+ }
2619
+ el = null;
2620
+
2621
+ return {
2622
+ read: {
2623
+ names: {
2624
+ 'class': classProp,
2625
+ 'className': classProp,
2626
+ 'for': forProp,
2627
+ 'htmlFor': forProp
2628
+ },
2629
+ values: {
2630
+ _getAttr: function(element, attribute) {
2631
+ return element.getAttribute(attribute);
2632
+ },
2633
+ _getAttr2: function(element, attribute) {
2634
+ return element.getAttribute(attribute, 2);
2635
+ },
2636
+ _getAttrNode: function(element, attribute) {
2637
+ var node = element.getAttributeNode(attribute);
2638
+ return node ? node.value : "";
2639
+ },
2640
+ _getEv: (function(){
2641
+
2642
+ var el = document.createElement('div'), f;
2643
+ el.onclick = Prototype.emptyFunction;
2644
+ var value = el.getAttribute('onclick');
2645
+
2646
+ if (String(value).indexOf('{') > -1) {
2647
+ f = function(element, attribute) {
2648
+ attribute = element.getAttribute(attribute);
2649
+ if (!attribute) return null;
2650
+ attribute = attribute.toString();
2651
+ attribute = attribute.split('{')[1];
2652
+ attribute = attribute.split('}')[0];
2653
+ return attribute.strip();
2654
+ };
2655
+ }
2656
+ else if (value === '') {
2657
+ f = function(element, attribute) {
2658
+ attribute = element.getAttribute(attribute);
2659
+ if (!attribute) return null;
2660
+ return attribute.strip();
2661
+ };
2662
+ }
2663
+ el = null;
2664
+ return f;
2665
+ })(),
2666
+ _flag: function(element, attribute) {
2667
+ return $(element).hasAttribute(attribute) ? attribute : null;
2668
+ },
2669
+ style: function(element) {
2670
+ return element.style.cssText.toLowerCase();
2671
+ },
2672
+ title: function(element) {
2673
+ return element.title;
2674
+ }
2675
+ }
2676
+ }
2677
+ }
2678
+ })();
2679
+
2680
+ Element._attributeTranslations.write = {
2681
+ names: Object.extend({
2682
+ cellpadding: 'cellPadding',
2683
+ cellspacing: 'cellSpacing'
2684
+ }, Element._attributeTranslations.read.names),
2685
+ values: {
2686
+ checked: function(element, value) {
2687
+ element.checked = !!value;
2688
+ },
2689
+
2690
+ style: function(element, value) {
2691
+ element.style.cssText = value ? value : '';
2692
+ }
2693
+ }
2694
+ };
2695
+
2696
+ Element._attributeTranslations.has = {};
2697
+
2698
+ $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
2699
+ 'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
2700
+ Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
2701
+ Element._attributeTranslations.has[attr.toLowerCase()] = attr;
2702
+ });
2703
+
2704
+ (function(v) {
2705
+ Object.extend(v, {
2706
+ href: v._getAttr2,
2707
+ src: v._getAttr2,
2708
+ type: v._getAttr,
2709
+ action: v._getAttrNode,
2710
+ disabled: v._flag,
2711
+ checked: v._flag,
2712
+ readonly: v._flag,
2713
+ multiple: v._flag,
2714
+ onload: v._getEv,
2715
+ onunload: v._getEv,
2716
+ onclick: v._getEv,
2717
+ ondblclick: v._getEv,
2718
+ onmousedown: v._getEv,
2719
+ onmouseup: v._getEv,
2720
+ onmouseover: v._getEv,
2721
+ onmousemove: v._getEv,
2722
+ onmouseout: v._getEv,
2723
+ onfocus: v._getEv,
2724
+ onblur: v._getEv,
2725
+ onkeypress: v._getEv,
2726
+ onkeydown: v._getEv,
2727
+ onkeyup: v._getEv,
2728
+ onsubmit: v._getEv,
2729
+ onreset: v._getEv,
2730
+ onselect: v._getEv,
2731
+ onchange: v._getEv
2732
+ });
2733
+ })(Element._attributeTranslations.read.values);
2734
+
2735
+ if (Prototype.BrowserFeatures.ElementExtensions) {
2736
+ (function() {
2737
+ function _descendants(element) {
2738
+ var nodes = element.getElementsByTagName('*'), results = [];
2739
+ for (var i = 0, node; node = nodes[i]; i++)
2740
+ if (node.tagName !== "!") // Filter out comment nodes.
2741
+ results.push(node);
2742
+ return results;
2743
+ }
2744
+
2745
+ Element.Methods.down = function(element, expression, index) {
2746
+ element = $(element);
2747
+ if (arguments.length == 1) return element.firstDescendant();
2748
+ return Object.isNumber(expression) ? _descendants(element)[expression] :
2749
+ Element.select(element, expression)[index || 0];
2750
+ }
2751
+ })();
2752
+ }
2753
+
2754
+ }
2755
+
2756
+ else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
2757
+ Element.Methods.setOpacity = function(element, value) {
2758
+ element = $(element);
2759
+ element.style.opacity = (value == 1) ? 0.999999 :
2760
+ (value === '') ? '' : (value < 0.00001) ? 0 : value;
2761
+ return element;
2762
+ };
2763
+ }
2764
+
2765
+ else if (Prototype.Browser.WebKit) {
2766
+ Element.Methods.setOpacity = function(element, value) {
2767
+ element = $(element);
2768
+ element.style.opacity = (value == 1 || value === '') ? '' :
2769
+ (value < 0.00001) ? 0 : value;
2770
+
2771
+ if (value == 1)
2772
+ if (element.tagName.toUpperCase() == 'IMG' && element.width) {
2773
+ element.width++; element.width--;
2774
+ } else try {
2775
+ var n = document.createTextNode(' ');
2776
+ element.appendChild(n);
2777
+ element.removeChild(n);
2778
+ } catch (e) { }
2779
+
2780
+ return element;
2781
+ };
2782
+ }
2783
+
2784
+ if ('outerHTML' in document.documentElement) {
2785
+ Element.Methods.replace = function(element, content) {
2786
+ element = $(element);
2787
+
2788
+ if (content && content.toElement) content = content.toElement();
2789
+ if (Object.isElement(content)) {
2790
+ element.parentNode.replaceChild(content, element);
2791
+ return element;
2792
+ }
2793
+
2794
+ content = Object.toHTML(content);
2795
+ var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
2796
+
2797
+ if (Element._insertionTranslations.tags[tagName]) {
2798
+ var nextSibling = element.next(),
2799
+ fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
2800
+ parent.removeChild(element);
2801
+ if (nextSibling)
2802
+ fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
2803
+ else
2804
+ fragments.each(function(node) { parent.appendChild(node) });
2805
+ }
2806
+ else element.outerHTML = content.stripScripts();
2807
+
2808
+ content.evalScripts.bind(content).defer();
2809
+ return element;
2810
+ };
2811
+ }
2812
+
2813
+ Element._returnOffset = function(l, t) {
2814
+ var result = [l, t];
2815
+ result.left = l;
2816
+ result.top = t;
2817
+ return result;
2818
+ };
2819
+
2820
+ Element._getContentFromAnonymousElement = function(tagName, html, force) {
2821
+ var div = new Element('div'),
2822
+ t = Element._insertionTranslations.tags[tagName];
2823
+
2824
+ var workaround = false;
2825
+ if (t) workaround = true;
2826
+ else if (force) {
2827
+ workaround = true;
2828
+ t = ['', '', 0];
2829
+ }
2830
+
2831
+ if (workaround) {
2832
+ div.innerHTML = '&nbsp;' + t[0] + html + t[1];
2833
+ div.removeChild(div.firstChild);
2834
+ for (var i = t[2]; i--; ) {
2835
+ div = div.firstChild;
2836
+ }
2837
+ }
2838
+ else {
2839
+ div.innerHTML = html;
2840
+ }
2841
+ return $A(div.childNodes);
2842
+ };
2843
+
2844
+ Element._insertionTranslations = {
2845
+ before: function(element, node) {
2846
+ element.parentNode.insertBefore(node, element);
2847
+ },
2848
+ top: function(element, node) {
2849
+ element.insertBefore(node, element.firstChild);
2850
+ },
2851
+ bottom: function(element, node) {
2852
+ element.appendChild(node);
2853
+ },
2854
+ after: function(element, node) {
2855
+ element.parentNode.insertBefore(node, element.nextSibling);
2856
+ },
2857
+ tags: {
2858
+ TABLE: ['<table>', '</table>', 1],
2859
+ TBODY: ['<table><tbody>', '</tbody></table>', 2],
2860
+ TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
2861
+ TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
2862
+ SELECT: ['<select>', '</select>', 1]
2863
+ }
2864
+ };
2865
+
2866
+ (function() {
2867
+ var tags = Element._insertionTranslations.tags;
2868
+ Object.extend(tags, {
2869
+ THEAD: tags.TBODY,
2870
+ TFOOT: tags.TBODY,
2871
+ TH: tags.TD
2872
+ });
2873
+ })();
2874
+
2875
+ Element.Methods.Simulated = {
2876
+ hasAttribute: function(element, attribute) {
2877
+ attribute = Element._attributeTranslations.has[attribute] || attribute;
2878
+ var node = $(element).getAttributeNode(attribute);
2879
+ return !!(node && node.specified);
2880
+ }
2881
+ };
2882
+
2883
+ Element.Methods.ByTag = { };
2884
+
2885
+ Object.extend(Element, Element.Methods);
2886
+
2887
+ (function(div) {
2888
+
2889
+ if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) {
2890
+ window.HTMLElement = { };
2891
+ window.HTMLElement.prototype = div['__proto__'];
2892
+ Prototype.BrowserFeatures.ElementExtensions = true;
2893
+ }
2894
+
2895
+ div = null;
2896
+
2897
+ })(document.createElement('div'));
2898
+
2899
+ Element.extend = (function() {
2900
+
2901
+ function checkDeficiency(tagName) {
2902
+ if (typeof window.Element != 'undefined') {
2903
+ var proto = window.Element.prototype;
2904
+ if (proto) {
2905
+ var id = '_' + (Math.random()+'').slice(2),
2906
+ el = document.createElement(tagName);
2907
+ proto[id] = 'x';
2908
+ var isBuggy = (el[id] !== 'x');
2909
+ delete proto[id];
2910
+ el = null;
2911
+ return isBuggy;
2912
+ }
2913
+ }
2914
+ return false;
2915
+ }
2916
+
2917
+ function extendElementWith(element, methods) {
2918
+ for (var property in methods) {
2919
+ var value = methods[property];
2920
+ if (Object.isFunction(value) && !(property in element))
2921
+ element[property] = value.methodize();
2922
+ }
2923
+ }
2924
+
2925
+ var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');
2926
+
2927
+ if (Prototype.BrowserFeatures.SpecificElementExtensions) {
2928
+ if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
2929
+ return function(element) {
2930
+ if (element && typeof element._extendedByPrototype == 'undefined') {
2931
+ var t = element.tagName;
2932
+ if (t && (/^(?:object|applet|embed)$/i.test(t))) {
2933
+ extendElementWith(element, Element.Methods);
2934
+ extendElementWith(element, Element.Methods.Simulated);
2935
+ extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
2936
+ }
2937
+ }
2938
+ return element;
2939
+ }
2940
+ }
2941
+ return Prototype.K;
2942
+ }
2943
+
2944
+ var Methods = { }, ByTag = Element.Methods.ByTag;
2945
+
2946
+ var extend = Object.extend(function(element) {
2947
+ if (!element || typeof element._extendedByPrototype != 'undefined' ||
2948
+ element.nodeType != 1 || element == window) return element;
2949
+
2950
+ var methods = Object.clone(Methods),
2951
+ tagName = element.tagName.toUpperCase();
2952
+
2953
+ if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
2954
+
2955
+ extendElementWith(element, methods);
2956
+
2957
+ element._extendedByPrototype = Prototype.emptyFunction;
2958
+ return element;
2959
+
2960
+ }, {
2961
+ refresh: function() {
2962
+ if (!Prototype.BrowserFeatures.ElementExtensions) {
2963
+ Object.extend(Methods, Element.Methods);
2964
+ Object.extend(Methods, Element.Methods.Simulated);
2965
+ }
2966
+ }
2967
+ });
2968
+
2969
+ extend.refresh();
2970
+ return extend;
2971
+ })();
2972
+
2973
+ if (document.documentElement.hasAttribute) {
2974
+ Element.hasAttribute = function(element, attribute) {
2975
+ return element.hasAttribute(attribute);
2976
+ };
2977
+ }
2978
+ else {
2979
+ Element.hasAttribute = Element.Methods.Simulated.hasAttribute;
2980
+ }
2981
+
2982
+ Element.addMethods = function(methods) {
2983
+ var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
2984
+
2985
+ if (!methods) {
2986
+ Object.extend(Form, Form.Methods);
2987
+ Object.extend(Form.Element, Form.Element.Methods);
2988
+ Object.extend(Element.Methods.ByTag, {
2989
+ "FORM": Object.clone(Form.Methods),
2990
+ "INPUT": Object.clone(Form.Element.Methods),
2991
+ "SELECT": Object.clone(Form.Element.Methods),
2992
+ "TEXTAREA": Object.clone(Form.Element.Methods),
2993
+ "BUTTON": Object.clone(Form.Element.Methods)
2994
+ });
2995
+ }
2996
+
2997
+ if (arguments.length == 2) {
2998
+ var tagName = methods;
2999
+ methods = arguments[1];
3000
+ }
3001
+
3002
+ if (!tagName) Object.extend(Element.Methods, methods || { });
3003
+ else {
3004
+ if (Object.isArray(tagName)) tagName.each(extend);
3005
+ else extend(tagName);
3006
+ }
3007
+
3008
+ function extend(tagName) {
3009
+ tagName = tagName.toUpperCase();
3010
+ if (!Element.Methods.ByTag[tagName])
3011
+ Element.Methods.ByTag[tagName] = { };
3012
+ Object.extend(Element.Methods.ByTag[tagName], methods);
3013
+ }
3014
+
3015
+ function copy(methods, destination, onlyIfAbsent) {
3016
+ onlyIfAbsent = onlyIfAbsent || false;
3017
+ for (var property in methods) {
3018
+ var value = methods[property];
3019
+ if (!Object.isFunction(value)) continue;
3020
+ if (!onlyIfAbsent || !(property in destination))
3021
+ destination[property] = value.methodize();
3022
+ }
3023
+ }
3024
+
3025
+ function findDOMClass(tagName) {
3026
+ var klass;
3027
+ var trans = {
3028
+ "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
3029
+ "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
3030
+ "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
3031
+ "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
3032
+ "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
3033
+ "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
3034
+ "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
3035
+ "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
3036
+ "FrameSet", "IFRAME": "IFrame"
3037
+ };
3038
+ if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
3039
+ if (window[klass]) return window[klass];
3040
+ klass = 'HTML' + tagName + 'Element';
3041
+ if (window[klass]) return window[klass];
3042
+ klass = 'HTML' + tagName.capitalize() + 'Element';
3043
+ if (window[klass]) return window[klass];
3044
+
3045
+ var element = document.createElement(tagName),
3046
+ proto = element['__proto__'] || element.constructor.prototype;
3047
+
3048
+ element = null;
3049
+ return proto;
3050
+ }
3051
+
3052
+ var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
3053
+ Element.prototype;
3054
+
3055
+ if (F.ElementExtensions) {
3056
+ copy(Element.Methods, elementPrototype);
3057
+ copy(Element.Methods.Simulated, elementPrototype, true);
3058
+ }
3059
+
3060
+ if (F.SpecificElementExtensions) {
3061
+ for (var tag in Element.Methods.ByTag) {
3062
+ var klass = findDOMClass(tag);
3063
+ if (Object.isUndefined(klass)) continue;
3064
+ copy(T[tag], klass.prototype);
3065
+ }
3066
+ }
3067
+
3068
+ Object.extend(Element, Element.Methods);
3069
+ delete Element.ByTag;
3070
+
3071
+ if (Element.extend.refresh) Element.extend.refresh();
3072
+ Element.cache = { };
3073
+ };
3074
+
3075
+
3076
+ document.viewport = {
3077
+
3078
+ getDimensions: function() {
3079
+ return { width: this.getWidth(), height: this.getHeight() };
3080
+ },
3081
+
3082
+ getScrollOffsets: function() {
3083
+ return Element._returnOffset(
3084
+ window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
3085
+ window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
3086
+ }
3087
+ };
3088
+
3089
+ (function(viewport) {
3090
+ var B = Prototype.Browser, doc = document, element, property = {};
3091
+
3092
+ function getRootElement() {
3093
+ if (B.WebKit && !doc.evaluate)
3094
+ return document;
3095
+
3096
+ if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
3097
+ return document.body;
3098
+
3099
+ return document.documentElement;
3100
+ }
3101
+
3102
+ function define(D) {
3103
+ if (!element) element = getRootElement();
3104
+
3105
+ property[D] = 'client' + D;
3106
+
3107
+ viewport['get' + D] = function() { return element[property[D]] };
3108
+ return viewport['get' + D]();
3109
+ }
3110
+
3111
+ viewport.getWidth = define.curry('Width');
3112
+
3113
+ viewport.getHeight = define.curry('Height');
3114
+ })(document.viewport);
3115
+
3116
+
3117
+ Element.Storage = {
3118
+ UID: 1
3119
+ };
3120
+
3121
+ Element.addMethods({
3122
+ getStorage: function(element) {
3123
+ if (!(element = $(element))) return;
3124
+
3125
+ var uid;
3126
+ if (element === window) {
3127
+ uid = 0;
3128
+ } else {
3129
+ if (typeof element._prototypeUID === "undefined")
3130
+ element._prototypeUID = Element.Storage.UID++;
3131
+ uid = element._prototypeUID;
3132
+ }
3133
+
3134
+ if (!Element.Storage[uid])
3135
+ Element.Storage[uid] = $H();
3136
+
3137
+ return Element.Storage[uid];
3138
+ },
3139
+
3140
+ store: function(element, key, value) {
3141
+ if (!(element = $(element))) return;
3142
+
3143
+ if (arguments.length === 2) {
3144
+ Element.getStorage(element).update(key);
3145
+ } else {
3146
+ Element.getStorage(element).set(key, value);
3147
+ }
3148
+
3149
+ return element;
3150
+ },
3151
+
3152
+ retrieve: function(element, key, defaultValue) {
3153
+ if (!(element = $(element))) return;
3154
+ var hash = Element.getStorage(element), value = hash.get(key);
3155
+
3156
+ if (Object.isUndefined(value)) {
3157
+ hash.set(key, defaultValue);
3158
+ value = defaultValue;
3159
+ }
3160
+
3161
+ return value;
3162
+ },
3163
+
3164
+ clone: function(element, deep) {
3165
+ if (!(element = $(element))) return;
3166
+ var clone = element.cloneNode(deep);
3167
+ clone._prototypeUID = void 0;
3168
+ if (deep) {
3169
+ var descendants = Element.select(clone, '*'),
3170
+ i = descendants.length;
3171
+ while (i--) {
3172
+ descendants[i]._prototypeUID = void 0;
3173
+ }
3174
+ }
3175
+ return Element.extend(clone);
3176
+ },
3177
+
3178
+ purge: function(element) {
3179
+ if (!(element = $(element))) return;
3180
+ var purgeElement = Element._purgeElement;
3181
+
3182
+ purgeElement(element);
3183
+
3184
+ var descendants = element.getElementsByTagName('*'),
3185
+ i = descendants.length;
3186
+
3187
+ while (i--) purgeElement(descendants[i]);
3188
+
3189
+ return null;
3190
+ }
3191
+ });
3192
+
3193
+ (function() {
3194
+
3195
+ function toDecimal(pctString) {
3196
+ var match = pctString.match(/^(\d+)%?$/i);
3197
+ if (!match) return null;
3198
+ return (Number(match[1]) / 100);
3199
+ }
3200
+
3201
+ function getPixelValue(value, property, context) {
3202
+ var element = null;
3203
+ if (Object.isElement(value)) {
3204
+ element = value;
3205
+ value = element.getStyle(property);
3206
+ }
3207
+
3208
+ if (value === null) {
3209
+ return null;
3210
+ }
3211
+
3212
+ if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) {
3213
+ return window.parseFloat(value);
3214
+ }
3215
+
3216
+ var isPercentage = value.include('%'), isViewport = (context === document.viewport);
3217
+
3218
+ if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) {
3219
+ var style = element.style.left, rStyle = element.runtimeStyle.left;
3220
+ element.runtimeStyle.left = element.currentStyle.left;
3221
+ element.style.left = value || 0;
3222
+ value = element.style.pixelLeft;
3223
+ element.style.left = style;
3224
+ element.runtimeStyle.left = rStyle;
3225
+
3226
+ return value;
3227
+ }
3228
+
3229
+ if (element && isPercentage) {
3230
+ context = context || element.parentNode;
3231
+ var decimal = toDecimal(value);
3232
+ var whole = null;
3233
+ var position = element.getStyle('position');
3234
+
3235
+ var isHorizontal = property.include('left') || property.include('right') ||
3236
+ property.include('width');
3237
+
3238
+ var isVertical = property.include('top') || property.include('bottom') ||
3239
+ property.include('height');
3240
+
3241
+ if (context === document.viewport) {
3242
+ if (isHorizontal) {
3243
+ whole = document.viewport.getWidth();
3244
+ } else if (isVertical) {
3245
+ whole = document.viewport.getHeight();
3246
+ }
3247
+ } else {
3248
+ if (isHorizontal) {
3249
+ whole = $(context).measure('width');
3250
+ } else if (isVertical) {
3251
+ whole = $(context).measure('height');
3252
+ }
3253
+ }
3254
+
3255
+ return (whole === null) ? 0 : whole * decimal;
3256
+ }
3257
+
3258
+ return 0;
3259
+ }
3260
+
3261
+ function toCSSPixels(number) {
3262
+ if (Object.isString(number) && number.endsWith('px')) {
3263
+ return number;
3264
+ }
3265
+ return number + 'px';
3266
+ }
3267
+
3268
+ function isDisplayed(element) {
3269
+ var originalElement = element;
3270
+ while (element && element.parentNode) {
3271
+ var display = element.getStyle('display');
3272
+ if (display === 'none') {
3273
+ return false;
3274
+ }
3275
+ element = $(element.parentNode);
3276
+ }
3277
+ return true;
3278
+ }
3279
+
3280
+ var hasLayout = Prototype.K;
3281
+ if ('currentStyle' in document.documentElement) {
3282
+ hasLayout = function(element) {
3283
+ if (!element.currentStyle.hasLayout) {
3284
+ element.style.zoom = 1;
3285
+ }
3286
+ return element;
3287
+ };
3288
+ }
3289
+
3290
+ function cssNameFor(key) {
3291
+ if (key.include('border')) key = key + '-width';
3292
+ return key.camelize();
3293
+ }
3294
+
3295
+ Element.Layout = Class.create(Hash, {
3296
+ initialize: function($super, element, preCompute) {
3297
+ $super();
3298
+ this.element = $(element);
3299
+
3300
+ Element.Layout.PROPERTIES.each( function(property) {
3301
+ this._set(property, null);
3302
+ }, this);
3303
+
3304
+ if (preCompute) {
3305
+ this._preComputing = true;
3306
+ this._begin();
3307
+ Element.Layout.PROPERTIES.each( this._compute, this );
3308
+ this._end();
3309
+ this._preComputing = false;
3310
+ }
3311
+ },
3312
+
3313
+ _set: function(property, value) {
3314
+ return Hash.prototype.set.call(this, property, value);
3315
+ },
3316
+
3317
+ set: function(property, value) {
3318
+ throw "Properties of Element.Layout are read-only.";
3319
+ },
3320
+
3321
+ get: function($super, property) {
3322
+ var value = $super(property);
3323
+ return value === null ? this._compute(property) : value;
3324
+ },
3325
+
3326
+ _begin: function() {
3327
+ if (this._prepared) return;
3328
+
3329
+ var element = this.element;
3330
+ if (isDisplayed(element)) {
3331
+ this._prepared = true;
3332
+ return;
3333
+ }
3334
+
3335
+ var originalStyles = {
3336
+ position: element.style.position || '',
3337
+ width: element.style.width || '',
3338
+ visibility: element.style.visibility || '',
3339
+ display: element.style.display || ''
3340
+ };
3341
+
3342
+ element.store('prototype_original_styles', originalStyles);
3343
+
3344
+ var position = element.getStyle('position'),
3345
+ width = element.getStyle('width');
3346
+
3347
+ if (width === "0px" || width === null) {
3348
+ element.style.display = 'block';
3349
+ width = element.getStyle('width');
3350
+ }
3351
+
3352
+ var context = (position === 'fixed') ? document.viewport :
3353
+ element.parentNode;
3354
+
3355
+ element.setStyle({
3356
+ position: 'absolute',
3357
+ visibility: 'hidden',
3358
+ display: 'block'
3359
+ });
3360
+
3361
+ var positionedWidth = element.getStyle('width');
3362
+
3363
+ var newWidth;
3364
+ if (width && (positionedWidth === width)) {
3365
+ newWidth = getPixelValue(element, 'width', context);
3366
+ } else if (position === 'absolute' || position === 'fixed') {
3367
+ newWidth = getPixelValue(element, 'width', context);
3368
+ } else {
3369
+ var parent = element.parentNode, pLayout = $(parent).getLayout();
3370
+
3371
+ newWidth = pLayout.get('width') -
3372
+ this.get('margin-left') -
3373
+ this.get('border-left') -
3374
+ this.get('padding-left') -
3375
+ this.get('padding-right') -
3376
+ this.get('border-right') -
3377
+ this.get('margin-right');
3378
+ }
3379
+
3380
+ element.setStyle({ width: newWidth + 'px' });
3381
+
3382
+ this._prepared = true;
3383
+ },
3384
+
3385
+ _end: function() {
3386
+ var element = this.element;
3387
+ var originalStyles = element.retrieve('prototype_original_styles');
3388
+ element.store('prototype_original_styles', null);
3389
+ element.setStyle(originalStyles);
3390
+ this._prepared = false;
3391
+ },
3392
+
3393
+ _compute: function(property) {
3394
+ var COMPUTATIONS = Element.Layout.COMPUTATIONS;
3395
+ if (!(property in COMPUTATIONS)) {
3396
+ throw "Property not found.";
3397
+ }
3398
+
3399
+ return this._set(property, COMPUTATIONS[property].call(this, this.element));
3400
+ },
3401
+
3402
+ toObject: function() {
3403
+ var args = $A(arguments);
3404
+ var keys = (args.length === 0) ? Element.Layout.PROPERTIES :
3405
+ args.join(' ').split(' ');
3406
+ var obj = {};
3407
+ keys.each( function(key) {
3408
+ if (!Element.Layout.PROPERTIES.include(key)) return;
3409
+ var value = this.get(key);
3410
+ if (value != null) obj[key] = value;
3411
+ }, this);
3412
+ return obj;
3413
+ },
3414
+
3415
+ toHash: function() {
3416
+ var obj = this.toObject.apply(this, arguments);
3417
+ return new Hash(obj);
3418
+ },
3419
+
3420
+ toCSS: function() {
3421
+ var args = $A(arguments);
3422
+ var keys = (args.length === 0) ? Element.Layout.PROPERTIES :
3423
+ args.join(' ').split(' ');
3424
+ var css = {};
3425
+
3426
+ keys.each( function(key) {
3427
+ if (!Element.Layout.PROPERTIES.include(key)) return;
3428
+ if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return;
3429
+
3430
+ var value = this.get(key);
3431
+ if (value != null) css[cssNameFor(key)] = value + 'px';
3432
+ }, this);
3433
+ return css;
3434
+ },
3435
+
3436
+ inspect: function() {
3437
+ return "#<Element.Layout>";
3438
+ }
3439
+ });
3440
+
3441
+ Object.extend(Element.Layout, {
3442
+ PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'),
3443
+
3444
+ COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'),
3445
+
3446
+ COMPUTATIONS: {
3447
+ 'height': function(element) {
3448
+ if (!this._preComputing) this._begin();
3449
+
3450
+ var bHeight = this.get('border-box-height');
3451
+ if (bHeight <= 0) {
3452
+ if (!this._preComputing) this._end();
3453
+ return 0;
3454
+ }
3455
+
3456
+ var bTop = this.get('border-top'),
3457
+ bBottom = this.get('border-bottom');
3458
+
3459
+ var pTop = this.get('padding-top'),
3460
+ pBottom = this.get('padding-bottom');
3461
+
3462
+ if (!this._preComputing) this._end();
3463
+
3464
+ return bHeight - bTop - bBottom - pTop - pBottom;
3465
+ },
3466
+
3467
+ 'width': function(element) {
3468
+ if (!this._preComputing) this._begin();
3469
+
3470
+ var bWidth = this.get('border-box-width');
3471
+ if (bWidth <= 0) {
3472
+ if (!this._preComputing) this._end();
3473
+ return 0;
3474
+ }
3475
+
3476
+ var bLeft = this.get('border-left'),
3477
+ bRight = this.get('border-right');
3478
+
3479
+ var pLeft = this.get('padding-left'),
3480
+ pRight = this.get('padding-right');
3481
+
3482
+ if (!this._preComputing) this._end();
3483
+
3484
+ return bWidth - bLeft - bRight - pLeft - pRight;
3485
+ },
3486
+
3487
+ 'padding-box-height': function(element) {
3488
+ var height = this.get('height'),
3489
+ pTop = this.get('padding-top'),
3490
+ pBottom = this.get('padding-bottom');
3491
+
3492
+ return height + pTop + pBottom;
3493
+ },
3494
+
3495
+ 'padding-box-width': function(element) {
3496
+ var width = this.get('width'),
3497
+ pLeft = this.get('padding-left'),
3498
+ pRight = this.get('padding-right');
3499
+
3500
+ return width + pLeft + pRight;
3501
+ },
3502
+
3503
+ 'border-box-height': function(element) {
3504
+ if (!this._preComputing) this._begin();
3505
+ var height = element.offsetHeight;
3506
+ if (!this._preComputing) this._end();
3507
+ return height;
3508
+ },
3509
+
3510
+ 'border-box-width': function(element) {
3511
+ if (!this._preComputing) this._begin();
3512
+ var width = element.offsetWidth;
3513
+ if (!this._preComputing) this._end();
3514
+ return width;
3515
+ },
3516
+
3517
+ 'margin-box-height': function(element) {
3518
+ var bHeight = this.get('border-box-height'),
3519
+ mTop = this.get('margin-top'),
3520
+ mBottom = this.get('margin-bottom');
3521
+
3522
+ if (bHeight <= 0) return 0;
3523
+
3524
+ return bHeight + mTop + mBottom;
3525
+ },
3526
+
3527
+ 'margin-box-width': function(element) {
3528
+ var bWidth = this.get('border-box-width'),
3529
+ mLeft = this.get('margin-left'),
3530
+ mRight = this.get('margin-right');
3531
+
3532
+ if (bWidth <= 0) return 0;
3533
+
3534
+ return bWidth + mLeft + mRight;
3535
+ },
3536
+
3537
+ 'top': function(element) {
3538
+ var offset = element.positionedOffset();
3539
+ return offset.top;
3540
+ },
3541
+
3542
+ 'bottom': function(element) {
3543
+ var offset = element.positionedOffset(),
3544
+ parent = element.getOffsetParent(),
3545
+ pHeight = parent.measure('height');
3546
+
3547
+ var mHeight = this.get('border-box-height');
3548
+
3549
+ return pHeight - mHeight - offset.top;
3550
+ },
3551
+
3552
+ 'left': function(element) {
3553
+ var offset = element.positionedOffset();
3554
+ return offset.left;
3555
+ },
3556
+
3557
+ 'right': function(element) {
3558
+ var offset = element.positionedOffset(),
3559
+ parent = element.getOffsetParent(),
3560
+ pWidth = parent.measure('width');
3561
+
3562
+ var mWidth = this.get('border-box-width');
3563
+
3564
+ return pWidth - mWidth - offset.left;
3565
+ },
3566
+
3567
+ 'padding-top': function(element) {
3568
+ return getPixelValue(element, 'paddingTop');
3569
+ },
3570
+
3571
+ 'padding-bottom': function(element) {
3572
+ return getPixelValue(element, 'paddingBottom');
3573
+ },
3574
+
3575
+ 'padding-left': function(element) {
3576
+ return getPixelValue(element, 'paddingLeft');
3577
+ },
3578
+
3579
+ 'padding-right': function(element) {
3580
+ return getPixelValue(element, 'paddingRight');
3581
+ },
3582
+
3583
+ 'border-top': function(element) {
3584
+ return getPixelValue(element, 'borderTopWidth');
3585
+ },
3586
+
3587
+ 'border-bottom': function(element) {
3588
+ return getPixelValue(element, 'borderBottomWidth');
3589
+ },
3590
+
3591
+ 'border-left': function(element) {
3592
+ return getPixelValue(element, 'borderLeftWidth');
3593
+ },
3594
+
3595
+ 'border-right': function(element) {
3596
+ return getPixelValue(element, 'borderRightWidth');
3597
+ },
3598
+
3599
+ 'margin-top': function(element) {
3600
+ return getPixelValue(element, 'marginTop');
3601
+ },
3602
+
3603
+ 'margin-bottom': function(element) {
3604
+ return getPixelValue(element, 'marginBottom');
3605
+ },
3606
+
3607
+ 'margin-left': function(element) {
3608
+ return getPixelValue(element, 'marginLeft');
3609
+ },
3610
+
3611
+ 'margin-right': function(element) {
3612
+ return getPixelValue(element, 'marginRight');
3613
+ }
3614
+ }
3615
+ });
3616
+
3617
+ if ('getBoundingClientRect' in document.documentElement) {
3618
+ Object.extend(Element.Layout.COMPUTATIONS, {
3619
+ 'right': function(element) {
3620
+ var parent = hasLayout(element.getOffsetParent());
3621
+ var rect = element.getBoundingClientRect(),
3622
+ pRect = parent.getBoundingClientRect();
3623
+
3624
+ return (pRect.right - rect.right).round();
3625
+ },
3626
+
3627
+ 'bottom': function(element) {
3628
+ var parent = hasLayout(element.getOffsetParent());
3629
+ var rect = element.getBoundingClientRect(),
3630
+ pRect = parent.getBoundingClientRect();
3631
+
3632
+ return (pRect.bottom - rect.bottom).round();
3633
+ }
3634
+ });
3635
+ }
3636
+
3637
+ Element.Offset = Class.create({
3638
+ initialize: function(left, top) {
3639
+ this.left = left.round();
3640
+ this.top = top.round();
3641
+
3642
+ this[0] = this.left;
3643
+ this[1] = this.top;
3644
+ },
3645
+
3646
+ relativeTo: function(offset) {
3647
+ return new Element.Offset(
3648
+ this.left - offset.left,
3649
+ this.top - offset.top
3650
+ );
3651
+ },
3652
+
3653
+ inspect: function() {
3654
+ return "#<Element.Offset left: #{left} top: #{top}>".interpolate(this);
3655
+ },
3656
+
3657
+ toString: function() {
3658
+ return "[#{left}, #{top}]".interpolate(this);
3659
+ },
3660
+
3661
+ toArray: function() {
3662
+ return [this.left, this.top];
3663
+ }
3664
+ });
3665
+
3666
+ function getLayout(element, preCompute) {
3667
+ return new Element.Layout(element, preCompute);
3668
+ }
3669
+
3670
+ function measure(element, property) {
3671
+ return $(element).getLayout().get(property);
3672
+ }
3673
+
3674
+ function getDimensions(element) {
3675
+ element = $(element);
3676
+ var display = Element.getStyle(element, 'display');
3677
+
3678
+ if (display && display !== 'none') {
3679
+ return { width: element.offsetWidth, height: element.offsetHeight };
3680
+ }
3681
+
3682
+ var style = element.style;
3683
+ var originalStyles = {
3684
+ visibility: style.visibility,
3685
+ position: style.position,
3686
+ display: style.display
3687
+ };
3688
+
3689
+ var newStyles = {
3690
+ visibility: 'hidden',
3691
+ display: 'block'
3692
+ };
3693
+
3694
+ if (originalStyles.position !== 'fixed')
3695
+ newStyles.position = 'absolute';
3696
+
3697
+ Element.setStyle(element, newStyles);
3698
+
3699
+ var dimensions = {
3700
+ width: element.offsetWidth,
3701
+ height: element.offsetHeight
3702
+ };
3703
+
3704
+ Element.setStyle(element, originalStyles);
3705
+
3706
+ return dimensions;
3707
+ }
3708
+
3709
+ function getOffsetParent(element) {
3710
+ element = $(element);
3711
+
3712
+ if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
3713
+ return $(document.body);
3714
+
3715
+ var isInline = (Element.getStyle(element, 'display') === 'inline');
3716
+ if (!isInline && element.offsetParent) return $(element.offsetParent);
3717
+
3718
+ while ((element = element.parentNode) && element !== document.body) {
3719
+ if (Element.getStyle(element, 'position') !== 'static') {
3720
+ return isHtml(element) ? $(document.body) : $(element);
3721
+ }
3722
+ }
3723
+
3724
+ return $(document.body);
3725
+ }
3726
+
3727
+
3728
+ function cumulativeOffset(element) {
3729
+ element = $(element);
3730
+ var valueT = 0, valueL = 0;
3731
+ if (element.parentNode) {
3732
+ do {
3733
+ valueT += element.offsetTop || 0;
3734
+ valueL += element.offsetLeft || 0;
3735
+ element = element.offsetParent;
3736
+ } while (element);
3737
+ }
3738
+ return new Element.Offset(valueL, valueT);
3739
+ }
3740
+
3741
+ function positionedOffset(element) {
3742
+ element = $(element);
3743
+
3744
+ var layout = element.getLayout();
3745
+
3746
+ var valueT = 0, valueL = 0;
3747
+ do {
3748
+ valueT += element.offsetTop || 0;
3749
+ valueL += element.offsetLeft || 0;
3750
+ element = element.offsetParent;
3751
+ if (element) {
3752
+ if (isBody(element)) break;
3753
+ var p = Element.getStyle(element, 'position');
3754
+ if (p !== 'static') break;
3755
+ }
3756
+ } while (element);
3757
+
3758
+ valueL -= layout.get('margin-top');
3759
+ valueT -= layout.get('margin-left');
3760
+
3761
+ return new Element.Offset(valueL, valueT);
3762
+ }
3763
+
3764
+ function cumulativeScrollOffset(element) {
3765
+ var valueT = 0, valueL = 0;
3766
+ do {
3767
+ valueT += element.scrollTop || 0;
3768
+ valueL += element.scrollLeft || 0;
3769
+ element = element.parentNode;
3770
+ } while (element);
3771
+ return new Element.Offset(valueL, valueT);
3772
+ }
3773
+
3774
+ function viewportOffset(forElement) {
3775
+ element = $(element);
3776
+ var valueT = 0, valueL = 0, docBody = document.body;
3777
+
3778
+ var element = forElement;
3779
+ do {
3780
+ valueT += element.offsetTop || 0;
3781
+ valueL += element.offsetLeft || 0;
3782
+ if (element.offsetParent == docBody &&
3783
+ Element.getStyle(element, 'position') == 'absolute') break;
3784
+ } while (element = element.offsetParent);
3785
+
3786
+ element = forElement;
3787
+ do {
3788
+ if (element != docBody) {
3789
+ valueT -= element.scrollTop || 0;
3790
+ valueL -= element.scrollLeft || 0;
3791
+ }
3792
+ } while (element = element.parentNode);
3793
+ return new Element.Offset(valueL, valueT);
3794
+ }
3795
+
3796
+ function absolutize(element) {
3797
+ element = $(element);
3798
+
3799
+ if (Element.getStyle(element, 'position') === 'absolute') {
3800
+ return element;
3801
+ }
3802
+
3803
+ var offsetParent = getOffsetParent(element);
3804
+ var eOffset = element.viewportOffset(),
3805
+ pOffset = offsetParent.viewportOffset();
3806
+
3807
+ var offset = eOffset.relativeTo(pOffset);
3808
+ var layout = element.getLayout();
3809
+
3810
+ element.store('prototype_absolutize_original_styles', {
3811
+ left: element.getStyle('left'),
3812
+ top: element.getStyle('top'),
3813
+ width: element.getStyle('width'),
3814
+ height: element.getStyle('height')
3815
+ });
3816
+
3817
+ element.setStyle({
3818
+ position: 'absolute',
3819
+ top: offset.top + 'px',
3820
+ left: offset.left + 'px',
3821
+ width: layout.get('width') + 'px',
3822
+ height: layout.get('height') + 'px'
3823
+ });
3824
+
3825
+ return element;
3826
+ }
3827
+
3828
+ function relativize(element) {
3829
+ element = $(element);
3830
+ if (Element.getStyle(element, 'position') === 'relative') {
3831
+ return element;
3832
+ }
3833
+
3834
+ var originalStyles =
3835
+ element.retrieve('prototype_absolutize_original_styles');
3836
+
3837
+ if (originalStyles) element.setStyle(originalStyles);
3838
+ return element;
3839
+ }
3840
+
3841
+ if (Prototype.Browser.IE) {
3842
+ getOffsetParent = getOffsetParent.wrap(
3843
+ function(proceed, element) {
3844
+ element = $(element);
3845
+
3846
+ if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
3847
+ return $(document.body);
3848
+
3849
+ var position = element.getStyle('position');
3850
+ if (position !== 'static') return proceed(element);
3851
+
3852
+ element.setStyle({ position: 'relative' });
3853
+ var value = proceed(element);
3854
+ element.setStyle({ position: position });
3855
+ return value;
3856
+ }
3857
+ );
3858
+
3859
+ positionedOffset = positionedOffset.wrap(function(proceed, element) {
3860
+ element = $(element);
3861
+ if (!element.parentNode) return new Element.Offset(0, 0);
3862
+ var position = element.getStyle('position');
3863
+ if (position !== 'static') return proceed(element);
3864
+
3865
+ var offsetParent = element.getOffsetParent();
3866
+ if (offsetParent && offsetParent.getStyle('position') === 'fixed')
3867
+ hasLayout(offsetParent);
3868
+
3869
+ element.setStyle({ position: 'relative' });
3870
+ var value = proceed(element);
3871
+ element.setStyle({ position: position });
3872
+ return value;
3873
+ });
3874
+ } else if (Prototype.Browser.Webkit) {
3875
+ cumulativeOffset = function(element) {
3876
+ element = $(element);
3877
+ var valueT = 0, valueL = 0;
3878
+ do {
3879
+ valueT += element.offsetTop || 0;
3880
+ valueL += element.offsetLeft || 0;
3881
+ if (element.offsetParent == document.body)
3882
+ if (Element.getStyle(element, 'position') == 'absolute') break;
3883
+
3884
+ element = element.offsetParent;
3885
+ } while (element);
3886
+
3887
+ return new Element.Offset(valueL, valueT);
3888
+ };
3889
+ }
3890
+
3891
+
3892
+ Element.addMethods({
3893
+ getLayout: getLayout,
3894
+ measure: measure,
3895
+ getDimensions: getDimensions,
3896
+ getOffsetParent: getOffsetParent,
3897
+ cumulativeOffset: cumulativeOffset,
3898
+ positionedOffset: positionedOffset,
3899
+ cumulativeScrollOffset: cumulativeScrollOffset,
3900
+ viewportOffset: viewportOffset,
3901
+ absolutize: absolutize,
3902
+ relativize: relativize
3903
+ });
3904
+
3905
+ function isBody(element) {
3906
+ return element.nodeName.toUpperCase() === 'BODY';
3907
+ }
3908
+
3909
+ function isHtml(element) {
3910
+ return element.nodeName.toUpperCase() === 'HTML';
3911
+ }
3912
+
3913
+ function isDocument(element) {
3914
+ return element.nodeType === Node.DOCUMENT_NODE;
3915
+ }
3916
+
3917
+ function isDetached(element) {
3918
+ return element !== document.body &&
3919
+ !Element.descendantOf(element, document.body);
3920
+ }
3921
+
3922
+ if ('getBoundingClientRect' in document.documentElement) {
3923
+ Element.addMethods({
3924
+ viewportOffset: function(element) {
3925
+ element = $(element);
3926
+ if (isDetached(element)) return new Element.Offset(0, 0);
3927
+
3928
+ var rect = element.getBoundingClientRect(),
3929
+ docEl = document.documentElement;
3930
+ return new Element.Offset(rect.left - docEl.clientLeft,
3931
+ rect.top - docEl.clientTop);
3932
+ }
3933
+ });
3934
+ }
3935
+ })();
3936
+ window.$$ = function() {
3937
+ var expression = $A(arguments).join(', ');
3938
+ return Prototype.Selector.select(expression, document);
3939
+ };
3940
+
3941
+ Prototype.Selector = (function() {
3942
+
3943
+ function select() {
3944
+ throw new Error('Method "Prototype.Selector.select" must be defined.');
3945
+ }
3946
+
3947
+ function match() {
3948
+ throw new Error('Method "Prototype.Selector.match" must be defined.');
3949
+ }
3950
+
3951
+ function find(elements, expression, index) {
3952
+ index = index || 0;
3953
+ var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i;
3954
+
3955
+ for (i = 0; i < length; i++) {
3956
+ if (match(elements[i], expression) && index == matchIndex++) {
3957
+ return Element.extend(elements[i]);
3958
+ }
3959
+ }
3960
+ }
3961
+
3962
+ function extendElements(elements) {
3963
+ for (var i = 0, length = elements.length; i < length; i++) {
3964
+ Element.extend(elements[i]);
3965
+ }
3966
+ return elements;
3967
+ }
3968
+
3969
+
3970
+ var K = Prototype.K;
3971
+
3972
+ return {
3973
+ select: select,
3974
+ match: match,
3975
+ find: find,
3976
+ extendElements: (Element.extend === K) ? K : extendElements,
3977
+ extendElement: Element.extend
3978
+ };
3979
+ })();
3980
+ Prototype._original_property = window.Sizzle;
3981
+ /*!
3982
+ * Sizzle CSS Selector Engine - v1.0
3983
+ * Copyright 2009, The Dojo Foundation
3984
+ * Released under the MIT, BSD, and GPL Licenses.
3985
+ * More information: http://sizzlejs.com/
3986
+ */
3987
+ (function(){
3988
+
3989
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
3990
+ done = 0,
3991
+ toString = Object.prototype.toString,
3992
+ hasDuplicate = false,
3993
+ baseHasDuplicate = true;
3994
+
3995
+ [0, 0].sort(function(){
3996
+ baseHasDuplicate = false;
3997
+ return 0;
3998
+ });
3999
+
4000
+ var Sizzle = function(selector, context, results, seed) {
4001
+ results = results || [];
4002
+ var origContext = context = context || document;
4003
+
4004
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
4005
+ return [];
4006
+ }
4007
+
4008
+ if ( !selector || typeof selector !== "string" ) {
4009
+ return results;
4010
+ }
4011
+
4012
+ var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context),
4013
+ soFar = selector;
4014
+
4015
+ while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
4016
+ soFar = m[3];
4017
+
4018
+ parts.push( m[1] );
4019
+
4020
+ if ( m[2] ) {
4021
+ extra = m[3];
4022
+ break;
4023
+ }
4024
+ }
4025
+
4026
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
4027
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
4028
+ set = posProcess( parts[0] + parts[1], context );
4029
+ } else {
4030
+ set = Expr.relative[ parts[0] ] ?
4031
+ [ context ] :
4032
+ Sizzle( parts.shift(), context );
4033
+
4034
+ while ( parts.length ) {
4035
+ selector = parts.shift();
4036
+
4037
+ if ( Expr.relative[ selector ] )
4038
+ selector += parts.shift();
4039
+
4040
+ set = posProcess( selector, set );
4041
+ }
4042
+ }
4043
+ } else {
4044
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
4045
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
4046
+ var ret = Sizzle.find( parts.shift(), context, contextXML );
4047
+ context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
4048
+ }
4049
+
4050
+ if ( context ) {
4051
+ var ret = seed ?
4052
+ { expr: parts.pop(), set: makeArray(seed) } :
4053
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
4054
+ set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
4055
+
4056
+ if ( parts.length > 0 ) {
4057
+ checkSet = makeArray(set);
4058
+ } else {
4059
+ prune = false;
4060
+ }
4061
+
4062
+ while ( parts.length ) {
4063
+ var cur = parts.pop(), pop = cur;
4064
+
4065
+ if ( !Expr.relative[ cur ] ) {
4066
+ cur = "";
4067
+ } else {
4068
+ pop = parts.pop();
4069
+ }
4070
+
4071
+ if ( pop == null ) {
4072
+ pop = context;
4073
+ }
4074
+
4075
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
4076
+ }
4077
+ } else {
4078
+ checkSet = parts = [];
4079
+ }
4080
+ }
4081
+
4082
+ if ( !checkSet ) {
4083
+ checkSet = set;
4084
+ }
4085
+
4086
+ if ( !checkSet ) {
4087
+ throw "Syntax error, unrecognized expression: " + (cur || selector);
4088
+ }
4089
+
4090
+ if ( toString.call(checkSet) === "[object Array]" ) {
4091
+ if ( !prune ) {
4092
+ results.push.apply( results, checkSet );
4093
+ } else if ( context && context.nodeType === 1 ) {
4094
+ for ( var i = 0; checkSet[i] != null; i++ ) {
4095
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
4096
+ results.push( set[i] );
4097
+ }
4098
+ }
4099
+ } else {
4100
+ for ( var i = 0; checkSet[i] != null; i++ ) {
4101
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
4102
+ results.push( set[i] );
4103
+ }
4104
+ }
4105
+ }
4106
+ } else {
4107
+ makeArray( checkSet, results );
4108
+ }
4109
+
4110
+ if ( extra ) {
4111
+ Sizzle( extra, origContext, results, seed );
4112
+ Sizzle.uniqueSort( results );
4113
+ }
4114
+
4115
+ return results;
4116
+ };
4117
+
4118
+ Sizzle.uniqueSort = function(results){
4119
+ if ( sortOrder ) {
4120
+ hasDuplicate = baseHasDuplicate;
4121
+ results.sort(sortOrder);
4122
+
4123
+ if ( hasDuplicate ) {
4124
+ for ( var i = 1; i < results.length; i++ ) {
4125
+ if ( results[i] === results[i-1] ) {
4126
+ results.splice(i--, 1);
4127
+ }
4128
+ }
4129
+ }
4130
+ }
4131
+
4132
+ return results;
4133
+ };
4134
+
4135
+ Sizzle.matches = function(expr, set){
4136
+ return Sizzle(expr, null, null, set);
4137
+ };
4138
+
4139
+ Sizzle.find = function(expr, context, isXML){
4140
+ var set, match;
4141
+
4142
+ if ( !expr ) {
4143
+ return [];
4144
+ }
4145
+
4146
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
4147
+ var type = Expr.order[i], match;
4148
+
4149
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
4150
+ var left = match[1];
4151
+ match.splice(1,1);
4152
+
4153
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
4154
+ match[1] = (match[1] || "").replace(/\\/g, "");
4155
+ set = Expr.find[ type ]( match, context, isXML );
4156
+ if ( set != null ) {
4157
+ expr = expr.replace( Expr.match[ type ], "" );
4158
+ break;
4159
+ }
4160
+ }
4161
+ }
4162
+ }
4163
+
4164
+ if ( !set ) {
4165
+ set = context.getElementsByTagName("*");
4166
+ }
4167
+
4168
+ return {set: set, expr: expr};
4169
+ };
4170
+
4171
+ Sizzle.filter = function(expr, set, inplace, not){
4172
+ var old = expr, result = [], curLoop = set, match, anyFound,
4173
+ isXMLFilter = set && set[0] && isXML(set[0]);
4174
+
4175
+ while ( expr && set.length ) {
4176
+ for ( var type in Expr.filter ) {
4177
+ if ( (match = Expr.match[ type ].exec( expr )) != null ) {
4178
+ var filter = Expr.filter[ type ], found, item;
4179
+ anyFound = false;
4180
+
4181
+ if ( curLoop == result ) {
4182
+ result = [];
4183
+ }
4184
+
4185
+ if ( Expr.preFilter[ type ] ) {
4186
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
4187
+
4188
+ if ( !match ) {
4189
+ anyFound = found = true;
4190
+ } else if ( match === true ) {
4191
+ continue;
4192
+ }
4193
+ }
4194
+
4195
+ if ( match ) {
4196
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
4197
+ if ( item ) {
4198
+ found = filter( item, match, i, curLoop );
4199
+ var pass = not ^ !!found;
4200
+
4201
+ if ( inplace && found != null ) {
4202
+ if ( pass ) {
4203
+ anyFound = true;
4204
+ } else {
4205
+ curLoop[i] = false;
4206
+ }
4207
+ } else if ( pass ) {
4208
+ result.push( item );
4209
+ anyFound = true;
4210
+ }
4211
+ }
4212
+ }
4213
+ }
4214
+
4215
+ if ( found !== undefined ) {
4216
+ if ( !inplace ) {
4217
+ curLoop = result;
4218
+ }
4219
+
4220
+ expr = expr.replace( Expr.match[ type ], "" );
4221
+
4222
+ if ( !anyFound ) {
4223
+ return [];
4224
+ }
4225
+
4226
+ break;
4227
+ }
4228
+ }
4229
+ }
4230
+
4231
+ if ( expr == old ) {
4232
+ if ( anyFound == null ) {
4233
+ throw "Syntax error, unrecognized expression: " + expr;
4234
+ } else {
4235
+ break;
4236
+ }
4237
+ }
4238
+
4239
+ old = expr;
4240
+ }
4241
+
4242
+ return curLoop;
4243
+ };
4244
+
4245
+ var Expr = Sizzle.selectors = {
4246
+ order: [ "ID", "NAME", "TAG" ],
4247
+ match: {
4248
+ ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
4249
+ CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
4250
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
4251
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
4252
+ TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
4253
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
4254
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
4255
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
4256
+ },
4257
+ leftMatch: {},
4258
+ attrMap: {
4259
+ "class": "className",
4260
+ "for": "htmlFor"
4261
+ },
4262
+ attrHandle: {
4263
+ href: function(elem){
4264
+ return elem.getAttribute("href");
4265
+ }
4266
+ },
4267
+ relative: {
4268
+ "+": function(checkSet, part, isXML){
4269
+ var isPartStr = typeof part === "string",
4270
+ isTag = isPartStr && !/\W/.test(part),
4271
+ isPartStrNotTag = isPartStr && !isTag;
4272
+
4273
+ if ( isTag && !isXML ) {
4274
+ part = part.toUpperCase();
4275
+ }
4276
+
4277
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
4278
+ if ( (elem = checkSet[i]) ) {
4279
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
4280
+
4281
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
4282
+ elem || false :
4283
+ elem === part;
4284
+ }
4285
+ }
4286
+
4287
+ if ( isPartStrNotTag ) {
4288
+ Sizzle.filter( part, checkSet, true );
4289
+ }
4290
+ },
4291
+ ">": function(checkSet, part, isXML){
4292
+ var isPartStr = typeof part === "string";
4293
+
4294
+ if ( isPartStr && !/\W/.test(part) ) {
4295
+ part = isXML ? part : part.toUpperCase();
4296
+
4297
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4298
+ var elem = checkSet[i];
4299
+ if ( elem ) {
4300
+ var parent = elem.parentNode;
4301
+ checkSet[i] = parent.nodeName === part ? parent : false;
4302
+ }
4303
+ }
4304
+ } else {
4305
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4306
+ var elem = checkSet[i];
4307
+ if ( elem ) {
4308
+ checkSet[i] = isPartStr ?
4309
+ elem.parentNode :
4310
+ elem.parentNode === part;
4311
+ }
4312
+ }
4313
+
4314
+ if ( isPartStr ) {
4315
+ Sizzle.filter( part, checkSet, true );
4316
+ }
4317
+ }
4318
+ },
4319
+ "": function(checkSet, part, isXML){
4320
+ var doneName = done++, checkFn = dirCheck;
4321
+
4322
+ if ( !/\W/.test(part) ) {
4323
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
4324
+ checkFn = dirNodeCheck;
4325
+ }
4326
+
4327
+ checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
4328
+ },
4329
+ "~": function(checkSet, part, isXML){
4330
+ var doneName = done++, checkFn = dirCheck;
4331
+
4332
+ if ( typeof part === "string" && !/\W/.test(part) ) {
4333
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
4334
+ checkFn = dirNodeCheck;
4335
+ }
4336
+
4337
+ checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
4338
+ }
4339
+ },
4340
+ find: {
4341
+ ID: function(match, context, isXML){
4342
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
4343
+ var m = context.getElementById(match[1]);
4344
+ return m ? [m] : [];
4345
+ }
4346
+ },
4347
+ NAME: function(match, context, isXML){
4348
+ if ( typeof context.getElementsByName !== "undefined" ) {
4349
+ var ret = [], results = context.getElementsByName(match[1]);
4350
+
4351
+ for ( var i = 0, l = results.length; i < l; i++ ) {
4352
+ if ( results[i].getAttribute("name") === match[1] ) {
4353
+ ret.push( results[i] );
4354
+ }
4355
+ }
4356
+
4357
+ return ret.length === 0 ? null : ret;
4358
+ }
4359
+ },
4360
+ TAG: function(match, context){
4361
+ return context.getElementsByTagName(match[1]);
4362
+ }
4363
+ },
4364
+ preFilter: {
4365
+ CLASS: function(match, curLoop, inplace, result, not, isXML){
4366
+ match = " " + match[1].replace(/\\/g, "") + " ";
4367
+
4368
+ if ( isXML ) {
4369
+ return match;
4370
+ }
4371
+
4372
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
4373
+ if ( elem ) {
4374
+ if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
4375
+ if ( !inplace )
4376
+ result.push( elem );
4377
+ } else if ( inplace ) {
4378
+ curLoop[i] = false;
4379
+ }
4380
+ }
4381
+ }
4382
+
4383
+ return false;
4384
+ },
4385
+ ID: function(match){
4386
+ return match[1].replace(/\\/g, "");
4387
+ },
4388
+ TAG: function(match, curLoop){
4389
+ for ( var i = 0; curLoop[i] === false; i++ ){}
4390
+ return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
4391
+ },
4392
+ CHILD: function(match){
4393
+ if ( match[1] == "nth" ) {
4394
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
4395
+ match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
4396
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
4397
+
4398
+ match[2] = (test[1] + (test[2] || 1)) - 0;
4399
+ match[3] = test[3] - 0;
4400
+ }
4401
+
4402
+ match[0] = done++;
4403
+
4404
+ return match;
4405
+ },
4406
+ ATTR: function(match, curLoop, inplace, result, not, isXML){
4407
+ var name = match[1].replace(/\\/g, "");
4408
+
4409
+ if ( !isXML && Expr.attrMap[name] ) {
4410
+ match[1] = Expr.attrMap[name];
4411
+ }
4412
+
4413
+ if ( match[2] === "~=" ) {
4414
+ match[4] = " " + match[4] + " ";
4415
+ }
4416
+
4417
+ return match;
4418
+ },
4419
+ PSEUDO: function(match, curLoop, inplace, result, not){
4420
+ if ( match[1] === "not" ) {
4421
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
4422
+ match[3] = Sizzle(match[3], null, null, curLoop);
4423
+ } else {
4424
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
4425
+ if ( !inplace ) {
4426
+ result.push.apply( result, ret );
4427
+ }
4428
+ return false;
4429
+ }
4430
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
4431
+ return true;
4432
+ }
4433
+
4434
+ return match;
4435
+ },
4436
+ POS: function(match){
4437
+ match.unshift( true );
4438
+ return match;
4439
+ }
4440
+ },
4441
+ filters: {
4442
+ enabled: function(elem){
4443
+ return elem.disabled === false && elem.type !== "hidden";
4444
+ },
4445
+ disabled: function(elem){
4446
+ return elem.disabled === true;
4447
+ },
4448
+ checked: function(elem){
4449
+ return elem.checked === true;
4450
+ },
4451
+ selected: function(elem){
4452
+ elem.parentNode.selectedIndex;
4453
+ return elem.selected === true;
4454
+ },
4455
+ parent: function(elem){
4456
+ return !!elem.firstChild;
4457
+ },
4458
+ empty: function(elem){
4459
+ return !elem.firstChild;
4460
+ },
4461
+ has: function(elem, i, match){
4462
+ return !!Sizzle( match[3], elem ).length;
4463
+ },
4464
+ header: function(elem){
4465
+ return /h\d/i.test( elem.nodeName );
4466
+ },
4467
+ text: function(elem){
4468
+ return "text" === elem.type;
4469
+ },
4470
+ radio: function(elem){
4471
+ return "radio" === elem.type;
4472
+ },
4473
+ checkbox: function(elem){
4474
+ return "checkbox" === elem.type;
4475
+ },
4476
+ file: function(elem){
4477
+ return "file" === elem.type;
4478
+ },
4479
+ password: function(elem){
4480
+ return "password" === elem.type;
4481
+ },
4482
+ submit: function(elem){
4483
+ return "submit" === elem.type;
4484
+ },
4485
+ image: function(elem){
4486
+ return "image" === elem.type;
4487
+ },
4488
+ reset: function(elem){
4489
+ return "reset" === elem.type;
4490
+ },
4491
+ button: function(elem){
4492
+ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
4493
+ },
4494
+ input: function(elem){
4495
+ return /input|select|textarea|button/i.test(elem.nodeName);
4496
+ }
4497
+ },
4498
+ setFilters: {
4499
+ first: function(elem, i){
4500
+ return i === 0;
4501
+ },
4502
+ last: function(elem, i, match, array){
4503
+ return i === array.length - 1;
4504
+ },
4505
+ even: function(elem, i){
4506
+ return i % 2 === 0;
4507
+ },
4508
+ odd: function(elem, i){
4509
+ return i % 2 === 1;
4510
+ },
4511
+ lt: function(elem, i, match){
4512
+ return i < match[3] - 0;
4513
+ },
4514
+ gt: function(elem, i, match){
4515
+ return i > match[3] - 0;
4516
+ },
4517
+ nth: function(elem, i, match){
4518
+ return match[3] - 0 == i;
4519
+ },
4520
+ eq: function(elem, i, match){
4521
+ return match[3] - 0 == i;
4522
+ }
4523
+ },
4524
+ filter: {
4525
+ PSEUDO: function(elem, match, i, array){
4526
+ var name = match[1], filter = Expr.filters[ name ];
4527
+
4528
+ if ( filter ) {
4529
+ return filter( elem, i, match, array );
4530
+ } else if ( name === "contains" ) {
4531
+ return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
4532
+ } else if ( name === "not" ) {
4533
+ var not = match[3];
4534
+
4535
+ for ( var i = 0, l = not.length; i < l; i++ ) {
4536
+ if ( not[i] === elem ) {
4537
+ return false;
4538
+ }
4539
+ }
4540
+
4541
+ return true;
4542
+ }
4543
+ },
4544
+ CHILD: function(elem, match){
4545
+ var type = match[1], node = elem;
4546
+ switch (type) {
4547
+ case 'only':
4548
+ case 'first':
4549
+ while ( (node = node.previousSibling) ) {
4550
+ if ( node.nodeType === 1 ) return false;
4551
+ }
4552
+ if ( type == 'first') return true;
4553
+ node = elem;
4554
+ case 'last':
4555
+ while ( (node = node.nextSibling) ) {
4556
+ if ( node.nodeType === 1 ) return false;
4557
+ }
4558
+ return true;
4559
+ case 'nth':
4560
+ var first = match[2], last = match[3];
4561
+
4562
+ if ( first == 1 && last == 0 ) {
4563
+ return true;
4564
+ }
4565
+
4566
+ var doneName = match[0],
4567
+ parent = elem.parentNode;
4568
+
4569
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
4570
+ var count = 0;
4571
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
4572
+ if ( node.nodeType === 1 ) {
4573
+ node.nodeIndex = ++count;
4574
+ }
4575
+ }
4576
+ parent.sizcache = doneName;
4577
+ }
4578
+
4579
+ var diff = elem.nodeIndex - last;
4580
+ if ( first == 0 ) {
4581
+ return diff == 0;
4582
+ } else {
4583
+ return ( diff % first == 0 && diff / first >= 0 );
4584
+ }
4585
+ }
4586
+ },
4587
+ ID: function(elem, match){
4588
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
4589
+ },
4590
+ TAG: function(elem, match){
4591
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
4592
+ },
4593
+ CLASS: function(elem, match){
4594
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
4595
+ .indexOf( match ) > -1;
4596
+ },
4597
+ ATTR: function(elem, match){
4598
+ var name = match[1],
4599
+ result = Expr.attrHandle[ name ] ?
4600
+ Expr.attrHandle[ name ]( elem ) :
4601
+ elem[ name ] != null ?
4602
+ elem[ name ] :
4603
+ elem.getAttribute( name ),
4604
+ value = result + "",
4605
+ type = match[2],
4606
+ check = match[4];
4607
+
4608
+ return result == null ?
4609
+ type === "!=" :
4610
+ type === "=" ?
4611
+ value === check :
4612
+ type === "*=" ?
4613
+ value.indexOf(check) >= 0 :
4614
+ type === "~=" ?
4615
+ (" " + value + " ").indexOf(check) >= 0 :
4616
+ !check ?
4617
+ value && result !== false :
4618
+ type === "!=" ?
4619
+ value != check :
4620
+ type === "^=" ?
4621
+ value.indexOf(check) === 0 :
4622
+ type === "$=" ?
4623
+ value.substr(value.length - check.length) === check :
4624
+ type === "|=" ?
4625
+ value === check || value.substr(0, check.length + 1) === check + "-" :
4626
+ false;
4627
+ },
4628
+ POS: function(elem, match, i, array){
4629
+ var name = match[2], filter = Expr.setFilters[ name ];
4630
+
4631
+ if ( filter ) {
4632
+ return filter( elem, i, match, array );
4633
+ }
4634
+ }
4635
+ }
4636
+ };
4637
+
4638
+ var origPOS = Expr.match.POS;
4639
+
4640
+ for ( var type in Expr.match ) {
4641
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
4642
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source );
4643
+ }
4644
+
4645
+ var makeArray = function(array, results) {
4646
+ array = Array.prototype.slice.call( array, 0 );
4647
+
4648
+ if ( results ) {
4649
+ results.push.apply( results, array );
4650
+ return results;
4651
+ }
4652
+
4653
+ return array;
4654
+ };
4655
+
4656
+ try {
4657
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 );
4658
+
4659
+ } catch(e){
4660
+ makeArray = function(array, results) {
4661
+ var ret = results || [];
4662
+
4663
+ if ( toString.call(array) === "[object Array]" ) {
4664
+ Array.prototype.push.apply( ret, array );
4665
+ } else {
4666
+ if ( typeof array.length === "number" ) {
4667
+ for ( var i = 0, l = array.length; i < l; i++ ) {
4668
+ ret.push( array[i] );
4669
+ }
4670
+ } else {
4671
+ for ( var i = 0; array[i]; i++ ) {
4672
+ ret.push( array[i] );
4673
+ }
4674
+ }
4675
+ }
4676
+
4677
+ return ret;
4678
+ };
4679
+ }
4680
+
4681
+ var sortOrder;
4682
+
4683
+ if ( document.documentElement.compareDocumentPosition ) {
4684
+ sortOrder = function( a, b ) {
4685
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
4686
+ if ( a == b ) {
4687
+ hasDuplicate = true;
4688
+ }
4689
+ return 0;
4690
+ }
4691
+
4692
+ var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
4693
+ if ( ret === 0 ) {
4694
+ hasDuplicate = true;
4695
+ }
4696
+ return ret;
4697
+ };
4698
+ } else if ( "sourceIndex" in document.documentElement ) {
4699
+ sortOrder = function( a, b ) {
4700
+ if ( !a.sourceIndex || !b.sourceIndex ) {
4701
+ if ( a == b ) {
4702
+ hasDuplicate = true;
4703
+ }
4704
+ return 0;
4705
+ }
4706
+
4707
+ var ret = a.sourceIndex - b.sourceIndex;
4708
+ if ( ret === 0 ) {
4709
+ hasDuplicate = true;
4710
+ }
4711
+ return ret;
4712
+ };
4713
+ } else if ( document.createRange ) {
4714
+ sortOrder = function( a, b ) {
4715
+ if ( !a.ownerDocument || !b.ownerDocument ) {
4716
+ if ( a == b ) {
4717
+ hasDuplicate = true;
4718
+ }
4719
+ return 0;
4720
+ }
4721
+
4722
+ var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
4723
+ aRange.setStart(a, 0);
4724
+ aRange.setEnd(a, 0);
4725
+ bRange.setStart(b, 0);
4726
+ bRange.setEnd(b, 0);
4727
+ var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
4728
+ if ( ret === 0 ) {
4729
+ hasDuplicate = true;
4730
+ }
4731
+ return ret;
4732
+ };
4733
+ }
4734
+
4735
+ (function(){
4736
+ var form = document.createElement("div"),
4737
+ id = "script" + (new Date).getTime();
4738
+ form.innerHTML = "<a name='" + id + "'/>";
4739
+
4740
+ var root = document.documentElement;
4741
+ root.insertBefore( form, root.firstChild );
4742
+
4743
+ if ( !!document.getElementById( id ) ) {
4744
+ Expr.find.ID = function(match, context, isXML){
4745
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
4746
+ var m = context.getElementById(match[1]);
4747
+ return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
4748
+ }
4749
+ };
4750
+
4751
+ Expr.filter.ID = function(elem, match){
4752
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
4753
+ return elem.nodeType === 1 && node && node.nodeValue === match;
4754
+ };
4755
+ }
4756
+
4757
+ root.removeChild( form );
4758
+ root = form = null; // release memory in IE
4759
+ })();
4760
+
4761
+ (function(){
4762
+
4763
+ var div = document.createElement("div");
4764
+ div.appendChild( document.createComment("") );
4765
+
4766
+ if ( div.getElementsByTagName("*").length > 0 ) {
4767
+ Expr.find.TAG = function(match, context){
4768
+ var results = context.getElementsByTagName(match[1]);
4769
+
4770
+ if ( match[1] === "*" ) {
4771
+ var tmp = [];
4772
+
4773
+ for ( var i = 0; results[i]; i++ ) {
4774
+ if ( results[i].nodeType === 1 ) {
4775
+ tmp.push( results[i] );
4776
+ }
4777
+ }
4778
+
4779
+ results = tmp;
4780
+ }
4781
+
4782
+ return results;
4783
+ };
4784
+ }
4785
+
4786
+ div.innerHTML = "<a href='#'></a>";
4787
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
4788
+ div.firstChild.getAttribute("href") !== "#" ) {
4789
+ Expr.attrHandle.href = function(elem){
4790
+ return elem.getAttribute("href", 2);
4791
+ };
4792
+ }
4793
+
4794
+ div = null; // release memory in IE
4795
+ })();
4796
+
4797
+ if ( document.querySelectorAll ) (function(){
4798
+ var oldSizzle = Sizzle, div = document.createElement("div");
4799
+ div.innerHTML = "<p class='TEST'></p>";
4800
+
4801
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
4802
+ return;
4803
+ }
4804
+
4805
+ Sizzle = function(query, context, extra, seed){
4806
+ context = context || document;
4807
+
4808
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
4809
+ try {
4810
+ return makeArray( context.querySelectorAll(query), extra );
4811
+ } catch(e){}
4812
+ }
4813
+
4814
+ return oldSizzle(query, context, extra, seed);
4815
+ };
4816
+
4817
+ for ( var prop in oldSizzle ) {
4818
+ Sizzle[ prop ] = oldSizzle[ prop ];
4819
+ }
4820
+
4821
+ div = null; // release memory in IE
4822
+ })();
4823
+
4824
+ if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
4825
+ var div = document.createElement("div");
4826
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
4827
+
4828
+ if ( div.getElementsByClassName("e").length === 0 )
4829
+ return;
4830
+
4831
+ div.lastChild.className = "e";
4832
+
4833
+ if ( div.getElementsByClassName("e").length === 1 )
4834
+ return;
4835
+
4836
+ Expr.order.splice(1, 0, "CLASS");
4837
+ Expr.find.CLASS = function(match, context, isXML) {
4838
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
4839
+ return context.getElementsByClassName(match[1]);
4840
+ }
4841
+ };
4842
+
4843
+ div = null; // release memory in IE
4844
+ })();
4845
+
4846
+ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4847
+ var sibDir = dir == "previousSibling" && !isXML;
4848
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4849
+ var elem = checkSet[i];
4850
+ if ( elem ) {
4851
+ if ( sibDir && elem.nodeType === 1 ){
4852
+ elem.sizcache = doneName;
4853
+ elem.sizset = i;
4854
+ }
4855
+ elem = elem[dir];
4856
+ var match = false;
4857
+
4858
+ while ( elem ) {
4859
+ if ( elem.sizcache === doneName ) {
4860
+ match = checkSet[elem.sizset];
4861
+ break;
4862
+ }
4863
+
4864
+ if ( elem.nodeType === 1 && !isXML ){
4865
+ elem.sizcache = doneName;
4866
+ elem.sizset = i;
4867
+ }
4868
+
4869
+ if ( elem.nodeName === cur ) {
4870
+ match = elem;
4871
+ break;
4872
+ }
4873
+
4874
+ elem = elem[dir];
4875
+ }
4876
+
4877
+ checkSet[i] = match;
4878
+ }
4879
+ }
4880
+ }
4881
+
4882
+ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4883
+ var sibDir = dir == "previousSibling" && !isXML;
4884
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4885
+ var elem = checkSet[i];
4886
+ if ( elem ) {
4887
+ if ( sibDir && elem.nodeType === 1 ) {
4888
+ elem.sizcache = doneName;
4889
+ elem.sizset = i;
4890
+ }
4891
+ elem = elem[dir];
4892
+ var match = false;
4893
+
4894
+ while ( elem ) {
4895
+ if ( elem.sizcache === doneName ) {
4896
+ match = checkSet[elem.sizset];
4897
+ break;
4898
+ }
4899
+
4900
+ if ( elem.nodeType === 1 ) {
4901
+ if ( !isXML ) {
4902
+ elem.sizcache = doneName;
4903
+ elem.sizset = i;
4904
+ }
4905
+ if ( typeof cur !== "string" ) {
4906
+ if ( elem === cur ) {
4907
+ match = true;
4908
+ break;
4909
+ }
4910
+
4911
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
4912
+ match = elem;
4913
+ break;
4914
+ }
4915
+ }
4916
+
4917
+ elem = elem[dir];
4918
+ }
4919
+
4920
+ checkSet[i] = match;
4921
+ }
4922
+ }
4923
+ }
4924
+
4925
+ var contains = document.compareDocumentPosition ? function(a, b){
4926
+ return a.compareDocumentPosition(b) & 16;
4927
+ } : function(a, b){
4928
+ return a !== b && (a.contains ? a.contains(b) : true);
4929
+ };
4930
+
4931
+ var isXML = function(elem){
4932
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
4933
+ !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
4934
+ };
4935
+
4936
+ var posProcess = function(selector, context){
4937
+ var tmpSet = [], later = "", match,
4938
+ root = context.nodeType ? [context] : context;
4939
+
4940
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
4941
+ later += match[0];
4942
+ selector = selector.replace( Expr.match.PSEUDO, "" );
4943
+ }
4944
+
4945
+ selector = Expr.relative[selector] ? selector + "*" : selector;
4946
+
4947
+ for ( var i = 0, l = root.length; i < l; i++ ) {
4948
+ Sizzle( selector, root[i], tmpSet );
4949
+ }
4950
+
4951
+ return Sizzle.filter( later, tmpSet );
4952
+ };
4953
+
4954
+
4955
+ window.Sizzle = Sizzle;
4956
+
4957
+ })();
4958
+
4959
+ ;(function(engine) {
4960
+ var extendElements = Prototype.Selector.extendElements;
4961
+
4962
+ function select(selector, scope) {
4963
+ return extendElements(engine(selector, scope || document));
4964
+ }
4965
+
4966
+ function match(element, selector) {
4967
+ return engine.matches(selector, [element]).length == 1;
4968
+ }
4969
+
4970
+ Prototype.Selector.engine = engine;
4971
+ Prototype.Selector.select = select;
4972
+ Prototype.Selector.match = match;
4973
+ })(Sizzle);
4974
+
4975
+ window.Sizzle = Prototype._original_property;
4976
+ delete Prototype._original_property;
4977
+
4978
+ var Form = {
4979
+ reset: function(form) {
4980
+ form = $(form);
4981
+ form.reset();
4982
+ return form;
4983
+ },
4984
+
4985
+ serializeElements: function(elements, options) {
4986
+ if (typeof options != 'object') options = { hash: !!options };
4987
+ else if (Object.isUndefined(options.hash)) options.hash = true;
4988
+ var key, value, submitted = false, submit = options.submit, accumulator, initial;
4989
+
4990
+ if (options.hash) {
4991
+ initial = {};
4992
+ accumulator = function(result, key, value) {
4993
+ if (key in result) {
4994
+ if (!Object.isArray(result[key])) result[key] = [result[key]];
4995
+ result[key].push(value);
4996
+ } else result[key] = value;
4997
+ return result;
4998
+ };
4999
+ } else {
5000
+ initial = '';
5001
+ accumulator = function(result, key, value) {
5002
+ return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + encodeURIComponent(value);
5003
+ }
5004
+ }
5005
+
5006
+ return elements.inject(initial, function(result, element) {
5007
+ if (!element.disabled && element.name) {
5008
+ key = element.name; value = $(element).getValue();
5009
+ if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
5010
+ submit !== false && (!submit || key == submit) && (submitted = true)))) {
5011
+ result = accumulator(result, key, value);
5012
+ }
5013
+ }
5014
+ return result;
5015
+ });
5016
+ }
5017
+ };
5018
+
5019
+ Form.Methods = {
5020
+ serialize: function(form, options) {
5021
+ return Form.serializeElements(Form.getElements(form), options);
5022
+ },
5023
+
5024
+ getElements: function(form) {
5025
+ var elements = $(form).getElementsByTagName('*'),
5026
+ element,
5027
+ arr = [ ],
5028
+ serializers = Form.Element.Serializers;
5029
+ for (var i = 0; element = elements[i]; i++) {
5030
+ arr.push(element);
5031
+ }
5032
+ return arr.inject([], function(elements, child) {
5033
+ if (serializers[child.tagName.toLowerCase()])
5034
+ elements.push(Element.extend(child));
5035
+ return elements;
5036
+ })
5037
+ },
5038
+
5039
+ getInputs: function(form, typeName, name) {
5040
+ form = $(form);
5041
+ var inputs = form.getElementsByTagName('input');
5042
+
5043
+ if (!typeName && !name) return $A(inputs).map(Element.extend);
5044
+
5045
+ for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
5046
+ var input = inputs[i];
5047
+ if ((typeName && input.type != typeName) || (name && input.name != name))
5048
+ continue;
5049
+ matchingInputs.push(Element.extend(input));
5050
+ }
5051
+
5052
+ return matchingInputs;
5053
+ },
5054
+
5055
+ disable: function(form) {
5056
+ form = $(form);
5057
+ Form.getElements(form).invoke('disable');
5058
+ return form;
5059
+ },
5060
+
5061
+ enable: function(form) {
5062
+ form = $(form);
5063
+ Form.getElements(form).invoke('enable');
5064
+ return form;
5065
+ },
5066
+
5067
+ findFirstElement: function(form) {
5068
+ var elements = $(form).getElements().findAll(function(element) {
5069
+ return 'hidden' != element.type && !element.disabled;
5070
+ });
5071
+ var firstByIndex = elements.findAll(function(element) {
5072
+ return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
5073
+ }).sortBy(function(element) { return element.tabIndex }).first();
5074
+
5075
+ return firstByIndex ? firstByIndex : elements.find(function(element) {
5076
+ return /^(?:input|select|textarea)$/i.test(element.tagName);
5077
+ });
5078
+ },
5079
+
5080
+ focusFirstElement: function(form) {
5081
+ form = $(form);
5082
+ var element = form.findFirstElement();
5083
+ if (element) element.activate();
5084
+ return form;
5085
+ },
5086
+
5087
+ request: function(form, options) {
5088
+ form = $(form), options = Object.clone(options || { });
5089
+
5090
+ var params = options.parameters, action = form.readAttribute('action') || '';
5091
+ if (action.blank()) action = window.location.href;
5092
+ options.parameters = form.serialize(true);
5093
+
5094
+ if (params) {
5095
+ if (Object.isString(params)) params = params.toQueryParams();
5096
+ Object.extend(options.parameters, params);
5097
+ }
5098
+
5099
+ if (form.hasAttribute('method') && !options.method)
5100
+ options.method = form.method;
5101
+
5102
+ return new Ajax.Request(action, options);
5103
+ }
5104
+ };
5105
+
5106
+ /*--------------------------------------------------------------------------*/
5107
+
5108
+
5109
+ Form.Element = {
5110
+ focus: function(element) {
5111
+ $(element).focus();
5112
+ return element;
5113
+ },
5114
+
5115
+ select: function(element) {
5116
+ $(element).select();
5117
+ return element;
5118
+ }
5119
+ };
5120
+
5121
+ Form.Element.Methods = {
5122
+
5123
+ serialize: function(element) {
5124
+ element = $(element);
5125
+ if (!element.disabled && element.name) {
5126
+ var value = element.getValue();
5127
+ if (value != undefined) {
5128
+ var pair = { };
5129
+ pair[element.name] = value;
5130
+ return Object.toQueryString(pair);
5131
+ }
5132
+ }
5133
+ return '';
5134
+ },
5135
+
5136
+ getValue: function(element) {
5137
+ element = $(element);
5138
+ var method = element.tagName.toLowerCase();
5139
+ return Form.Element.Serializers[method](element);
5140
+ },
5141
+
5142
+ setValue: function(element, value) {
5143
+ element = $(element);
5144
+ var method = element.tagName.toLowerCase();
5145
+ Form.Element.Serializers[method](element, value);
5146
+ return element;
5147
+ },
5148
+
5149
+ clear: function(element) {
5150
+ $(element).value = '';
5151
+ return element;
5152
+ },
5153
+
5154
+ present: function(element) {
5155
+ return $(element).value != '';
5156
+ },
5157
+
5158
+ activate: function(element) {
5159
+ element = $(element);
5160
+ try {
5161
+ element.focus();
5162
+ if (element.select && (element.tagName.toLowerCase() != 'input' ||
5163
+ !(/^(?:button|reset|submit)$/i.test(element.type))))
5164
+ element.select();
5165
+ } catch (e) { }
5166
+ return element;
5167
+ },
5168
+
5169
+ disable: function(element) {
5170
+ element = $(element);
5171
+ element.disabled = true;
5172
+ return element;
5173
+ },
5174
+
5175
+ enable: function(element) {
5176
+ element = $(element);
5177
+ element.disabled = false;
5178
+ return element;
5179
+ }
5180
+ };
5181
+
5182
+ /*--------------------------------------------------------------------------*/
5183
+
5184
+ var Field = Form.Element;
5185
+
5186
+ var $F = Form.Element.Methods.getValue;
5187
+
5188
+ /*--------------------------------------------------------------------------*/
5189
+
5190
+ Form.Element.Serializers = (function() {
5191
+ function input(element, value) {
5192
+ switch (element.type.toLowerCase()) {
5193
+ case 'checkbox':
5194
+ case 'radio':
5195
+ return inputSelector(element, value);
5196
+ default:
5197
+ return valueSelector(element, value);
5198
+ }
5199
+ }
5200
+
5201
+ function inputSelector(element, value) {
5202
+ if (Object.isUndefined(value))
5203
+ return element.checked ? element.value : null;
5204
+ else element.checked = !!value;
5205
+ }
5206
+
5207
+ function valueSelector(element, value) {
5208
+ if (Object.isUndefined(value)) return element.value;
5209
+ else element.value = value;
5210
+ }
5211
+
5212
+ function select(element, value) {
5213
+ if (Object.isUndefined(value))
5214
+ return (element.type === 'select-one' ? selectOne : selectMany)(element);
5215
+
5216
+ var opt, currentValue, single = !Object.isArray(value);
5217
+ for (var i = 0, length = element.length; i < length; i++) {
5218
+ opt = element.options[i];
5219
+ currentValue = this.optionValue(opt);
5220
+ if (single) {
5221
+ if (currentValue == value) {
5222
+ opt.selected = true;
5223
+ return;
5224
+ }
5225
+ }
5226
+ else opt.selected = value.include(currentValue);
5227
+ }
5228
+ }
5229
+
5230
+ function selectOne(element) {
5231
+ var index = element.selectedIndex;
5232
+ return index >= 0 ? optionValue(element.options[index]) : null;
5233
+ }
5234
+
5235
+ function selectMany(element) {
5236
+ var values, length = element.length;
5237
+ if (!length) return null;
5238
+
5239
+ for (var i = 0, values = []; i < length; i++) {
5240
+ var opt = element.options[i];
5241
+ if (opt.selected) values.push(optionValue(opt));
5242
+ }
5243
+ return values;
5244
+ }
5245
+
5246
+ function optionValue(opt) {
5247
+ return Element.hasAttribute(opt, 'value') ? opt.value : opt.text;
5248
+ }
5249
+
5250
+ return {
5251
+ input: input,
5252
+ inputSelector: inputSelector,
5253
+ textarea: valueSelector,
5254
+ select: select,
5255
+ selectOne: selectOne,
5256
+ selectMany: selectMany,
5257
+ optionValue: optionValue,
5258
+ button: valueSelector
5259
+ };
5260
+ })();
5261
+
5262
+ /*--------------------------------------------------------------------------*/
5263
+
5264
+
5265
+ Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
5266
+ initialize: function($super, element, frequency, callback) {
5267
+ $super(callback, frequency);
5268
+ this.element = $(element);
5269
+ this.lastValue = this.getValue();
5270
+ },
5271
+
5272
+ execute: function() {
5273
+ var value = this.getValue();
5274
+ if (Object.isString(this.lastValue) && Object.isString(value) ?
5275
+ this.lastValue != value : String(this.lastValue) != String(value)) {
5276
+ this.callback(this.element, value);
5277
+ this.lastValue = value;
5278
+ }
5279
+ }
5280
+ });
5281
+
5282
+ Form.Element.Observer = Class.create(Abstract.TimedObserver, {
5283
+ getValue: function() {
5284
+ return Form.Element.getValue(this.element);
5285
+ }
5286
+ });
5287
+
5288
+ Form.Observer = Class.create(Abstract.TimedObserver, {
5289
+ getValue: function() {
5290
+ return Form.serialize(this.element);
5291
+ }
5292
+ });
5293
+
5294
+ /*--------------------------------------------------------------------------*/
5295
+
5296
+ Abstract.EventObserver = Class.create({
5297
+ initialize: function(element, callback) {
5298
+ this.element = $(element);
5299
+ this.callback = callback;
5300
+
5301
+ this.lastValue = this.getValue();
5302
+ if (this.element.tagName.toLowerCase() == 'form')
5303
+ this.registerFormCallbacks();
5304
+ else
5305
+ this.registerCallback(this.element);
5306
+ },
5307
+
5308
+ onElementEvent: function() {
5309
+ var value = this.getValue();
5310
+ if (this.lastValue != value) {
5311
+ this.callback(this.element, value);
5312
+ this.lastValue = value;
5313
+ }
5314
+ },
5315
+
5316
+ registerFormCallbacks: function() {
5317
+ Form.getElements(this.element).each(this.registerCallback, this);
5318
+ },
5319
+
5320
+ registerCallback: function(element) {
5321
+ if (element.type) {
5322
+ switch (element.type.toLowerCase()) {
5323
+ case 'checkbox':
5324
+ case 'radio':
5325
+ Event.observe(element, 'click', this.onElementEvent.bind(this));
5326
+ break;
5327
+ default:
5328
+ Event.observe(element, 'change', this.onElementEvent.bind(this));
5329
+ break;
5330
+ }
5331
+ }
5332
+ }
5333
+ });
5334
+
5335
+ Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
5336
+ getValue: function() {
5337
+ return Form.Element.getValue(this.element);
5338
+ }
5339
+ });
5340
+
5341
+ Form.EventObserver = Class.create(Abstract.EventObserver, {
5342
+ getValue: function() {
5343
+ return Form.serialize(this.element);
5344
+ }
5345
+ });
5346
+ (function() {
5347
+
5348
+ var Event = {
5349
+ KEY_BACKSPACE: 8,
5350
+ KEY_TAB: 9,
5351
+ KEY_RETURN: 13,
5352
+ KEY_ESC: 27,
5353
+ KEY_LEFT: 37,
5354
+ KEY_UP: 38,
5355
+ KEY_RIGHT: 39,
5356
+ KEY_DOWN: 40,
5357
+ KEY_DELETE: 46,
5358
+ KEY_HOME: 36,
5359
+ KEY_END: 35,
5360
+ KEY_PAGEUP: 33,
5361
+ KEY_PAGEDOWN: 34,
5362
+ KEY_INSERT: 45,
5363
+
5364
+ cache: {}
5365
+ };
5366
+
5367
+ var docEl = document.documentElement;
5368
+ var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
5369
+ && 'onmouseleave' in docEl;
5370
+
5371
+
5372
+
5373
+ var isIELegacyEvent = function(event) { return false; };
5374
+
5375
+ if (window.attachEvent) {
5376
+ if (window.addEventListener) {
5377
+ isIELegacyEvent = function(event) {
5378
+ return !(event instanceof window.Event);
5379
+ };
5380
+ } else {
5381
+ isIELegacyEvent = function(event) { return true; };
5382
+ }
5383
+ }
5384
+
5385
+ var _isButton;
5386
+
5387
+ function _isButtonForDOMEvents(event, code) {
5388
+ return event.which ? (event.which === code + 1) : (event.button === code);
5389
+ }
5390
+
5391
+ var legacyButtonMap = { 0: 1, 1: 4, 2: 2 };
5392
+ function _isButtonForLegacyEvents(event, code) {
5393
+ return event.button === legacyButtonMap[code];
5394
+ }
5395
+
5396
+ function _isButtonForWebKit(event, code) {
5397
+ switch (code) {
5398
+ case 0: return event.which == 1 && !event.metaKey;
5399
+ case 1: return event.which == 2 || (event.which == 1 && event.metaKey);
5400
+ case 2: return event.which == 3;
5401
+ default: return false;
5402
+ }
5403
+ }
5404
+
5405
+ if (window.attachEvent) {
5406
+ if (!window.addEventListener) {
5407
+ _isButton = _isButtonForLegacyEvents;
5408
+ } else {
5409
+ _isButton = function(event, code) {
5410
+ return isIELegacyEvent(event) ? _isButtonForLegacyEvents(event, code) :
5411
+ _isButtonForDOMEvents(event, code);
5412
+ }
5413
+ }
5414
+ } else if (Prototype.Browser.WebKit) {
5415
+ _isButton = _isButtonForWebKit;
5416
+ } else {
5417
+ _isButton = _isButtonForDOMEvents;
5418
+ }
5419
+
5420
+ function isLeftClick(event) { return _isButton(event, 0) }
5421
+
5422
+ function isMiddleClick(event) { return _isButton(event, 1) }
5423
+
5424
+ function isRightClick(event) { return _isButton(event, 2) }
5425
+
5426
+ function element(event) {
5427
+ event = Event.extend(event);
5428
+
5429
+ var node = event.target, type = event.type,
5430
+ currentTarget = event.currentTarget;
5431
+
5432
+ if (currentTarget && currentTarget.tagName) {
5433
+ if (type === 'load' || type === 'error' ||
5434
+ (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
5435
+ && currentTarget.type === 'radio'))
5436
+ node = currentTarget;
5437
+ }
5438
+
5439
+ if (node.nodeType == Node.TEXT_NODE)
5440
+ node = node.parentNode;
5441
+
5442
+ return Element.extend(node);
5443
+ }
5444
+
5445
+ function findElement(event, expression) {
5446
+ var element = Event.element(event);
5447
+
5448
+ if (!expression) return element;
5449
+ while (element) {
5450
+ if (Object.isElement(element) && Prototype.Selector.match(element, expression)) {
5451
+ return Element.extend(element);
5452
+ }
5453
+ element = element.parentNode;
5454
+ }
5455
+ }
5456
+
5457
+ function pointer(event) {
5458
+ return { x: pointerX(event), y: pointerY(event) };
5459
+ }
5460
+
5461
+ function pointerX(event) {
5462
+ var docElement = document.documentElement,
5463
+ body = document.body || { scrollLeft: 0 };
5464
+
5465
+ return event.pageX || (event.clientX +
5466
+ (docElement.scrollLeft || body.scrollLeft) -
5467
+ (docElement.clientLeft || 0));
5468
+ }
5469
+
5470
+ function pointerY(event) {
5471
+ var docElement = document.documentElement,
5472
+ body = document.body || { scrollTop: 0 };
5473
+
5474
+ return event.pageY || (event.clientY +
5475
+ (docElement.scrollTop || body.scrollTop) -
5476
+ (docElement.clientTop || 0));
5477
+ }
5478
+
5479
+
5480
+ function stop(event) {
5481
+ Event.extend(event);
5482
+ event.preventDefault();
5483
+ event.stopPropagation();
5484
+
5485
+ event.stopped = true;
5486
+ }
5487
+
5488
+
5489
+ Event.Methods = {
5490
+ isLeftClick: isLeftClick,
5491
+ isMiddleClick: isMiddleClick,
5492
+ isRightClick: isRightClick,
5493
+
5494
+ element: element,
5495
+ findElement: findElement,
5496
+
5497
+ pointer: pointer,
5498
+ pointerX: pointerX,
5499
+ pointerY: pointerY,
5500
+
5501
+ stop: stop
5502
+ };
5503
+
5504
+ var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
5505
+ m[name] = Event.Methods[name].methodize();
5506
+ return m;
5507
+ });
5508
+
5509
+ if (window.attachEvent) {
5510
+ function _relatedTarget(event) {
5511
+ var element;
5512
+ switch (event.type) {
5513
+ case 'mouseover':
5514
+ case 'mouseenter':
5515
+ element = event.fromElement;
5516
+ break;
5517
+ case 'mouseout':
5518
+ case 'mouseleave':
5519
+ element = event.toElement;
5520
+ break;
5521
+ default:
5522
+ return null;
5523
+ }
5524
+ return Element.extend(element);
5525
+ }
5526
+
5527
+ var additionalMethods = {
5528
+ stopPropagation: function() { this.cancelBubble = true },
5529
+ preventDefault: function() { this.returnValue = false },
5530
+ inspect: function() { return '[object Event]' }
5531
+ };
5532
+
5533
+ Event.extend = function(event, element) {
5534
+ if (!event) return false;
5535
+
5536
+ if (!isIELegacyEvent(event)) return event;
5537
+
5538
+ if (event._extendedByPrototype) return event;
5539
+ event._extendedByPrototype = Prototype.emptyFunction;
5540
+
5541
+ var pointer = Event.pointer(event);
5542
+
5543
+ Object.extend(event, {
5544
+ target: event.srcElement || element,
5545
+ relatedTarget: _relatedTarget(event),
5546
+ pageX: pointer.x,
5547
+ pageY: pointer.y
5548
+ });
5549
+
5550
+ Object.extend(event, methods);
5551
+ Object.extend(event, additionalMethods);
5552
+
5553
+ return event;
5554
+ };
5555
+ } else {
5556
+ Event.extend = Prototype.K;
5557
+ }
5558
+
5559
+ if (window.addEventListener) {
5560
+ Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
5561
+ Object.extend(Event.prototype, methods);
5562
+ }
5563
+
5564
+ function _createResponder(element, eventName, handler) {
5565
+ var registry = Element.retrieve(element, 'prototype_event_registry');
5566
+
5567
+ if (Object.isUndefined(registry)) {
5568
+ CACHE.push(element);
5569
+ registry = Element.retrieve(element, 'prototype_event_registry', $H());
5570
+ }
5571
+
5572
+ var respondersForEvent = registry.get(eventName);
5573
+ if (Object.isUndefined(respondersForEvent)) {
5574
+ respondersForEvent = [];
5575
+ registry.set(eventName, respondersForEvent);
5576
+ }
5577
+
5578
+ if (respondersForEvent.pluck('handler').include(handler)) return false;
5579
+
5580
+ var responder;
5581
+ if (eventName.include(":")) {
5582
+ responder = function(event) {
5583
+ if (Object.isUndefined(event.eventName))
5584
+ return false;
5585
+
5586
+ if (event.eventName !== eventName)
5587
+ return false;
5588
+
5589
+ Event.extend(event, element);
5590
+ handler.call(element, event);
5591
+ };
5592
+ } else {
5593
+ if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
5594
+ (eventName === "mouseenter" || eventName === "mouseleave")) {
5595
+ if (eventName === "mouseenter" || eventName === "mouseleave") {
5596
+ responder = function(event) {
5597
+ Event.extend(event, element);
5598
+
5599
+ var parent = event.relatedTarget;
5600
+ while (parent && parent !== element) {
5601
+ try { parent = parent.parentNode; }
5602
+ catch(e) { parent = element; }
5603
+ }
5604
+
5605
+ if (parent === element) return;
5606
+
5607
+ handler.call(element, event);
5608
+ };
5609
+ }
5610
+ } else {
5611
+ responder = function(event) {
5612
+ Event.extend(event, element);
5613
+ handler.call(element, event);
5614
+ };
5615
+ }
5616
+ }
5617
+
5618
+ responder.handler = handler;
5619
+ respondersForEvent.push(responder);
5620
+ return responder;
5621
+ }
5622
+
5623
+ function _destroyCache() {
5624
+ for (var i = 0, length = CACHE.length; i < length; i++) {
5625
+ Event.stopObserving(CACHE[i]);
5626
+ CACHE[i] = null;
5627
+ }
5628
+ }
5629
+
5630
+ var CACHE = [];
5631
+
5632
+ if (Prototype.Browser.IE)
5633
+ window.attachEvent('onunload', _destroyCache);
5634
+
5635
+ if (Prototype.Browser.WebKit)
5636
+ window.addEventListener('unload', Prototype.emptyFunction, false);
5637
+
5638
+
5639
+ var _getDOMEventName = Prototype.K,
5640
+ translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
5641
+
5642
+ if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
5643
+ _getDOMEventName = function(eventName) {
5644
+ return (translations[eventName] || eventName);
5645
+ };
5646
+ }
5647
+
5648
+ function observe(element, eventName, handler) {
5649
+ element = $(element);
5650
+
5651
+ var responder = _createResponder(element, eventName, handler);
5652
+
5653
+ if (!responder) return element;
5654
+
5655
+ if (eventName.include(':')) {
5656
+ if (element.addEventListener)
5657
+ element.addEventListener("dataavailable", responder, false);
5658
+ else {
5659
+ element.attachEvent("ondataavailable", responder);
5660
+ element.attachEvent("onlosecapture", responder);
5661
+ }
5662
+ } else {
5663
+ var actualEventName = _getDOMEventName(eventName);
5664
+
5665
+ if (element.addEventListener)
5666
+ element.addEventListener(actualEventName, responder, false);
5667
+ else
5668
+ element.attachEvent("on" + actualEventName, responder);
5669
+ }
5670
+
5671
+ return element;
5672
+ }
5673
+
5674
+ function stopObserving(element, eventName, handler) {
5675
+ element = $(element);
5676
+
5677
+ var registry = Element.retrieve(element, 'prototype_event_registry');
5678
+ if (!registry) return element;
5679
+
5680
+ if (!eventName) {
5681
+ registry.each( function(pair) {
5682
+ var eventName = pair.key;
5683
+ stopObserving(element, eventName);
5684
+ });
5685
+ return element;
5686
+ }
5687
+
5688
+ var responders = registry.get(eventName);
5689
+ if (!responders) return element;
5690
+
5691
+ if (!handler) {
5692
+ responders.each(function(r) {
5693
+ stopObserving(element, eventName, r.handler);
5694
+ });
5695
+ return element;
5696
+ }
5697
+
5698
+ var i = responders.length, responder;
5699
+ while (i--) {
5700
+ if (responders[i].handler === handler) {
5701
+ responder = responders[i];
5702
+ break;
5703
+ }
5704
+ }
5705
+ if (!responder) return element;
5706
+
5707
+ if (eventName.include(':')) {
5708
+ if (element.removeEventListener)
5709
+ element.removeEventListener("dataavailable", responder, false);
5710
+ else {
5711
+ element.detachEvent("ondataavailable", responder);
5712
+ element.detachEvent("onlosecapture", responder);
5713
+ }
5714
+ } else {
5715
+ var actualEventName = _getDOMEventName(eventName);
5716
+ if (element.removeEventListener)
5717
+ element.removeEventListener(actualEventName, responder, false);
5718
+ else
5719
+ element.detachEvent('on' + actualEventName, responder);
5720
+ }
5721
+
5722
+ registry.set(eventName, responders.without(responder));
5723
+
5724
+ return element;
5725
+ }
5726
+
5727
+ function fire(element, eventName, memo, bubble) {
5728
+ element = $(element);
5729
+
5730
+ if (Object.isUndefined(bubble))
5731
+ bubble = true;
5732
+
5733
+ if (element == document && document.createEvent && !element.dispatchEvent)
5734
+ element = document.documentElement;
5735
+
5736
+ var event;
5737
+ if (document.createEvent) {
5738
+ event = document.createEvent('HTMLEvents');
5739
+ event.initEvent('dataavailable', bubble, true);
5740
+ } else {
5741
+ event = document.createEventObject();
5742
+ event.eventType = bubble ? 'ondataavailable' : 'onlosecapture';
5743
+ }
5744
+
5745
+ event.eventName = eventName;
5746
+ event.memo = memo || { };
5747
+
5748
+ if (document.createEvent)
5749
+ element.dispatchEvent(event);
5750
+ else
5751
+ element.fireEvent(event.eventType, event);
5752
+
5753
+ return Event.extend(event);
5754
+ }
5755
+
5756
+ Event.Handler = Class.create({
5757
+ initialize: function(element, eventName, selector, callback) {
5758
+ this.element = $(element);
5759
+ this.eventName = eventName;
5760
+ this.selector = selector;
5761
+ this.callback = callback;
5762
+ this.handler = this.handleEvent.bind(this);
5763
+ },
5764
+
5765
+ start: function() {
5766
+ Event.observe(this.element, this.eventName, this.handler);
5767
+ return this;
5768
+ },
5769
+
5770
+ stop: function() {
5771
+ Event.stopObserving(this.element, this.eventName, this.handler);
5772
+ return this;
5773
+ },
5774
+
5775
+ handleEvent: function(event) {
5776
+ var element = Event.findElement(event, this.selector);
5777
+ if (element) this.callback.call(this.element, event, element);
5778
+ }
5779
+ });
5780
+
5781
+ function on(element, eventName, selector, callback) {
5782
+ element = $(element);
5783
+ if (Object.isFunction(selector) && Object.isUndefined(callback)) {
5784
+ callback = selector, selector = null;
5785
+ }
5786
+
5787
+ return new Event.Handler(element, eventName, selector, callback).start();
5788
+ }
5789
+
5790
+ Object.extend(Event, Event.Methods);
5791
+
5792
+ Object.extend(Event, {
5793
+ fire: fire,
5794
+ observe: observe,
5795
+ stopObserving: stopObserving,
5796
+ on: on
5797
+ });
5798
+
5799
+ Element.addMethods({
5800
+ fire: fire,
5801
+
5802
+ observe: observe,
5803
+
5804
+ stopObserving: stopObserving,
5805
+
5806
+ on: on
5807
+ });
5808
+
5809
+ Object.extend(document, {
5810
+ fire: fire.methodize(),
5811
+
5812
+ observe: observe.methodize(),
5813
+
5814
+ stopObserving: stopObserving.methodize(),
5815
+
5816
+ on: on.methodize(),
5817
+
5818
+ loaded: false
5819
+ });
5820
+
5821
+ if (window.Event) Object.extend(window.Event, Event);
5822
+ else window.Event = Event;
5823
+ })();
5824
+
5825
+ (function() {
5826
+ /* Support for the DOMContentLoaded event is based on work by Dan Webb,
5827
+ Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
5828
+
5829
+ var timer;
5830
+
5831
+ function fireContentLoadedEvent() {
5832
+ if (document.loaded) return;
5833
+ if (timer) window.clearTimeout(timer);
5834
+ document.loaded = true;
5835
+ document.fire('dom:loaded');
5836
+ }
5837
+
5838
+ function checkReadyState() {
5839
+ if (document.readyState === 'complete') {
5840
+ document.stopObserving('readystatechange', checkReadyState);
5841
+ fireContentLoadedEvent();
5842
+ }
5843
+ }
5844
+
5845
+ function pollDoScroll() {
5846
+ try { document.documentElement.doScroll('left'); }
5847
+ catch(e) {
5848
+ timer = pollDoScroll.defer();
5849
+ return;
5850
+ }
5851
+ fireContentLoadedEvent();
5852
+ }
5853
+
5854
+ if (document.addEventListener) {
5855
+ document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
5856
+ } else {
5857
+ document.observe('readystatechange', checkReadyState);
5858
+ if (window == top)
5859
+ timer = pollDoScroll.defer();
5860
+ }
5861
+
5862
+ Event.observe(window, 'load', fireContentLoadedEvent);
5863
+ })();
5864
+
5865
+ Element.addMethods();
5866
+
5867
+ /*------------------------------- DEPRECATED -------------------------------*/
5868
+
5869
+ Hash.toQueryString = Object.toQueryString;
5870
+
5871
+ var Toggle = { display: Element.toggle };
5872
+
5873
+ Element.Methods.childOf = Element.Methods.descendantOf;
5874
+
5875
+ var Insertion = {
5876
+ Before: function(element, content) {
5877
+ return Element.insert(element, {before:content});
5878
+ },
5879
+
5880
+ Top: function(element, content) {
5881
+ return Element.insert(element, {top:content});
5882
+ },
5883
+
5884
+ Bottom: function(element, content) {
5885
+ return Element.insert(element, {bottom:content});
5886
+ },
5887
+
5888
+ After: function(element, content) {
5889
+ return Element.insert(element, {after:content});
5890
+ }
5891
+ };
5892
+
5893
+ var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
5894
+
5895
+ var Position = {
5896
+ includeScrollOffsets: false,
5897
+
5898
+ prepare: function() {
5899
+ this.deltaX = window.pageXOffset
5900
+ || document.documentElement.scrollLeft
5901
+ || document.body.scrollLeft
5902
+ || 0;
5903
+ this.deltaY = window.pageYOffset
5904
+ || document.documentElement.scrollTop
5905
+ || document.body.scrollTop
5906
+ || 0;
5907
+ },
5908
+
5909
+ within: function(element, x, y) {
5910
+ if (this.includeScrollOffsets)
5911
+ return this.withinIncludingScrolloffsets(element, x, y);
5912
+ this.xcomp = x;
5913
+ this.ycomp = y;
5914
+ this.offset = Element.cumulativeOffset(element);
5915
+
5916
+ return (y >= this.offset[1] &&
5917
+ y < this.offset[1] + element.offsetHeight &&
5918
+ x >= this.offset[0] &&
5919
+ x < this.offset[0] + element.offsetWidth);
5920
+ },
5921
+
5922
+ withinIncludingScrolloffsets: function(element, x, y) {
5923
+ var offsetcache = Element.cumulativeScrollOffset(element);
5924
+
5925
+ this.xcomp = x + offsetcache[0] - this.deltaX;
5926
+ this.ycomp = y + offsetcache[1] - this.deltaY;
5927
+ this.offset = Element.cumulativeOffset(element);
5928
+
5929
+ return (this.ycomp >= this.offset[1] &&
5930
+ this.ycomp < this.offset[1] + element.offsetHeight &&
5931
+ this.xcomp >= this.offset[0] &&
5932
+ this.xcomp < this.offset[0] + element.offsetWidth);
5933
+ },
5934
+
5935
+ overlap: function(mode, element) {
5936
+ if (!mode) return 0;
5937
+ if (mode == 'vertical')
5938
+ return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
5939
+ element.offsetHeight;
5940
+ if (mode == 'horizontal')
5941
+ return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
5942
+ element.offsetWidth;
5943
+ },
5944
+
5945
+
5946
+ cumulativeOffset: Element.Methods.cumulativeOffset,
5947
+
5948
+ positionedOffset: Element.Methods.positionedOffset,
5949
+
5950
+ absolutize: function(element) {
5951
+ Position.prepare();
5952
+ return Element.absolutize(element);
5953
+ },
5954
+
5955
+ relativize: function(element) {
5956
+ Position.prepare();
5957
+ return Element.relativize(element);
5958
+ },
5959
+
5960
+ realOffset: Element.Methods.cumulativeScrollOffset,
5961
+
5962
+ offsetParent: Element.Methods.getOffsetParent,
5963
+
5964
+ page: Element.Methods.viewportOffset,
5965
+
5966
+ clone: function(source, target, options) {
5967
+ options = options || { };
5968
+ return Element.clonePosition(target, source, options);
5969
+ }
5970
+ };
5971
+
5972
+ /*--------------------------------------------------------------------------*/
5973
+
5974
+ if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
5975
+ function iter(name) {
5976
+ return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
5977
+ }
5978
+
5979
+ instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
5980
+ function(element, className) {
5981
+ className = className.toString().strip();
5982
+ var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
5983
+ return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
5984
+ } : function(element, className) {
5985
+ className = className.toString().strip();
5986
+ var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
5987
+ if (!classNames && !className) return elements;
5988
+
5989
+ var nodes = $(element).getElementsByTagName('*');
5990
+ className = ' ' + className + ' ';
5991
+
5992
+ for (var i = 0, child, cn; child = nodes[i]; i++) {
5993
+ if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
5994
+ (classNames && classNames.all(function(name) {
5995
+ return !name.toString().blank() && cn.include(' ' + name + ' ');
5996
+ }))))
5997
+ elements.push(Element.extend(child));
5998
+ }
5999
+ return elements;
6000
+ };
6001
+
6002
+ return function(className, parentElement) {
6003
+ return $(parentElement || document.body).getElementsByClassName(className);
6004
+ };
6005
+ }(Element.Methods);
6006
+
6007
+ /*--------------------------------------------------------------------------*/
6008
+
6009
+ Element.ClassNames = Class.create();
6010
+ Element.ClassNames.prototype = {
6011
+ initialize: function(element) {
6012
+ this.element = $(element);
6013
+ },
6014
+
6015
+ _each: function(iterator) {
6016
+ this.element.className.split(/\s+/).select(function(name) {
6017
+ return name.length > 0;
6018
+ })._each(iterator);
6019
+ },
6020
+
6021
+ set: function(className) {
6022
+ this.element.className = className;
6023
+ },
6024
+
6025
+ add: function(classNameToAdd) {
6026
+ if (this.include(classNameToAdd)) return;
6027
+ this.set($A(this).concat(classNameToAdd).join(' '));
6028
+ },
6029
+
6030
+ remove: function(classNameToRemove) {
6031
+ if (!this.include(classNameToRemove)) return;
6032
+ this.set($A(this).without(classNameToRemove).join(' '));
6033
+ },
6034
+
6035
+ toString: function() {
6036
+ return $A(this).join(' ');
6037
+ }
6038
+ };
6039
+
6040
+ Object.extend(Element.ClassNames.prototype, Enumerable);
6041
+
6042
+ /*--------------------------------------------------------------------------*/
6043
+
6044
+ (function() {
6045
+ window.Selector = Class.create({
6046
+ initialize: function(expression) {
6047
+ this.expression = expression.strip();
6048
+ },
6049
+
6050
+ findElements: function(rootElement) {
6051
+ return Prototype.Selector.select(this.expression, rootElement);
6052
+ },
6053
+
6054
+ match: function(element) {
6055
+ return Prototype.Selector.match(element, this.expression);
6056
+ },
6057
+
6058
+ toString: function() {
6059
+ return this.expression;
6060
+ },
6061
+
6062
+ inspect: function() {
6063
+ return "#<Selector: " + this.expression + ">";
6064
+ }
6065
+ });
6066
+
6067
+ Object.extend(Selector, {
6068
+ matchElements: function(elements, expression) {
6069
+ var match = Prototype.Selector.match,
6070
+ results = [];
6071
+
6072
+ for (var i = 0, length = elements.length; i < length; i++) {
6073
+ var element = elements[i];
6074
+ if (match(element, expression)) {
6075
+ results.push(Element.extend(element));
6076
+ }
6077
+ }
6078
+ return results;
6079
+ },
6080
+
6081
+ findElement: function(elements, expression, index) {
6082
+ index = index || 0;
6083
+ var matchIndex = 0, element;
6084
+ for (var i = 0, length = elements.length; i < length; i++) {
6085
+ element = elements[i];
6086
+ if (Prototype.Selector.match(element, expression) && index === matchIndex++) {
6087
+ return Element.extend(element);
6088
+ }
6089
+ }
6090
+ },
6091
+
6092
+ findChildElements: function(element, expressions) {
6093
+ var selector = expressions.toArray().join(', ');
6094
+ return Prototype.Selector.select(selector, element || document);
6095
+ }
6096
+ });
6097
+ })();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>responsive</name>
4
- <version>0.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -27,14 +27,12 @@ It support &#xD;
27
  - 479px+ Mobile devices&#xD;
28
  &#xD;
29
  -iPhone, Android, Windows phone and other smartphones</description>
30
- <notes>support&#xD;
31
- &#xD;
32
- - firefox, chrome &#xD;
33
- - from IE8</notes>
34
  <authors><author><name>tony vu</name><user>vuductrung</user><email>vuductrung2003@gmail.com</email></author></authors>
35
- <date>2013-12-22</date>
36
- <time>22:33:59</time>
37
- <contents><target name="magelocal"><dir name="Tvcom"><dir name="Page"><dir name="Block"><dir name="Html"><file name="Topmenu.php" hash="352187a84b23bf49e13729b35c83a3d4"/></dir></dir><dir name="etc"><file name="config.xml" hash="b44a7f3ece8afeb85ddb3a8d4e1ea692"/></dir></dir><dir name="Themecustom"><dir name="Helper"><file name="Data.php" hash="07559e4fa8223efcb10bd0795458c765"/></dir><dir name="Model"><file name="Custom.php" hash="bff5f52f606c33ada097641e6e2970bf"/></dir><dir name="etc"><file name="config.xml" hash="de2cf6d9e20493e77747b83ba6e7dc2c"/><file name="system.xml" hash="95e2229d31bb336f75b5101808de00d7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tvcom_Page.xml" hash="6eb34161b3a13e001b1af7dea977f484"/><file name="Tvcom_Themecustom.xml" hash="742cda5cce51b8cb0cfebfe3075a06d9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="responsive"><dir name="layout"><file name="catalog.xml" hash="640975004551c7430aa338a8308a9b9c"/><file name="catalogsearch.xml" hash="e78dcf8c3211ec8a42252331087d1be1"/><file name="checkout.xml" hash="ebd8515f1888b36fc6545d4f3896d17f"/><file name="page.xml" hash="da409dfc39428655bb43756bb79ed930"/></dir><dir name="template"><dir name="catalog"><dir name="category"><file name="view.phtml" hash="cceafbc47607415df40308f862f34df0"/></dir><dir name="layer"><file name="state.phtml" hash="4bf29ca4ce76d4f56a1f298f916dbc2e"/></dir><dir name="product"><dir name="compare"><file name="sidebar.phtml" hash="615efb37c43f4e6099dc4c869ea70d22"/></dir><dir name="list"><file name="toolbar.phtml" hash="434efbf05a25ad66e08617102f2acb84"/></dir><file name="list.phtml" hash="5afa6ac1016aa199ec4d33aa96aeb19b"/><dir name="view"><file name="attributes.phtml" hash="23f81cbe34ef191b5748d3899418a2b7"/></dir><file name="view.phtml" hash="1770881c388b30131ceb8f2074d675d7"/></dir></dir><dir name="catalogsearch"><dir name="advanced"><file name="form.phtml" hash="da5a91141a34f6dab2f60ec72de0cd12"/></dir><file name="form.mini.phtml" hash="3be8cbc8ba6b9efda2540306a405af16"/></dir><dir name="checkout"><dir name="cart"><file name="coupon.phtml" hash="3c8d5da75a8b74a0b65237398a31faa1"/><file name="crosssell.phtml" hash="2fe2d26ad86123d453677687ad18cb75"/><dir name="item"><file name="default.phtml" hash="a09cd9fd47311cbcec3a5df9269e0c3a"/></dir><file name="shipping.phtml" hash="eb2582cb28f52f33489c143b7e907187"/><dir name="sidebar"><file name="default.phtml" hash="5b64bb75c39984829140dd7265025d75"/></dir><file name="sidebar.phtml" hash="9a14973934e91c8cfbef11b28d2ad5ec"/></dir><file name="cart.phtml" hash="a7fb8fa61eb3b92fd9c6f11feb7d2429"/><dir name="onepage"><file name="link.phtml" hash="d4b7eff731b7736a35b42340f1c484af"/></dir></dir><dir name="contacts"><file name="form.phtml" hash="5b209a14afb46dfdc35a4d8b9cd8a742"/></dir><dir name="customblock"><dir name="socialnetwork"><file name="networkshare.phtml" hash="4715a26226883bc70d9cd7a33ad06d02"/></dir></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="address.phtml" hash="d39ddf7d3dea541b3c08bd1717356a9f"/><file name="info.phtml" hash="9a0afc6868754390a9eb66f470ddafc3"/></dir></dir><dir name="form"><file name="edit.phtml" hash="46948a88aef6ba3a1e7ee46ab54c4727"/><file name="forgotpassword.phtml" hash="33d71a5f207dd942f14202d4cf915981"/></dir><dir name="widget"><file name="name.phtml" hash="3aa7a542339bf2d64eddcb382ff85f45"/></dir></dir><dir name="newsletter"><file name="subscribe.phtml" hash="5d09d74355d196f44024dfef9e9a7f49"/></dir><dir name="page"><file name="1column.phtml" hash="8f2578c19ae57f70ee3141d31f9f1a22"/><file name="2columns-left.phtml" hash="6ead24530145d1f7f9750b25dcf83d88"/><file name="2columns-right.phtml" hash="69012716b9e773a5357cc4be01159a4e"/><file name="3columns.phtml" hash="1fbf4e3a5c3bc3c6414bf28c9c57bc13"/><dir name="html"><file name="head.phtml" hash="882bceee3d6c945a8956f6253e24540a"/><file name="header.phtml" hash="234750241ec25e7775e6f34804418c6a"/><file name="pager.phtml" hash="19bf607119a013bb4797c5182c3e0380"/><file name="topmenu.phtml" hash="2463bdbbe7a42bc4f36daf19b947d3ba"/></dir><dir name="template"><file name="links.phtml" hash="00466dab494b53c8c764e38215876812"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="f26b21cac8c142ba35ded5b08cdd6f05"/><file name="login.phtml" hash="7122df5630b7437e4da4e2c8713a8efd"/></dir></dir><dir name="customer"><dir name="form"><file name="login.phtml" hash="217361603f19a2c4fd6a8becb19a5232"/><file name="register.phtml" hash="998323c2a4928a80167d573657cdf8e3"/></dir></dir></dir><dir name="poll"><file name="active.phtml" hash="cbaa4cf06b173ab28a5879e76016ca5e"/></dir><dir name="review"><file name="form.phtml" hash="184175fb22afaacfcd588aabf6380c74"/></dir><dir name="sales"><dir name="guest"><file name="form.phtml" hash="3a8f1de79b1e226d8a48d9ea1006625e"/></dir></dir><dir name="tag"><file name="list.phtml" hash="d35d9598af9b5bb51414cad0e88700e6"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="responsive"><dir name="layout"><file name="colorpicker.xml" hash="a7e0375e1a9c6715ef7955157202a6d3"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="responsive"><dir name="css"><file name="extension.php" hash="8c9203a52f617acfae399df4fb7ad9fa"/><file name="homepage-example.php" hash="f8ee9d5edfee69f63f742b5b4c56ea99"/><file name="responsive.css" hash="dca313da3ccf7385de4679240b611605"/><file name="styles.css" hash="ffe1b3320e3ba74f627657079ee412a2"/><file name="styles.php" hash="141a1767a14b4b21f62e0791d0935dbd"/></dir><dir name="images"><file name="bkg_rating.gif" hash="0a8777c815350ddf1e316a537ad0c335"/></dir></dir></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
40
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>responsive</name>
4
+ <version>0.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
27
  - 479px+ Mobile devices&#xD;
28
  &#xD;
29
  -iPhone, Android, Windows phone and other smartphones</description>
30
+ <notes>- Fix the complict between prototype and &#xD;
31
+ - more config theme at the backend</notes>
 
 
32
  <authors><author><name>tony vu</name><user>vuductrung</user><email>vuductrung2003@gmail.com</email></author></authors>
33
+ <date>2013-12-26</date>
34
+ <time>22:07:56</time>
35
+ <contents><target name="magelocal"><dir name="Tvcom"><dir name="Page"><dir name="Block"><dir name="Html"><file name="Topmenu.php" hash="352187a84b23bf49e13729b35c83a3d4"/></dir></dir><dir name="etc"><file name="config.xml" hash="b44a7f3ece8afeb85ddb3a8d4e1ea692"/></dir></dir><dir name="Themecustom"><dir name="Helper"><file name="Data.php" hash="07559e4fa8223efcb10bd0795458c765"/></dir><dir name="Model"><dir name="Background"><file name="Repeat.php" hash="9dd83ae44d13d96333c2fd21b9fa52ad"/></dir><file name="Custom.php" hash="bff5f52f606c33ada097641e6e2970bf"/></dir><dir name="etc"><file name="config.xml" hash="de2cf6d9e20493e77747b83ba6e7dc2c"/><file name="system.xml" hash="3fb19805f991c0ac858f232954ecd122"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tvcom_Page.xml" hash="6eb34161b3a13e001b1af7dea977f484"/><file name="Tvcom_Themecustom.xml" hash="742cda5cce51b8cb0cfebfe3075a06d9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="responsive"><dir name="layout"><file name="catalog.xml" hash="640975004551c7430aa338a8308a9b9c"/><file name="catalogsearch.xml" hash="e78dcf8c3211ec8a42252331087d1be1"/><file name="checkout.xml" hash="ebd8515f1888b36fc6545d4f3896d17f"/><file name="page.xml" hash="da409dfc39428655bb43756bb79ed930"/></dir><dir name="template"><dir name="catalog"><dir name="category"><file name="view.phtml" hash="cceafbc47607415df40308f862f34df0"/></dir><dir name="layer"><file name="state.phtml" hash="4bf29ca4ce76d4f56a1f298f916dbc2e"/></dir><dir name="product"><dir name="compare"><file name="sidebar.phtml" hash="615efb37c43f4e6099dc4c869ea70d22"/></dir><dir name="list"><file name="toolbar.phtml" hash="434efbf05a25ad66e08617102f2acb84"/></dir><file name="list.phtml" hash="5afa6ac1016aa199ec4d33aa96aeb19b"/><dir name="view"><file name="attributes.phtml" hash="23f81cbe34ef191b5748d3899418a2b7"/></dir><file name="view.phtml" hash="1770881c388b30131ceb8f2074d675d7"/></dir></dir><dir name="catalogsearch"><dir name="advanced"><file name="form.phtml" hash="da5a91141a34f6dab2f60ec72de0cd12"/></dir><file name="form.mini.phtml" hash="3be8cbc8ba6b9efda2540306a405af16"/></dir><dir name="checkout"><dir name="cart"><file name="coupon.phtml" hash="3c8d5da75a8b74a0b65237398a31faa1"/><file name="crosssell.phtml" hash="2fe2d26ad86123d453677687ad18cb75"/><dir name="item"><file name="default.phtml" hash="a09cd9fd47311cbcec3a5df9269e0c3a"/></dir><file name="shipping.phtml" hash="eb2582cb28f52f33489c143b7e907187"/><dir name="sidebar"><file name="default.phtml" hash="5b64bb75c39984829140dd7265025d75"/></dir><file name="sidebar.phtml" hash="9a14973934e91c8cfbef11b28d2ad5ec"/></dir><file name="cart.phtml" hash="a7fb8fa61eb3b92fd9c6f11feb7d2429"/><dir name="onepage"><file name="link.phtml" hash="d4b7eff731b7736a35b42340f1c484af"/></dir></dir><dir name="contacts"><file name="form.phtml" hash="5b209a14afb46dfdc35a4d8b9cd8a742"/></dir><dir name="customblock"><dir name="socialnetwork"><file name="networkshare.phtml" hash="4715a26226883bc70d9cd7a33ad06d02"/></dir></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="address.phtml" hash="d39ddf7d3dea541b3c08bd1717356a9f"/><file name="info.phtml" hash="9a0afc6868754390a9eb66f470ddafc3"/></dir></dir><dir name="form"><file name="edit.phtml" hash="46948a88aef6ba3a1e7ee46ab54c4727"/><file name="forgotpassword.phtml" hash="33d71a5f207dd942f14202d4cf915981"/></dir><dir name="widget"><file name="name.phtml" hash="3aa7a542339bf2d64eddcb382ff85f45"/></dir></dir><dir name="newsletter"><file name="subscribe.phtml" hash="5d09d74355d196f44024dfef9e9a7f49"/></dir><dir name="page"><file name="1column.phtml" hash="8f2578c19ae57f70ee3141d31f9f1a22"/><file name="2columns-left.phtml" hash="6ead24530145d1f7f9750b25dcf83d88"/><file name="2columns-right.phtml" hash="69012716b9e773a5357cc4be01159a4e"/><file name="3columns.phtml" hash="1fbf4e3a5c3bc3c6414bf28c9c57bc13"/><dir name="html"><file name="head.phtml" hash="882bceee3d6c945a8956f6253e24540a"/><file name="header.phtml" hash="234750241ec25e7775e6f34804418c6a"/><file name="pager.phtml" hash="19bf607119a013bb4797c5182c3e0380"/><file name="topmenu.phtml" hash="ff9474eb72f997fc3339375377851203"/></dir><dir name="template"><file name="links.phtml" hash="00466dab494b53c8c764e38215876812"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="f26b21cac8c142ba35ded5b08cdd6f05"/><file name="login.phtml" hash="7122df5630b7437e4da4e2c8713a8efd"/></dir></dir><dir name="customer"><dir name="form"><file name="login.phtml" hash="217361603f19a2c4fd6a8becb19a5232"/><file name="register.phtml" hash="998323c2a4928a80167d573657cdf8e3"/></dir></dir></dir><dir name="poll"><file name="active.phtml" hash="cbaa4cf06b173ab28a5879e76016ca5e"/></dir><dir name="review"><file name="form.phtml" hash="184175fb22afaacfcd588aabf6380c74"/></dir><dir name="sales"><dir name="guest"><file name="form.phtml" hash="3a8f1de79b1e226d8a48d9ea1006625e"/></dir></dir><dir name="tag"><file name="list.phtml" hash="d35d9598af9b5bb51414cad0e88700e6"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="responsive"><dir name="layout"><file name="colorpicker.xml" hash="a7e0375e1a9c6715ef7955157202a6d3"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="responsive"><dir name="css"><file name="extension.php" hash="f7a3840b2495768bd9c7efb84824b097"/><file name="homepage-example.php" hash="f8ee9d5edfee69f63f742b5b4c56ea99"/><file name="responsive.css" hash="dca313da3ccf7385de4679240b611605"/><file name="styles.css" hash="ffe1b3320e3ba74f627657079ee412a2"/><file name="styles.php" hash="61f1fd6390fc6c7d1c5cd66945a09dac"/></dir><dir name="images"><file name="bkg_rating.gif" hash="0a8777c815350ddf1e316a537ad0c335"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="prototype"><file name="prototype.js" hash="3fcb2fb515a2b67ee70fe53afbd2775f"/></dir></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
38
  </package>
skin/frontend/default/responsive/css/extension.php CHANGED
@@ -1,12 +1,14 @@
1
  <h3>Overview</h3>
2
- <p>The responsive theme is written above the Magento community base theme. It supports 1200px (Wide screens), 960px (laptop screens), iPad, iPhone, Android, Windows phone and other martphones </p>
 
 
 
 
 
 
 
3
 
4
  <h3>Technique</h3>
5
- <p>The Theme combines</p>
6
  <p>+ Bootstrap 3</p>
7
  <p>+ Awesome font</p>
8
- <p>+ HTML 5 and CSS 3</p>
9
-
10
- <h3>Supports</h3>
11
- <p>Please let me know If you have some issue to install.</p>
12
- <p>email: vuductrung2003@gmail.com</p>
1
  <h3>Overview</h3>
2
+ <p>The responsive theme is written above the Magento community base theme. </p>
3
+ <p>demo link <a href="http://responsive.asmarket.com.au/" target="_blank">http://responsive.asmarket.com.au/</a></p>
4
+ <p>Please let me know If you have some issue to install.</p>
5
+ <p>email to <a href="mailto:vuductrung2003@gmail.com">vuductrung2003@gmail.com</a></p>
6
+ <p><a href="https://www.facebook.com/tonyvu2003">Facebook</a></p>
7
+ <h3>Feature</h3>
8
+ <p>+ Support all different devices such as large computer, laptop, all tablets and mobile phone</p>
9
+ <p>+ Theme custom is at the Admin backend</p>
10
 
11
  <h3>Technique</h3>
 
12
  <p>+ Bootstrap 3</p>
13
  <p>+ Awesome font</p>
14
+ <p>+ HTML 5 and CSS 3</p>
 
 
 
 
skin/frontend/default/responsive/css/styles.php CHANGED
@@ -3,7 +3,10 @@
3
  header("Content-type: text/css; charset: UTF-8");
4
 
5
  $bgcolor = '#' . Mage::getStoreConfig('setting/themebg/bgcolor');
6
- $bgimage = Mage::getStoreConfig('setting/themebg/bgimage');
 
 
 
7
 
8
  $fontfm = Mage::getStoreConfig('setting/themefont/fontfamily');
9
  $fontsize = Mage::getStoreConfig('setting/themefont/fontsize');
@@ -12,7 +15,7 @@
12
 
13
  * { margin:0; padding:0; }
14
 
15
- body { background:<?php echo $bgcolor ?> /*url(<?php //echo $bgimage ?>) 0 0 no-repeat*/; font-family: <?php echo $fontfm ?>; font-size:<?php echo $fontsize ?>; color: <?php echo $textcolor ?>; text-align:center}
16
 
17
  img { border:0; vertical-align:top; }
18
 
3
  header("Content-type: text/css; charset: UTF-8");
4
 
5
  $bgcolor = '#' . Mage::getStoreConfig('setting/themebg/bgcolor');
6
+ $bgimage = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'bgimage/' . Mage::getStoreConfig('setting/themebg/bgimage');
7
+ $bgpositionx = Mage::getStoreConfig('setting/themebg/bgpositionx');
8
+ $bgpositiony = Mage::getStoreConfig('setting/themebg/bgpositiony');
9
+ $bgpositionrepeat = Mage::getStoreConfig('setting/themebg/bgrepeat');
10
 
11
  $fontfm = Mage::getStoreConfig('setting/themefont/fontfamily');
12
  $fontsize = Mage::getStoreConfig('setting/themefont/fontsize');
15
 
16
  * { margin:0; padding:0; }
17
 
18
+ body { background:<?php echo $bgcolor ?> url(<?php echo $bgimage ?>) <?php echo $bgpositionx ?> <?php echo $bgpositiony ?> <?php echo $bgpositionrepeat ?>; font-family: <?php echo $fontfm ?>; font-size:<?php echo $fontsize ?>; color: <?php echo $textcolor ?>; text-align:center}
19
 
20
  img { border:0; vertical-align:top; }
21