PrescriptionPayment - Version 0.1.0

Version Notes

Stable version. Please check https://github.com/codedge/prescriptionpayment for updates

Download this release

Release Info

Developer Holger Lösken
Extension PrescriptionPayment
Version 0.1.0
Comparing to
See all releases


Code changes from version 0.0.1 to 0.1.0

Files changed (25) hide show
  1. app/code/community/Ce/PrescriptionPayment/Block/Adminhtml/Notifications.php +38 -0
  2. app/code/community/Ce/PrescriptionPayment/Block/Adminhtml/Sales/Order/Prescriptionpayment.php +35 -0
  3. app/code/community/Ce/PrescriptionPayment/Block/Adminhtml/Sales/Order/View/Tab/Prescriptions.php +27 -0
  4. app/code/community/Ce/PrescriptionPayment/Block/Items.php +111 -0
  5. app/code/community/Ce/PrescriptionPayment/Helper/Data.php +39 -0
  6. app/code/community/Ce/PrescriptionPayment/Model/Mysql4/Prescriptionpayment.php +26 -0
  7. app/code/community/Ce/PrescriptionPayment/Model/Mysql4/Prescriptionpayment/Collection.php +27 -0
  8. app/code/community/Ce/PrescriptionPayment/Model/Observer.php +197 -0
  9. app/code/community/Ce/PrescriptionPayment/Model/Prescriptionpayment.php +210 -0
  10. app/code/community/Ce/PrescriptionPayment/controllers/ItemsController.php +116 -0
  11. app/code/community/Ce/PrescriptionPayment/etc/config.xml +148 -0
  12. app/code/community/Ce/PrescriptionPayment/etc/system.xml +96 -0
  13. app/code/community/Ce/PrescriptionPayment/sql/prescriptionpayment_setup/mysql4-install-0.1.0.php +37 -0
  14. app/design/adminhtml/default/default/layout/ce_prescriptionpayment.xml +8 -0
  15. app/design/adminhtml/default/default/template/prescriptionpayment/order/view/tab/info.phtml +140 -0
  16. app/design/adminhtml/default/default/template/prescriptionpayment/order/view/tab/prescriptions.phtml +32 -0
  17. app/design/frontend/default/default/layout/ce_prescriptionpayment.xml +41 -0
  18. app/design/frontend/default/default/template/prescriptionpayment/selectitems.phtml +62 -33
  19. app/locale/de_DE/Ce_PrescriptionPayment.csv +12 -0
  20. package.xml +7 -5
  21. skin/frontend/default/default/css/prescriptionpayment/pp-custom.css +45 -0
  22. skin/frontend/default/default/js/jquery-1.8.3.min.js +2 -0
  23. skin/frontend/default/default/js/jquery-noconflict.js +19 -0
  24. skin/frontend/default/default/js/prescriptionpayment/jquery.form.js +1190 -0
  25. skin/frontend/default/default/js/prescriptionpayment/pp-custom.js +48 -0
app/code/community/Ce/PrescriptionPayment/Block/Adminhtml/Notifications.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
21
+ {
22
+ /**
23
+ * Get the message for a notification shown in the admin panel
24
+ * @return string
25
+ */
26
+ public function getMessage()
27
+ {
28
+ $message = '';
29
+
30
+ if(Mage::getSingleton('prescriptionpayment/prescriptionpayment')->isEnabled()
31
+ && Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getAttributeCode() == ''
32
+ ) {
33
+ $message = $this->__('Please enter the attribute code for the prescription payment method');
34
+ }
35
+
36
+ return $message;
37
+ }
38
+ }
app/code/community/Ce/PrescriptionPayment/Block/Adminhtml/Sales/Order/Prescriptionpayment.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_Prescriptionpayment
21
+ extends Mage_Adminhtml_Block_Sales_Order_View_Info
22
+ {
23
+ public function __construct()
24
+ {
25
+ $this->setTemplate('prescriptionpayment/order/view/tab/prescriptions.phtml');
26
+ }
27
+
28
+ /**
29
+ * Get the prescriptions uploaded for this order
30
+ */
31
+ public function getPrescriptions()
32
+ {
33
+ return "";
34
+ }
35
+ }
app/code/community/Ce/PrescriptionPayment/Block/Adminhtml/Sales/Order/View/Tab/Prescriptions.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: hloesken
5
+ * Date: 16.05.13
6
+ * Time: 16:38
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_View_Tab_Prescriptions
11
+ extends Mage_Adminhtml_Block_Sales_Order_View_Tab_Info
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->setTemplate('prescriptionpayment/order/view/tab/info.phtml');
17
+ }
18
+
19
+ /**
20
+ * Retrieve prescription files block as html
21
+ * @return string
22
+ */
23
+ public function getPrescriptionHtml()
24
+ {
25
+ return Mage::getBlockSingleton('prescriptionpayment/adminhtml_sales_order_prescriptionpayment')->_toHtml();
26
+ }
27
+ }
app/code/community/Ce/PrescriptionPayment/Block/Items.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Block_Items extends Mage_Checkout_Block_Cart
21
+ {
22
+ /**
23
+ * Name of the input field for file uploads
24
+ * Square brackets used for uploading of more than one file
25
+ * @var string
26
+ */
27
+ protected $_fileUploadName = 'file_upload';
28
+
29
+ /**
30
+ * Items for prescription payment
31
+ * @return array Items that can be paid via prescription
32
+ */
33
+ public function getItems()
34
+ {
35
+ $itemsOld = parent::getItems();
36
+ $items = Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getReducedItems($itemsOld);
37
+
38
+ return $items;
39
+ }
40
+
41
+ /**
42
+ * Get the address where the prescription should be send to
43
+ * @return string
44
+ */
45
+ public function getAddress()
46
+ {
47
+ return Mage::getStoreConfig('general/store_information/address');
48
+ }
49
+
50
+
51
+ /**
52
+ * Get allowed file types
53
+ * @return string
54
+ */
55
+ public function getAllowedFileTypes()
56
+ {
57
+ return Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getAllowedFileTypesAsText();
58
+ }
59
+
60
+ /**
61
+ * Check if customer wants to pay by prescription
62
+ * @return boolean
63
+ */
64
+ public function payByPrescription()
65
+ {
66
+ return Ce_PrescriptionPayment_Helper_Data::payByPrescription();
67
+ }
68
+
69
+ /**
70
+ * Check if upload shall be used
71
+ * @return boolean
72
+ */
73
+ public function useUploader()
74
+ {
75
+ return Mage::getSingleton('prescriptionpayment/prescriptionpayment')->useUploader();
76
+ }
77
+
78
+ /**
79
+ * Get the uploader path
80
+ * @return string
81
+ */
82
+ public function getUploaderPath()
83
+ {
84
+ return Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getUploaderPath();
85
+ }
86
+
87
+ /**
88
+ * Get the name of the file upload field
89
+ * @param boolean $brackets Return name w/o brackets
90
+ * @return string
91
+ */
92
+ public function getFileUploadFieldName($brackets=true)
93
+ {
94
+ $name = $this->_fileUploadName;
95
+
96
+ if($this->getFileUploadMultiple() && $brackets === true)
97
+ $name = $name . '[]';
98
+
99
+ return $name;
100
+ }
101
+
102
+ /**
103
+ * Get if multiple files can be uploaded
104
+ * return boolean
105
+ */
106
+ public function getFileUploadMultiple()
107
+ {
108
+ return filter_var(Mage::getStoreConfig('payment/prescriptionpayment/uploader_multiple_files'),
109
+ FILTER_VALIDATE_BOOLEAN);
110
+ }
111
+ }
app/code/community/Ce/PrescriptionPayment/Helper/Data.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Helper_Data extends Mage_Core_Helper_Abstract
21
+ {
22
+ /**
23
+ * Check if customer wants to pay by prescription
24
+ * @return boolean
25
+ */
26
+ public static function payByPrescription()
27
+ {
28
+ $v = Mage::app()->getRequest()->getParam('prescriptionpayment_choose_payment');
29
+
30
+ if((Mage::getSingleton('checkout/session')->getPayByPrescription() != 0
31
+ && !empty($v))
32
+ || !empty($v)
33
+ ) {
34
+ return true;
35
+ }
36
+
37
+ return false;
38
+ }
39
+ }
app/code/community/Ce/PrescriptionPayment/Model/Mysql4/Prescriptionpayment.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Model_Mysql4_Prescriptionpayment extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ $this->_init('prescriptionpayment/prescriptionpayment', 'id');
25
+ }
26
+ }
app/code/community/Ce/PrescriptionPayment/Model/Mysql4/Prescriptionpayment/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Model_Mysql4_Prescriptionpayment_Collection
21
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
22
+ {
23
+ public function _construct()
24
+ {
25
+ $this->_init('prescriptionpayment/prescriptionpayment');
26
+ }
27
+ }
app/code/community/Ce/PrescriptionPayment/Model/Observer.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_Model_Observer
21
+ {
22
+ /**
23
+ * The maximum value of the cart where the payment should work
24
+ * @var string
25
+ */
26
+ private $attributeMaxTotal;
27
+
28
+ /**
29
+ * The minimum value of the cart where the payment should work
30
+ * @var string
31
+ */
32
+ private $attributeMinTotal;
33
+
34
+
35
+ /**
36
+ * Constructor of the class
37
+ * Used to set the settings from the backend
38
+ */
39
+ public function __construct() {
40
+ $this->attributeMaxTotal = Mage::getStoreConfig('payment/prescriptionpayment/max_order_total');
41
+ $this->attributeMinTotal = Mage::getStoreConfig('payment/prescriptionpayment/min_order_total');
42
+ }
43
+
44
+ /**
45
+ * Check if cart has items with consultation overhead.
46
+ * If yes, redirect to new overview page, where you can select which item
47
+ * to pay with prescription payment
48
+ * @param Varien_Event_Observer $observer
49
+ * @return mixed False if no items are found, redirect for further
50
+ * processing
51
+ */
52
+ public function hasItemsForConsultationOverhead($observer)
53
+ {
54
+ // If extension is disabled
55
+ if(!Mage::getSingleton('prescriptionpayment/prescriptionpayment')->isEnabled())
56
+ return false;
57
+
58
+ $cartTotal = Mage::helper('checkout/cart')->getQuote()->getGrandTotal();
59
+
60
+ if($this->attributeMinTotal > $cartTotal
61
+ || ($this->attributeMaxTotal < $cartTotal
62
+ && !empty($this->attributeMaxTotal))
63
+ || Mage::app()->getRequest()->getParam('proceedtocheckout') == 1
64
+ ){
65
+ if(Mage::app()->getRequest()->getParam('proceedtocheckout')) {
66
+ if(Ce_PrescriptionPayment_Helper_Data::payByPrescription()) {
67
+ $this->setCartItemsPriceToZero();
68
+ } else {
69
+ $this->setCartItemsPriceToOriginalPrice();
70
+ }
71
+
72
+ }
73
+ return false;
74
+ }
75
+
76
+ $itemsOld = $this->getCartItems();
77
+ $items = Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getReducedItems($itemsOld);
78
+ if(!empty($items)) {
79
+ Mage::app()->getResponse()->setRedirect(Mage::getUrl('prescriptionpayment/items/select'));
80
+ }
81
+
82
+ return false;
83
+ }
84
+
85
+ /**
86
+ * Recollect totals if user canceled checkout and paid by prescription
87
+ * @param Varien_Event_Observer $observer
88
+ * @return void
89
+ */
90
+ public function recollectTotals($observer)
91
+ {
92
+ if(Mage::getSingleton('checkout/session')->getPayByPrescription() == 1) {
93
+ $this->setCartItemsPriceToOriginalPrice();
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Save the uploaded prescriptions to database
99
+ * @param Varien_Event_Observer $observer
100
+ * @return boolean|mixed If nothing to do, it fires false
101
+ */
102
+ public function saveUploadedPrescriptions($observer)
103
+ {
104
+ if(Mage::getSingleton('prescriptionpayment/prescriptionpayment')->useUploader()) {
105
+ $model = Mage::getSingleton('prescriptionpayment/prescriptionpayment');
106
+ $files = $model->getUploadedFiles();
107
+
108
+ foreach($files as $file) {
109
+
110
+ }
111
+ }
112
+
113
+ return false;
114
+ }
115
+
116
+
117
+ /**
118
+ * Set the value of selected items in cart to 0.00
119
+ * @return void
120
+ */
121
+ protected function setCartItemsPriceToZero()
122
+ {
123
+ /** @var array $arrItemsSelected Selected items for prescription
124
+ * payment
125
+ */
126
+ $arrItemsSelected = Mage::app()->getRequest()->getParam('prescriptionpayment_select');
127
+ $items = $this->getCartItems();
128
+
129
+ /** @var Mage_Sales_Model_Quote $quote */
130
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
131
+
132
+ /** @var Mage_Sales_Model_Quote_Item_ $_item */
133
+ foreach($items as $_item) {
134
+ if(in_array($_item->getId(), $arrItemsSelected))
135
+ {
136
+ $this->setItemPriceAndSave($_item, 0);
137
+ }
138
+ }
139
+
140
+ $quote->setTotalsCollectedFlag(false);
141
+ $quote->collectTotals();
142
+
143
+ // Set value for payment via prescription
144
+ Mage::getSingleton('checkout/session')->setPayByPrescription(1);
145
+ }
146
+
147
+ /**
148
+ * Set the price of an item in cart to its original price from the catalog
149
+ * @return void
150
+ */
151
+ protected function setCartItemsPriceToOriginalPrice()
152
+ {
153
+ $items = $this->getCartItems();
154
+
155
+ /** @var Mage_Sales_Model_Quote $quote */
156
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
157
+
158
+ /** @var Mage_Sales_Model_Quote_Item_ $_item */
159
+ foreach($items as $_item) {
160
+ $this->setItemPriceAndSave($_item, $_item->getProduct()->getPrice());
161
+ }
162
+
163
+ $quote->setTotalsCollectedFlag(false);
164
+ $quote->collectTotals();
165
+
166
+ // Set value for payment via prescription
167
+ Mage::getSingleton('checkout/session')->setPayByPrescription(0);
168
+ }
169
+
170
+
171
+ /**
172
+ * Get all items in cart
173
+ * @return array
174
+ */
175
+ protected function getCartItems()
176
+ {
177
+ return Mage::getSingleton('checkout/session')->getQuote()
178
+ ->getAllItems();
179
+ }
180
+
181
+ /**
182
+ * Set the price of an item and save it
183
+ * @param Mage_Sales_Model_Quote_Item_ $item
184
+ * @param int|float $price
185
+ * @return void
186
+ */
187
+ protected function setItemPriceAndSave($item, $price)
188
+ {
189
+ $item->setPrice($price)
190
+ ->setCustomPrice($price)
191
+ ->setBaseOriginalPrice($price)
192
+ ->setOriginalCustomPrice($price)
193
+ ->save();
194
+ $item->getProduct()->setIsSuperMode(true);
195
+ $item->save();
196
+ }
197
+ }
app/code/community/Ce/PrescriptionPayment/Model/Prescriptionpayment.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+ class Ce_PrescriptionPayment_Model_Prescriptionpayment
20
+ extends Mage_Payment_Model_Method_Cc
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ *
25
+ * @var string [a-z0-9_]
26
+ */
27
+ protected $_code = 'prescriptionpayment';
28
+
29
+ /**
30
+ * Specify if the extension is enabled
31
+ * @var string
32
+ */
33
+ protected $_isEnabled;
34
+
35
+ /**
36
+ * The internal name of the attribute, this has to be the same as the
37
+ * internal name of the attribute
38
+ * @var string
39
+ */
40
+ protected $_attributeCode;
41
+
42
+ /**
43
+ * Prefer the settings of configurable product instead of single product
44
+ * @var string
45
+ */
46
+ protected $_useConfigurableProductSetting;
47
+
48
+ /**
49
+ * Use the uploader in frontend
50
+ * @var string
51
+ */
52
+ protected $_useUploader;
53
+
54
+ /**
55
+ * Path where uploads are saved
56
+ * @var string
57
+ */
58
+ protected $_uploaderPath;
59
+
60
+ /**
61
+ * Allowed file types for upload
62
+ * @var string
63
+ */
64
+ protected $_allowedFileTypes;
65
+
66
+ /**
67
+ * Files that has been uploaded
68
+ * @var array()
69
+ */
70
+ protected $_filesUploaded;
71
+
72
+ /**
73
+ * Constructor of the class
74
+ * Used to set the settings from the backend
75
+ */
76
+ public function __construct()
77
+ {
78
+ $this->_isEnabled = Mage::getStoreConfig('payment/prescriptionpayment/active');
79
+ $this->_attributeCode = Mage::getStoreConfig('payment/prescriptionpayment/attribute_code');
80
+ $this->_useConfigurableProductSetting = Mage::getStoreConfig('payment/prescriptionpayment/use_configurable_product');
81
+ $this->_useUploader = Mage::getStoreConfig('payment/prescriptionpayment/use_uploader');
82
+ $this->_allowedFileTypes = Mage::getStoreConfig('payment/prescriptionpayment/uploader_file_extensions');
83
+ $this->_uploaderPath = Mage::getBaseDir('media') . DS . 'prescriptionpayment' . DS;
84
+ }
85
+
86
+ /**
87
+ * Reduces the cart items to only these with consultation overhead
88
+ * @param $items
89
+ * @return array
90
+ */
91
+ public function getReducedItems($items)
92
+ {
93
+ foreach($items as $_key => $_item) {
94
+ $_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getSku());
95
+
96
+ // Load setting from configurable product
97
+ if($_product->getTypeId() == 'simple'
98
+ && $this->_useConfigurableProductSetting
99
+ && $pId = $this->getConfigurableProductId($_product)
100
+ ){
101
+ $_product = Mage::getModel('catalog/product')->load($pId);
102
+ }
103
+
104
+ // Value of attribute, usually '1' if selected/true
105
+ $attrSelect = $_product->getData($this->_attributeCode);
106
+
107
+ if ($attrSelect == 0) {
108
+ unset($items[$_key]);
109
+ }
110
+ }
111
+
112
+ return $items;
113
+ }
114
+
115
+ /**
116
+ * Check if a product has a parent configurable product
117
+ * @param Mage_Catalog_Model_Product $_product
118
+ * @return mixed Return the id of parent product or false if no parent
119
+ * product exists
120
+ */
121
+ public function getConfigurableProductId($_product)
122
+ {
123
+ $parentId = Mage::getModel('catalog/product_type_configurable')
124
+ ->getParentIdsByChild($_product->getId());
125
+
126
+ if(!empty($parentId[0]))
127
+ return $parentId[0];
128
+
129
+ return false;
130
+ }
131
+
132
+ /**
133
+ * Get if payment method is enabled
134
+ * return boolean
135
+ */
136
+ public function isEnabled()
137
+ {
138
+ return filter_var($this->_isEnabled, FILTER_VALIDATE_BOOLEAN);
139
+ }
140
+
141
+ /**
142
+ * Get the attribute code that is used to identify the items that should be paid via this method
143
+ * @return string
144
+ */
145
+ public function getAttributeCode()
146
+ {
147
+ return $this->_attributeCode;
148
+ }
149
+
150
+ /**
151
+ * Get the setting if uploader should be used
152
+ * @return boolean
153
+ */
154
+ public function useUploader()
155
+ {
156
+ return filter_var($this->_useUploader, FILTER_VALIDATE_BOOLEAN);
157
+ }
158
+
159
+ /**
160
+ * Get the uploader path
161
+ * @return string
162
+ */
163
+ public function getUploaderPath()
164
+ {
165
+ return $this->_uploaderPath;
166
+ }
167
+
168
+ /**
169
+ * Get allowed file types as text
170
+ * @return string
171
+ */
172
+ public function getAllowedFileTypesAsText()
173
+ {
174
+ return (string)$this->_allowedFileTypes;
175
+ }
176
+
177
+ /**
178
+ * Get allowed uploader file types as array
179
+ * @return array
180
+ */
181
+ public function getAllowedFilesTypesAsArray()
182
+ {
183
+ $fTypesArr = array();
184
+
185
+ if(!empty($this->_allowedFileTypes)) {
186
+ $fTypesArr = preg_split('/[,;]/', $this->_allowedFileTypes);
187
+ }
188
+
189
+ return $fTypesArr;
190
+ }
191
+
192
+ /**
193
+ * Add an uploaded file to array
194
+ * @param string filename
195
+ * @return void
196
+ */
197
+ public function addUploadedFile($fileName)
198
+ {
199
+ $this->_filesUploaded[] = $fileName;
200
+ }
201
+
202
+ /**
203
+ * Get all files that have been uploaded
204
+ * @return array
205
+ */
206
+ public function getUploadedFiles()
207
+ {
208
+ return $this->_filesUploaded;
209
+ }
210
+ }
app/code/community/Ce/PrescriptionPayment/controllers/ItemsController.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ class Ce_PrescriptionPayment_ItemsController
21
+ extends Mage_Core_Controller_Front_Action
22
+ {
23
+ /**
24
+ * Checking if user is logged in or not
25
+ * If not logged in then redirect to customer login
26
+ */
27
+ public function preDispatch()
28
+ {
29
+ parent::preDispatch();
30
+
31
+ if (!Mage::getSingleton('customer/session')->authenticate($this)) {
32
+ $this->setFlag('', 'no-dispatch', true);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Select the items which shall be paid by prescription
38
+ * @return $this
39
+ */
40
+ public function selectAction()
41
+ {
42
+ $this->loadLayout();
43
+ $this->renderLayout();
44
+ }
45
+
46
+ /**
47
+ * Upload prescriptions
48
+ * @return void
49
+ */
50
+ public function uploadAction()
51
+ {
52
+ if ($this->getRequest()->isXmlHttpRequest()
53
+ && !empty($_FILES)
54
+ ) {
55
+ $type = Mage::getBlockSingleton('prescriptionpayment/items')->getFileUploadFieldName(false);
56
+
57
+ if(Mage::getBlockSingleton('prescriptionpayment/items')->getFileUploadMultiple()) {
58
+ // Multiple file upload
59
+ $reorderedFiles = $this->_diverseArray($_FILES[$type]);
60
+
61
+ foreach($reorderedFiles as $f) {
62
+ $this->_uploadFiles($f, $f['name']);
63
+ }
64
+
65
+ } else {
66
+ // Single file upload
67
+ $this->_uploadFiles($type, $_FILES[$type]['name']);
68
+ }
69
+
70
+
71
+
72
+ }
73
+ }
74
+
75
+
76
+ protected function _uploadFiles($files, $fileName)
77
+ {
78
+ $path = Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getUploaderPath();
79
+ $fTypesArr = Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getAllowedFilesTypesAsArray();
80
+
81
+ try{
82
+ $uploader = new Varien_File_Uploader($files);
83
+ // Allows only files defined in backend
84
+ $uploader->setAllowedExtensions($fTypesArr);
85
+ // Can create uploader folder
86
+ $uploader->setAllowCreateFolders(true);
87
+ $uploader->setAllowRenameFiles(true);
88
+ $uploader->setFilesDispersion(true);
89
+ $uploader->save($path, $fileName);
90
+ $targetFilename = $uploader->getUploadedFileName();
91
+
92
+ // Add file to model
93
+ Mage::getSingleton('prescriptionpayment/prescriptionpayment')->addUploadedFile($targetFilename);
94
+
95
+ Mage::log("\n___" . 'File (' . $targetFilename . ') uploaded!' . "___\n");
96
+ }
97
+ catch (Exception $e)
98
+ {
99
+ Mage::log('Upload File: ' . $e->getCode() . ' : ' . $e->getMessage());
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Reorder array for use with Magento uploader... grrrr :-(
105
+ * @param array $files
106
+ * @return array Reordered array
107
+ */
108
+ protected function _diverseArray($files)
109
+ {
110
+ $result = array();
111
+ foreach($files as $key1 => $value1)
112
+ foreach($value1 as $key2 => $value2)
113
+ $result[$key2][$key1] = $value2;
114
+ return $result;
115
+ }
116
+ }
app/code/community/Ce/PrescriptionPayment/etc/config.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ce_PrescriptionPayment>
5
+ <version>0.1.0</version>
6
+ </Ce_PrescriptionPayment>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <prescriptionpayment>
11
+ <class>Ce_PrescriptionPayment_Model</class>
12
+ <resourceModel>prescriptionpayment_mysql4</resourceModel>
13
+ </prescriptionpayment>
14
+ <prescriptionpayment_mysql4>
15
+ <class>Ce_PrescriptionPayment_Model_Mysql4</class>
16
+ <entities>
17
+ <prescriptionpayment>
18
+ <table>prescriptionpayment</table>
19
+ </prescriptionpayment>
20
+ </entities>
21
+ </prescriptionpayment_mysql4>
22
+ </models>
23
+ <helpers>
24
+ <prescriptionpayment>
25
+ <class>Ce_PrescriptionPayment_Helper</class>
26
+ </prescriptionpayment>
27
+ </helpers>
28
+ <blocks>
29
+ <prescriptionpayment>
30
+ <class>Ce_PrescriptionPayment_Block</class>
31
+ </prescriptionpayment>
32
+ <adminhtml>
33
+ <rewrite>
34
+ <sales_order_view_tab_info>Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_View_Tab_Prescriptions</sales_order_view_tab_info>
35
+ <sales_order_view_info>Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_Prescriptionpayment</sales_order_view_info>
36
+ </rewrite>
37
+ </adminhtml>
38
+ </blocks>
39
+ <resources>
40
+ <prescriptionpayment_setup>
41
+ <setup>
42
+ <module>Ce_PrescriptionPayment</module>
43
+ </setup>
44
+ <connection>
45
+ <use>core_setup</use>
46
+ </connection>
47
+ </prescriptionpayment_setup>
48
+ <prescriptionpayment_write>
49
+ <connection>
50
+ <use>core_write</use>
51
+ </connection>
52
+ </prescriptionpayment_write>
53
+ <prescriptionpayment_read>
54
+ <connection>
55
+ <use>core_read</use>
56
+ </connection>
57
+ </prescriptionpayment_read>
58
+ </resources>
59
+ <events>
60
+ <controller_action_predispatch_checkout_onepage_index>
61
+ <observers>
62
+ <prescriptionpayment>
63
+ <type>singleton</type>
64
+ <class>Ce_PrescriptionPayment_Model_Observer</class>
65
+ <method>hasItemsForConsultationOverhead</method>
66
+ </prescriptionpayment>
67
+ </observers>
68
+ </controller_action_predispatch_checkout_onepage_index>
69
+ <controller_action_predispatch_checkout_cart_index>
70
+ <observers>
71
+ <prescriptionpayment>
72
+ <type>singleton</type>
73
+ <class>Ce_PrescriptionPayment_Model_Observer</class>
74
+ <method>recollectTotals</method>
75
+ </prescriptionpayment>
76
+ </observers>
77
+ </controller_action_predispatch_checkout_cart_index>
78
+ <checkout_onepage_controller_success_action>
79
+ <observers>
80
+ <prescriptionpayment>
81
+ <type>singleton</type>
82
+ <class>Ce_PrescriptionPayment_Model_Observer</class>
83
+ <method>saveUploadedPrescriptions</method>
84
+ </prescriptionpayment>
85
+ </observers>
86
+ </checkout_onepage_controller_success_action>
87
+ </events>
88
+ </global>
89
+ <adminhtml>
90
+ <translate>
91
+ <modules>
92
+ <Ce_PrescriptionPayment>
93
+ <files>
94
+ <default>Ce_PrescriptionPayment.csv</default>
95
+ </files>
96
+ </Ce_PrescriptionPayment>
97
+ </modules>
98
+ </translate>
99
+ <layout>
100
+ <updates>
101
+ <index>
102
+ <file>ce_prescriptionpayment.xml</file>
103
+ </index>
104
+ </updates>
105
+ </layout>
106
+ </adminhtml>
107
+ <frontend>
108
+ <translate>
109
+ <modules>
110
+ <Ce_PrescriptionPayment>
111
+ <files>
112
+ <default>Ce_PrescriptionPayment.csv</default>
113
+ </files>
114
+ </Ce_PrescriptionPayment>
115
+ </modules>
116
+ </translate>
117
+ <routers>
118
+ <prescriptionpayment>
119
+ <use>standard</use>
120
+ <args>
121
+ <module>Ce_PrescriptionPayment</module>
122
+ <frontName>prescriptionpayment</frontName>
123
+ </args>
124
+ </prescriptionpayment>
125
+ </routers>
126
+ <layout>
127
+ <updates>
128
+ <prescriptionpayment>
129
+ <file>ce_prescriptionpayment.xml</file>
130
+ </prescriptionpayment>
131
+ </updates>
132
+ </layout>
133
+ </frontend>
134
+ <default>
135
+ <payment>
136
+ <prescriptionpayment>
137
+ <active>1</active>
138
+ <model>prescriptionpayment/prescriptionpayment</model>
139
+ <order_status>pending</order_status>
140
+ <title>Rezeptbezahlung</title>
141
+ <allowspecific>0</allowspecific>
142
+ <form_block_type>0</form_block_type>
143
+ <min_order_total>0</min_order_total>
144
+ <max_order_total>0</max_order_total>
145
+ </prescriptionpayment>
146
+ </payment>
147
+ </default>
148
+ </config>
app/code/community/Ce/PrescriptionPayment/etc/system.xml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <prescriptionpayment translate="label" module="payment">
7
+ <label>Prescription Payment</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>2</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <attribute_code translate="label">
32
+ <label>Attribute code</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>30</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
+ </attribute_code>
39
+ <use_configurable_product>
40
+ <label>Use configurable product settings</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>adminhtml/system_config_source_yesno</source_model>
43
+ <sort_order>40</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
+ <comment>Prefer the configuration of configurable product instead of single product</comment>
48
+ </use_configurable_product>
49
+ <use_uploader translate="label">
50
+ <label>Use uploader</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>45</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </use_uploader>
58
+ <uploader_file_extensions translate="label">
59
+ <label>File extensions</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>50</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </uploader_file_extensions>
66
+ <uploader_multiple_files translate="label">
67
+ <label>Upload multiple files</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>55</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </uploader_multiple_files>
75
+ <min_order_total>
76
+ <label>Minimum Order Total</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>71</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </min_order_total>
83
+ <max_order_total>
84
+ <label>Maximum Order Total</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>72</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </max_order_total>
91
+ </fields>
92
+ </prescriptionpayment>
93
+ </groups>
94
+ </payment>
95
+ </sections>
96
+ </config>
app/code/community/Ce/PrescriptionPayment/sql/prescriptionpayment_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ */
19
+
20
+ $installer = $this;
21
+
22
+ $installer->startSetup();
23
+
24
+ $installer->run("
25
+
26
+ DROP TABLE IF EXISTS {$this->getTable('prescriptionpayment')};
27
+ CREATE TABLE {$this->getTable('prescriptionpayment')} (
28
+ `id` int(11) unsigned NOT NULL auto_increment,
29
+ `order_id` int(11) NOT NULL default 0,
30
+ `file` varchar(50) NOT NULL default '',
31
+ `created_time` datetime NULL,
32
+ `update_time` datetime NULL,
33
+ PRIMARY KEY (`id`)
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
35
+ ");
36
+
37
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/ce_prescriptionpayment.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="notifications">
5
+ <block type="prescriptionpayment/adminhtml_notifications" name="prescriptionpayment_notifications" template="prescriptionpayment/notifications.phtml"/>
6
+ </reference>
7
+ </default>
8
+ </layout>
app/design/adminhtml/default/default/template/prescriptionpayment/order/view/tab/info.phtml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ *
26
+ * @see Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_View_Tab_Prescriptions
27
+ */
28
+ ?>
29
+ <?php /** @var $this Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_View_Tab_Prescriptions */ ?>
30
+ <?php $_order = $this->getOrder() ?>
31
+ <div>32132132
32
+ <div id="order-messages">
33
+ <?php echo $this->getChildHtml('order_messages') ?>
34
+ </div>
35
+ <?php echo $this->getChildHtml('order_info') ?>
36
+ <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
37
+ <?php if ($_order->getIsVirtual()): ?>
38
+ <div class="box-right">
39
+ <?php else: ?>
40
+ <div class="box-left">
41
+ <?php endif; ?>
42
+ <!--Payment Method-->
43
+ <div class="entry-edit">
44
+ <div class="entry-edit-head">
45
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
46
+ </div>
47
+ <fieldset>
48
+ <?php echo $this->getPaymentHtml() ?>
49
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
50
+ </fieldset>
51
+ </div>
52
+ </div>
53
+ <?php if (!$_order->getIsVirtual()): ?>
54
+ <div class="box-right">
55
+ <!--Shipping Method-->
56
+ <div class="entry-edit">
57
+ <div class="entry-edit-head">
58
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
59
+ </div>
60
+ <fieldset>
61
+ <?php if ($_order->getTracksCollection()->count()) : ?>
62
+ <a href="#" id="linkId"
63
+ onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"
64
+ title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
65
+ <br/>
66
+ <?php endif; ?>
67
+ <?php if ($_order->getShippingDescription()): ?>
68
+ <strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
69
+
70
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
71
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
72
+ <?php else: ?>
73
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
74
+ <?php endif; ?>
75
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
76
+
77
+ <?php echo $_excl; ?>
78
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
79
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
80
+ <?php endif; ?>
81
+ <?php else: ?>
82
+ <?php echo $this->helper('sales')->__('No shipping information available'); ?>
83
+ <?php endif; ?>
84
+ </fieldset>
85
+ </div>
86
+ </div>
87
+ <?php endif; ?>
88
+ <div class="clear"></div>
89
+ <?php echo $this->getGiftOptionsHtml() ?>
90
+ <div class="clear"></div>
91
+ <div class="entry-edit">
92
+ <div class="entry-edit-head">
93
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
94
+ </div>
95
+ </div>
96
+ <?php echo $this->getItemsHtml() ?>
97
+ <div class="clear"></div>
98
+
99
+ <div class="box-left">
100
+ <div class="entry-edit">
101
+ <div class="entry-edit-head">
102
+ <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
103
+ </div>
104
+ <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
105
+ </div>
106
+ </div>
107
+ <div class="box-right entry-edit">
108
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
109
+ <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
110
+ </div>
111
+ <div class="clear"></div>
112
+ <?php echo $this->getPrescriptionHtml(); ?>
113
+ </div>
114
+
115
+ <?php echo $this->getChildHtml('popup_window'); ?>
116
+ <script type="text/javascript">
117
+ //<![CDATA[
118
+ /**
119
+ * Retrieve gift options tooltip content
120
+ */
121
+ function getGiftOptionsTooltipContent(itemId) {
122
+ var contentLines = [];
123
+ var headerLine = null;
124
+ var contentLine = null;
125
+
126
+ $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
127
+ if (element.down(0)) {
128
+ headerLine = element.down(0).innerHTML;
129
+ contentLine = element.down(0).next().innerHTML;
130
+ if (contentLine.length > 30) {
131
+ contentLine = contentLine.slice(0, 30) + '...';
132
+ }
133
+ contentLines.push(headerLine + ' ' + contentLine);
134
+ }
135
+ });
136
+ return contentLines.join('<br/>');
137
+ }
138
+ giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
139
+ //]]>
140
+ </script>
app/design/adminhtml/default/default/template/prescriptionpayment/order/view/tab/prescriptions.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @package Ce_PrescriptionPayment
16
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
17
+ * @author Holger Lösken <post@codedge.de>
18
+ *
19
+ *
20
+ * @see Ce_PrescriptionPayment_Block_Adminhtml_Sales_Order_Prescriptionpayment
21
+ */
22
+ ?>
23
+
24
+ <div class="entry-edit">
25
+ <div class="entry-edit-head">
26
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('prescriptionpayment')->__('Prescriptions') ?></h4>
27
+ </div>
28
+ <fieldset>
29
+ <?php echo Mage::helper('prescriptionpayment')->__('Uploaded files') ?>:
30
+ </fieldset>
31
+ </div>
32
+ <div class="clear"></div>
app/design/frontend/default/default/layout/ce_prescriptionpayment.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+ <prescriptionpayment_items_select>
4
+ <reference name="head">
5
+ <block type="page/html_head" name="jquery-prescriptionpayment">
6
+ <action method="addItem"><type>skin_js</type><name>js/jquery-1.8.3.min.js</name></action>
7
+ <action method="addItem"><type>skin_js</type><name>js/jquery-noconflict.js</name></action>
8
+ <action method="addItem"><type>skin_js</type><name>js/prescriptionpayment/pp-custom.js</name></action>
9
+ <action method="addItem"><type>skin_js</type><name>js/prescriptionpayment/jquery.form.js</name></action>
10
+ <action method="addItem"><type>skin_css</type><name>css/prescriptionpayment/pp-custom.css</name></action>
11
+ </block>
12
+ </reference>
13
+ <reference name="root">
14
+ <action method="setTemplate">
15
+ <template>page/1column.phtml</template>
16
+ </action>
17
+ </reference>
18
+ <reference name="content">
19
+ <block type="prescriptionpayment/items" name="prescriptionpayment_items_select" template="prescriptionpayment/selectitems.phtml">
20
+ <action method="setCartTemplate"><value>prescriptionpayment/selectitems.phtml</value></action>
21
+ <action method="chooseTemplate"/>
22
+ <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>prescriptionpayment/item/default.phtml</template></action>
23
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>prescriptionpayment/item/default.phtml</template></action>
24
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>prescriptionpayment/item/default.phtml</template></action>
25
+ <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
26
+ <label>Payment Methods Before Checkout Button</label>
27
+ <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="prescriptionpayment/onepage_link.phtml"/>
28
+ </block>
29
+ <block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
30
+ <label>Shopping Cart Form Before</label>
31
+ </block>
32
+ <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
33
+ <label>Payment Methods After Checkout Button</label>
34
+ <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="prescriptionpayment/onepage_link.phtml"/>
35
+ <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
36
+ </block>
37
+ <block type="prescriptionpayment/items" name="prescriptionpayment.choose.payment" as="choosepayment" template="prescriptionpayment/choose_payment.phtml" />
38
+ </block>
39
+ </reference>
40
+ </prescriptionpayment_items_select>
41
+ </layout>
app/design/frontend/default/default/template/prescriptionpayment/selectitems.phtml CHANGED
@@ -36,9 +36,14 @@
36
  </ul>
37
  <?php endif; ?>
38
  </div>
 
 
 
 
 
39
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
40
  <?php echo $this->getChildHtml('form_before') ?>
41
- <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
42
  <?php echo $this->getChildHtml('choosepayment') ?>
43
  <fieldset>
44
  <table id="shopping-cart-table" class="data-table cart-table">
@@ -102,51 +107,75 @@
102
  <script type="text/javascript">decorateTable('shopping-cart-table')</script>
103
  </fieldset>
104
  </form>
105
- <div class="cart-collaterals">
106
  <div class="col2-set">
107
  <div class="block block-prescriptionpayment hint">
108
  <div class="block-title">
109
- <h3><strong>Hinweis zur Rezeptbezahlung</strong></h3>
110
  </div>
111
  <div class="block-content">
112
  <p class="empty">
113
  <strong>
114
  <?php echo $this->__('Please send the prescriptions for the selected items to the following address') ?>:
115
  </strong><br />
116
- <?php echo nl2br(Mage::getStoreConfig('general/store_information/address')); ?>
117
  <br /><br />
118
- Der Versand kann erst erfolgen, wenn das Rezept sowie der zu zahlende Restbetrag bei uns eingegangen ist.
119
  </p>
120
  </div>
121
  </div>
122
  </div>
123
- </div>
124
- </div>
125
-
126
- <script type="text/javascript">
127
- if (typeof jQuery != 'undefined') {
128
- jQuery(document).ready(function() {
129
- // Check radio buttons after load
130
- if(jQuery("input[name='prescriptionpayment_choose_payment']:checked").val() == 0) {
131
- jQuery('#prescriptionpayment-form fieldset, .block-prescriptionpayment').css('display', 'none');
132
- } else {
133
- jQuery('#prescriptionpayment-form fieldset, .block-prescriptionpayment').css('display', 'block');
134
- }
135
-
136
- jQuery("input[name='prescriptionpayment_choose_payment']").click(function() {
137
- if(jQuery(this).val() == 0) {
138
- jQuery('#prescriptionpayment-form fieldset, .block-prescriptionpayment').css('display', 'none');
139
- } else {
140
- jQuery('#prescriptionpayment-form fieldset, .block-prescriptionpayment').css('display', 'block');
141
- }
142
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
- // Select all items
145
- jQuery("button[name='select_all_prescription']").click(function() {
146
- jQuery('#prescriptionpayment-form').find(':checkbox').each(function () {
147
- jQuery(this).prop('checked', 'checked');
 
 
 
 
 
 
 
 
148
  });
149
- });
150
- });
151
- }
152
- </script>
 
36
  </ul>
37
  <?php endif; ?>
38
  </div>
39
+ <div class="block">
40
+ <p class="empty">
41
+ <?php echo $this->__('For the following articles it is possible to pay them by prescription') ?>.
42
+ </p>
43
+ </div>
44
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
45
  <?php echo $this->getChildHtml('form_before') ?>
46
+ <form id="prescriptionpayment-form" action="<?php echo $this->getUrl('checkout/onepage') ?>" method="post">
47
  <?php echo $this->getChildHtml('choosepayment') ?>
48
  <fieldset>
49
  <table id="shopping-cart-table" class="data-table cart-table">
107
  <script type="text/javascript">decorateTable('shopping-cart-table')</script>
108
  </fieldset>
109
  </form>
110
+ <div class="cart-collaterals prescriptionpayment">
111
  <div class="col2-set">
112
  <div class="block block-prescriptionpayment hint">
113
  <div class="block-title">
114
+ <h3><strong><?php echo $this->__('Notice') ?></strong></h3>
115
  </div>
116
  <div class="block-content">
117
  <p class="empty">
118
  <strong>
119
  <?php echo $this->__('Please send the prescriptions for the selected items to the following address') ?>:
120
  </strong><br />
121
+ <?php echo nl2br($this->getAddress()); ?>
122
  <br /><br />
123
+ <?php echo $this->__('Delivery essentially only takes place after your prescriptions and payment is received') ?>.
124
  </p>
125
  </div>
126
  </div>
127
  </div>
128
+ <?php if($this->useUploader()) : ?>
129
+ <div class="upload-prescription totals">
130
+ <form id="pp-upload-form" name="pp-upload-form" method="post" enctype="multipart/form-data" action="<?php echo $this->getUrl('prescriptionpayment/items/upload')?>">
131
+ <div class="block block-upload-prescriptions">
132
+ <div class="block-title">
133
+ <h3 class="left"><strong><?php echo $this->__('Upload prescriptions') ?></strong></h3>
134
+ <?php if($this->getFileUploadMultiple()) : ?>
135
+ <span class="right add">+</span>
136
+ <?php endif ?>
137
+ <div class="clearer"></div>
138
+ </div>
139
+ <div class="block-content">
140
+ <p class="empty">
141
+ <span class="fileLbl"><?php echo $this->__('File')?>:</span>&nbsp;<input type="file" name="<?php echo $this->getFileUploadFieldName(); ?>" />
142
+ <button type="submit" title="Save"><span><?php echo $this->__('Submit')?></span></button><br />
143
+ <span class="accepted-file-types">
144
+ <?php echo $this->__('Only the following file types are accepted: %s', $this->getAllowedFileTypes()); ?>
145
+ </span>
146
+ </p>
147
+ </div>
148
+ </div>
149
+ </form>
150
+ </div>
151
+ <script type="text/javascript">
152
+ // <![CDATA[
153
+ jQuery(document).ready(function() {
154
+ // Submit form via ajax
155
+ jQuery('#pp-upload-form').ajaxForm({
156
+ success: function() {
157
+ jQuery('.block-upload-prescriptions .block-content .empty')
158
+ .find('span.fileLbl:gt(0), input[type="file"]:gt(0)').remove();
159
+ jQuery('.block-upload-prescriptions .block-content .empty')
160
+ .find('input[name="<?php echo $this->getFileUploadFieldName(); ?>"]').val('');
161
+ }
162
+ });
163
 
164
+ // Adding new input fields
165
+ jQuery('.block-upload-prescriptions .add').click(function() {
166
+ jQuery('<br />').insertBefore('#pp-upload-form button[type="submit"]');
167
+ jQuery('<span />', {
168
+ text: '<?php echo $this->__('File')?>:',
169
+ class: 'fileLbl'
170
+ }).insertBefore('#pp-upload-form button[type="submit"]');
171
+ jQuery('<input>').attr({
172
+ type: 'file',
173
+ name: '<?php echo $this->getFileUploadFieldName(); ?>'
174
+ }).insertBefore('#pp-upload-form button[type="submit"]');
175
+ });
176
  });
177
+ // ]]>
178
+ </script>
179
+ <?php endif ?>
180
+ </div>
181
+ </div>
app/locale/de_DE/Ce_PrescriptionPayment.csv CHANGED
@@ -3,7 +3,11 @@
3
  "Attribute option label for 'Yes'","Bezeichnung der Option für 'Ja'"
4
  "Back to shopping cart","Zurück zum Warenkorb"
5
  "Choose your products for prescription payment","Wählen Sie Ihre Produkte für die Rezeptbezahlung"
 
6
  "Do you want to pay by prescription?","Möchten Sie per Rezept bezahlen?"
 
 
 
7
  "For the following articles it is possible to pay them by prescription","Für folgende Artikel ist es möglich, diese als Sprechstundenbedarf SGB per Rezept zu bezahlen"
8
  "Prescription Payment","Rezeptbezahlung"
9
  "Sort order","Reihenfolge"
@@ -17,12 +21,20 @@
17
  "New order status","Status neuer Bestellungen"
18
  "No","Nein"
19
  "No, I don't want to pay by prescription","Nein, ich möchte nicht per Rezept bezahlen"
 
 
20
  "Please send the prescriptions for the selected items to the following address","Bitte senden Sie das Rezept für die ausgewählten Sprechstundenbedarfsartikel an folgende Adresse"
 
21
  "Select all","Alle auswählen"
22
  "Select item for prescription payment","Produkt für Rezeptbezahlung auswählen"
23
  "Select all items for prescription payment","Alle Produkte für Rezeptbezahlung auswählen"
24
  "Set the label for the attribute option when it is 'true'","Setzen Sie hier den Wert, wenn die Option 'wahr' ist"
 
25
  "Title","Titel"
 
 
 
26
  "Use configurable product settings","Einstellung des konfigurierbaren Produktes nutzen"
 
27
  "Yes","Ja"
28
  "Yes, I want to pay by prescription","Ja, ich möchte per Rezept bezahlen"
3
  "Attribute option label for 'Yes'","Bezeichnung der Option für 'Ja'"
4
  "Back to shopping cart","Zurück zum Warenkorb"
5
  "Choose your products for prescription payment","Wählen Sie Ihre Produkte für die Rezeptbezahlung"
6
+ "Delivery essentially only takes place after your prescriptions and payment is received","Der Versand kann erst erfolgen, wenn das Rezept sowie der zu zahlende Restbetrag bei uns eingegangen ist"
7
  "Do you want to pay by prescription?","Möchten Sie per Rezept bezahlen?"
8
+ "Enabled","Aktiviert"
9
+ "File", "Datei"
10
+ "File extensions","Dateitypen"
11
  "For the following articles it is possible to pay them by prescription","Für folgende Artikel ist es möglich, diese als Sprechstundenbedarf SGB per Rezept zu bezahlen"
12
  "Prescription Payment","Rezeptbezahlung"
13
  "Sort order","Reihenfolge"
21
  "New order status","Status neuer Bestellungen"
22
  "No","Nein"
23
  "No, I don't want to pay by prescription","Nein, ich möchte nicht per Rezept bezahlen"
24
+ "Notice","Hinweis zur Rezeptbezahlung"
25
+ "Only the following file types are accepted: %s","Folgende Dateitypen werden akzeptiert: %s"
26
  "Please send the prescriptions for the selected items to the following address","Bitte senden Sie das Rezept für die ausgewählten Sprechstundenbedarfsartikel an folgende Adresse"
27
+ "Prescriptions","Rezepte"
28
  "Select all","Alle auswählen"
29
  "Select item for prescription payment","Produkt für Rezeptbezahlung auswählen"
30
  "Select all items for prescription payment","Alle Produkte für Rezeptbezahlung auswählen"
31
  "Set the label for the attribute option when it is 'true'","Setzen Sie hier den Wert, wenn die Option 'wahr' ist"
32
+ "Submit","Absenden"
33
  "Title","Titel"
34
+ "Upload prescriptions","Rezepte hochladen"
35
+ "Uploaded files","Hochgeladene Dateien"
36
+ "Upload multiple files","Mehrere Dateien hochladen"
37
  "Use configurable product settings","Einstellung des konfigurierbaren Produktes nutzen"
38
+ "Use uploader","Uploader benutzen"
39
  "Yes","Ja"
40
  "Yes, I want to pay by prescription","Ja, ich möchte per Rezept bezahlen"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PrescriptionPayment</name>
4
- <version>0.0.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
@@ -9,12 +9,14 @@
9
  <summary>This extension enables the shop owner to let the customer select which items shall be paid via a prescription.</summary>
10
  <description>This is a payment method extension for the ecommerce platform Magento. Use it preferably if you maintain a shop for medical things where it should be possible to pay via a prescription.&#xD;
11
  &#xD;
 
 
12
  It enables the shop owner to let the customer select which items shall be paid via a prescription. Those items value will be set to 0.00. All other items can be paid via other payment methods (f. ex. PayPal).</description>
13
  <notes>Stable version. Please check https://github.com/codedge/prescriptionpayment for updates</notes>
14
- <authors><author><name>Holger L&#xF6;sken</name><user>cod2edge</user><email>post@codedge.de</email></author></authors>
15
- <date>2013-05-12</date>
16
- <time>19:43:41</time>
17
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="prescriptionpayment"><file name="notifications.phtml" hash="3bc8c15a8be0a7beb42578ea3747b3f2"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="prescriptionpayment"><file name="choose_payment.phtml" hash="293339e56babbfbfa6440b9f5c2aeeed"/><dir name="item"><file name="default.phtml" hash="5fd5f616a714102c5fc55ffb7fa4ae37"/></dir><file name="onepage_link.phtml" hash="80beb697df60eae9a012561553354bdd"/><file name="selectitems.phtml" hash="4d6b8bcf0db5e2b199defb8c9ad49703"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Ce_PrescriptionPayment.csv" hash="5deab60afac98eb4eb4893d056dc24dd"/></dir></target><target name="mageetc"><dir name="modules"><file name="Ce_PrescriptionPayment.xml" hash="00be1ebba9d1706e92c55f18eea40e70"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>5.4.9</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PrescriptionPayment</name>
4
+ <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
9
  <summary>This extension enables the shop owner to let the customer select which items shall be paid via a prescription.</summary>
10
  <description>This is a payment method extension for the ecommerce platform Magento. Use it preferably if you maintain a shop for medical things where it should be possible to pay via a prescription.&#xD;
11
  &#xD;
12
+ &#xD;
13
+ &#xD;
14
  It enables the shop owner to let the customer select which items shall be paid via a prescription. Those items value will be set to 0.00. All other items can be paid via other payment methods (f. ex. PayPal).</description>
15
  <notes>Stable version. Please check https://github.com/codedge/prescriptionpayment for updates</notes>
16
+ <authors><author><name>Holger L&#xF6;sken</name><user>codedge</user><email>post@codedge.de</email></author></authors>
17
+ <date>2013-05-17</date>
18
+ <time>11:32:45</time>
19
+ <contents><target name="magecommunity"><dir name="Ce"><dir name="PrescriptionPayment"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="b704ed2bdd65b4ce3a4a0c26d2747d2c"/><dir name="Sales"><dir name="Order"><file name="Prescriptionpayment.php" hash="2bcf9c3c10e910460f809e50179b2ee3"/><dir name="View"><dir name="Tab"><file name="Prescriptions.php" hash="a8d9e2e4cf0fcb248252574515df77c5"/></dir></dir></dir></dir></dir><file name="Items.php" hash="bded2c200295547d495c719c27d01d67"/></dir><dir name="Helper"><file name="Data.php" hash="d1e1f46e0177c6d96c35b98a2aa14831"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Prescriptionpayment"><file name="Collection.php" hash="cfd980780287e0ec63755823d2d4557d"/></dir><file name="Prescriptionpayment.php" hash="62c8d02097f01b3f7cf6cea7ce8437f1"/></dir><file name="Observer.php" hash="1c9ea2eed8194d7e01c312d32804e573"/><file name="Prescriptionpayment.php" hash="a4f80fed9bf351129b472e19081a9b25"/></dir><dir name="controllers"><file name="ItemsController.php" hash="96cff6d38d7a6257f3ebbfa524543211"/></dir><dir name="etc"><file name="config.xml" hash="fa0eb77ba06e8196e44ee38609e63cb5"/><file name="system.xml" hash="cfc5c5fda957d198d0fe6e2e0df107be"/></dir><dir name="sql"><dir name="prescriptionpayment_setup"><file name="mysql4-install-0.1.0.php" hash="44af96f8e0ec3961b458cae89191efe9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="prescriptionpayment"><file name="choose_payment.phtml" hash="293339e56babbfbfa6440b9f5c2aeeed"/><dir name="item"><file name="default.phtml" hash="5fd5f616a714102c5fc55ffb7fa4ae37"/></dir><file name="onepage_link.phtml" hash="80beb697df60eae9a012561553354bdd"/><file name="selectitems.phtml" hash="d489eddfa56395a10947631761cc21b2"/></dir></dir><dir name="layout"><file name="ce_prescriptionpayment.xml" hash="91af9b2d23f81d16254eaeb6da4a001f"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="prescriptionpayment"><file name="notifications.phtml" hash="3bc8c15a8be0a7beb42578ea3747b3f2"/><dir name="order"><dir name="view"><dir name="tab"><file name="info.phtml" hash="27c9c1407dbc7148c8d19e33b00e1261"/><file name="prescriptions.phtml" hash="c0c0a981a4ff38a96f1b65a707661d95"/></dir></dir></dir></dir></dir><dir name="layout"><file name="ce_prescriptionpayment.xml" hash="ad64d3458a37f0d7fdb90f31f334f9f3"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Ce_PrescriptionPayment.csv" hash="34be67dec4e5877bec766b9343399b45"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="js"><dir name="prescriptionpayment"><file name="jquery.form.js" hash="30462a68d2d2ea5733f8687c27d4e783"/><file name="pp-custom.js" hash="7144209f4cd26457fc3894cf69ffddc9"/></dir><file name="jquery-noconflict.js" hash="102c661f414e2f525bdfa04b47065605"/><file name="jquery-1.8.3.min.js" hash="e1288116312e4728f98923c79b034b67"/></dir><dir name="css"><dir name="prescriptionpayment"><file name="pp-custom.css" hash="045a7290990b2e831fda743c25283362"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ce_PrescriptionPayment.xml" hash="00be1ebba9d1706e92c55f18eea40e70"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>5.4.9</max></php></required></dependencies>
22
  </package>
skin/frontend/default/default/css/prescriptionpayment/pp-custom.css ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * @package Ce_PrescriptionPayment
15
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
16
+ * @author Holger Lösken <post@codedge.de>
17
+ */
18
+
19
+ .prescriptionpayment-items-select h3 {
20
+ margin:0 !important;
21
+ }
22
+
23
+ .prescriptionpayment-items-select .block-prescriptionpayment.hint {
24
+ width:500px;
25
+ }
26
+
27
+ .prescriptionpayment-items-select .add {
28
+ background-color:#849ba3;
29
+ color:#fff;
30
+ padding:0 4px;
31
+ }
32
+
33
+ .prescriptionpayment-items-select .add:hover {
34
+ cursor: pointer;
35
+ }
36
+
37
+ .prescriptionpayment-items-select .upload-prescription {
38
+ width:380px !important;
39
+ border:0 !important;
40
+ background:none !important;
41
+ }
42
+
43
+ .prescriptionpayment-items-select .cart-collaterals.prescriptionpayment .col2-set {
44
+ width:auto !important;
45
+ }
skin/frontend/default/default/js/jquery-1.8.3.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! jQuery v1.8.3 jquery.com | jquery.org/license */
2
+ (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
skin/frontend/default/default/js/jquery-noconflict.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * @package Ce_PrescriptionPayment
15
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
16
+ * @author Holger Lösken <post@codedge.de>
17
+ */
18
+
19
+ jQuery.noConflict();
skin/frontend/default/default/js/prescriptionpayment/jquery.form.js ADDED
@@ -0,0 +1,1190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Form Plugin
3
+ * version: 3.33.0-2013.05.02
4
+ * @requires jQuery v1.5 or later
5
+ * Copyright (c) 2013 M. Alsup
6
+ * Examples and documentation at: http://malsup.com/jquery/form/
7
+ * Project repository: https://github.com/malsup/form
8
+ * Dual licensed under the MIT and GPL licenses.
9
+ * https://github.com/malsup/form#copyright-and-license
10
+ */
11
+ /*global ActiveXObject */
12
+ ;(function($) {
13
+ "use strict";
14
+
15
+ /*
16
+ Usage Note:
17
+ -----------
18
+ Do not use both ajaxSubmit and ajaxForm on the same form. These
19
+ functions are mutually exclusive. Use ajaxSubmit if you want
20
+ to bind your own submit handler to the form. For example,
21
+
22
+ $(document).ready(function() {
23
+ $('#myForm').on('submit', function(e) {
24
+ e.preventDefault(); // <-- important
25
+ $(this).ajaxSubmit({
26
+ target: '#output'
27
+ });
28
+ });
29
+ });
30
+
31
+ Use ajaxForm when you want the plugin to manage all the event binding
32
+ for you. For example,
33
+
34
+ $(document).ready(function() {
35
+ $('#myForm').ajaxForm({
36
+ target: '#output'
37
+ });
38
+ });
39
+
40
+ You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
41
+ form does not have to exist when you invoke ajaxForm:
42
+
43
+ $('#myForm').ajaxForm({
44
+ delegation: true,
45
+ target: '#output'
46
+ });
47
+
48
+ When using ajaxForm, the ajaxSubmit function will be invoked for you
49
+ at the appropriate time.
50
+ */
51
+
52
+ /**
53
+ * Feature detection
54
+ */
55
+ var feature = {};
56
+ feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
57
+ feature.formdata = window.FormData !== undefined;
58
+
59
+ var hasProp = !!$.fn.prop;
60
+
61
+ // attr2 uses prop when it can but checks the return type for
62
+ // an expected string. this accounts for the case where a form
63
+ // contains inputs with names like "action" or "method"; in those
64
+ // cases "prop" returns the element
65
+ $.fn.attr2 = function() {
66
+ if ( ! hasProp )
67
+ return this.attr.apply(this, arguments);
68
+ var val = this.prop.apply(this, arguments);
69
+ if ( ( val && val.jquery ) || typeof val === 'string' )
70
+ return val;
71
+ return this.attr.apply(this, arguments);
72
+ };
73
+
74
+ /**
75
+ * ajaxSubmit() provides a mechanism for immediately submitting
76
+ * an HTML form using AJAX.
77
+ */
78
+ $.fn.ajaxSubmit = function(options) {
79
+ /*jshint scripturl:true */
80
+
81
+ // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
82
+ if (!this.length) {
83
+ log('ajaxSubmit: skipping submit process - no element selected');
84
+ return this;
85
+ }
86
+
87
+ var method, action, url, $form = this;
88
+
89
+ if (typeof options == 'function') {
90
+ options = { success: options };
91
+ }
92
+
93
+ method = this.attr2('method');
94
+ action = this.attr2('action');
95
+
96
+ url = (typeof action === 'string') ? $.trim(action) : '';
97
+ url = url || window.location.href || '';
98
+ if (url) {
99
+ // clean url (don't include hash vaue)
100
+ url = (url.match(/^([^#]+)/)||[])[1];
101
+ }
102
+
103
+ options = $.extend(true, {
104
+ url: url,
105
+ success: $.ajaxSettings.success,
106
+ type: method || 'GET',
107
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
108
+ }, options);
109
+
110
+ // hook for manipulating the form data before it is extracted;
111
+ // convenient for use with rich editors like tinyMCE or FCKEditor
112
+ var veto = {};
113
+ this.trigger('form-pre-serialize', [this, options, veto]);
114
+ if (veto.veto) {
115
+ log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
116
+ return this;
117
+ }
118
+
119
+ // provide opportunity to alter form data before it is serialized
120
+ if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
121
+ log('ajaxSubmit: submit aborted via beforeSerialize callback');
122
+ return this;
123
+ }
124
+
125
+ var traditional = options.traditional;
126
+ if ( traditional === undefined ) {
127
+ traditional = $.ajaxSettings.traditional;
128
+ }
129
+
130
+ var elements = [];
131
+ var qx, a = this.formToArray(options.semantic, elements);
132
+ if (options.data) {
133
+ options.extraData = options.data;
134
+ qx = $.param(options.data, traditional);
135
+ }
136
+
137
+ // give pre-submit callback an opportunity to abort the submit
138
+ if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
139
+ log('ajaxSubmit: submit aborted via beforeSubmit callback');
140
+ return this;
141
+ }
142
+
143
+ // fire vetoable 'validate' event
144
+ this.trigger('form-submit-validate', [a, this, options, veto]);
145
+ if (veto.veto) {
146
+ log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
147
+ return this;
148
+ }
149
+
150
+ var q = $.param(a, traditional);
151
+ if (qx) {
152
+ q = ( q ? (q + '&' + qx) : qx );
153
+ }
154
+ if (options.type.toUpperCase() == 'GET') {
155
+ options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
156
+ options.data = null; // data is null for 'get'
157
+ }
158
+ else {
159
+ options.data = q; // data is the query string for 'post'
160
+ }
161
+
162
+ var callbacks = [];
163
+ if (options.resetForm) {
164
+ callbacks.push(function() { $form.resetForm(); });
165
+ }
166
+ if (options.clearForm) {
167
+ callbacks.push(function() { $form.clearForm(options.includeHidden); });
168
+ }
169
+
170
+ // perform a load on the target only if dataType is not provided
171
+ if (!options.dataType && options.target) {
172
+ var oldSuccess = options.success || function(){};
173
+ callbacks.push(function(data) {
174
+ var fn = options.replaceTarget ? 'replaceWith' : 'html';
175
+ $(options.target)[fn](data).each(oldSuccess, arguments);
176
+ });
177
+ }
178
+ else if (options.success) {
179
+ callbacks.push(options.success);
180
+ }
181
+
182
+ options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
183
+ var context = options.context || this ; // jQuery 1.4+ supports scope context
184
+ for (var i=0, max=callbacks.length; i < max; i++) {
185
+ callbacks[i].apply(context, [data, status, xhr || $form, $form]);
186
+ }
187
+ };
188
+
189
+ if (options.error) {
190
+ var oldError = options.error;
191
+ options.error = function(xhr, status, error) {
192
+ var context = options.context || this;
193
+ oldError.apply(context, [xhr, status, error, $form]);
194
+ };
195
+ }
196
+
197
+ if (options.complete) {
198
+ var oldComplete = options.complete;
199
+ options.complete = function(xhr, status) {
200
+ var context = options.context || this;
201
+ oldComplete.apply(context, [xhr, status, $form]);
202
+ };
203
+ }
204
+
205
+ // are there files to upload?
206
+
207
+ // [value] (issue #113), also see comment:
208
+ // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
209
+ var fileInputs = $('input[type=file]:enabled[value!=""]', this);
210
+
211
+ var hasFileInputs = fileInputs.length > 0;
212
+ var mp = 'multipart/form-data';
213
+ var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
214
+
215
+ var fileAPI = feature.fileapi && feature.formdata;
216
+ log("fileAPI :" + fileAPI);
217
+ var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
218
+
219
+ var jqxhr;
220
+
221
+ // options.iframe allows user to force iframe mode
222
+ // 06-NOV-09: now defaulting to iframe mode if file input is detected
223
+ if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
224
+ // hack to fix Safari hang (thanks to Tim Molendijk for this)
225
+ // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
226
+ if (options.closeKeepAlive) {
227
+ $.get(options.closeKeepAlive, function() {
228
+ jqxhr = fileUploadIframe(a);
229
+ });
230
+ }
231
+ else {
232
+ jqxhr = fileUploadIframe(a);
233
+ }
234
+ }
235
+ else if ((hasFileInputs || multipart) && fileAPI) {
236
+ jqxhr = fileUploadXhr(a);
237
+ }
238
+ else {
239
+ jqxhr = $.ajax(options);
240
+ }
241
+
242
+ $form.removeData('jqxhr').data('jqxhr', jqxhr);
243
+
244
+ // clear element array
245
+ for (var k=0; k < elements.length; k++)
246
+ elements[k] = null;
247
+
248
+ // fire 'notify' event
249
+ this.trigger('form-submit-notify', [this, options]);
250
+ return this;
251
+
252
+ // utility fn for deep serialization
253
+ function deepSerialize(extraData){
254
+ var serialized = $.param(extraData).split('&');
255
+ var len = serialized.length;
256
+ var result = [];
257
+ var i, part;
258
+ for (i=0; i < len; i++) {
259
+ // #252; undo param space replacement
260
+ serialized[i] = serialized[i].replace(/\+/g,' ');
261
+ part = serialized[i].split('=');
262
+ // #278; use array instead of object storage, favoring array serializations
263
+ result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
264
+ }
265
+ return result;
266
+ }
267
+
268
+ // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
269
+ function fileUploadXhr(a) {
270
+ var formdata = new FormData();
271
+
272
+ for (var i=0; i < a.length; i++) {
273
+ formdata.append(a[i].name, a[i].value);
274
+ }
275
+
276
+ if (options.extraData) {
277
+ var serializedData = deepSerialize(options.extraData);
278
+ for (i=0; i < serializedData.length; i++)
279
+ if (serializedData[i])
280
+ formdata.append(serializedData[i][0], serializedData[i][1]);
281
+ }
282
+
283
+ options.data = null;
284
+
285
+ var s = $.extend(true, {}, $.ajaxSettings, options, {
286
+ contentType: false,
287
+ processData: false,
288
+ cache: false,
289
+ type: method || 'POST'
290
+ });
291
+
292
+ if (options.uploadProgress) {
293
+ // workaround because jqXHR does not expose upload property
294
+ s.xhr = function() {
295
+ var xhr = jQuery.ajaxSettings.xhr();
296
+ if (xhr.upload) {
297
+ xhr.upload.addEventListener('progress', function(event) {
298
+ var percent = 0;
299
+ var position = event.loaded || event.position; /*event.position is deprecated*/
300
+ var total = event.total;
301
+ if (event.lengthComputable) {
302
+ percent = Math.ceil(position / total * 100);
303
+ }
304
+ options.uploadProgress(event, position, total, percent);
305
+ }, false);
306
+ }
307
+ return xhr;
308
+ };
309
+ }
310
+
311
+ s.data = null;
312
+ var beforeSend = s.beforeSend;
313
+ s.beforeSend = function(xhr, o) {
314
+ o.data = formdata;
315
+ if(beforeSend)
316
+ beforeSend.call(this, xhr, o);
317
+ };
318
+ return $.ajax(s);
319
+ }
320
+
321
+ // private function for handling file uploads (hat tip to YAHOO!)
322
+ function fileUploadIframe(a) {
323
+ var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
324
+ var deferred = $.Deferred();
325
+
326
+ if (a) {
327
+ // ensure that every serialized input is still enabled
328
+ for (i=0; i < elements.length; i++) {
329
+ el = $(elements[i]);
330
+ if ( hasProp )
331
+ el.prop('disabled', false);
332
+ else
333
+ el.removeAttr('disabled');
334
+ }
335
+ }
336
+
337
+ s = $.extend(true, {}, $.ajaxSettings, options);
338
+ s.context = s.context || s;
339
+ id = 'jqFormIO' + (new Date().getTime());
340
+ if (s.iframeTarget) {
341
+ $io = $(s.iframeTarget);
342
+ n = $io.attr2('name');
343
+ if (!n)
344
+ $io.attr2('name', id);
345
+ else
346
+ id = n;
347
+ }
348
+ else {
349
+ $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
350
+ $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
351
+ }
352
+ io = $io[0];
353
+
354
+
355
+ xhr = { // mock object
356
+ aborted: 0,
357
+ responseText: null,
358
+ responseXML: null,
359
+ status: 0,
360
+ statusText: 'n/a',
361
+ getAllResponseHeaders: function() {},
362
+ getResponseHeader: function() {},
363
+ setRequestHeader: function() {},
364
+ abort: function(status) {
365
+ var e = (status === 'timeout' ? 'timeout' : 'aborted');
366
+ log('aborting upload... ' + e);
367
+ this.aborted = 1;
368
+
369
+ try { // #214, #257
370
+ if (io.contentWindow.document.execCommand) {
371
+ io.contentWindow.document.execCommand('Stop');
372
+ }
373
+ }
374
+ catch(ignore) {}
375
+
376
+ $io.attr('src', s.iframeSrc); // abort op in progress
377
+ xhr.error = e;
378
+ if (s.error)
379
+ s.error.call(s.context, xhr, e, status);
380
+ if (g)
381
+ $.event.trigger("ajaxError", [xhr, s, e]);
382
+ if (s.complete)
383
+ s.complete.call(s.context, xhr, e);
384
+ }
385
+ };
386
+
387
+ g = s.global;
388
+ // trigger ajax global events so that activity/block indicators work like normal
389
+ if (g && 0 === $.active++) {
390
+ $.event.trigger("ajaxStart");
391
+ }
392
+ if (g) {
393
+ $.event.trigger("ajaxSend", [xhr, s]);
394
+ }
395
+
396
+ if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
397
+ if (s.global) {
398
+ $.active--;
399
+ }
400
+ deferred.reject();
401
+ return deferred;
402
+ }
403
+ if (xhr.aborted) {
404
+ deferred.reject();
405
+ return deferred;
406
+ }
407
+
408
+ // add submitting element to data if we know it
409
+ sub = form.clk;
410
+ if (sub) {
411
+ n = sub.name;
412
+ if (n && !sub.disabled) {
413
+ s.extraData = s.extraData || {};
414
+ s.extraData[n] = sub.value;
415
+ if (sub.type == "image") {
416
+ s.extraData[n+'.x'] = form.clk_x;
417
+ s.extraData[n+'.y'] = form.clk_y;
418
+ }
419
+ }
420
+ }
421
+
422
+ var CLIENT_TIMEOUT_ABORT = 1;
423
+ var SERVER_ABORT = 2;
424
+
425
+ function getDoc(frame) {
426
+ /* it looks like contentWindow or contentDocument do not
427
+ * carry the protocol property in ie8, when running under ssl
428
+ * frame.document is the only valid response document, since
429
+ * the protocol is know but not on the other two objects. strange?
430
+ * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
431
+ */
432
+
433
+ var doc = null;
434
+
435
+ // IE8 cascading access check
436
+ try {
437
+ if (frame.contentWindow) {
438
+ doc = frame.contentWindow.document;
439
+ }
440
+ } catch(err) {
441
+ // IE8 access denied under ssl & missing protocol
442
+ log('cannot get iframe.contentWindow document: ' + err);
443
+ }
444
+
445
+ if (doc) { // successful getting content
446
+ return doc;
447
+ }
448
+
449
+ try { // simply checking may throw in ie8 under ssl or mismatched protocol
450
+ doc = frame.contentDocument ? frame.contentDocument : frame.document;
451
+ } catch(err) {
452
+ // last attempt
453
+ log('cannot get iframe.contentDocument: ' + err);
454
+ doc = frame.document;
455
+ }
456
+ return doc;
457
+ }
458
+
459
+ // Rails CSRF hack (thanks to Yvan Barthelemy)
460
+ var csrf_token = $('meta[name=csrf-token]').attr('content');
461
+ var csrf_param = $('meta[name=csrf-param]').attr('content');
462
+ if (csrf_param && csrf_token) {
463
+ s.extraData = s.extraData || {};
464
+ s.extraData[csrf_param] = csrf_token;
465
+ }
466
+
467
+ // take a breath so that pending repaints get some cpu time before the upload starts
468
+ function doSubmit() {
469
+ // make sure form attrs are set
470
+ var t = $form.attr2('target'), a = $form.attr2('action');
471
+
472
+ // update form attrs in IE friendly way
473
+ form.setAttribute('target',id);
474
+ if (!method) {
475
+ form.setAttribute('method', 'POST');
476
+ }
477
+ if (a != s.url) {
478
+ form.setAttribute('action', s.url);
479
+ }
480
+
481
+ // ie borks in some cases when setting encoding
482
+ if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
483
+ $form.attr({
484
+ encoding: 'multipart/form-data',
485
+ enctype: 'multipart/form-data'
486
+ });
487
+ }
488
+
489
+ // support timout
490
+ if (s.timeout) {
491
+ timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
492
+ }
493
+
494
+ // look for server aborts
495
+ function checkState() {
496
+ try {
497
+ var state = getDoc(io).readyState;
498
+ log('state = ' + state);
499
+ if (state && state.toLowerCase() == 'uninitialized')
500
+ setTimeout(checkState,50);
501
+ }
502
+ catch(e) {
503
+ log('Server abort: ' , e, ' (', e.name, ')');
504
+ cb(SERVER_ABORT);
505
+ if (timeoutHandle)
506
+ clearTimeout(timeoutHandle);
507
+ timeoutHandle = undefined;
508
+ }
509
+ }
510
+
511
+ // add "extra" data to form if provided in options
512
+ var extraInputs = [];
513
+ try {
514
+ if (s.extraData) {
515
+ for (var n in s.extraData) {
516
+ if (s.extraData.hasOwnProperty(n)) {
517
+ // if using the $.param format that allows for multiple values with the same name
518
+ if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
519
+ extraInputs.push(
520
+ $('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value)
521
+ .appendTo(form)[0]);
522
+ } else {
523
+ extraInputs.push(
524
+ $('<input type="hidden" name="'+n+'">').val(s.extraData[n])
525
+ .appendTo(form)[0]);
526
+ }
527
+ }
528
+ }
529
+ }
530
+
531
+ if (!s.iframeTarget) {
532
+ // add iframe to doc and submit the form
533
+ $io.appendTo('body');
534
+ if (io.attachEvent)
535
+ io.attachEvent('onload', cb);
536
+ else
537
+ io.addEventListener('load', cb, false);
538
+ }
539
+ setTimeout(checkState,15);
540
+
541
+ try {
542
+ form.submit();
543
+ } catch(err) {
544
+ // just in case form has element with name/id of 'submit'
545
+ var submitFn = document.createElement('form').submit;
546
+ submitFn.apply(form);
547
+ }
548
+ }
549
+ finally {
550
+ // reset attrs and remove "extra" input elements
551
+ form.setAttribute('action',a);
552
+ if(t) {
553
+ form.setAttribute('target', t);
554
+ } else {
555
+ $form.removeAttr('target');
556
+ }
557
+ $(extraInputs).remove();
558
+ }
559
+ }
560
+
561
+ if (s.forceSync) {
562
+ doSubmit();
563
+ }
564
+ else {
565
+ setTimeout(doSubmit, 10); // this lets dom updates render
566
+ }
567
+
568
+ var data, doc, domCheckCount = 50, callbackProcessed;
569
+
570
+ function cb(e) {
571
+ if (xhr.aborted || callbackProcessed) {
572
+ return;
573
+ }
574
+
575
+ doc = getDoc(io);
576
+ if(!doc) {
577
+ log('cannot access response document');
578
+ e = SERVER_ABORT;
579
+ }
580
+ if (e === CLIENT_TIMEOUT_ABORT && xhr) {
581
+ xhr.abort('timeout');
582
+ deferred.reject(xhr, 'timeout');
583
+ return;
584
+ }
585
+ else if (e == SERVER_ABORT && xhr) {
586
+ xhr.abort('server abort');
587
+ deferred.reject(xhr, 'error', 'server abort');
588
+ return;
589
+ }
590
+
591
+ if (!doc || doc.location.href == s.iframeSrc) {
592
+ // response not received yet
593
+ if (!timedOut)
594
+ return;
595
+ }
596
+ if (io.detachEvent)
597
+ io.detachEvent('onload', cb);
598
+ else
599
+ io.removeEventListener('load', cb, false);
600
+
601
+ var status = 'success', errMsg;
602
+ try {
603
+ if (timedOut) {
604
+ throw 'timeout';
605
+ }
606
+
607
+ var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
608
+ log('isXml='+isXml);
609
+ if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
610
+ if (--domCheckCount) {
611
+ // in some browsers (Opera) the iframe DOM is not always traversable when
612
+ // the onload callback fires, so we loop a bit to accommodate
613
+ log('requeing onLoad callback, DOM not available');
614
+ setTimeout(cb, 250);
615
+ return;
616
+ }
617
+ // let this fall through because server response could be an empty document
618
+ //log('Could not access iframe DOM after mutiple tries.');
619
+ //throw 'DOMException: not available';
620
+ }
621
+
622
+ //log('response detected');
623
+ var docRoot = doc.body ? doc.body : doc.documentElement;
624
+ xhr.responseText = docRoot ? docRoot.innerHTML : null;
625
+ xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
626
+ if (isXml)
627
+ s.dataType = 'xml';
628
+ xhr.getResponseHeader = function(header){
629
+ var headers = {'content-type': s.dataType};
630
+ return headers[header];
631
+ };
632
+ // support for XHR 'status' & 'statusText' emulation :
633
+ if (docRoot) {
634
+ xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
635
+ xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
636
+ }
637
+
638
+ var dt = (s.dataType || '').toLowerCase();
639
+ var scr = /(json|script|text)/.test(dt);
640
+ if (scr || s.textarea) {
641
+ // see if user embedded response in textarea
642
+ var ta = doc.getElementsByTagName('textarea')[0];
643
+ if (ta) {
644
+ xhr.responseText = ta.value;
645
+ // support for XHR 'status' & 'statusText' emulation :
646
+ xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
647
+ xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
648
+ }
649
+ else if (scr) {
650
+ // account for browsers injecting pre around json response
651
+ var pre = doc.getElementsByTagName('pre')[0];
652
+ var b = doc.getElementsByTagName('body')[0];
653
+ if (pre) {
654
+ xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
655
+ }
656
+ else if (b) {
657
+ xhr.responseText = b.textContent ? b.textContent : b.innerText;
658
+ }
659
+ }
660
+ }
661
+ else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
662
+ xhr.responseXML = toXml(xhr.responseText);
663
+ }
664
+
665
+ try {
666
+ data = httpData(xhr, dt, s);
667
+ }
668
+ catch (err) {
669
+ status = 'parsererror';
670
+ xhr.error = errMsg = (err || status);
671
+ }
672
+ }
673
+ catch (err) {
674
+ log('error caught: ',err);
675
+ status = 'error';
676
+ xhr.error = errMsg = (err || status);
677
+ }
678
+
679
+ if (xhr.aborted) {
680
+ log('upload aborted');
681
+ status = null;
682
+ }
683
+
684
+ if (xhr.status) { // we've set xhr.status
685
+ status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
686
+ }
687
+
688
+ // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
689
+ if (status === 'success') {
690
+ if (s.success)
691
+ s.success.call(s.context, data, 'success', xhr);
692
+ deferred.resolve(xhr.responseText, 'success', xhr);
693
+ if (g)
694
+ $.event.trigger("ajaxSuccess", [xhr, s]);
695
+ }
696
+ else if (status) {
697
+ if (errMsg === undefined)
698
+ errMsg = xhr.statusText;
699
+ if (s.error)
700
+ s.error.call(s.context, xhr, status, errMsg);
701
+ deferred.reject(xhr, 'error', errMsg);
702
+ if (g)
703
+ $.event.trigger("ajaxError", [xhr, s, errMsg]);
704
+ }
705
+
706
+ if (g)
707
+ $.event.trigger("ajaxComplete", [xhr, s]);
708
+
709
+ if (g && ! --$.active) {
710
+ $.event.trigger("ajaxStop");
711
+ }
712
+
713
+ if (s.complete)
714
+ s.complete.call(s.context, xhr, status);
715
+
716
+ callbackProcessed = true;
717
+ if (s.timeout)
718
+ clearTimeout(timeoutHandle);
719
+
720
+ // clean up
721
+ setTimeout(function() {
722
+ if (!s.iframeTarget)
723
+ $io.remove();
724
+ xhr.responseXML = null;
725
+ }, 100);
726
+ }
727
+
728
+ var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
729
+ if (window.ActiveXObject) {
730
+ doc = new ActiveXObject('Microsoft.XMLDOM');
731
+ doc.async = 'false';
732
+ doc.loadXML(s);
733
+ }
734
+ else {
735
+ doc = (new DOMParser()).parseFromString(s, 'text/xml');
736
+ }
737
+ return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
738
+ };
739
+ var parseJSON = $.parseJSON || function(s) {
740
+ /*jslint evil:true */
741
+ return window['eval']('(' + s + ')');
742
+ };
743
+
744
+ var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
745
+
746
+ var ct = xhr.getResponseHeader('content-type') || '',
747
+ xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
748
+ data = xml ? xhr.responseXML : xhr.responseText;
749
+
750
+ if (xml && data.documentElement.nodeName === 'parsererror') {
751
+ if ($.error)
752
+ $.error('parsererror');
753
+ }
754
+ if (s && s.dataFilter) {
755
+ data = s.dataFilter(data, type);
756
+ }
757
+ if (typeof data === 'string') {
758
+ if (type === 'json' || !type && ct.indexOf('json') >= 0) {
759
+ data = parseJSON(data);
760
+ } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
761
+ $.globalEval(data);
762
+ }
763
+ }
764
+ return data;
765
+ };
766
+
767
+ return deferred;
768
+ }
769
+ };
770
+
771
+ /**
772
+ * ajaxForm() provides a mechanism for fully automating form submission.
773
+ *
774
+ * The advantages of using this method instead of ajaxSubmit() are:
775
+ *
776
+ * 1: This method will include coordinates for <input type="image" /> elements (if the element
777
+ * is used to submit the form).
778
+ * 2. This method will include the submit element's name/value data (for the element that was
779
+ * used to submit the form).
780
+ * 3. This method binds the submit() method to the form for you.
781
+ *
782
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
783
+ * passes the options argument along after properly binding events for submit elements and
784
+ * the form itself.
785
+ */
786
+ $.fn.ajaxForm = function(options) {
787
+ options = options || {};
788
+ options.delegation = options.delegation && $.isFunction($.fn.on);
789
+
790
+ // in jQuery 1.3+ we can fix mistakes with the ready state
791
+ if (!options.delegation && this.length === 0) {
792
+ var o = { s: this.selector, c: this.context };
793
+ if (!$.isReady && o.s) {
794
+ log('DOM not ready, queuing ajaxForm');
795
+ $(function() {
796
+ $(o.s,o.c).ajaxForm(options);
797
+ });
798
+ return this;
799
+ }
800
+ // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
801
+ log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
802
+ return this;
803
+ }
804
+
805
+ if ( options.delegation ) {
806
+ $(document)
807
+ .off('submit.form-plugin', this.selector, doAjaxSubmit)
808
+ .off('click.form-plugin', this.selector, captureSubmittingElement)
809
+ .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
810
+ .on('click.form-plugin', this.selector, options, captureSubmittingElement);
811
+ return this;
812
+ }
813
+
814
+ return this.ajaxFormUnbind()
815
+ .bind('submit.form-plugin', options, doAjaxSubmit)
816
+ .bind('click.form-plugin', options, captureSubmittingElement);
817
+ };
818
+
819
+ // private event handlers
820
+ function doAjaxSubmit(e) {
821
+ /*jshint validthis:true */
822
+ var options = e.data;
823
+ if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
824
+ e.preventDefault();
825
+ $(this).ajaxSubmit(options);
826
+ }
827
+ }
828
+
829
+ function captureSubmittingElement(e) {
830
+ /*jshint validthis:true */
831
+ var target = e.target;
832
+ var $el = $(target);
833
+ if (!($el.is("[type=submit],[type=image]"))) {
834
+ // is this a child element of the submit el? (ex: a span within a button)
835
+ var t = $el.closest('[type=submit]');
836
+ if (t.length === 0) {
837
+ return;
838
+ }
839
+ target = t[0];
840
+ }
841
+ var form = this;
842
+ form.clk = target;
843
+ if (target.type == 'image') {
844
+ if (e.offsetX !== undefined) {
845
+ form.clk_x = e.offsetX;
846
+ form.clk_y = e.offsetY;
847
+ } else if (typeof $.fn.offset == 'function') {
848
+ var offset = $el.offset();
849
+ form.clk_x = e.pageX - offset.left;
850
+ form.clk_y = e.pageY - offset.top;
851
+ } else {
852
+ form.clk_x = e.pageX - target.offsetLeft;
853
+ form.clk_y = e.pageY - target.offsetTop;
854
+ }
855
+ }
856
+ // clear form vars
857
+ setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
858
+ }
859
+
860
+
861
+ // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
862
+ $.fn.ajaxFormUnbind = function() {
863
+ return this.unbind('submit.form-plugin click.form-plugin');
864
+ };
865
+
866
+ /**
867
+ * formToArray() gathers form element data into an array of objects that can
868
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
869
+ * Each object in the array has both a 'name' and 'value' property. An example of
870
+ * an array for a simple login form might be:
871
+ *
872
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
873
+ *
874
+ * It is this array that is passed to pre-submit callback functions provided to the
875
+ * ajaxSubmit() and ajaxForm() methods.
876
+ */
877
+ $.fn.formToArray = function(semantic, elements) {
878
+ var a = [];
879
+ if (this.length === 0) {
880
+ return a;
881
+ }
882
+
883
+ var form = this[0];
884
+ var els = semantic ? form.getElementsByTagName('*') : form.elements;
885
+ if (!els) {
886
+ return a;
887
+ }
888
+
889
+ var i,j,n,v,el,max,jmax;
890
+ for(i=0, max=els.length; i < max; i++) {
891
+ el = els[i];
892
+ n = el.name;
893
+ if (!n || el.disabled) {
894
+ continue;
895
+ }
896
+
897
+ if (semantic && form.clk && el.type == "image") {
898
+ // handle image inputs on the fly when semantic == true
899
+ if(form.clk == el) {
900
+ a.push({name: n, value: $(el).val(), type: el.type });
901
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
902
+ }
903
+ continue;
904
+ }
905
+
906
+ v = $.fieldValue(el, true);
907
+ if (v && v.constructor == Array) {
908
+ if (elements)
909
+ elements.push(el);
910
+ for(j=0, jmax=v.length; j < jmax; j++) {
911
+ a.push({name: n, value: v[j]});
912
+ }
913
+ }
914
+ else if (feature.fileapi && el.type == 'file') {
915
+ if (elements)
916
+ elements.push(el);
917
+ var files = el.files;
918
+ if (files.length) {
919
+ for (j=0; j < files.length; j++) {
920
+ a.push({name: n, value: files[j], type: el.type});
921
+ }
922
+ }
923
+ else {
924
+ // #180
925
+ a.push({ name: n, value: '', type: el.type });
926
+ }
927
+ }
928
+ else if (v !== null && typeof v != 'undefined') {
929
+ if (elements)
930
+ elements.push(el);
931
+ a.push({name: n, value: v, type: el.type, required: el.required});
932
+ }
933
+ }
934
+
935
+ if (!semantic && form.clk) {
936
+ // input type=='image' are not found in elements array! handle it here
937
+ var $input = $(form.clk), input = $input[0];
938
+ n = input.name;
939
+ if (n && !input.disabled && input.type == 'image') {
940
+ a.push({name: n, value: $input.val()});
941
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
942
+ }
943
+ }
944
+ return a;
945
+ };
946
+
947
+ /**
948
+ * Serializes form data into a 'submittable' string. This method will return a string
949
+ * in the format: name1=value1&amp;name2=value2
950
+ */
951
+ $.fn.formSerialize = function(semantic) {
952
+ //hand off to jQuery.param for proper encoding
953
+ return $.param(this.formToArray(semantic));
954
+ };
955
+
956
+ /**
957
+ * Serializes all field elements in the jQuery object into a query string.
958
+ * This method will return a string in the format: name1=value1&amp;name2=value2
959
+ */
960
+ $.fn.fieldSerialize = function(successful) {
961
+ var a = [];
962
+ this.each(function() {
963
+ var n = this.name;
964
+ if (!n) {
965
+ return;
966
+ }
967
+ var v = $.fieldValue(this, successful);
968
+ if (v && v.constructor == Array) {
969
+ for (var i=0,max=v.length; i < max; i++) {
970
+ a.push({name: n, value: v[i]});
971
+ }
972
+ }
973
+ else if (v !== null && typeof v != 'undefined') {
974
+ a.push({name: this.name, value: v});
975
+ }
976
+ });
977
+ //hand off to jQuery.param for proper encoding
978
+ return $.param(a);
979
+ };
980
+
981
+ /**
982
+ * Returns the value(s) of the element in the matched set. For example, consider the following form:
983
+ *
984
+ * <form><fieldset>
985
+ * <input name="A" type="text" />
986
+ * <input name="A" type="text" />
987
+ * <input name="B" type="checkbox" value="B1" />
988
+ * <input name="B" type="checkbox" value="B2"/>
989
+ * <input name="C" type="radio" value="C1" />
990
+ * <input name="C" type="radio" value="C2" />
991
+ * </fieldset></form>
992
+ *
993
+ * var v = $('input[type=text]').fieldValue();
994
+ * // if no values are entered into the text inputs
995
+ * v == ['','']
996
+ * // if values entered into the text inputs are 'foo' and 'bar'
997
+ * v == ['foo','bar']
998
+ *
999
+ * var v = $('input[type=checkbox]').fieldValue();
1000
+ * // if neither checkbox is checked
1001
+ * v === undefined
1002
+ * // if both checkboxes are checked
1003
+ * v == ['B1', 'B2']
1004
+ *
1005
+ * var v = $('input[type=radio]').fieldValue();
1006
+ * // if neither radio is checked
1007
+ * v === undefined
1008
+ * // if first radio is checked
1009
+ * v == ['C1']
1010
+ *
1011
+ * The successful argument controls whether or not the field element must be 'successful'
1012
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
1013
+ * The default value of the successful argument is true. If this value is false the value(s)
1014
+ * for each element is returned.
1015
+ *
1016
+ * Note: This method *always* returns an array. If no valid value can be determined the
1017
+ * array will be empty, otherwise it will contain one or more values.
1018
+ */
1019
+ $.fn.fieldValue = function(successful) {
1020
+ for (var val=[], i=0, max=this.length; i < max; i++) {
1021
+ var el = this[i];
1022
+ var v = $.fieldValue(el, successful);
1023
+ if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
1024
+ continue;
1025
+ }
1026
+ if (v.constructor == Array)
1027
+ $.merge(val, v);
1028
+ else
1029
+ val.push(v);
1030
+ }
1031
+ return val;
1032
+ };
1033
+
1034
+ /**
1035
+ * Returns the value of the field element.
1036
+ */
1037
+ $.fieldValue = function(el, successful) {
1038
+ var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
1039
+ if (successful === undefined) {
1040
+ successful = true;
1041
+ }
1042
+
1043
+ if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
1044
+ (t == 'checkbox' || t == 'radio') && !el.checked ||
1045
+ (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
1046
+ tag == 'select' && el.selectedIndex == -1)) {
1047
+ return null;
1048
+ }
1049
+
1050
+ if (tag == 'select') {
1051
+ var index = el.selectedIndex;
1052
+ if (index < 0) {
1053
+ return null;
1054
+ }
1055
+ var a = [], ops = el.options;
1056
+ var one = (t == 'select-one');
1057
+ var max = (one ? index+1 : ops.length);
1058
+ for(var i=(one ? index : 0); i < max; i++) {
1059
+ var op = ops[i];
1060
+ if (op.selected) {
1061
+ var v = op.value;
1062
+ if (!v) { // extra pain for IE...
1063
+ v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
1064
+ }
1065
+ if (one) {
1066
+ return v;
1067
+ }
1068
+ a.push(v);
1069
+ }
1070
+ }
1071
+ return a;
1072
+ }
1073
+ return $(el).val();
1074
+ };
1075
+
1076
+ /**
1077
+ * Clears the form data. Takes the following actions on the form's input fields:
1078
+ * - input text fields will have their 'value' property set to the empty string
1079
+ * - select elements will have their 'selectedIndex' property set to -1
1080
+ * - checkbox and radio inputs will have their 'checked' property set to false
1081
+ * - inputs of type submit, button, reset, and hidden will *not* be effected
1082
+ * - button elements will *not* be effected
1083
+ */
1084
+ $.fn.clearForm = function(includeHidden) {
1085
+ return this.each(function() {
1086
+ $('input,select,textarea', this).clearFields(includeHidden);
1087
+ });
1088
+ };
1089
+
1090
+ /**
1091
+ * Clears the selected form elements.
1092
+ */
1093
+ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
1094
+ var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
1095
+ return this.each(function() {
1096
+ var t = this.type, tag = this.tagName.toLowerCase();
1097
+ if (re.test(t) || tag == 'textarea') {
1098
+ this.value = '';
1099
+ }
1100
+ else if (t == 'checkbox' || t == 'radio') {
1101
+ this.checked = false;
1102
+ }
1103
+ else if (tag == 'select') {
1104
+ this.selectedIndex = -1;
1105
+ }
1106
+ else if (t == "file") {
1107
+ if (/MSIE/.test(navigator.userAgent)) {
1108
+ $(this).replaceWith($(this).clone(true));
1109
+ } else {
1110
+ $(this).val('');
1111
+ }
1112
+ }
1113
+ else if (includeHidden) {
1114
+ // includeHidden can be the value true, or it can be a selector string
1115
+ // indicating a special test; for example:
1116
+ // $('#myForm').clearForm('.special:hidden')
1117
+ // the above would clean hidden inputs that have the class of 'special'
1118
+ if ( (includeHidden === true && /hidden/.test(t)) ||
1119
+ (typeof includeHidden == 'string' && $(this).is(includeHidden)) )
1120
+ this.value = '';
1121
+ }
1122
+ });
1123
+ };
1124
+
1125
+ /**
1126
+ * Resets the form data. Causes all form elements to be reset to their original value.
1127
+ */
1128
+ $.fn.resetForm = function() {
1129
+ return this.each(function() {
1130
+ // guard against an input with the name of 'reset'
1131
+ // note that IE reports the reset function as an 'object'
1132
+ if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
1133
+ this.reset();
1134
+ }
1135
+ });
1136
+ };
1137
+
1138
+ /**
1139
+ * Enables or disables any matching elements.
1140
+ */
1141
+ $.fn.enable = function(b) {
1142
+ if (b === undefined) {
1143
+ b = true;
1144
+ }
1145
+ return this.each(function() {
1146
+ this.disabled = !b;
1147
+ });
1148
+ };
1149
+
1150
+ /**
1151
+ * Checks/unchecks any matching checkboxes or radio buttons and
1152
+ * selects/deselects and matching option elements.
1153
+ */
1154
+ $.fn.selected = function(select) {
1155
+ if (select === undefined) {
1156
+ select = true;
1157
+ }
1158
+ return this.each(function() {
1159
+ var t = this.type;
1160
+ if (t == 'checkbox' || t == 'radio') {
1161
+ this.checked = select;
1162
+ }
1163
+ else if (this.tagName.toLowerCase() == 'option') {
1164
+ var $sel = $(this).parent('select');
1165
+ if (select && $sel[0] && $sel[0].type == 'select-one') {
1166
+ // deselect all other options
1167
+ $sel.find('option').selected(false);
1168
+ }
1169
+ this.selected = select;
1170
+ }
1171
+ });
1172
+ };
1173
+
1174
+ // expose debug var
1175
+ $.fn.ajaxSubmit.debug = false;
1176
+
1177
+ // helper fn for console logging
1178
+ function log() {
1179
+ if (!$.fn.ajaxSubmit.debug)
1180
+ return;
1181
+ var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
1182
+ if (window.console && window.console.log) {
1183
+ window.console.log(msg);
1184
+ }
1185
+ else if (window.opera && window.opera.postError) {
1186
+ window.opera.postError(msg);
1187
+ }
1188
+ }
1189
+
1190
+ })(jQuery);
skin/frontend/default/default/js/prescriptionpayment/pp-custom.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * @package Ce_PrescriptionPayment
15
+ * @copyright Copyright (c) 2013 codedge (http://www.codedge.de)
16
+ * @author Holger Lösken <post@codedge.de>
17
+ */
18
+
19
+ if (typeof jQuery != 'undefined') {
20
+ jQuery(document).ready(function() {
21
+
22
+ // Check radio buttons after load
23
+ if(jQuery("input[name='prescriptionpayment_choose_payment']:checked").val() == 0) {
24
+ jQuery('#prescriptionpayment-form fieldset,' +
25
+ '.block-prescriptionpayment, .upload-prescription').css('display', 'none');
26
+ } else {
27
+ jQuery('#prescriptionpayment-form fieldset,' +
28
+ '.block-prescriptionpayment, .upload-prescription').css('display', 'block');
29
+ }
30
+
31
+ jQuery("input[name='prescriptionpayment_choose_payment']").click(function() {
32
+ if(jQuery(this).val() == 0) {
33
+ jQuery('#prescriptionpayment-form fieldset,' +
34
+ '.block-prescriptionpayment, .upload-prescription').css('display', 'none');
35
+ } else {
36
+ jQuery('#prescriptionpayment-form fieldset,' +
37
+ '.block-prescriptionpayment, .upload-prescription').css('display', 'block');
38
+ }
39
+ });
40
+
41
+ // Select all items
42
+ jQuery("button[name='select_all_prescription']").click(function() {
43
+ jQuery('#prescriptionpayment-form').find(':checkbox').each(function () {
44
+ jQuery(this).prop('checked', 'checked');
45
+ });
46
+ });
47
+ });
48
+ }