Mana_Filters - Version 12.12.21.19

Version Notes

Adds multiple selection features for attribute and price filters in Magento layered navigation.

Download this release

Release Info

Developer Magento Core Team
Extension Mana_Filters
Version 12.12.21.19
Comparing to
See all releases


Code changes from version 12.04.24.23 to 12.12.21.19

Files changed (75) hide show
  1. app/code/local/Mana/Core/Block/Singleton.php +8 -2
  2. app/code/local/Mana/Core/Helper/Data.php +80 -4
  3. app/code/local/Mana/Core/Helper/Image.php +17 -0
  4. app/code/local/Mana/Core/Helper/Layout.php +37 -0
  5. app/code/local/Mana/Core/Model/Observer.php +71 -3
  6. app/code/local/Mana/Core/etc/config.xml +37 -2
  7. app/code/local/Mana/Db/Helper/Data.php +23 -1
  8. app/code/local/Mana/Db/Model/Object.php +1 -0
  9. app/code/local/Mana/Filters/Block/Filter.php +50 -3
  10. app/code/local/Mana/Filters/Block/Search.php +2 -45
  11. app/code/local/Mana/Filters/Block/State.php +38 -1
  12. app/code/local/Mana/Filters/Block/View.php +132 -23
  13. app/code/local/Mana/Filters/Helper/Data.php +280 -33
  14. app/code/local/Mana/Filters/Helper/Extended.php +1 -26
  15. app/code/local/Mana/Filters/Interface/Filter.php +80 -0
  16. app/code/local/Mana/Filters/Model/Filter/Attribute.php +229 -118
  17. app/code/local/Mana/Filters/Model/Filter/Category.php +257 -102
  18. app/code/local/Mana/Filters/Model/Filter/Common.php +153 -0
  19. app/code/local/Mana/Filters/Model/Filter/Decimal.php +346 -151
  20. app/code/local/Mana/Filters/Model/Filter/Price.php +293 -160
  21. app/code/local/Mana/Filters/Model/Filter2.php +2 -0
  22. app/code/local/Mana/Filters/Model/Filter2/Store.php +1 -0
  23. app/code/local/Mana/Filters/Model/Filter2/Value.php +1 -0
  24. app/code/local/Mana/Filters/Model/Filter2/Value/Store.php +1 -0
  25. app/code/local/Mana/Filters/Model/Item.php +7 -5
  26. app/code/local/Mana/Filters/Model/Observer.php +24 -0
  27. app/code/local/Mana/Filters/Model/Query.php +174 -0
  28. app/code/local/Mana/Filters/Model/Repository.php +22 -0
  29. app/code/local/Mana/Filters/Model/Solr/Adapter/HttpStream.php +125 -0
  30. app/code/local/Mana/Filters/Model/Solr/Adapter/PhpExtension.php +75 -0
  31. app/code/local/Mana/Filters/Model/Solr/And/Attribute.php +24 -0
  32. app/code/local/Mana/Filters/Model/Solr/Attribute.php +52 -0
  33. app/code/local/Mana/Filters/Model/Solr/Category.php +61 -0
  34. app/code/local/Mana/Filters/Model/Solr/Decimal.php +89 -0
  35. app/code/local/Mana/Filters/Model/Solr/Price.php +290 -0
  36. app/code/local/Mana/Filters/Model/Solr/Reverse/Attribute.php +24 -0
  37. app/code/local/Mana/Filters/Model/Solr/Reverse/Decimal.php +34 -0
  38. app/code/local/Mana/Filters/Model/Solr/Reverse/Price.php +39 -0
  39. app/code/local/Mana/Filters/Resource/EnterpriseSearch/Engine.php +23 -0
  40. app/code/local/Mana/Filters/Resource/Filter/And/Attribute.php +43 -0
  41. app/code/local/Mana/Filters/Resource/Filter/Attribute.php +38 -91
  42. app/code/local/Mana/Filters/Resource/Filter/Decimal.php +68 -60
  43. app/code/local/Mana/Filters/Resource/Filter/Price.php +132 -82
  44. app/code/local/Mana/Filters/Resource/Filter/Reverse/Attribute.php +43 -0
  45. app/code/local/Mana/Filters/Resource/Filter/Reverse/Decimal.php +54 -0
  46. app/code/local/Mana/Filters/Resource/Filter/Reverse/Price.php +53 -0
  47. app/code/local/Mana/Filters/Resource/Filter2.php +59 -14
  48. app/code/local/Mana/Filters/Resource/Filter2/Store.php +15 -8
  49. app/code/local/Mana/Filters/Resource/Filter2/Value.php +13 -2
  50. app/code/local/Mana/Filters/Resource/Filter2/Value/Store.php +2 -2
  51. app/code/local/Mana/Filters/Resource/Indexer/Source.php +52 -0
  52. app/code/local/Mana/Filters/Resource/Solr/And/Attribute.php +26 -0
  53. app/code/local/Mana/Filters/Resource/Solr/Attribute.php +40 -0
  54. app/code/local/Mana/Filters/Resource/Solr/Reverse/Attribute.php +26 -0
  55. app/code/local/Mana/Filters/etc/config.xml +56 -11
  56. app/code/local/Mana/Filters/sql/mana_filters_setup/mysql4-upgrade-12.10.25.17-12.10.25.18.php +26 -0
  57. app/code/local/Mana/Filters/sql/mana_filters_setup/mysql4-upgrade-12.11.02.16-12.11.13.15.php +26 -0
  58. app/design/frontend/base/default/layout/mana_filters.xml +20 -0
  59. app/design/frontend/base/default/template/mana/filters/cms.phtml +9 -0
  60. app/design/frontend/base/default/template/mana/filters/items/list.phtml +5 -3
  61. app/design/frontend/base/default/template/mana/filters/items/list_popup.phtml +8 -6
  62. app/design/frontend/base/default/template/mana/filters/items/standard.phtml +5 -3
  63. app/design/frontend/base/default/template/mana/filters/items/standard_popup.phtml +4 -2
  64. app/design/frontend/base/default/template/mana/filters/state.phtml +4 -2
  65. app/locale/en_US/Mana_Filters.csv +4 -1
  66. js/jquery/advListRotator.js +1 -0
  67. js/jquery/jquery-1.7.2.min.js +6 -0
  68. js/jquery/jquery-ui.js +1 -1
  69. js/jquery/jquery-ui.min.js +1 -1
  70. js/jquery/jquery.flexslider-min.js +43 -0
  71. js/jquery/jquery.js +1 -1
  72. js/jquery/jquery.min.js +1 -1
  73. js/mana/core.js +96 -7
  74. package.xml +4 -4
  75. skin/frontend/base/default/css/mana_filters.css +5 -1
app/code/local/Mana/Core/Block/Singleton.php CHANGED
@@ -11,13 +11,19 @@
11
  */
12
  class Mana_Core_Block_Singleton extends Mage_Core_Block_Text_List {
13
  protected $_singletons = array();
14
- public function addSingletonBlock($type, $name, $template = null) {
15
  if (!isset($this->_singletons[$name])) {
16
  $this->_singletons[$name] = $block = $this->getLayout()->createBlock($type, $name);
17
  if ($template) {
18
  $block->setTemplate($template);
19
  }
20
- $this->append($block, $name);
 
 
 
 
 
 
21
  }
22
  return $this;
23
  }
11
  */
12
  class Mana_Core_Block_Singleton extends Mage_Core_Block_Text_List {
13
  protected $_singletons = array();
14
+ public function addSingletonBlock($type, $name, $template = null, $before = null) {
15
  if (!isset($this->_singletons[$name])) {
16
  $this->_singletons[$name] = $block = $this->getLayout()->createBlock($type, $name);
17
  if ($template) {
18
  $block->setTemplate($template);
19
  }
20
+ if ($before) {
21
+ $this->insert($block, $before, false, $name);
22
+ }
23
+ else {
24
+ $this->append($block, $name);
25
+ }
26
+
27
  }
28
  return $this;
29
  }
app/code/local/Mana/Core/Helper/Data.php CHANGED
@@ -407,8 +407,15 @@ class Mana_Core_Helper_Data extends Mage_Core_Helper_Abstract {
407
  $version = explode('.', $version);
408
  $mageVersion = array_values(Mage::getVersionInfo());
409
  foreach ($version as $key => $value) {
410
- if ((int)$mageVersion[$key] < (int)$value) {
411
- return false;
 
 
 
 
 
 
 
412
  }
413
  }
414
  return true;
@@ -426,7 +433,7 @@ class Mana_Core_Helper_Data extends Mage_Core_Helper_Abstract {
426
  }
427
  $result = array();
428
  foreach (explode($separator['sep'], $input) as $value) {
429
- if (($sanitizedValue = $this->sanitizeNumber($value, $separators)) !== false && $sanitizedValue !== '') {
430
  $result[] = $sanitizedValue;
431
  }
432
  }
@@ -438,7 +445,76 @@ class Mana_Core_Helper_Data extends Mage_Core_Helper_Abstract {
438
  }
439
  }
440
  else {
441
- return is_numeric($input) ? $input : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  }
443
  }
444
  }
407
  $version = explode('.', $version);
408
  $mageVersion = array_values(Mage::getVersionInfo());
409
  foreach ($version as $key => $value) {
410
+ if ($key == 1 && Mage::getConfig()->getModuleConfig('Enterprise_Enterprise')->is('active', 'true')) {
411
+ if ((int)$mageVersion[$key] < (int)($value + 5)) {
412
+ return false;
413
+ }
414
+ }
415
+ else {
416
+ if ((int)$mageVersion[$key] < (int)$value) {
417
+ return false;
418
+ }
419
  }
420
  }
421
  return true;
433
  }
434
  $result = array();
435
  foreach (explode($separator['sep'], $input) as $value) {
436
+ if (($sanitizedValue = $this->sanitizeNumber($value, $separators)) !== false && $sanitizedValue !== '' && $sanitizedValue !== null) {
437
  $result[] = $sanitizedValue;
438
  }
439
  }
445
  }
446
  }
447
  else {
448
+ return is_numeric($input) ? $input : null;
449
+ }
450
+ }
451
+ public function sanitizeRequestNumberParam($paramName, $separators = array()) {
452
+ $param = $this->sanitizeNumber(urldecode(
453
+ preg_replace('/__\d__/', '', Mage::app()->getRequest()->getParam($paramName))),
454
+ $separators);
455
+ if (isset($_GET[$paramName])) {
456
+ if (trim($param) === '' || trim($param) === null) {
457
+ unset($_GET[$paramName]);
458
+ }
459
+ else {
460
+ $_GET[$paramName] = $param;
461
+ }
462
+ } else {
463
+ if (trim($param) === '' || trim($param) === null) {
464
+ Mage::app()->getRequest()->setParam($paramName, null);
465
+ } else {
466
+ Mage::app()->getRequest()->setParam($paramName, $param);
467
+ }
468
+ }
469
+ return $param;
470
+ }
471
+ public function updateRequestParameter($paramName, $newValue, $oldValue) {
472
+ if (isset($_GET[$paramName])) {
473
+ if (trim($newValue) === '' || trim($newValue) === null) {
474
+ if ($paramName == 'no_cache') {
475
+ Mage::app()->getRequest()->setParam('no_cache', 1);
476
+ }
477
+ unset($_GET[$paramName]);
478
+ $_SERVER['REQUEST_URI'] = str_replace('?'. $paramName .'=' . $oldValue, '', $_SERVER['REQUEST_URI']);
479
+ $_SERVER['REQUEST_URI'] = str_replace('&' . $paramName . '=' . $oldValue, '', $_SERVER['REQUEST_URI']);
480
+ $_SERVER['REQUEST_URI'] = str_replace('&amp;' . $paramName . '=' . $oldValue, '', $_SERVER['REQUEST_URI']);
481
+ } else {
482
+ $_GET[$paramName] = $newValue;
483
+ $_SERVER['REQUEST_URI'] = str_replace('?' . $paramName . '=' . $oldValue, '?' . $paramName . '=' . $newValue, $_SERVER['REQUEST_URI']);
484
+ $_SERVER['REQUEST_URI'] = str_replace('&' . $paramName . '=' . $oldValue, '&' . $paramName . '=' . $newValue, $_SERVER['REQUEST_URI']);
485
+ $_SERVER['REQUEST_URI'] = str_replace('&amp;' . $paramName . '=' . $oldValue, '&' . $paramName . '=' . $newValue, $_SERVER['REQUEST_URI']);
486
+ }
487
+ }
488
+ elseif (isset($_POST[$paramName])) {
489
+ if (trim($newValue) === '' || trim($newValue) === null) {
490
+ unset($_POST[$paramName]);
491
+ } else {
492
+ $_POST[$paramName] = $newValue;
493
+ }
494
+ }
495
+ }
496
+
497
+ public function callProtectedMethod($callback) {
498
+ $args = func_get_args();
499
+ $callback = array_shift($args);
500
+
501
+ list($object, $methodName) = $callback;
502
+ if (is_string($object)) {
503
+ $className = $object;
504
+ $object = null;
505
+ }
506
+ else {
507
+ $className = get_class($object);
508
+ }
509
+
510
+ $class = new ReflectionClass($className);
511
+ $method = $class->getMethod($methodName);
512
+ if (method_exists($method, 'setAccessible')) {
513
+ $method->setAccessible(true);
514
+ return $method->invokeArgs($callback[0], $args);
515
+ }
516
+ else {
517
+ return null;
518
  }
519
  }
520
  }
app/code/local/Mana/Core/Helper/Image.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Core
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Core_Helper_Image extends Mage_Catalog_Helper_Image {
13
+ protected function setImageFile($file) {
14
+ $this->_getModel()->setBaseFile($file);
15
+ return parent::setImageFile($file);
16
+ }
17
+ }
app/code/local/Mana/Core/Helper/Layout.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Core
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Core_Helper_Layout extends Mage_Core_Helper_Abstract {
13
+ protected $_delayPrepareLayoutBlocks = array();
14
+ /**
15
+ * @param Mage_Core_Block_Abstract $block
16
+ */
17
+ public function delayPrepareLayout($block, $sortOrder = 0) {
18
+ if (Mage::registry('m_page_is_being_rendered')) {
19
+ $block->delayedPrepareLayout();
20
+ }
21
+ else {
22
+ $this->_delayPrepareLayoutBlocks[$block->getNameInLayout()] = compact('block', 'sortOrder');
23
+ }
24
+ }
25
+ public function prepareDelayedLayoutBlocks() {
26
+ uasort($this->_delayPrepareLayoutBlocks, array($this, '_compareBlocks'));
27
+ foreach ($this->_delayPrepareLayoutBlocks as $block) {
28
+ $block['block']->delayedPrepareLayout();
29
+ }
30
+ }
31
+
32
+ public function _compareBlocks($a, $b) {
33
+ if ($a['sortOrder'] < $b['sortOrder']) return -1;
34
+ if ($a['sortOrder'] > $b['sortOrder']) return 1;
35
+ return 0;
36
+ }
37
+ }
app/code/local/Mana/Core/Model/Observer.php CHANGED
@@ -46,8 +46,42 @@ class Mana_Core_Model_Observer {
46
  }
47
  }
48
  }
 
49
  }
50
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /* BASED ON SNIPPET: Models/Event handler */
52
  /**
53
  * After blocks are generated change their properties (handles event "controller_action_layout_generate_blocks_after")
@@ -56,7 +90,9 @@ class Mana_Core_Model_Observer {
56
  public function postProcessBlocks($observer) {
57
  /* @var $action Mage_Core_Controller_Varien_Action */ $action = $observer->getEvent()->getAction();
58
  /* @var $layout Mage_Core_Model_Layout */ $layout = $observer->getEvent()->getLayout();
59
-
 
 
60
  if (Mage::getConfig()->getNode('m_blocks')) {
61
  foreach (Mage::getConfig()->getNode('m_blocks')->children() as $name => $config) {
62
  if (in_array($name, $layout->getUpdate()->getHandles())) {
@@ -158,4 +194,36 @@ class Mana_Core_Model_Observer {
158
  }
159
  }
160
  }
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  }
48
  }
49
+
50
  }
51
+ /**
52
+ * REPLACE THIS WITH DESCRIPTION (handles event "controller_action_layout_generate_xml_before")
53
+ * @param Varien_Event_Observer $observer
54
+ */
55
+ public function loadBlockLayouts($observer) {
56
+ /* @var $action Mage_Core_Controller_Varien_Action */
57
+ $action = $observer->getEvent()->getAction();
58
+ /* @var $layout Mage_Core_Model_Layout */
59
+ $layout = $observer->getEvent()->getLayout();
60
+
61
+ if ($node = Mage::getConfig()->getNode('m_block_layout_handle')) {
62
+ foreach ($node->children() as $ruleName => $ruleConfig) {
63
+ $if = $ruleConfig->if;
64
+ $handleName = (string)$ruleConfig->load_handle;
65
+ if ($type = (string)$if['type']) {
66
+ if ($this->_hasBlockInXml($type, $layout)) {
67
+ $action->getLayout()->getUpdate()->fetchPackageLayoutUpdates((string)$handleName);
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ /**
75
+ * @param string $blockType
76
+ * @param Mage_Core_Model_Layout $layout
77
+ * @return bool
78
+ */
79
+ protected function _hasBlockInXml($blockType, $layout) {
80
+ /* @var $xml Mage_Core_Model_Layout_Element */
81
+ $xml = $layout->getUpdate()->asSimplexml();
82
+ return $blocks = $xml->xpath("//block[@type='{$blockType}']");
83
+ }
84
+
85
  /* BASED ON SNIPPET: Models/Event handler */
86
  /**
87
  * After blocks are generated change their properties (handles event "controller_action_layout_generate_blocks_after")
90
  public function postProcessBlocks($observer) {
91
  /* @var $action Mage_Core_Controller_Varien_Action */ $action = $observer->getEvent()->getAction();
92
  /* @var $layout Mage_Core_Model_Layout */ $layout = $observer->getEvent()->getLayout();
93
+
94
+ Mage::helper('mana_core/layout')->prepareDelayedLayoutBlocks();
95
+
96
  if (Mage::getConfig()->getNode('m_blocks')) {
97
  foreach (Mage::getConfig()->getNode('m_blocks')->children() as $name => $config) {
98
  if (in_array($name, $layout->getUpdate()->getHandles())) {
194
  }
195
  }
196
  }
197
+
198
+ /**
199
+ * REPLACE THIS WITH DESCRIPTION (handles event "cms_page_render")
200
+ * @param Varien_Event_Observer $observer
201
+ */
202
+ public function handleUpdateInstructions($observer) {
203
+ /* @var $page Mage_Cms_Model_Page */ $page = $observer->getEvent()->getPage();
204
+ /* @var $controllerAction Mage_Core_Controller_Varien_Action */ $controllerAction = $observer->getEvent()->getControllerAction();
205
+
206
+ $inRange = Mage::app()->getLocale()->isStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo());
207
+ if ($layoutUpdate = ($page->getCustomLayoutUpdateXml() && $inRange) ? $page->getCustomLayoutUpdateXml() : $page->getLayoutUpdateXml()) {
208
+ $layoutUpdate = '<' . '?xml version="1.0"?' . '><layout>' . $layoutUpdate . '</layout>';
209
+ if ($xml = simplexml_load_string($layoutUpdate, Mage::getConfig()->getModelClassName('core/layout_element'))) {
210
+ foreach ($xml->children() as $child) {
211
+ if (strtolower($child->getName()) == 'update' && isset($child['handle'])) {
212
+ $controllerAction->getLayout()->getUpdate()->addHandle((string)$child['handle']);
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+
219
+ /**
220
+ * REPLACE THIS WITH DESCRIPTION (handles event "controller_action_layout_render_before")
221
+ * @param Varien_Event_Observer $observer
222
+ */
223
+ public function registerThatPageIsBeingRendered($observer) {
224
+ if (!Mage::registry('m_page_is_being_rendered')) {
225
+ Mage::register('m_page_is_being_rendered', true);
226
+ }
227
+ }
228
+ }
229
+
app/code/local/Mana/Core/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <Mana_Core>
13
  <!-- This version number identifies version of database tables specific to this extension. It is written to
14
  core_resource table. -->
15
- <version>12.04.24.23</version>
16
  </Mana_Core>
17
  </modules>
18
  <!-- This section contains module settings which are merged into global configuration during each page load,
@@ -27,7 +27,12 @@
27
  Mage::helper() calls. -->
28
  <class>Mana_Core_Helper</class>
29
  </mana_core>
30
- </helpers>
 
 
 
 
 
31
  <!-- BASED ON SNIPPET: Blocks/Block support (config.xml) -->
32
  <!-- This section registers block classes to be accessible from layout XML files (in type="<block type>") or
33
  through calls to $this->getLayout()->createBlock('<block type>') in block or controller code. That is,
@@ -100,6 +105,36 @@
100
  </mana_core>
101
  </observers>
102
  </core_block_abstract_to_html_after>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  </events>
104
  <!-- BASED ON SNIPPET: Resources/Installation script support (config.xml) -->
105
  <!-- This tells Magento to analyze sql/mana_core_setup directory for install/upgrade scripts.
12
  <Mana_Core>
13
  <!-- This version number identifies version of database tables specific to this extension. It is written to
14
  core_resource table. -->
15
+ <version>12.12.21.19</version>
16
  </Mana_Core>
17
  </modules>
18
  <!-- This section contains module settings which are merged into global configuration during each page load,
27
  Mage::helper() calls. -->
28
  <class>Mana_Core_Helper</class>
29
  </mana_core>
30
+ <catalog>
31
+ <rewrite>
32
+ <image>Mana_Core_Helper_Image</image>
33
+ </rewrite>
34
+ </catalog>
35
+ </helpers>
36
  <!-- BASED ON SNIPPET: Blocks/Block support (config.xml) -->
37
  <!-- This section registers block classes to be accessible from layout XML files (in type="<block type>") or
38
  through calls to $this->getLayout()->createBlock('<block type>') in block or controller code. That is,
105
  </mana_core>
106
  </observers>
107
  </core_block_abstract_to_html_after>
108
+ <cms_page_render><!-- this is event name this module listens for -->
109
+ <observers>
110
+ <mana_core>
111
+ <class>mana_core/observer</class>
112
+ <!-- model name of class containing event handler methods -->
113
+ <method>handleUpdateInstructions</method>
114
+ <!-- event handler method name -->
115
+ </mana_core>
116
+ </observers>
117
+ </cms_page_render>
118
+ <controller_action_layout_generate_xml_before><!-- this is event name this module listens for -->
119
+ <observers>
120
+ <mana_core>
121
+ <class>mana_core/observer</class>
122
+ <!-- model name of class containing event handler methods -->
123
+ <method>loadBlockLayouts</method>
124
+ <!-- event handler method name -->
125
+ </mana_core>
126
+ </observers>
127
+ </controller_action_layout_generate_xml_before>
128
+ <controller_action_layout_render_before><!-- this is event name this module listens for -->
129
+ <observers>
130
+ <mana_core>
131
+ <class>mana_core/observer</class>
132
+ <!-- model name of class containing event handler methods -->
133
+ <method>registerThatPageIsBeingRendered</method>
134
+ <!-- event handler method name -->
135
+ </mana_core>
136
+ </observers>
137
+ </controller_action_layout_render_before>
138
  </events>
139
  <!-- BASED ON SNIPPET: Resources/Installation script support (config.xml) -->
140
  <!-- This tells Magento to analyze sql/mana_core_setup directory for install/upgrade scripts.
app/code/local/Mana/Db/Helper/Data.php CHANGED
@@ -336,6 +336,28 @@ class Mana_Db_Helper_Data extends Mage_Core_Helper_Abstract {
336
  return $this;
337
  }
338
  public function beginEditing() {
339
- return Mage::getResourceSingleton('mana_db/edit_session')->begin();
 
340
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  }
336
  return $this;
337
  }
338
  public function beginEditing() {
339
+ $this->_lastEditSessionId = Mage::getResourceSingleton('mana_db/edit_session')->begin();
340
+ return $this->_lastEditSessionId;
341
  }
342
+ protected $_lastEditSessionId = false;
343
+ public function getLastEditingSessionId() {
344
+ return $this->_lastEditSessionId;
345
+ }
346
+ public function beginEditingIfNotAlreadyDoneSo() {
347
+ if (!Mage::helper('mana_db')->getInEditing()) {
348
+ Mage::helper('mana_db')->setInEditing();
349
+ return $this->beginEditing();
350
+ }
351
+ else {
352
+ return $this->_lastEditSessionId;
353
+ }
354
+ }
355
+ public function emptyEdit($editSessionId) {
356
+ return array(
357
+ 'sessionId' => $editSessionId,
358
+ 'pending' => array(),
359
+ 'saved' => array(),
360
+ 'deleted' => array(),
361
+ );
362
+ }
363
  }
app/code/local/Mana/Db/Model/Object.php CHANGED
@@ -70,6 +70,7 @@ class Mana_Db_Model_Object extends Mage_Core_Model_Abstract {
70
  public function assignDefaultValues() {
71
  $this->_assignDefaultValues();
72
  Mage::dispatchEvent('m_db_assign_defaults', array('object' => $this));
 
73
  }
74
  protected function _assignDefaultValues() {
75
  }
70
  public function assignDefaultValues() {
71
  $this->_assignDefaultValues();
72
  Mage::dispatchEvent('m_db_assign_defaults', array('object' => $this));
73
+ return $this;
74
  }
75
  protected function _assignDefaultValues() {
76
  }
app/code/local/Mana/Filters/Block/Filter.php CHANGED
@@ -11,6 +11,7 @@
11
  * Injected into layout instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_View_Category::_initBlocks.
12
  */
13
  class Mana_Filters_Block_Filter extends Mage_Catalog_Block_Layer_Filter_Abstract {
 
14
  /**
15
  * This function is typically called to initialize underlying model of filter and apply it to current
16
  * product set if needed. Here we leave it as is except that we assign template file here not in constructor,
@@ -18,8 +19,11 @@ class Mana_Filters_Block_Filter extends Mage_Catalog_Block_Layer_Filter_Abstract
18
  * @see Mage_Catalog_Block_Layer_Filter_Abstract::init()
19
  */
20
  public function init() {
 
 
 
21
  $this->setTemplate((string)$this->getDisplayOptions()->template);
22
- $this->_filterModelName = (string)$this->getDisplayOptions()->model;
23
  return parent::init();
24
  }
25
 
@@ -30,10 +34,15 @@ class Mana_Filters_Block_Filter extends Mage_Catalog_Block_Layer_Filter_Abstract
30
  $this->_filter
31
  ->setFilterOptions($this->getFilterOptions())
32
  ->setDisplayOptions($this->getDisplayOptions())
33
- ->setMode($this->getMode());
 
34
  return $this;
35
  }
36
-
 
 
 
 
37
  /**
38
  * Returns underlying model object which contains actual filter data
39
  * @return Mage_Catalog_Model_Layer_Filter_Attribute
@@ -43,6 +52,12 @@ class Mana_Filters_Block_Filter extends Mage_Catalog_Block_Layer_Filter_Abstract
43
  }
44
 
45
  public function getName() {
 
 
 
 
 
 
46
  return $this->getFilterOptions()->getName();
47
  }
48
 
@@ -56,4 +71,36 @@ class Mana_Filters_Block_Filter extends Mage_Catalog_Block_Layer_Filter_Abstract
56
  }
57
  return implode('_', $result);
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
11
  * Injected into layout instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_View_Category::_initBlocks.
12
  */
13
  class Mana_Filters_Block_Filter extends Mage_Catalog_Block_Layer_Filter_Abstract {
14
+ protected $_isBlockPrepared = false;
15
  /**
16
  * This function is typically called to initialize underlying model of filter and apply it to current
17
  * product set if needed. Here we leave it as is except that we assign template file here not in constructor,
19
  * @see Mage_Catalog_Block_Layer_Filter_Abstract::init()
20
  */
21
  public function init() {
22
+ /* @var $helper Mana_Filters_Helper_Data */
23
+ $helper = Mage::helper(strtolower('Mana_Filters'));
24
+
25
  $this->setTemplate((string)$this->getDisplayOptions()->template);
26
+ $this->_filterModelName = $helper->getFilterTypeName('model', $this->getFilterOptions());
27
  return parent::init();
28
  }
29
 
34
  $this->_filter
35
  ->setFilterOptions($this->getFilterOptions())
36
  ->setDisplayOptions($this->getDisplayOptions())
37
+ ->setMode($this->getMode())
38
+ ->setQuery($this->getQuery());
39
  return $this;
40
  }
41
+
42
+ protected function _prepareFilterBlock() {
43
+ return $this;
44
+ }
45
+
46
  /**
47
  * Returns underlying model object which contains actual filter data
48
  * @return Mage_Catalog_Model_Layer_Filter_Attribute
52
  }
53
 
54
  public function getName() {
55
+ if ($parent = $this->getParentBlock()) {
56
+ if ($label = $parent->getData($this->getFilterOptions()->getCode().'_label')) {
57
+ return $label;
58
+ }
59
+ }
60
+
61
  return $this->getFilterOptions()->getName();
62
  }
63
 
71
  }
72
  return implode('_', $result);
73
  }
74
+
75
+ public function getItemsCount() {
76
+ $this->_prepareFilterBlockOnce();
77
+ return $this->getHidden() ? 0 : $this->_filter->getItemsCount();
78
+ }
79
+
80
+ protected function _initFilter() {
81
+ if ($filter = Mage::getSingleton('mana_filters/repository')->getFilter($this->getFilterOptions()->getCode())) {
82
+ $this->_filter = $filter;
83
+ }
84
+ else {
85
+ if (!$this->_filterModelName) {
86
+ Mage::throwException(Mage::helper('catalog')->__('Filter model name must be declared.'));
87
+ }
88
+ $this->_filter = Mage::getModel($this->_filterModelName)
89
+ ->setLayer($this->getLayer());
90
+ $this->_prepareFilter();
91
+
92
+ //$this->_filter->apply($this->getRequest(), $this);
93
+ $this->getQuery()->addFilter($this->getFilterOptions()->getCode(), $this->_filter);
94
+ Mage::getSingleton('mana_filters/repository')->setFilter($this->getFilterOptions()->getCode(), $this->_filter);
95
+ }
96
+ return $this;
97
+ }
98
+
99
+ protected function _prepareFilterBlockOnce() {
100
+ if (!$this->_isBlockPrepared) {
101
+ $this->_prepareFilterBlock();
102
+ $this->_isBlockPrepared = true;
103
+ }
104
+ return $this;
105
+ }
106
  }
app/code/local/Mana/Filters/Block/Search.php CHANGED
@@ -9,51 +9,8 @@
9
  * Block type for showing filters in search pages.
10
  * @author Mana Team
11
  * Injected into layout instead of standard catalogsearch/layer in layout XML file.
 
12
  */
13
- class Mana_Filters_Block_Search extends Mage_CatalogSearch_Block_Layer {
14
- protected $_mode = 'search';
15
-
16
- /**
17
- * This method is called during page rendering to generate additional child blocks for this block.
18
- * @return Mana_Filters_Block_View_Category
19
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
- * changes are marked with comments.
21
- * @see app/code/core/Mage/Catalog/Block/Layer/Mage_Catalog_Block_Layer_View::_prepareLayout()
22
- */
23
- protected function _prepareLayout()
24
- {
25
- $stateBlock = $this->getLayout()->createBlock('mana_filters/state')
26
- ->setLayer($this->getLayer());
27
- $this->setChild('layer_state', $stateBlock);
28
-
29
- foreach (Mage::helper('mana_filters')->getFilterOptionsCollection() as $filterOptions) {
30
- $displayOptions = $filterOptions->getDisplayOptions();
31
- $block = $this->getLayout()->createBlock((string)$displayOptions->block, '', array(
32
- 'filter_options' => $filterOptions,
33
- 'display_options' => $displayOptions,
34
- ))->setLayer($this->getLayer());
35
- if ($attribute = $filterOptions->getAttribute()) {
36
- $block->setAttributeModel($attribute);
37
- }
38
- $block->setMode($this->_mode)->init();
39
- $this->setChild($filterOptions->getCode() . '_filter', $block);
40
- }
41
 
42
- $this->getLayer()->apply();
43
-
44
- return $this;
45
- }
46
-
47
- public function getFilters() {
48
- $filters = array();
49
- foreach (Mage::helper('mana_filters')->getFilterOptionsCollection() as $filterOptions) {
50
- if ($filterOptions->getIsEnabledInSearch()) {
51
- $filters[] = $this->getChild($filterOptions->getCode() . '_filter');
52
- }
53
- }
54
- return $filters;
55
- }
56
- public function getClearUrl() {
57
- return Mage::helper('mana_filters')->getClearUrl();
58
- }
59
  }
9
  * Block type for showing filters in search pages.
10
  * @author Mana Team
11
  * Injected into layout instead of standard catalogsearch/layer in layout XML file.
12
+ * @deprecated
13
  */
14
+ class Mana_Filters_Block_Search extends Mana_Filters_Block_View {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
app/code/local/Mana/Filters/Block/State.php CHANGED
@@ -12,7 +12,21 @@
12
  */
13
  class Mana_Filters_Block_State extends Mage_Catalog_Block_Layer_State {
14
  public function getClearUrl() {
15
- return Mage::helper('mana_filters')->getClearUrl();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
  public function __construct()
18
  {
@@ -25,4 +39,27 @@ class Mana_Filters_Block_State extends Mage_Catalog_Block_Layer_State {
25
  Mage::dispatchEvent('m_filter_value_html', compact('block', 'item', 'result'));
26
  return $result->getHtml() ? $result->getHtml() : '';
27
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
12
  */
13
  class Mana_Filters_Block_State extends Mage_Catalog_Block_Layer_State {
14
  public function getClearUrl() {
15
+ if ($this->getMode() == 'this') {
16
+ $query = array();
17
+ foreach ($this->getActiveFilters() as $item) {
18
+ $query[$item->getFilter()->getRequestVar()] = $item->getFilter()->getResetValue();
19
+ }
20
+ $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
21
+ $params['_current'] = true;
22
+ $params['_use_rewrite'] = true;
23
+ $params['_m_escape'] = '';
24
+ $params['_query'] = $query;
25
+ return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
26
+ }
27
+ else {
28
+ return Mage::helper('mana_filters')->getClearUrl();
29
+ }
30
  }
31
  public function __construct()
32
  {
39
  Mage::dispatchEvent('m_filter_value_html', compact('block', 'item', 'result'));
40
  return $result->getHtml() ? $result->getHtml() : '';
41
  }
42
+ public function getActiveFilters() {
43
+ $filters = parent::getActiveFilters();
44
+ if ($this->getMode() == 'this') {
45
+ $result = array();
46
+ foreach ($filters as $item) {
47
+ if ($this->_doesParentContainsFilter($item->getFilter())) {
48
+ $result[] = $item;
49
+ }
50
+ }
51
+ return $result;
52
+ }
53
+ else {
54
+ return $filters;
55
+ }
56
+ }
57
+ protected function _doesParentContainsFilter($filter) {
58
+ foreach (array_keys($this->getParentBlock()->getChild()) as $blockName) {
59
+ if ($blockName == $filter->getFilterOptions()->getCode().'_filter') {
60
+ return true;
61
+ }
62
+ }
63
+ return false;
64
+ }
65
  }
app/code/local/Mana/Filters/Block/View.php CHANGED
@@ -9,51 +9,160 @@
9
  * Block type for showing filters in category view pages.
10
  * @author Mana Team
11
  * Injected into layout instead of standard catalog/layer_view in layout XML file.
 
12
  */
13
  class Mana_Filters_Block_View extends Mage_Catalog_Block_Layer_View {
14
- protected $_mode = 'category';
15
-
 
 
 
 
16
  /**
17
  * This method is called during page rendering to generate additional child blocks for this block.
18
- * @return Mana_Filters_Block_View_Category
19
  * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
  * changes are marked with comments.
21
  * @see app/code/core/Mage/Catalog/Block/Layer/Mage_Catalog_Block_Layer_View::_prepareLayout()
22
  */
23
  protected function _prepareLayout()
24
  {
25
- $stateBlock = $this->getLayout()->createBlock('mana_filters/state')
26
- ->setLayer($this->getLayer());
27
- $this->setChild('layer_state', $stateBlock);
28
-
29
- foreach (Mage::helper('mana_filters')->getFilterOptionsCollection() as $filterOptions) {
30
- $displayOptions = $filterOptions->getDisplayOptions();
31
- $block = $this->getLayout()->createBlock((string)$displayOptions->block, '', array(
32
- 'filter_options' => $filterOptions,
33
- 'display_options' => $displayOptions,
34
- ))->setLayer($this->getLayer());
35
- if ($attribute = $filterOptions->getAttribute()) {
36
- $block->setAttributeModel($attribute);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
- $block->setMode($this->_mode)->init();
39
- $this->setChild($filterOptions->getCode() . '_filter', $block);
 
 
 
 
 
 
 
40
  }
41
 
42
- $this->getLayer()->apply();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  return $this;
45
  }
46
-
47
  public function getFilters() {
 
 
 
48
  $filters = array();
49
- foreach (Mage::helper('mana_filters')->getFilterOptionsCollection() as $filterOptions) {
50
- if ($filterOptions->getIsEnabled()) {
51
- $filters[] = $this->getChild($filterOptions->getCode() . '_filter');
 
 
 
 
 
52
  }
53
  }
54
  return $filters;
55
  }
56
  public function getClearUrl() {
57
- return Mage::helper('mana_filters')->getClearUrl();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
  }
9
  * Block type for showing filters in category view pages.
10
  * @author Mana Team
11
  * Injected into layout instead of standard catalog/layer_view in layout XML file.
12
+ * @method string getShowInFilter() returns position of layered navigation if positioning module is installed and null otherwise
13
  */
14
  class Mana_Filters_Block_View extends Mage_Catalog_Block_Layer_View {
15
+ protected function _construct()
16
+ {
17
+ parent::_construct();
18
+ Mage::register('current_layer', $this->getLayer(), true);
19
+ }
20
+
21
  /**
22
  * This method is called during page rendering to generate additional child blocks for this block.
23
+ * @return Mana_Filters_Block_View
24
  * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
25
  * changes are marked with comments.
26
  * @see app/code/core/Mage/Catalog/Block/Layer/Mage_Catalog_Block_Layer_View::_prepareLayout()
27
  */
28
  protected function _prepareLayout()
29
  {
30
+ /* @var $layoutHelper Mana_Core_Helper_Layout */
31
+ $layoutHelper = Mage::helper('mana_core/layout');
32
+ $layoutHelper->delayPrepareLayout($this, 1000);
33
+
34
+ return $this;
35
+ }
36
+
37
+ public function delayedPrepareLayout() {
38
+ /* @var $helper Mana_Filters_Helper_Data */
39
+ $helper = Mage::helper(strtolower('Mana_Filters'));
40
+
41
+ /* @var $layout Mage_Core_Model_Layout */
42
+ $layout = $this->getLayout();
43
+
44
+ /* @var $layer Mage_Catalog_Model_Layer */
45
+ $layer = $this->getLayer();
46
+
47
+ /* @var $query Mana_Filters_Model_Query */
48
+ $query = Mage::getSingleton('mana_filters/query');
49
+ $query
50
+ ->setLayer($layer)
51
+ ->init();
52
+
53
+ $showState = 'all';
54
+ if ($showInFilter = $this->getShowInFilter()) {
55
+ if ($template = Mage::getStoreConfig('mana_filters/positioning/' . $showInFilter)) {
56
+ $this->setTemplate($template);
57
  }
58
+ $showState = Mage::getStoreConfig('mana_filters/positioning/show_state_' . $showInFilter);
59
+ }
60
+ if ($showState) {
61
+ /* @var $state Mana_Filters_Block_State */
62
+ $stateBlock = $layout->createBlock('mana_filters/state', '', array(
63
+ 'layer' => $layer,
64
+ 'mode' => $showState,
65
+ ));
66
+ $this->setChild('layer_state', $stateBlock);
67
  }
68
 
69
+ foreach ($helper->getFilterOptionsCollection() as $filterOptions) {
70
+ /* @var $filterOptions Mana_Filters_Model_Filter2_Store */
71
+
72
+ if ($helper->canShowFilterInBlock($this, $filterOptions)) {
73
+ $displayOptions = $filterOptions->getDisplayOptions();
74
+
75
+ $blockName = $helper->getFilterLayoutName($this, $filterOptions);
76
+ /* @var $block Mana_Filters_Block_Filter */
77
+ $block = $layout->createBlock((string)$displayOptions->block, $blockName, array(
78
+ 'filter_options' => $filterOptions,
79
+ 'display_options' => $displayOptions,
80
+ 'show_in_filter' => $this->getShowInFilter(),
81
+ 'query' => $query,
82
+ 'layer' => $layer,
83
+ 'attribute_model' => $filterOptions->getAttribute(),
84
+ 'mode' => $helper->getMode(),
85
+ ));
86
+ $block->init();
87
+ $this->setChild($filterOptions->getCode() . '_filter', $block);
88
+ }
89
+ }
90
+
91
+ $query->apply();
92
+ $layer->apply();
93
 
94
  return $this;
95
  }
96
+
97
  public function getFilters() {
98
+ /* @var $helper Mana_Filters_Helper_Data */
99
+ $helper = Mage::helper(strtolower('Mana_Filters'));
100
+
101
  $filters = array();
102
+ foreach ($helper->getFilterOptionsCollection() as $filterOptions) {
103
+ /* @var $filterOptions Mana_Filters_Model_Filter2_Store */
104
+
105
+
106
+ if ($helper->isFilterEnabled($filterOptions)) {
107
+ if ($helper->canShowFilterInBlock($this, $filterOptions)) {
108
+ $filters[] = $this->getChild($filterOptions->getCode() . '_filter');
109
+ }
110
  }
111
  }
112
  return $filters;
113
  }
114
  public function getClearUrl() {
115
+ /* @var $helper Mana_Filters_Helper_Data */
116
+ $helper = Mage::helper(strtolower('Mana_Filters'));
117
+
118
+ return $helper->getClearUrl();
119
+ }
120
+
121
+ /**
122
+ * @return Mage_Catalog_Model_Layer
123
+ */
124
+ public function getLayer() {
125
+ /* @var $helper Mana_Filters_Helper_Data */
126
+ $helper = Mage::helper(strtolower('Mana_Filters'));
127
+
128
+ return $helper->getLayer();
129
+ }
130
+
131
+ public function canShowBlock() {
132
+ /* @var $helper Mana_Filters_Helper_Data */
133
+ $helper = Mage::helper(strtolower('Mana_Filters'));
134
+
135
+ switch ($helper->getMode()) {
136
+ case 'category':
137
+ return $this->_canShowBlockInCategory();
138
+ case 'search':
139
+ return $this->_canShowBlockInSearch();
140
+ default:
141
+ throw new Exception('Not implemented');
142
+ }
143
+ }
144
+ public function _canShowBlockInCategory() {
145
+ if ($this->canShowOptions()) {
146
+ return true;
147
+ } elseif ($state = $this->getChild('layer_state')) {
148
+ $appliedFilters = $this->getChild('layer_state')->getActiveFilters();
149
+ return !empty($appliedFilters);
150
+ }
151
+ else {
152
+ return false;
153
+ }
154
+ }
155
+ public function _canShowBlockInSearch() {
156
+ $_isLNAllowedByEngine = Mage::helper('catalogsearch')->getEngine()->isLeyeredNavigationAllowed();
157
+ if (!$_isLNAllowedByEngine) {
158
+ return false;
159
+ }
160
+ $availableResCount = (int) Mage::app()->getStore()
161
+ ->getConfig(Mage_CatalogSearch_Model_Layer::XML_PATH_DISPLAY_LAYER_COUNT);
162
+
163
+ if ($availableResCount && $availableResCount<$this->getLayer()->getProductCollection()->getSize()) {
164
+ return false;
165
+ }
166
+ return $this->_canShowBlockInCategory();
167
  }
168
  }
app/code/local/Mana/Filters/Helper/Data.php CHANGED
@@ -11,20 +11,6 @@
11
  * @author Mana Team
12
  */
13
  class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
14
- /**
15
- * Recognizes block type based on its class.
16
- * OO purists would say that kind of ifs should be done using virtual functions. Here we ignore OO-ness and
17
- * micro performance penalty for the sake of clarity and keeping logic in one file.
18
- * @param Mage_Catalog_Block_Layer_Filter_Abstract $block
19
- * @return string
20
- */
21
- public function getBlockType($block) {
22
- if ($block instanceof Mana_Filters_Block_Filter_Attribute) return 'attribute';
23
- elseif ($block instanceof Mana_Filters_Block_Filter_Category) return 'category';
24
- elseif ($block instanceof Mana_Filters_Block_Filter_Decimal) return 'decimal';
25
- elseif ($block instanceof Mana_Filters_Block_Filter_Price) return 'price';
26
- else throw new Exception('Not implemented');
27
- }
28
  /**
29
  * Return unique filter name.
30
  * OO purists would say that kind of ifs should be done using virtual functions. Here we ignore OO-ness and
@@ -32,10 +18,20 @@ class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
32
  * @param Mage_Catalog_Model_Layer_Filter_Abstract $model
33
  * @return string
34
  */
35
- public function getFilterName($model) {
36
- if ($model instanceof Mana_Filters_Model_Filter_Category) return 'category';
37
- else return $model->getAttributeModel()->getAttributeCode();
38
- }
 
 
 
 
 
 
 
 
 
 
39
  // INSERT HERE: helper functions that should be available from any other place in the system
40
  public function getJsPriceFormat() {
41
  return $this->formatPrice(0);
@@ -100,21 +96,28 @@ class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
100
  return array_merge($collection->getConnection()->fetchCol($select), array('category'));
101
  }
102
  public function markLayeredNavigationUrl($url, $routePath, $routeParams) {
103
- if (Mage::getStoreConfigFlag('mana_filters/session/save_applied_filters')) {
104
- $routeParams['_nosid'] = true;
105
- //if (Mage::getSingleton('core/url')->getUrl($routePath, $routeParams) == Mage::getSingleton('core/url')->getRouteUrl($routePath, $routeParams)) {
106
- $url .= (strpos($url, '?') === false) ? '?m-layered=1' : '&m-layered=1';
107
- //}
108
- //else {
109
- // $url = str_replace('?m-layered=1', '', $url);
110
- // $url = str_replace('&m-layered=1', '', $url);
111
- //}
112
- }
 
 
 
 
 
 
 
113
  return $url;
114
  }
115
  public function getClearUrl($markUrl = true, $clearListParams = false) {
116
  $filterState = array();
117
- foreach (array_merge(Mage::getSingleton('catalog/layer')->getState()->getFilters(), Mage::getSingleton('catalogsearch/layer')->getState()->getFilters()) as $item) {
118
  $filterState[$item->getFilter()->getRequestVar()] = $item->getFilter()->getCleanValue();
119
  }
120
  if ($clearListParams) {
@@ -129,6 +132,7 @@ class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
129
  $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
130
  $params['_current'] = true;
131
  $params['_use_rewrite'] = true;
 
132
  $filterState['m-layered'] = null;
133
  $params['_query'] = $filterState;
134
  $result = Mage::getUrl('*/*/*', $params);
@@ -138,7 +142,7 @@ class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
138
  return $result;
139
  }
140
  public function getActiveFilters() {
141
- $filters = Mage::getSingleton('catalog/layer')->getState()->getFilters();
142
  if (!is_array($filters)) {
143
  $filters = array();
144
  }
@@ -171,12 +175,255 @@ class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
171
  }
172
  $select->setPart(Zend_Db_Select::WHERE, $where);
173
  }
174
- public function getLayer () {
 
 
 
175
  if (in_array(Mage::helper('mana_core')->getRoutePath(), array('catalogsearch/result/index', 'manapro_filterajax/search/index'))) {
176
- return Mage::getSingleton('catalogsearch/layer');
177
  }
178
  else {
179
- return Mage::getSingleton('catalog/layer');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
181
  }
182
  }
11
  * @author Mana Team
12
  */
13
  class Mana_Filters_Helper_Data extends Mage_Core_Helper_Abstract {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * Return unique filter name.
16
  * OO purists would say that kind of ifs should be done using virtual functions. Here we ignore OO-ness and
18
  * @param Mage_Catalog_Model_Layer_Filter_Abstract $model
19
  * @return string
20
  */
21
+ public function getFilterName($block, $model) {
22
+ if ($model instanceof Mana_Filters_Model_Filter_Category) {
23
+ $result = 'category';
24
+ }
25
+ else {
26
+ $result = $model->getAttributeModel()->getAttributeCode();
27
+ }
28
+
29
+ if ($showInFilter = $block->getShowInFilter()) {
30
+ return $showInFilter . '_' . $result;
31
+ } else {
32
+ return $result;
33
+ }
34
+ }
35
  // INSERT HERE: helper functions that should be available from any other place in the system
36
  public function getJsPriceFormat() {
37
  return $this->formatPrice(0);
96
  return array_merge($collection->getConnection()->fetchCol($select), array('category'));
97
  }
98
  public function markLayeredNavigationUrl($url, $routePath, $routeParams) {
99
+ $request = Mage::app()->getRequest();
100
+ $path = $request->getModuleName().'/'.$request->getControllerName(). '/'.$request->getActionName();
101
+ if ($path == 'catalog/category/view') {
102
+ if (Mage::getStoreConfigFlag('mana_filters/session/save_applied_filters')) {
103
+ $url .= (strpos($url, '?') === false) ? '?m-layered=1' : '&m-layered=1';
104
+ }
105
+ }
106
+ elseif ($path == 'catalogsearch/result/index') {
107
+ if (Mage::getStoreConfigFlag('mana_filters/session/save_applied_search_filters')) {
108
+ $url .= (strpos($url, '?') === false) ? '?m-layered=1' : '&m-layered=1';
109
+ }
110
+ }
111
+ else {
112
+ if (Mage::getStoreConfigFlag('mana_filters/session/save_applied_cms_filters')) {
113
+ $url .= (strpos($url, '?') === false) ? '?m-layered=1' : '&m-layered=1';
114
+ }
115
+ }
116
  return $url;
117
  }
118
  public function getClearUrl($markUrl = true, $clearListParams = false) {
119
  $filterState = array();
120
+ foreach ($this->getLayer()->getState()->getFilters() as $item) {
121
  $filterState[$item->getFilter()->getRequestVar()] = $item->getFilter()->getCleanValue();
122
  }
123
  if ($clearListParams) {
132
  $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
133
  $params['_current'] = true;
134
  $params['_use_rewrite'] = true;
135
+ $params['_m_escape'] = '';
136
  $filterState['m-layered'] = null;
137
  $params['_query'] = $filterState;
138
  $result = Mage::getUrl('*/*/*', $params);
142
  return $result;
143
  }
144
  public function getActiveFilters() {
145
+ $filters = $this->getLayer()->getState()->getFilters();
146
  if (!is_array($filters)) {
147
  $filters = array();
148
  }
175
  }
176
  $select->setPart(Zend_Db_Select::WHERE, $where);
177
  }
178
+ /**
179
+ * @return Mage_Catalog_Model_Layer
180
+ */
181
+ public function getMode() {
182
  if (in_array(Mage::helper('mana_core')->getRoutePath(), array('catalogsearch/result/index', 'manapro_filterajax/search/index'))) {
183
+ return 'search';
184
  }
185
  else {
186
+ return 'category';
187
+ }
188
+ }
189
+
190
+ /**
191
+ * @param Mana_Filters_Model_Filter2_Store $filterOptions
192
+ * @throws Exception
193
+ * @return bool
194
+ */
195
+ public function isFilterEnabled($filterOptions) {
196
+ switch ($this->getMode()) {
197
+ case 'category':
198
+ return $filterOptions->getIsEnabled();
199
+ case 'search':
200
+ return $filterOptions->getIsEnabledInSearch();
201
+ default:
202
+ throw new Exception('Not implemented');
203
+ }
204
+ }
205
+ /**
206
+ * @return Mage_Catalog_Model_Layer
207
+ * @throws Exception
208
+ */
209
+ public function getLayer () {
210
+ switch ($this->getMode()) {
211
+ case 'category':
212
+ return Mage::getSingleton($this->useSolrForNavigation()
213
+ ? 'enterprise_search/catalog_layer'
214
+ : 'catalog/layer'
215
+ );
216
+ case 'search':
217
+ return Mage::getSingleton($this->useSolrForSearch()
218
+ ? 'enterprise_search/search_layer'
219
+ : 'catalogsearch/layer'
220
+ );
221
+ default:
222
+ throw new Exception('Not implemented');
223
+ }
224
+ }
225
+ public function canShowFilterInBlock($block, $filter) {
226
+ if ($block->getData('show_'.$filter->getCode())) {
227
+ return true;
228
+ }
229
+ elseif ($block->getData('hide_' . $filter->getCode())) {
230
+ return false;
231
+ }
232
+ elseif ($showInFilter = $block->getShowInFilter()) {
233
+ $showIn = $filter->getShowIn();
234
+ if (!is_array($showIn)) {
235
+ $showIn = explode(',', $showIn);
236
+ }
237
+ return in_array($showInFilter, $showIn);
238
+ }
239
+ else {
240
+ return true;
241
+ }
242
+ }
243
+ public function getFilterLayoutName($block, $filter) {
244
+ if ($showInFilter = $block->getShowInFilter()) {
245
+ return 'm_' . $showInFilter . '_' . $filter->getCode() . '_filter';
246
+ }
247
+ else {
248
+ return 'm_' . $filter->getCode() . '_filter';
249
+ }
250
+ }
251
+
252
+ public function addCountToCategories($productCollection, $categoryCollection, $inCurrentCategory = false) {
253
+ $isAnchor = array();
254
+ $isNotAnchor = array();
255
+ foreach ($categoryCollection as $category) {
256
+ if ($category->getIsAnchor()) {
257
+ $isAnchor[] = $category->getId();
258
+ } else {
259
+ $isNotAnchor[] = $category->getId();
260
+ }
261
+ }
262
+ $productCounts = array();
263
+ if ($isAnchor || $isNotAnchor) {
264
+ /* @var $select Varien_Db_Select */
265
+ $select = $productCollection->getProductCountSelect();
266
+
267
+ if ($inCurrentCategory) {
268
+ $from = $select->getPart(Varien_Db_Select::FROM);
269
+ if (isset($from['cat_index'])) {
270
+ $categoryId = $this->getLayer()->getCurrentCategory()->getId();
271
+ $from['cat_index']['joinCondition'] = preg_replace(
272
+ "/(.*)(`?)cat_index(`?).(`?)category_id(`?)='(\\d+)'(.*)/",
273
+ "$1$2cat_index$3.$4category_id$5='{$categoryId}'$7",
274
+ $from['cat_index']['joinCondition']
275
+ );
276
+ $select->setPart(Varien_Db_Select::FROM, $from);
277
+ }
278
+ }
279
+
280
+ Mage::dispatchEvent(
281
+ 'catalog_product_collection_before_add_count_to_categories',
282
+ array('collection' => $productCollection)
283
+ );
284
+
285
+ if ($isAnchor) {
286
+ $anchorStmt = clone $select;
287
+ $anchorStmt->limit(); //reset limits
288
+ $anchorStmt->where('count_table.category_id IN (?)', $isAnchor);
289
+ $productCounts += $productCollection->getConnection()->fetchPairs($anchorStmt);
290
+ $anchorStmt = null;
291
+ }
292
+ if ($isNotAnchor) {
293
+ $notAnchorStmt = clone $select;
294
+ $notAnchorStmt->limit(); //reset limits
295
+ $notAnchorStmt->where('count_table.category_id IN (?)', $isNotAnchor);
296
+ $notAnchorStmt->where('count_table.is_parent = 1');
297
+ $productCounts += $productCollection->getConnection()->fetchPairs($notAnchorStmt);
298
+ $notAnchorStmt = null;
299
+ }
300
+ $select = null;
301
+ $productCollection->unsProductCountSelect();
302
+ }
303
+
304
+ foreach ($categoryCollection as $category) {
305
+ $_count = 0;
306
+ if (isset($productCounts[$category->getId()])) {
307
+ $_count = $productCounts[$category->getId()];
308
+ }
309
+ $category->setProductCount($_count);
310
+ }
311
+
312
+ return $this;
313
+ }
314
+ public function renderHtml($block, $part, $data = array()) {
315
+ $result = new Varien_Object();
316
+ switch ($part) {
317
+ case 'groups':
318
+ $result->setResult($this->getNoGroups($block->getFilters()));
319
+ break;
320
+ case 'name_attributes':
321
+ echo ' data-id="' . $this->getFilterLayoutName($block, $data['filter']->getFilterOptions()) . '"';
322
+ break;
323
+ case 'group_attributes':
324
+ echo ' data-id="' . $block->getShowInFilter() .'-'. $data['group']->getId() . '"';
325
+ break;
326
+ case 'menu_visible':
327
+ $result->setResult(false);
328
+ break;
329
+ case 'currently_shopping_by':
330
+ $result->setResult(true);
331
+ break;
332
+ case 'name_action':
333
+ case 'group_action':
334
+ $result->setResult(array());
335
+ break;
336
+ }
337
+ Mage::dispatchEvent('m_advanced_filter_' . $part, array_merge($data, compact('block', 'result')));
338
+ return $result->getResult();
339
+ }
340
+ /**
341
+ * @param $result
342
+ * @param $filterBlocks
343
+ * @return array
344
+ */
345
+ public function getNoGroups($filterBlocks) {
346
+ $result = array(
347
+ '' => new Varien_Object(array(
348
+ 'name' => '',
349
+ 'sort_order' => -1,
350
+ 'id' => 0,
351
+ 'filters' => array(),
352
+ ))
353
+ );
354
+ foreach ($filterBlocks as /* @var $filterBlock Mana_Filters_Block_Filter */ $filterBlock) {
355
+ $filters = $result['']->getFilters();
356
+ $filters[] = $filterBlock;
357
+ $result['']->setFilters($filters);
358
+ }
359
+ return $result;
360
+ }
361
+
362
+ /**
363
+ * @param string $field
364
+ * @param Mana_Filters_Model_Filter2_Store $options
365
+ * @return string
366
+ */
367
+ public function getFilterTypeName($field, $options) {
368
+ $displayOptions = $options->getDisplayOptions();
369
+ $result = (string)$displayOptions->$field;
370
+
371
+ // add Solr prefix
372
+ $prefix = '';
373
+ if ($this->useSolr()) {
374
+ $prefix .= 'solr_';
375
+ }
376
+ if ($prefix) {
377
+ $prefixedField = $prefix.$field;
378
+ if ($prefixedResult = (string)$displayOptions->$prefixedField) {
379
+ $result = $prefixedResult;
380
+ }
381
+ }
382
+
383
+ // add prefix for alternative logic
384
+ if ($options->getIsReverse()) {
385
+ $prefix .= 'reverse_';
386
+ }
387
+ elseif ($options->getOperation() == 'and') {
388
+ $prefix .= 'and_';
389
+ }
390
+ if ($prefix) {
391
+ $prefixedField = $prefix.$field;
392
+ if ($prefixedResult = (string)$displayOptions->$prefixedField) {
393
+ $result = $prefixedResult;
394
+ }
395
+ }
396
+
397
+ return $result;
398
+ }
399
+
400
+ public function useSolrForNavigation() {
401
+ if (!Mage::helper('core')->isModuleEnabled('Enterprise_Search')) {
402
+ return false;
403
+ }
404
+ /* @var $helper Enterprise_Search_Helper_Data */
405
+ $helper = Mage::helper('enterprise_search');
406
+
407
+ return $helper->getIsEngineAvailableForNavigation();
408
+ }
409
+ public function useSolrForSearch() {
410
+ if (!Mage::helper('core')->isModuleEnabled('Enterprise_Search')) {
411
+ return false;
412
+ }
413
+ /* @var $helper Enterprise_Search_Helper_Data */
414
+ $helper = Mage::helper('enterprise_search');
415
+
416
+ return $helper->isThirdPartSearchEngine() && $helper->isActiveEngine();
417
+ }
418
+
419
+ public function useSolr() {
420
+ switch ($this->getMode()) {
421
+ case 'category':
422
+ return $this->useSolrForNavigation();
423
+ case 'search':
424
+ return $this->useSolrForSearch();
425
+ default:
426
+ throw new Exception('Not implemented');
427
  }
428
  }
429
  }
app/code/local/Mana/Filters/Helper/Extended.php CHANGED
@@ -12,32 +12,7 @@
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Helper_Extended extends Mage_Core_Helper_Abstract {
15
- /**
16
- * Provides phtml template file name to be used with this filter. Checks global configuration specific for
17
- * specified filter block
18
- * @param Mage_Catalog_Block_Layer_Filter_Abstract $filterBlock Block to be rendered in returned template
19
- * @return string
20
- */
21
- public function getFilterTemplate($filterBlock) {
22
-
23
- /* @var $helper Mana_Filters_Helper_Data */ $helper = Mage::helper(strtolower('Mana_Filters'));
24
- $type = $helper->getBlockType($filterBlock);
25
- if (/* @var $displayOptions Mage_Core_Model_Config_Element */ $displayOptions = Mage::getConfig()
26
- ->getNode('mana_filters/display/'.$type))
27
- {
28
- $position = 0;
29
- /* @var $default Mage_Core_Model_Config_Element */ $default = null;
30
- foreach ($displayOptions->children() as $name => /* @var $options Mage_Core_Model_Config_Element */ $options) {
31
- if (!$position || $position > (string)$options->position) {
32
- $position = (string)$options->position;
33
- $default = $options;
34
- }
35
- }
36
- if ($default) return (string)$default->template;
37
- }
38
- throw new Mage_Core_Exception($this->__('Filters of type "%s" can not be displayed - no template installed.'));
39
- }
40
-
41
  /**
42
  * Modifies filter items and filter model itself as specified by extensions subscribed to
43
  * mana_filters_process_items event.
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Helper_Extended extends Mage_Core_Helper_Abstract {
15
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Modifies filter items and filter model itself as specified by extensions subscribed to
18
  * mana_filters_process_items event.
app/code/local/Mana/Filters/Interface/Filter.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * All filter models used in Mana_Filters_Model_Query singleton should implement this interface. Through this
10
+ * interface Mana_Filters_Model_Query orchestrates applying and counting of filters
11
+ * @author Mana Team
12
+ *
13
+ */
14
+ interface Mana_Filters_Interface_Filter
15
+ {
16
+ public function init();
17
+
18
+ /**
19
+ * Returns whether this filter is applied
20
+ *
21
+ * @return bool
22
+ */
23
+ public function isApplied();
24
+
25
+ /**
26
+ * Applies filter values provided in URL to a given product collection
27
+ *
28
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
29
+ * @return void
30
+ */
31
+ public function applyToCollection($collection);
32
+
33
+ /**
34
+ * Returns true if counting should be done on main collection query and false if a separated query should be done
35
+ * Typically it should return false; however there are some cases (like not applied Solr facets) when it should
36
+ * return true.
37
+ *
38
+ * @return bool
39
+ */
40
+ public function isCountedOnMainCollection();
41
+
42
+ /**
43
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
44
+ * Typically, this method should return final result - option id/count pairs for option lists or
45
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
46
+ * object and later processCounts() extracts actual counts from this collections.
47
+ *
48
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
49
+ * @return mixed
50
+ */
51
+ public function countOnCollection($collection);
52
+
53
+ public function getRangeOnCollection($collection);
54
+
55
+ /**
56
+ * Returns option id/count pairs for option lists or min/max pair for slider. Typically, this method just returns
57
+ * $counts. However, in some cases (like not applied Solr facets) this method gets a collection object with Solr
58
+ * results and extracts those results.
59
+ *
60
+ * @param mixed $counts
61
+ * @return array
62
+ */
63
+ public function processCounts($counts);
64
+
65
+ /**
66
+ * Returns whether a given filter $modelToBeApplied should be applied when this filter is being counted. Typically,
67
+ * returns true for all filters except this one.
68
+ *
69
+ * @param $modelToBeApplied
70
+ * @return mixed
71
+ */
72
+ public function isFilterAppliedWhenCounting($modelToBeApplied);
73
+
74
+ /**
75
+ * Adds all selected items of this filters to the layered navigation state object
76
+ *
77
+ * @return void
78
+ */
79
+ public function addToState();
80
+ }
app/code/local/Mana/Filters/Model/Filter/Attribute.php CHANGED
@@ -10,94 +10,38 @@
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Attribute constructor.
12
  */
13
- class Mana_Filters_Model_Filter_Attribute extends Mage_Catalog_Model_Layer_Filter_Attribute {
 
 
 
 
 
 
 
 
14
  /**
15
- * Apply attribute option filter to product collection
16
- * @param Zend_Controller_Request_Abstract $request
17
- * @param Mana_Filters_Block_Filter_Attribute $filterBlock
18
- * @return Mana_Filters_Model_Filter_Attribute
19
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
- * changes are marked with comments.
21
- * @see app/code/core/Mage/Catalog/Model/Layer/Filter/Mage_Catalog_Model_Layer_Filter_Attribute::apply()
22
  */
23
- public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
24
  {
25
- $filter = $request->getParam($this->_requestVar);
26
- if (is_array($filter)) {
27
- return $this;
28
- }
29
-
30
- // MANA BEGIN: when several filter options can be applied, several labels should be added to layer
31
- // state, on label for each selected option. Here we assume all option ids to be in URL as one string value
32
- // separated by '_'
33
- // $text = $this->_getOptionText($filter);
34
- $text = array();
35
  foreach ($this->getMSelectedValues() as $optionId) {
36
- $text[$optionId] = $this->getAttributeModel()->getFrontend()->getOption($optionId);
37
- }
38
- // MANA END
39
-
40
- if ($filter && $text) {
41
- $this->_getResource()->applyFilterToCollection($this, $filter);
42
- // MANA BEGIN: create multiple items in layer state, prevent filter from hiding when value is set
43
- foreach ($this->getMSelectedValues() as $optionId) {
44
- $this->getLayer()->getState()->addFilter($this->_createItemEx(array(
45
- 'label' => $text[$optionId],
46
- 'value' => $optionId,
47
- 'm_selected' => true,
48
- )));
49
- }
50
- // $this->_items = array();
51
- // MANA END
52
  }
53
- return $this;
54
- }
55
- /**
56
- * Creates in-memory representation of a single option of a filter
57
- * @param array $data
58
- * @return Mana_Filters_Model_Item
59
- * This method is cloned from method _createItem() in parent class (method body was pasted from parent class
60
- * completely rewritten.
61
- * Standard method did not give us possibility to initialize non-standard fields.
62
- */
63
- protected function _createItemEx($data)
64
- {
65
- return Mage::getModel('mana_filters/item')
66
- ->setData($data)
67
- ->setFilter($this);
68
- }
69
- /**
70
- * Initializes internal array of in-memory representations of options of a filter
71
- * @return Mana_Filters_Model_Filter_Attribute
72
- * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
73
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
74
- * changes are marked with comments.
75
- */
76
- protected function _initItems()
77
- {
78
- $data = $this->_getItemsData();
79
- $items=array();
80
- foreach ($data as $itemData) {
81
- // MANA BEGIN
82
- $items[] = $this->_createItemEx($itemData);
83
- // MANA END
84
- }
85
- // MANA BEGIN: enable additional filter item processing
86
- /* @var $ext Mana_Filters_Helper_Extended */ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
87
- $items = $ext->processFilterItems($this, $items);
88
- // MANA END
89
- $this->_items = $items;
90
- return $this;
91
  }
 
92
  /**
93
- * Returns all values currently selected for this filter
94
- */
95
- public function getMSelectedValues() {
96
- $values = Mage::app()->getRequest()->getParam($this->_requestVar);
97
- return Mage::helper('mana_core')->sanitizeNumber($values, array('_'));
98
- }
99
-
100
- /**
101
  * Depending on current filter values and on attribute settings, returns available filter options from database
102
  * and additionally whether individual options are selected or not.
103
  * @return array
@@ -107,26 +51,30 @@ class Mana_Filters_Model_Filter_Attribute extends Mage_Catalog_Model_Layer_Filte
107
  */
108
  protected function _getItemsData()
109
  {
110
- // MANA BEGIN: from url, retrieve ids of all options currently selected
111
- $selectedOptionIds = $this->getMSelectedValues();
112
- // MANA END
113
 
114
- $attribute = $this->getAttributeModel();
 
 
 
 
115
  $this->_requestVar = $attribute->getAttributeCode();
116
 
117
- $key = $this->getLayer()->getStateKey().'_'.$this->_requestVar;
118
  $data = $this->getLayer()->getAggregator()->getCacheData($key);
119
 
120
  if ($data === null) {
121
  $options = $attribute->getFrontend()->getSelectOptions();
122
- $optionsCount = $this->_getResource()->getCount($this);
123
  $data = array();
124
 
125
  foreach ($options as $option) {
126
- if (is_array($option['value'])) {
127
  continue;
128
  }
129
  if (Mage::helper('core/string')->strlen($option['value'])) {
 
130
  // Check filter type
131
  if ($this->_getIsFilterableAttribute($attribute) == self::OPTIONS_ONLY_WITH_RESULTS) {
132
  if (!empty($optionsCount[$option['value']]) || in_array($option['value'], $selectedOptionIds)) {
@@ -134,29 +82,25 @@ class Mana_Filters_Model_Filter_Attribute extends Mage_Catalog_Model_Layer_Filte
134
  'label' => $option['label'],
135
  'value' => $option['value'],
136
  'count' => isset($optionsCount[$option['value']]) ? $optionsCount[$option['value']] : 0,
137
- // MANA BEGIN: mark each selected item now in memory so we could later mark it
138
- // visually in markup
139
- 'm_selected' => in_array($option['value'], $selectedOptionIds),
140
- // MANA END
141
  );
142
  }
143
- }
144
- else {
145
  $data[] = array(
146
  'label' => $option['label'],
147
  'value' => $option['value'],
148
  'count' => isset($optionsCount[$option['value']]) ? $optionsCount[$option['value']] : 0,
149
- // MANA BEGIN: mark each selected item now in memory so we could later mark it
150
- // visually in markup
151
- 'm_selected' => in_array($option['value'], $selectedOptionIds),
152
- // MANA END
153
  );
154
  }
155
  }
156
  }
157
 
158
  $tags = array(
159
- Mage_Eav_Model_Entity_Attribute::CACHE_TAG.':'.$attribute->getId()
160
  );
161
 
162
  $tags = $this->getLayer()->getStateTags($tags);
@@ -168,44 +112,211 @@ class Mana_Filters_Model_Filter_Attribute extends Mage_Catalog_Model_Layer_Filte
168
  }
169
  $this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
170
  }
 
171
  return $data;
172
  }
173
-
174
- /**
175
- * This method locates resource type which should do all dirty job with the database. In this override, we
176
- * instruct Magento to take our resource type, not standard.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  * @see Mage_Catalog_Model_Layer_Filter_Attribute::_getResource()
178
  */
179
  protected function _getResource()
180
  {
181
  if (is_null($this->_resource)) {
182
- $this->_resource = Mage::getResourceModel((string)$this->getDisplayOptions()->resource);
 
 
 
 
 
183
  }
 
184
  return $this->_resource;
185
  }
186
 
187
  protected function _getIsFilterable()
188
  {
189
- switch ($this->getMode()) {
190
- case 'category': return $this->getFilterOptions()->getIsEnabled();
191
- case 'search': return $this->getFilterOptions()->getIsEnabledInSearch();
192
- default: throw new Exception('Not implemented');
193
- }
194
- }
195
-
196
- public function getRemoveUrl() {
197
- $query = array($this->getRequestVar()=>$this->getResetValue());
198
- $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
199
- $params['_current'] = true;
 
 
 
 
200
  $params['_use_rewrite'] = true;
201
- $params['_query'] = $query;
 
 
202
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
203
  }
 
204
  protected function _getIsFilterableAttribute($attribute)
205
  {
206
  return $this->_getIsFilterable(); //return $this->getFilterOptions()->getIsEnabled();
207
  }
208
- public function getName() {
209
- return $this->getFilterOptions()->getName();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  }
 
211
  }
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Attribute constructor.
12
  */
13
+ class Mana_Filters_Model_Filter_Attribute
14
+ extends Mage_Catalog_Model_Layer_Filter_Attribute
15
+ implements Mana_Filters_Interface_Filter
16
+ {
17
+ #region Attribute specific logic
18
+
19
+ public function init() {
20
+ }
21
+
22
  /**
23
+ * Adds all selected items of this filters to the layered navigation state object
24
+ *
25
+ * @return void
 
 
 
 
26
  */
27
+ public function addToState()
28
  {
 
 
 
 
 
 
 
 
 
 
29
  foreach ($this->getMSelectedValues() as $optionId) {
30
+ $label = $this->getAttributeModel()->getFrontend()->getOption($optionId);
31
+ $this->getLayer()->getState()->addFilter(
32
+ $this->_createItemEx(
33
+ array(
34
+ 'label' => $label,
35
+ 'value' => $optionId,
36
+ 'm_selected' => true,
37
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse(),
38
+ )
39
+ )
40
+ );
 
 
 
 
 
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
+
44
  /**
 
 
 
 
 
 
 
 
45
  * Depending on current filter values and on attribute settings, returns available filter options from database
46
  * and additionally whether individual options are selected or not.
47
  * @return array
51
  */
52
  protected function _getItemsData()
53
  {
54
+ /* @var $query Mana_Filters_Model_Query */
55
+ $query = $this->getQuery();
 
56
 
57
+ // MANA BEGIN: from url, retrieve ids of all options currently selected
58
+ $selectedOptionIds = $this->getMSelectedValues();
59
+ // MANA END
60
+
61
+ $attribute = $this->getAttributeModel();
62
  $this->_requestVar = $attribute->getAttributeCode();
63
 
64
+ $key = $this->getLayer()->getStateKey() . '_' . $this->_requestVar;
65
  $data = $this->getLayer()->getAggregator()->getCacheData($key);
66
 
67
  if ($data === null) {
68
  $options = $attribute->getFrontend()->getSelectOptions();
69
+ $optionsCount = $query->getFilterCounts($this->getFilterOptions()->getCode());
70
  $data = array();
71
 
72
  foreach ($options as $option) {
73
+ if (!$option || is_array($option['value'])) {
74
  continue;
75
  }
76
  if (Mage::helper('core/string')->strlen($option['value'])) {
77
+ $isSelected = in_array($option['value'], $selectedOptionIds);
78
  // Check filter type
79
  if ($this->_getIsFilterableAttribute($attribute) == self::OPTIONS_ONLY_WITH_RESULTS) {
80
  if (!empty($optionsCount[$option['value']]) || in_array($option['value'], $selectedOptionIds)) {
82
  'label' => $option['label'],
83
  'value' => $option['value'],
84
  'count' => isset($optionsCount[$option['value']]) ? $optionsCount[$option['value']] : 0,
85
+ 'm_selected' => $isSelected,
86
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse(
87
+ ) ? !$isSelected : $isSelected,
 
88
  );
89
  }
90
+ } else {
 
91
  $data[] = array(
92
  'label' => $option['label'],
93
  'value' => $option['value'],
94
  'count' => isset($optionsCount[$option['value']]) ? $optionsCount[$option['value']] : 0,
95
+ 'm_selected' => $isSelected,
96
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse() ? !$isSelected : $isSelected,
 
 
97
  );
98
  }
99
  }
100
  }
101
 
102
  $tags = array(
103
+ Mage_Eav_Model_Entity_Attribute::CACHE_TAG . ':' . $attribute->getId()
104
  );
105
 
106
  $tags = $this->getLayer()->getStateTags($tags);
112
  }
113
  $this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
114
  }
115
+
116
  return $data;
117
  }
118
+ #endregion
119
+
120
+ #region Logic common for all non-category filters
121
+ /**
122
+ * Applies filter values provided in URL to a given product collection
123
+ *
124
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
125
+ * @return void
126
+ */
127
+ protected function _applyToCollection($collection, $value = null)
128
+ {
129
+ $this->_getResource()->applyToCollection($collection, $this, is_null($value) ? $this->getMSelectedValues() : $value);
130
+ }
131
+
132
+ #endregion
133
+
134
+ #region Mana_Filters_Interface_Filter methods
135
+ /**
136
+ * Returns whether this filter is applied
137
+ *
138
+ * @return bool
139
+ */
140
+ public function isApplied()
141
+ {
142
+ $appliedValues = $this->getMSelectedValues();
143
+
144
+ return !empty($appliedValues);
145
+ }
146
+
147
+ /**
148
+ * Applies filter values provided in URL to a given product collection
149
+ *
150
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
151
+ * @return void
152
+ */
153
+ public function applyToCollection($collection)
154
+ {
155
+ $this->_applyToCollection($collection);
156
+ }
157
+
158
+ /**
159
+ * Returns true if counting should be done on main collection query and false if a separated query should be done
160
+ * Typically it should return false; however there are some cases (like not applied Solr facets) when it should
161
+ * return true.
162
+ *
163
+ * @return bool
164
+ */
165
+ public function isCountedOnMainCollection()
166
+ {
167
+ return false;
168
+ }
169
+
170
+ /**
171
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
172
+ * Typically, this method should return final result - option id/count pairs for option lists or
173
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
174
+ * object and later processCounts() extracts actual counts from this collections.
175
+ *
176
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
177
+ * @return mixed
178
+ */
179
+ public function countOnCollection($collection)
180
+ {
181
+ return $this->_getResource()->countOnCollection($collection, $this);
182
+ }
183
+
184
+ public function getRangeOnCollection($collection)
185
+ {
186
+ return array();
187
+ }
188
+
189
+ /**
190
+ * Returns option id/count pairs for option lists or min/max pair for slider. Typically, this method just returns
191
+ * $counts. However, in some cases (like not applied Solr facets) this method gets a collection object with Solr
192
+ * results and extracts those results.
193
+ *
194
+ * @param mixed $counts
195
+ * @return array
196
+ */
197
+ public function processCounts($counts)
198
+ {
199
+ return $counts;
200
+ }
201
+
202
+ /**
203
+ * Returns whether a given filter $modelToBeApplied should be applied when this filter is being counted. Typically,
204
+ * returns true for all filters except this one.
205
+ *
206
+ * @param $modelToBeApplied
207
+ * @return mixed
208
+ */
209
+ public function isFilterAppliedWhenCounting($modelToBeApplied)
210
+ {
211
+ return $modelToBeApplied != $this;
212
+ }
213
+
214
+
215
+ #endregion
216
+ #region common part for all mana_filters/filter_* models
217
+
218
+
219
+
220
+ /**
221
+ * Creates in-memory representation of a single option of a filter
222
+ * @param array $data
223
+ * @return Mana_Filters_Model_Item
224
+ */
225
+ protected function _createItemEx($data)
226
+ {
227
+ return Mage::getModel('mana_filters/item')
228
+ ->setData($data)
229
+ ->setFilter($this);
230
+ }
231
+
232
+ /**
233
+ * Initializes internal array of in-memory representations of options of a filter
234
+ * @return Mana_Filters_Model_Filter_Attribute
235
+ * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
236
+ */
237
+ protected function _initItems()
238
+ {
239
+ /* @var $ext Mana_Filters_Helper_Extended */
240
+ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
241
+
242
+ $data = $this->_getItemsData();
243
+ $items = array();
244
+ foreach ($data as $itemData) {
245
+ $items[] = $this->_createItemEx($itemData);
246
+ }
247
+ $items = $ext->processFilterItems($this, $items);
248
+ $this->_items = $items;
249
+
250
+ return $this;
251
+ }
252
+
253
+ /**
254
+ * This method locates resource type which should do all dirty job with the database. In this override, we
255
+ * instruct Magento to take our resource type, not standard.
256
  * @see Mage_Catalog_Model_Layer_Filter_Attribute::_getResource()
257
  */
258
  protected function _getResource()
259
  {
260
  if (is_null($this->_resource)) {
261
+ /* @var $helper Mana_Filters_Helper_Data */
262
+ $helper = Mage::helper(strtolower('Mana_Filters'));
263
+
264
+ $this->_resource = Mage::getResourceModel(
265
+ $helper->getFilterTypeName('resource', $this->getFilterOptions())
266
+ );
267
  }
268
+
269
  return $this->_resource;
270
  }
271
 
272
  protected function _getIsFilterable()
273
  {
274
+ switch ($this->getMode()) {
275
+ case 'category':
276
+ return $this->getFilterOptions()->getIsEnabled();
277
+ case 'search':
278
+ return $this->getFilterOptions()->getIsEnabledInSearch();
279
+ default:
280
+ throw new Exception('Not implemented');
281
+ }
282
+ }
283
+
284
+ public function getRemoveUrl()
285
+ {
286
+ $query = array($this->getRequestVar() => $this->getResetValue());
287
+ $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
288
+ $params['_current'] = true;
289
  $params['_use_rewrite'] = true;
290
+ $params['_m_escape'] = '';
291
+ $params['_query'] = $query;
292
+
293
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
294
  }
295
+
296
  protected function _getIsFilterableAttribute($attribute)
297
  {
298
  return $this->_getIsFilterable(); //return $this->getFilterOptions()->getIsEnabled();
299
  }
300
+
301
+ public function getName()
302
+ {
303
+ return $this->getFilterOptions()->getName();
304
+ }
305
+
306
+ /**
307
+ * Returns all values currently selected for this filter
308
+ */
309
+ public function getMSelectedValues()
310
+ {
311
+ /* @var $core Mana_Core_Helper_Data */
312
+ $core = Mage::helper(strtolower('Mana_Core'));
313
+
314
+ $values = $core->sanitizeRequestNumberParam(
315
+ $this->_requestVar,
316
+ array(array('sep' => '_', 'as_string' => true))
317
+ );
318
+
319
+ return $values ? array_filter(explode('_', $values)) : array();
320
  }
321
+ #endregion
322
  }
app/code/local/Mana/Filters/Model/Filter/Category.php CHANGED
@@ -10,153 +10,308 @@
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Category constructor.
12
  */
13
- class Mana_Filters_Model_Filter_Category extends Mage_Catalog_Model_Layer_Filter_Category {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
- * Apply category filter to product collection
16
- * @param Zend_Controller_Request_Abstract $request
17
- * @param Mana_Filters_Block_Filter_Category $filterBlock
18
- * @return Mana_Filters_Block_Filter_Category
19
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
- * changes are marked with comments.
21
- * @see app/code/core/Mage/Catalog/Model/Layer/Filter/Mage_Catalog_Model_Layer_Filter_Category::apply()
22
  */
23
- public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
24
  {
25
- $filter = (int) $request->getParam($this->getRequestVar());
26
- if (!$filter) {
27
- return $this;
28
  }
29
- $this->_categoryId = $filter;
30
 
31
- $category = $this->getCategory();
32
- Mage::register('current_category_filter', $category);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
- $this->_appliedCategory = Mage::getModel('catalog/category')
35
- ->setStoreId(Mage::app()->getStore()->getId())
36
- ->load($filter);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
- if ($this->_isValidCategory($this->_appliedCategory)) {
39
- $this->getLayer()->getProductCollection()
40
- ->addCategoryFilter($this->_appliedCategory);
 
41
 
42
- $this->getLayer()->getState()->addFilter($this->_createItemEx(array(
43
- 'label' => $this->_appliedCategory->getName(),
44
- 'value' => $filter,
45
- 'm_selected' => true,
46
- )));
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
 
48
 
49
- return $this;
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
- /**
52
- * Returns all values currently selected for this filter
 
 
 
 
53
  */
54
- // public function getMSelectedValues() {
55
- // $values = Mage::app()->getRequest()->getParam($this->_requestVar);
56
- // return $values ? explode('_', $values) : array();
57
- // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * Creates in-memory representation of a single option of a filter
60
  * @param array $data
61
  * @return Mana_Filters_Model_Item
62
- * This method is cloned from method _createItem() in parent class (method body was pasted from parent class
63
- * completely rewritten.
64
- * Standard method did not give us possibility to initialize non-standard fields.
65
  */
66
  protected function _createItemEx($data)
67
  {
68
  return Mage::getModel('mana_filters/item')
69
- ->setData($data)
70
- ->setFilter($this);
71
  }
72
- /**
 
73
  * Initializes internal array of in-memory representations of options of a filter
74
  * @return Mana_Filters_Model_Filter_Attribute
75
  * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
76
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
77
- * changes are marked with comments.
78
  */
79
  protected function _initItems()
80
  {
 
 
 
81
  $data = $this->_getItemsData();
82
- $items=array();
83
  foreach ($data as $itemData) {
84
- // MANA BEGIN
85
  $items[] = $this->_createItemEx($itemData);
86
- // MANA END
87
  }
88
- // MANA BEGIN: enable additional filter item processing
89
- /* @var $ext Mana_Filters_Helper_Extended */ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
90
  $items = $ext->processFilterItems($this, $items);
91
- // MANA END
92
  $this->_items = $items;
 
93
  return $this;
94
  }
95
- protected function _getCategoryItemsData($category, $products, $categories = null)
 
 
 
 
 
 
96
  {
97
- if (!$categories) {
98
- $categories = $category->getChildrenCategories();
99
- $products->addCountToCategories($categories);
100
- }
101
- $data = array();
102
- foreach ($categories as $category) {
103
- if ($category->getIsActive() && $category->getProductCount()) {
104
- $data[] = array(
105
- 'label' => Mage::helper('core')->htmlEscape($category->getName()),
106
- 'value' => $category->getId(),
107
- 'count' => $category->getProductCount(),
108
- 'm_selected' => $category->getId() == $this->getCategory()->getId()
109
- );
110
- }
111
  }
112
- return $data;
 
113
  }
114
- protected function _getItemsData()
115
- {
116
- $key = $this->getLayer()->getStateKey().'_SUBCATEGORIES';
117
- $data = $this->getLayer()->getAggregator()->getCacheData($key);
118
 
119
- if ($data === null) {
120
- $categoty = $this->getCategory();
121
- /** @var $categoty Mage_Catalog_Model_Categeory */
122
- Mana_Core_Profiler::start('mln', __CLASS__, __METHOD__, '$categoty->getChildrenCategories()');
123
- $categories = $categoty->getChildrenCategories();
124
- Mana_Core_Profiler::stop('mln', __CLASS__, __METHOD__, '$categoty->getChildrenCategories()');
125
-
126
- $this->getLayer()->getProductCollection()
127
- ->addCountToCategories($categories);
128
-
129
- $data = array();
130
- foreach ($categories as $category) {
131
- if ($category->getIsActive() && $category->getProductCount()) {
132
- $data[] = array(
133
- 'label' => Mage::helper('core')->htmlEscape($category->getName()),
134
- 'value' => $category->getId(),
135
- 'count' => $category->getProductCount(),
136
- );
137
- }
138
- }
139
- $data = $this->_getCategoryItemsData($this->getCategory(), $this->getLayer()->getProductCollection(), $categories);
140
- //if (!count($data)) { // no child categories having products
141
- // $category = $this->getCategory()->getParentCategory();
142
- // $products = clone ($this->getLayer()->getProductCollection());
143
- // $products->addCategoryFilter($category);
144
- // $data = $this->_getCategoryItemsData($category, $products);
145
- //}
146
- $tags = $this->getLayer()->getStateTags();
147
- $this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
148
  }
149
- return $data;
150
  }
151
- public function getRemoveUrl() {
152
- $query = array($this->getRequestVar()=>$this->getResetValue());
 
 
153
  $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
154
- $params['_current'] = true;
155
  $params['_use_rewrite'] = true;
156
- $params['_query'] = $query;
 
 
157
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
158
  }
159
- public function getName() {
 
 
 
 
 
 
 
160
  return $this->getFilterOptions()->getName();
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Category constructor.
12
  */
13
+ class Mana_Filters_Model_Filter_Category
14
+ extends Mage_Catalog_Model_Layer_Filter_Category
15
+ implements Mana_Filters_Interface_Filter
16
+ {
17
+ #region Category Specific logic
18
+ protected $_countedCategories;
19
+
20
+
21
+ public function getCountedCategories() {
22
+ if (!$this->_countedCategories) {
23
+ $category = $this->isApplied() ? $this->getAppliedCategory() : $this->getCategory();
24
+ $this->_countedCategories = $category->getChildrenCategories();
25
+ }
26
+ return $this->_countedCategories;
27
+ }
28
+ public function getAppliedCategory() {
29
+ if (!$this->_appliedCategory) {
30
+ $values = $this->getMSelectedValues();
31
+ $category = $this->getCategory();
32
+ Mage::register('current_category_filter', $category, true);
33
+
34
+ $this->_appliedCategory = Mage::getModel('catalog/category')
35
+ ->setStoreId(Mage::app()->getStore()->getId())
36
+ ->load($values[0]);
37
+ }
38
+ return $this->_appliedCategory;
39
+ }
40
+ public function init()
41
+ {
42
+ }
43
+
44
  /**
45
+ * Applies filter values provided in URL to a given product collection
46
+ *
47
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
48
+ * @return void
 
 
 
49
  */
50
+ protected function _applyToCollection($collection)
51
  {
52
+ if ($this->_isValidCategory($this->getAppliedCategory())) {
53
+ $collection->addCategoryFilter($this->getAppliedCategory());
 
54
  }
55
+ }
56
 
57
+ protected function _getCategoryItemsData($categories)
58
+ {
59
+ $data = array();
60
+ foreach ($categories as $category) {
61
+ if ($category->getIsActive() && $category->getProductCount()) {
62
+ $data[] = array(
63
+ 'label' => Mage::helper('core')->htmlEscape($category->getName()),
64
+ 'value' => $category->getId(),
65
+ 'count' => $category->getProductCount(),
66
+ 'm_selected' => $category->getId() == $this->getCategory()->getId()
67
+ );
68
+ }
69
+ }
70
+ return $data;
71
+ }
72
+ protected function _getItemsData()
73
+ {
74
+ $key = $this->getLayer()->getStateKey().'_SUBCATEGORIES';
75
+ $data = $this->getLayer()->getAggregator()->getCacheData($key);
76
 
77
+ if ($data === null) {
78
+ /* @var $query Mana_Filters_Model_Query */
79
+ $query = $this->getQuery();
80
+ $counts = $query->getFilterCounts($this->getFilterOptions()->getCode());
81
+ $data = $this->_getCategoryItemsData($counts);
82
+ $tags = $this->getLayer()->getStateTags();
83
+ $this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
84
+ }
85
+ return $data;
86
+ }
87
+
88
+ /**
89
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection $categories
90
+ * @return Mana_Filters_Model_Filter_Category
91
+ */
92
+ public function addCountToCategories($categories, $products = null, $inCurrentCategory = false) {
93
+ if (!$products) {
94
+ $products = $this->getLayer()->getProductCollection();
95
+ }
96
+ //$products->addCountToCategories($categories);
97
+ $items = is_array($categories) ? $categories : $categories->getItems();
98
+ if (count($items)) {
99
+ $category = array_shift($items);
100
+ if (!$category->hasProductCount()) {
101
+ Mage::helper('mana_filters')->addCountToCategories($products, $categories, $inCurrentCategory);
102
+ }
103
+ }
104
+ return $this;
105
+ }
106
+
107
+ /**
108
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
109
+ * Typically, this method should return final result - option id/count pairs for option lists or
110
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
111
+ * object and later processCounts() extracts actual counts from this collections.
112
+ *
113
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
114
+ * @return mixed
115
+ */
116
+ public function countOnCollection($collection)
117
+ {
118
+ $this->addCountToCategories($this->getCountedCategories(), $collection);
119
+ return $this->getCountedCategories();
120
+ }
121
 
122
+ public function getRangeOnCollection($collection)
123
+ {
124
+ return array();
125
+ }
126
 
127
+ /**
128
+ * Adds all selected items of this filters to the layered navigation state object
129
+ *
130
+ * @return void
131
+ */
132
+ public function addToState()
133
+ {
134
+ foreach ($this->getMSelectedValues() as $optionId) {
135
+ $this->getLayer()->getState()->addFilter(
136
+ $this->_createItemEx(
137
+ array(
138
+ 'label' => $this->getAppliedCategory()->getName(),
139
+ 'value' => $optionId,
140
+ 'm_selected' => true,
141
+ 'm_show_selected' => false,
142
+ )
143
+ )
144
+ );
145
  }
146
+ }
147
 
148
+ #endregion
149
+ #region Mana_Filters_Interface_Filter methods
150
+ /**
151
+ * Returns whether this filter is applied
152
+ *
153
+ * @return bool
154
+ */
155
+ public function isApplied()
156
+ {
157
+ $appliedValues = $this->getMSelectedValues();
158
+
159
+ return !empty($appliedValues);
160
  }
161
+
162
+ /**
163
+ * Applies filter values provided in URL to a given product collection
164
+ *
165
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
166
+ * @return void
167
  */
168
+ public function applyToCollection($collection)
169
+ {
170
+ $this->_applyToCollection($collection);
171
+ }
172
+
173
+ /**
174
+ * Returns true if counting should be done on main collection query and false if a separated query should be done
175
+ * Typically it should return false; however there are some cases (like not applied Solr facets) when it should
176
+ * return true.
177
+ *
178
+ * @return bool
179
+ */
180
+ public function isCountedOnMainCollection()
181
+ {
182
+ return false;
183
+ }
184
+
185
+ /**
186
+ * Returns option id/count pairs for option lists or min/max pair for slider. Typically, this method just returns
187
+ * $counts. However, in some cases (like not applied Solr facets) this method gets a collection object with Solr
188
+ * results and extracts those results.
189
+ *
190
+ * @param mixed $counts
191
+ * @return array
192
+ */
193
+ public function processCounts($counts)
194
+ {
195
+ return $counts;
196
+ }
197
+
198
+ /**
199
+ * Returns whether a given filter $modelToBeApplied should be applied when this filter is being counted. Typically,
200
+ * returns true for all filters except this one.
201
+ *
202
+ * @param $modelToBeApplied
203
+ * @return mixed
204
+ */
205
+ public function isFilterAppliedWhenCounting($modelToBeApplied)
206
+ {
207
+ return $modelToBeApplied != $this;
208
+ }
209
+
210
+ #endregion
211
+ #region common part for all mana_filters/filter_* models
212
+
213
+
214
  /**
215
  * Creates in-memory representation of a single option of a filter
216
  * @param array $data
217
  * @return Mana_Filters_Model_Item
 
 
 
218
  */
219
  protected function _createItemEx($data)
220
  {
221
  return Mage::getModel('mana_filters/item')
222
+ ->setData($data)
223
+ ->setFilter($this);
224
  }
225
+
226
+ /**
227
  * Initializes internal array of in-memory representations of options of a filter
228
  * @return Mana_Filters_Model_Filter_Attribute
229
  * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
 
 
230
  */
231
  protected function _initItems()
232
  {
233
+ /* @var $ext Mana_Filters_Helper_Extended */
234
+ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
235
+
236
  $data = $this->_getItemsData();
237
+ $items = array();
238
  foreach ($data as $itemData) {
 
239
  $items[] = $this->_createItemEx($itemData);
 
240
  }
 
 
241
  $items = $ext->processFilterItems($this, $items);
 
242
  $this->_items = $items;
243
+
244
  return $this;
245
  }
246
+
247
+ /**
248
+ * This method locates resource type which should do all dirty job with the database. In this override, we
249
+ * instruct Magento to take our resource type, not standard.
250
+ * @see Mage_Catalog_Model_Layer_Filter_Attribute::_getResource()
251
+ */
252
+ protected function _getResource()
253
  {
254
+ if (is_null($this->_resource)) {
255
+ /* @var $helper Mana_Filters_Helper_Data */
256
+ $helper = Mage::helper(strtolower('Mana_Filters'));
257
+
258
+ $this->_resource = Mage::getResourceModel(
259
+ $helper->getFilterTypeName('resource', $this->getFilterOptions())
260
+ );
 
 
 
 
 
 
 
261
  }
262
+
263
+ return $this->_resource;
264
  }
 
 
 
 
265
 
266
+ protected function _getIsFilterable()
267
+ {
268
+ switch ($this->getMode()) {
269
+ case 'category':
270
+ return $this->getFilterOptions()->getIsEnabled();
271
+ case 'search':
272
+ return $this->getFilterOptions()->getIsEnabledInSearch();
273
+ default:
274
+ throw new Exception('Not implemented');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  }
 
276
  }
277
+
278
+ public function getRemoveUrl()
279
+ {
280
+ $query = array($this->getRequestVar() => $this->getResetValue());
281
  $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
282
+ $params['_current'] = true;
283
  $params['_use_rewrite'] = true;
284
+ $params['_m_escape'] = '';
285
+ $params['_query'] = $query;
286
+
287
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
288
  }
289
+
290
+ protected function _getIsFilterableAttribute($attribute)
291
+ {
292
+ return $this->_getIsFilterable(); //return $this->getFilterOptions()->getIsEnabled();
293
+ }
294
+
295
+ public function getName()
296
+ {
297
  return $this->getFilterOptions()->getName();
298
  }
299
+
300
+ /**
301
+ * Returns all values currently selected for this filter
302
+ */
303
+ public function getMSelectedValues()
304
+ {
305
+ /* @var $core Mana_Core_Helper_Data */
306
+ $core = Mage::helper(strtolower('Mana_Core'));
307
+
308
+ $values = $core->sanitizeRequestNumberParam(
309
+ $this->_requestVar,
310
+ array(array('sep' => '_', 'as_string' => true))
311
+ );
312
+
313
+ return $values ? array_filter(explode('_', $values)) : array();
314
+ }
315
+ #endregion
316
+
317
  }
app/code/local/Mana/Filters/Model/Filter/Common.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Filter_Common
13
+ {
14
+ /**
15
+ * @var Mana_Filters_Interface_Filter_Model
16
+ */
17
+ protected $_model;
18
+
19
+ public function __construct(Mana_Filters_Interface_Filter_Model $model) {
20
+ $this->_model = $model;
21
+ }
22
+
23
+ #region Mana_Filters_Interface_Filter_Query methods
24
+ /**
25
+ * Returns whether this filter is applied
26
+ *
27
+ * @return bool
28
+ */
29
+ public function isApplied()
30
+ {
31
+ $appliedValues = $this->_model->getMSelectedValues();
32
+ return !empty($appliedValues);
33
+ }
34
+
35
+ /**
36
+ * Applies filter values provided in URL to a given product collection
37
+ *
38
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
39
+ * @return void
40
+ */
41
+ public function applyToCollection($collection)
42
+ {
43
+ $this->_model->getResource()->applyToCollection($collection, $this, $this->_model->getMSelectedValues());
44
+ }
45
+
46
+ /**
47
+ * Returns true if counting should be done on main collection query and false if a separated query should be done
48
+ * Typically it should return false; however there are some cases (like not applied Solr facets) when it should
49
+ * return true.
50
+ *
51
+ * @return bool
52
+ */
53
+ public function isCountedOnMainCollection()
54
+ {
55
+ return false;
56
+ }
57
+
58
+ /**
59
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
60
+ * Typically, this method should return final result - option id/count pairs for option lists or
61
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
62
+ * object and later processCounts() extracts actual counts from this collections.
63
+ *
64
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
65
+ * @return mixed
66
+ */
67
+ public function countOnCollection($collection)
68
+ {
69
+ return $this->_model->getResource()->countOnCollection($collection, $this);
70
+ }
71
+
72
+ /**
73
+ * Returns option id/count pairs for option lists or min/max pair for slider. Typically, this method just returns
74
+ * $counts. However, in some cases (like not applied Solr facets) this method gets a collection object with Solr
75
+ * results and extracts those results.
76
+ *
77
+ * @param mixed $counts
78
+ * @return array
79
+ */
80
+ public function processCounts($counts)
81
+ {
82
+ return $counts;
83
+ }
84
+ /**
85
+ * Returns whether a given filter $modelToBeApplied should be applied when this filter is being counted. Typically,
86
+ * returns true for all filters except this one.
87
+ *
88
+ * @param $modelToBeApplied
89
+ * @return mixed
90
+ */
91
+ public function isFilterAppliedWhenCounting($modelToBeApplied) {
92
+ return $modelToBeApplied != $this->_model;
93
+ }
94
+ #endregion
95
+
96
+ /**
97
+ * Creates in-memory representation of a single option of a filter
98
+ * @param array $data
99
+ * @return Mana_Filters_Model_Item
100
+ * This method is cloned from method _createItem() in parent class (method body was pasted from parent class
101
+ * completely rewritten.
102
+ * Standard method did not give us possibility to initialize non-standard fields.
103
+ */
104
+ public function createItemEx($data)
105
+ {
106
+ return Mage::getModel('mana_filters/item')
107
+ ->setData($data)
108
+ ->setFilter($this->_model);
109
+ }
110
+
111
+ /**
112
+ * Initializes internal array of in-memory representations of options of a filter
113
+ * @return Mana_Filters_Model_Filter_Attribute
114
+ * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
115
+ * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
116
+ * changes are marked with comments.
117
+ */
118
+ public function initItems()
119
+ {
120
+ /* @var $ext Mana_Filters_Helper_Extended */
121
+ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
122
+
123
+ $data = $this->_model->getItemsData();
124
+ $items=array();
125
+ foreach ($data as $itemData) {
126
+ $items[] = $this->_model->createItemEx($itemData);
127
+ }
128
+ $items = $ext->processFilterItems($this, $items);
129
+ $this->_model->setItems($items);
130
+ return $this;
131
+ }
132
+
133
+ /**
134
+ * Returns all values currently selected for this filter
135
+ */
136
+ public function getMSelectedValues() {
137
+ /* @var $core Mana_Core_Helper_Data */
138
+ $core = Mage::helper(strtolower('Mana_Core'));
139
+
140
+ $values = $core->sanitizeRequestNumberParam($this->_model->getRequestVar(),
141
+ array(array('sep' => '_', 'as_string' => true)));
142
+ return $values ? array_filter(explode('_', $values)) : array();
143
+ }
144
+ public function getMSelectedRangeValues() {
145
+ /* @var $core Mana_Core_Helper_Data */
146
+ $core = Mage::helper(strtolower('Mana_Core'));
147
+
148
+ $values = $core->sanitizeRequestNumberParam($this->_model->getRequestVar(),
149
+ array(array('sep' => '_', 'as_string' => true), array('sep' => ',', 'as_string' => true)));
150
+ return $values ? explode('_', $values) : array();
151
+ }
152
+
153
+ }
app/code/local/Mana/Filters/Model/Filter/Decimal.php CHANGED
@@ -10,42 +10,10 @@
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Price constructor.
12
  */
13
- class Mana_Filters_Model_Filter_Decimal extends Mage_Catalog_Model_Layer_Filter_Decimal {
14
- /**
15
- * Apply price filter to product collection
16
- * @param Zend_Controller_Request_Abstract $request
17
- * @param Mana_Filters_Block_Filter_Price $filterBlock
18
- * @return Mana_Filters_Model_Filter_Price
19
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
- * changes are marked with comments.
21
- * @see app/code/core/Mage/Catalog/Model/Layer/Filter/Mage_Catalog_Model_Layer_Filter_Price::apply()
22
- */
23
- public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
24
- {
25
- // MANA BEGIN: read multiple price ranges from URL instead of single range read in standard code,
26
- // apply multiple ranges, show multiple ranges in state and do not hide selected ranges from filter options
27
- $selections = $this->getMSelectedValues();
28
-
29
- if (count($selections) > 0) {
30
- if (strpos($selections[0], ',') !== false) {
31
- list($index, $range) = explode(',', $selections[0]);
32
- if ((int)$range) {
33
- $this->setRange((int)$range);
34
- $this->_applyToCollectionEx($selections);
35
- foreach ($selections as $selection) {
36
- list($index, $range) = explode(',', $selection);
37
- $this->getLayer()->getState()->addFilter($this->_createItemEx(array(
38
- 'label' => $this->_renderItemLabel($range, $index),
39
- 'value' => $selection,
40
- 'm_selected' => true,
41
- )));
42
- }
43
- }
44
- }
45
- }
46
- // MANA END
47
- return $this;
48
- }
49
  /**
50
  * Prepare text of item label
51
  *
@@ -60,184 +28,411 @@ class Mana_Filters_Model_Filter_Decimal extends Mage_Catalog_Model_Layer_Filter_
60
  Mage::dispatchEvent('m_render_price_range', array('range' => $range, 'model' => $this, 'result' => $result));
61
  if ($result->getLabel()) {
62
  return $result->getLabel();
63
- }
64
- else {
65
- $store = Mage::app()->getStore();
66
- $fromPrice = $store->formatPrice($range['from']);
67
- $toPrice = $store->formatPrice($range['to']);
68
  return Mage::helper('catalog')->__('%s - %s', $fromPrice, $toPrice);
69
  }
70
  }
71
-
72
  /**
73
- * Applies one or more price filters to currently viewed product collection
74
- * @param array $selections
75
- * @return Mana_Filters_Model_Filter_Price
76
- * This method is cloned from method _applyToCollection() in parent class (method body was pasted from parent class
77
- * completely rewritten.
78
- * Standard method did not give us possibility to filter multiple ranges.
79
  */
80
- protected function _applyToCollectionEx($selections)
81
  {
82
- $this->_getResource()->applyFilterToCollectionEx($this, $selections);
83
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Creates in-memory representation of a single option of a filter
87
  * @param array $data
88
  * @return Mana_Filters_Model_Item
89
- * This method is cloned from method _createItem() in parent class (method body was pasted from parent class
90
- * completely rewritten.
91
- * Standard method did not give us possibility to initialize non-standard fields.
92
  */
93
  protected function _createItemEx($data)
94
  {
95
  return Mage::getModel('mana_filters/item')
96
- ->setData($data)
97
- ->setFilter($this);
98
  }
99
- /**
 
100
  * Initializes internal array of in-memory representations of options of a filter
101
  * @return Mana_Filters_Model_Filter_Attribute
102
  * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
103
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
104
- * changes are marked with comments.
105
  */
106
  protected function _initItems()
107
  {
 
 
 
108
  $data = $this->_getItemsData();
109
- $items=array();
110
  foreach ($data as $itemData) {
111
- // MANA BEGIN
112
  $items[] = $this->_createItemEx($itemData);
113
- // MANA END
114
  }
115
- // MANA BEGIN: enable additional filter item processing
116
- /* @var $ext Mana_Filters_Helper_Extended */ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
117
  $items = $ext->processFilterItems($this, $items);
118
- // MANA END
119
  $this->_items = $items;
 
120
  return $this;
121
  }
 
122
  /**
123
- * Returns all values currently selected for this filter
 
 
124
  */
125
- public function getMSelectedValues() {
126
- $values = Mage::app()->getRequest()->getParam($this->_requestVar);
127
- return Mage::helper('mana_core')->sanitizeNumber(urldecode($values), array(
128
- '_', array('sep' => ',', 'as_string' => true)
129
- ));
130
- }
131
- /**
132
- * Depending on current filter values, returns available filter options from database
133
- * and additionally whether individual options are selected or not.
134
- * @return array
135
- * @see Mage_Catalog_Model_Layer_Filter_Price::_getItemsData()
136
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
137
- * changes are marked with comments.
138
- */
139
- protected function _getItemsData()
140
  {
141
- $range = $this->getRange();
142
- $dbRanges = $this->getRangeItemCounts($range);
143
- $data = array();
144
 
145
- // MANA BEGIN
146
- $selectedIndexes = array();
147
- foreach ($this->getMSelectedValues() as $selection) {
148
- if (strpos($selection, ',') !== false) {
149
- list($index, $range) = explode(',', $selection);
150
- $selectedIndexes[] = $index;
151
- }
152
- }
153
- // MANA END
154
-
155
- foreach ($dbRanges as $index=>$count) {
156
- $data[] = array(
157
- 'label' => $this->_renderItemLabel($range, $index),
158
- 'value' => $index . ',' . $range,
159
- 'count' => $count,
160
- // MANA BEGIN
161
- 'm_selected' => in_array($index, $selectedIndexes),
162
- // MANA END
163
  );
164
  }
165
 
166
- return $data;
167
  }
168
- /**
169
- * This method locates resource type which should do all dirty job with the database. In this override, we
170
- * instruct Magento to take our resource type, not standard.
171
- * @see Mage_Catalog_Model_Layer_Filter_Price::_getResource()
172
- */
173
- protected function _getResource()
174
  {
175
- if (is_null($this->_resource)) {
176
- $this->_resource = Mage::getResourceModel((string)$this->getDisplayOptions()->resource);
 
 
 
 
 
177
  }
178
- return $this->_resource;
179
  }
180
- public function getLowestPossibleValue() {
181
- return (int)$this->getMinValue();
182
- }
183
- public function getHighestPossibleValue() {
184
- $result = (int)ceil($this->getMaxValue());
185
- $min = $this->getLowestPossibleValue();
186
- return $result != $min ? $result : $result + 1;
 
 
 
 
187
  }
188
- public function getCurrentRangeLowerBound() {
189
- $selections = $this->getMSelectedValues();
190
- if ($selections && count($selections) == 1) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  if (strpos($selections[0], ',') !== false) {
192
  list($index, $range) = explode(',', $selections[0]);
193
- return $index;
 
194
  }
195
- }
 
196
  return $this->getLowestPossibleValue();
197
  }
198
- public function getCurrentRangeHigherBound() {
199
- $selections = $this->getMSelectedValues();
200
- if ($selections && count($selections) == 1) {
 
 
201
  if (strpos($selections[0], ',') !== false) {
202
  list($index, $range) = explode(',', $selections[0]);
203
- return $range;
 
204
  }
205
  }
206
- return $this->getHighestPossibleValue();
207
- }
208
- public function getRemoveUrl() {
209
- $query = array($this->getRequestVar()=>$this->getResetValue());
210
- $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
211
- $params['_current'] = true;
212
- $params['_use_rewrite'] = true;
213
- $params['_query'] = $query;
214
- return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
215
- }
216
- public function getName() {
217
- return $this->getFilterOptions()->getName();
218
  }
219
- public function getRange() {
 
 
220
  $range = $this->getData('range');
 
 
 
 
 
 
221
  if (!$range) {
222
  if (Mage::helper('mana_db')->hasOverriddenValueEx($this->getFilterOptions(), 24)) {
223
  $range = (float)$this->getFilterOptions()->getRangeStep();
224
- }
225
- elseif (Mage::helper('mana_db')->hasOverriddenValueEx($this->getFilterOptions(), 24, 'global_default_mask')) {
 
 
 
 
226
  $range = (float)$this->getFilterOptions()->getGlobalRangeStep();
227
  }
228
  }
229
  if (!$range) {
 
230
  $maxValue = $this->getMaxValue();
231
- $index = 1;
232
- do {
233
- $range = pow(10, (strlen(floor($maxValue)) - $index));
234
- $items = $this->getRangeItemCounts($range);
235
- $index++;
236
  }
237
- while ($range > self::MIN_RANGE_POWER && count($items) < 2);
238
- $this->setData('range', $range);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
 
 
240
 
241
- return $range;
 
242
  }
 
243
  }
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Price constructor.
12
  */
13
+ class Mana_Filters_Model_Filter_Decimal
14
+ extends Mage_Catalog_Model_Layer_Filter_Decimal
15
+ implements Mana_Filters_Interface_Filter
16
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Prepare text of item label
19
  *
28
  Mage::dispatchEvent('m_render_price_range', array('range' => $range, 'model' => $this, 'result' => $result));
29
  if ($result->getLabel()) {
30
  return $result->getLabel();
31
+ } else {
32
+ $store = Mage::app()->getStore();
33
+ $fromPrice = $store->formatPrice($range['from']);
34
+ $toPrice = $store->formatPrice($range['to']);
35
+
36
  return Mage::helper('catalog')->__('%s - %s', $fromPrice, $toPrice);
37
  }
38
  }
39
+
40
  /**
41
+ * Depending on current filter values, returns available filter options from database
42
+ * and additionally whether individual options are selected or not.
43
+ * @return array
44
+ * @see Mage_Catalog_Model_Layer_Filter_Price::_getItemsData()
45
+ * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
46
+ * changes are marked with comments.
47
  */
48
+ protected function _getItemsData()
49
  {
50
+ /* @var $query Mana_Filters_Model_Query */
51
+ $query = $this->getQuery();
52
+
53
+ $range = $this->getRange();
54
+ $dbRanges = $query->getFilterCounts($this->getFilterOptions()->getCode());
55
+ if ($this->_getIsFilterable() == 2) {
56
+ $nonEmptyRanges = $dbRanges;
57
+ $dbRanges = array();
58
+ for ($i = 1; ($i + 1) * $range > $this->getMinValue() && ($i - 1) * $range < $this->getMaxValue(); $i++) {
59
+ $dbRanges[$i] = isset($nonEmptyRanges[$i]) ? $nonEmptyRanges[$i] : 0;
60
+ }
61
+ }
62
+ $data = array();
63
+
64
+ $selectedIndexes = array();
65
+ foreach ($this->getMSelectedValues() as $selection) {
66
+ if (strpos($selection, ',') !== false) {
67
+ list($index, $range) = explode(',', $selection);
68
+ $selectedIndexes[] = $index;
69
+ }
70
+ }
71
+
72
+ foreach ($dbRanges as $index => $count) {
73
+ $isSelected = in_array($index, $selectedIndexes);
74
+ $data[] = array(
75
+ 'label' => $this->_renderItemLabel($range, $index),
76
+ 'value' => $index . ',' . $range,
77
+ 'count' => $count,
78
+ 'm_selected' => $isSelected,
79
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse() ? !$isSelected : $isSelected,
80
+ );
81
+ }
82
+
83
+ return $data;
84
+ }
85
+
86
+ public function getLowestPossibleValue()
87
+ {
88
+ return (int)$this->getMinValue();
89
+ }
90
+
91
+ public function getHighestPossibleValue()
92
+ {
93
+ $result = (int)ceil($this->getMaxValue());
94
+ $min = $this->getLowestPossibleValue();
95
+
96
+ return $result != $min ? $result : $result + 1;
97
  }
98
+
99
+ #region Mana_Filters_Interface_Filter methods
100
+ /**
101
+ * Returns whether this filter is applied
102
+ *
103
+ * @return bool
104
+ */
105
+ public function isApplied()
106
+ {
107
+ $appliedValues = $this->getMSelectedValues();
108
+
109
+ return !empty($appliedValues);
110
+ }
111
+
112
+ /**
113
+ * Applies filter values provided in URL to a given product collection
114
+ *
115
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
116
+ * @return void
117
+ */
118
+ public function applyToCollection($collection)
119
+ {
120
+ $this->_applyToCollection($collection);
121
+ }
122
+
123
+ /**
124
+ * Returns true if counting should be done on main collection query and false if a separated query should be done
125
+ * Typically it should return false; however there are some cases (like not applied Solr facets) when it should
126
+ * return true.
127
+ *
128
+ * @return bool
129
+ */
130
+ public function isCountedOnMainCollection()
131
+ {
132
+ return false;
133
+ }
134
+
135
+ /**
136
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
137
+ * Typically, this method should return final result - option id/count pairs for option lists or
138
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
139
+ * object and later processCounts() extracts actual counts from this collections.
140
+ *
141
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
142
+ * @return mixed
143
+ */
144
+ public function countOnCollection($collection)
145
+ {
146
+ return $this->_getResource()->countOnCollection($collection, $this);
147
+ }
148
+
149
+ public function getRangeOnCollection($collection)
150
+ {
151
+ list($min, $max) = $this->_getResource()->getMinMaxForCollection($this, $collection);
152
+ return compact('min', 'max');
153
+ }
154
+
155
+ /**
156
+ * Returns option id/count pairs for option lists or min/max pair for slider. Typically, this method just returns
157
+ * $counts. However, in some cases (like not applied Solr facets) this method gets a collection object with Solr
158
+ * results and extracts those results.
159
+ *
160
+ * @param mixed $counts
161
+ * @return array
162
+ */
163
+ public function processCounts($counts)
164
+ {
165
+ return $counts;
166
+ }
167
+
168
+ /**
169
+ * Returns whether a given filter $modelToBeApplied should be applied when this filter is being counted. Typically,
170
+ * returns true for all filters except this one.
171
+ *
172
+ * @param $modelToBeApplied
173
+ * @return mixed
174
+ */
175
+ public function isFilterAppliedWhenCounting($modelToBeApplied)
176
+ {
177
+ return $modelToBeApplied != $this;
178
+ }
179
+
180
+ #endregion
181
+ #region common part for all mana_filters/filter_* models
182
+
183
+
184
+
185
  /**
186
  * Creates in-memory representation of a single option of a filter
187
  * @param array $data
188
  * @return Mana_Filters_Model_Item
 
 
 
189
  */
190
  protected function _createItemEx($data)
191
  {
192
  return Mage::getModel('mana_filters/item')
193
+ ->setData($data)
194
+ ->setFilter($this);
195
  }
196
+
197
+ /**
198
  * Initializes internal array of in-memory representations of options of a filter
199
  * @return Mana_Filters_Model_Filter_Attribute
200
  * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
 
 
201
  */
202
  protected function _initItems()
203
  {
204
+ /* @var $ext Mana_Filters_Helper_Extended */
205
+ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
206
+
207
  $data = $this->_getItemsData();
208
+ $items = array();
209
  foreach ($data as $itemData) {
 
210
  $items[] = $this->_createItemEx($itemData);
 
211
  }
 
 
212
  $items = $ext->processFilterItems($this, $items);
 
213
  $this->_items = $items;
214
+
215
  return $this;
216
  }
217
+
218
  /**
219
+ * This method locates resource type which should do all dirty job with the database. In this override, we
220
+ * instruct Magento to take our resource type, not standard.
221
+ * @see Mage_Catalog_Model_Layer_Filter_Attribute::_getResource()
222
  */
223
+ protected function _getResource()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  {
225
+ if (is_null($this->_resource)) {
226
+ /* @var $helper Mana_Filters_Helper_Data */
227
+ $helper = Mage::helper(strtolower('Mana_Filters'));
228
 
229
+ $this->_resource = Mage::getResourceModel(
230
+ $helper->getFilterTypeName('resource', $this->getFilterOptions())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  );
232
  }
233
 
234
+ return $this->_resource;
235
  }
236
+
237
+ protected function _getIsFilterable()
 
 
 
 
238
  {
239
+ switch ($this->getMode()) {
240
+ case 'category':
241
+ return $this->getFilterOptions()->getIsEnabled();
242
+ case 'search':
243
+ return $this->getFilterOptions()->getIsEnabledInSearch();
244
+ default:
245
+ throw new Exception('Not implemented');
246
  }
 
247
  }
248
+
249
+ public function getRemoveUrl()
250
+ {
251
+ $query = array($this->getRequestVar() => $this->getResetValue());
252
+ $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
253
+ $params['_current'] = true;
254
+ $params['_use_rewrite'] = true;
255
+ $params['_m_escape'] = '';
256
+ $params['_query'] = $query;
257
+
258
+ return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
259
  }
260
+
261
+ protected function _getIsFilterableAttribute($attribute)
262
+ {
263
+ return $this->_getIsFilterable(); //return $this->getFilterOptions()->getIsEnabled();
264
+ }
265
+
266
+ public function getName()
267
+ {
268
+ return $this->getFilterOptions()->getName();
269
+ }
270
+
271
+ #endregion
272
+ #region Methods common for Prices and Decimals
273
+
274
+
275
+ public function getCurrentRangeLowerBound()
276
+ {
277
+ $selections = $this->getMSelectedValues();
278
+ if ($selections && count($selections) == 1) {
279
  if (strpos($selections[0], ',') !== false) {
280
  list($index, $range) = explode(',', $selections[0]);
281
+
282
+ return $index;
283
  }
284
+ }
285
+
286
  return $this->getLowestPossibleValue();
287
  }
288
+
289
+ public function getCurrentRangeHigherBound()
290
+ {
291
+ $selections = $this->getMSelectedValues();
292
+ if ($selections && count($selections) == 1) {
293
  if (strpos($selections[0], ',') !== false) {
294
  list($index, $range) = explode(',', $selections[0]);
295
+
296
+ return $range;
297
  }
298
  }
299
+
300
+ return $this->getHighestPossibleValue();
 
 
 
 
 
 
 
 
 
 
301
  }
302
+
303
+ public function getRange()
304
+ {
305
  $range = $this->getData('range');
306
+
307
+ $value = $this->getMSelectedValues();
308
+ if (!empty($value)) {
309
+ list($index, $range) = explode(',', $value[0]);
310
+ }
311
+
312
  if (!$range) {
313
  if (Mage::helper('mana_db')->hasOverriddenValueEx($this->getFilterOptions(), 24)) {
314
  $range = (float)$this->getFilterOptions()->getRangeStep();
315
+ } elseif (Mage::helper('mana_db')->hasOverriddenValueEx(
316
+ $this->getFilterOptions(),
317
+ 24,
318
+ 'global_default_mask'
319
+ )
320
+ ) {
321
  $range = (float)$this->getFilterOptions()->getGlobalRangeStep();
322
  }
323
  }
324
  if (!$range) {
325
+ $minValue = $this->getMinValue();
326
  $maxValue = $this->getMaxValue();
327
+ if ($this->hasNoResults()) {
328
+ $range = 1;
329
+ while (ceil(($maxValue - $minValue) / $range) > 10) {
330
+ $range *= 10;
331
+ }
332
  }
333
+ else {
334
+ $index = 1;
335
+ do {
336
+ $range = pow(10, (strlen(floor($maxValue)) - $index));
337
+ $this->setData('range', $range);
338
+ /* @var $query Mana_Filters_Model_Query */
339
+ $query = $this->getQuery();
340
+ $items = $query->getFilterCounts($this->getFilterOptions()->getCode(), false);
341
+ $index++;
342
+ } while ($range > self::MIN_RANGE_POWER && count($items) < 2);
343
+ }
344
+ }
345
+ $this->setData('range', $range);
346
+ return $this->getData('range');
347
+ }
348
+
349
+ protected $_hasNoResults = false;
350
+ public function hasNoResults() {
351
+ return $this->_hasNoResults;
352
+ }
353
+
354
+ protected $_isMinMaxCalculated = false;
355
+ protected $_minMax;
356
+
357
+ protected function _calculateMinMax() {
358
+ if (!$this->_isMinMaxCalculated) {
359
+ /* @var $query Mana_Filters_Model_Query */
360
+ $query = $this->getQuery();
361
+ $queryResult = $query->getFilterRange($this->getFilterOptions()->getCode());
362
+ $this->_minMax = $queryResult;
363
+ if (!$this->_minMax['min'] && !($this->_minMax['max']) && $this->_getIsFilterable() == 2) {
364
+ $rootCategory = Mage::getModel('catalog/category')
365
+ ->setStoreId(Mage::app()->getStore()->getId())
366
+ ->load(Mage::app()->getStore()->getRootCategoryId());
367
+ $currentCategory = $this->getLayer()->getCurrentCategory();
368
+ $this->getLayer()->setCurrentCategory($rootCategory);
369
+ $queryResult = $query->getFilterRange($this->getFilterOptions()->getCode(), false,
370
+ $this->getLayer()->getProductCollection(), false);
371
+ $this->getLayer()->setCurrentCategory($currentCategory);
372
+ $this->_minMax = $queryResult;
373
+ $this->_hasNoResults = true;
374
+ }
375
+ $this->_isMinMaxCalculated = true;
376
+ }
377
+ return $this->_minMax;
378
+ }
379
+ public function getMinValue()
380
+ {
381
+ $result = $this->_calculateMinMax();
382
+ return $result['min'];
383
+ }
384
+
385
+ public function getMaxValue() {
386
+ $result = $this->_calculateMinMax();
387
+ return $result['max'];
388
+ }
389
+ public function init() {
390
+ }
391
+ /**
392
+ * Returns all values currently selected for this filter
393
+ */
394
+ public function getMSelectedValues() {
395
+ $values = Mage::helper('mana_core')->sanitizeRequestNumberParam($this->_requestVar,
396
+ array(array('sep' => '_', 'as_string' => true), array('sep' => ',', 'as_string' => true)));
397
+ return $values ? array_filter(explode('_', $values)) : array();
398
+ }
399
+
400
+ /**
401
+ * Applies filter values provided in URL to a given product collection
402
+ *
403
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
404
+ * @return void
405
+ */
406
+ protected function _applyToCollection($collection)
407
+ {
408
+ $this->_getResource()->applyToCollection($collection, $this, $this->getMSelectedValues());
409
+ }
410
+
411
+ /**
412
+ * Adds all selected items of this filters to the layered navigation state object
413
+ *
414
+ * @return void
415
+ */
416
+ public function addToState()
417
+ {
418
+ foreach ($this->getMSelectedValues() as $selection) {
419
+ list($index, $range) = explode(',', $selection);
420
+ $this->getLayer()->getState()->addFilter(
421
+ $this->_createItemEx(
422
+ array(
423
+ 'label' => $this->_renderItemLabel($range, $index),
424
+ 'value' => $selection,
425
+ 'm_selected' => true,
426
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse(),
427
+ )
428
+ )
429
+ );
430
  }
431
+ }
432
+
433
 
434
+ public function isUpperBoundInclusive() {
435
+ return $this->_getResource()->isUpperBoundInclusive();
436
  }
437
+ #endregion
438
  }
app/code/local/Mana/Filters/Model/Filter/Price.php CHANGED
@@ -10,45 +10,10 @@
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Price constructor.
12
  */
13
- class Mana_Filters_Model_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Price {
14
- /**
15
- * Apply price filter to product collection
16
- * @param Zend_Controller_Request_Abstract $request
17
- * @param Mana_Filters_Block_Filter_Price $filterBlock
18
- * @return Mana_Filters_Model_Filter_Price
19
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
- * changes are marked with comments.
21
- * @see app/code/core/Mage/Catalog/Model/Layer/Filter/Mage_Catalog_Model_Layer_Filter_Price::apply()
22
- */
23
- public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
24
- {
25
- // MANA BEGIN: read multiple price ranges from URL instead of single range read in standard code,
26
- // apply multiple ranges, show multiple ranges in state and do not hide selected ranges from filter options
27
- $selections = $this->getMSelectedValues();
28
-
29
- if (count($selections) > 0) {
30
- if (strpos($selections[0], ',') !== false) {
31
- list($index, $range) = explode(',', $selections[0]);
32
- if ((int)$range) {
33
- $this->setPriceRange((int)$range);
34
- $this->_applyToCollectionEx($selections);
35
- foreach ($selections as $selection) {
36
- if (strpos($selection, ',') !== false) {
37
- list($index, $range) = explode(',', $selection);
38
- $this->getLayer()->getState()->addFilter($this->_createItemEx(array(
39
- 'label' => $this->_renderItemLabel($range, $index),
40
- 'value' => $selection,
41
- 'm_selected' => true,
42
- )));
43
- }
44
- }
45
- }
46
- }
47
- // $this->_items = array();
48
- }
49
- // MANA END
50
- return $this;
51
- }
52
  /**
53
  * Prepare text of item label
54
  *
@@ -71,27 +36,179 @@ class Mana_Filters_Model_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Pr
71
  return Mage::helper('catalog')->__('%s - %s', $fromPrice, $toPrice);
72
  }
73
  }
74
-
75
  /**
76
- * Applies one or more price filters to currently viewed product collection
77
- * @param array $selections
78
- * @return Mana_Filters_Model_Filter_Price
79
- * This method is cloned from method _applyToCollection() in parent class (method body was pasted from parent class
80
- * completely rewritten.
81
- * Standard method did not give us possibility to filter multiple ranges.
82
  */
83
- protected function _applyToCollectionEx($selections)
84
  {
85
- $this->_getResource()->applyFilterToCollectionEx($this, $selections);
86
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
  * Creates in-memory representation of a single option of a filter
90
  * @param array $data
91
  * @return Mana_Filters_Model_Item
92
- * This method is cloned from method _createItem() in parent class (method body was pasted from parent class
93
  * completely rewritten.
94
- * Standard method did not give us possibility to initialize non-standard fields.
95
  */
96
  protected function _createItemEx($data)
97
  {
@@ -99,7 +216,7 @@ class Mana_Filters_Model_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Pr
99
  ->setData($data)
100
  ->setFilter($this);
101
  }
102
- /**
103
  * Initializes internal array of in-memory representations of options of a filter
104
  * @return Mana_Filters_Model_Filter_Attribute
105
  * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
@@ -111,11 +228,8 @@ class Mana_Filters_Model_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Pr
111
  $data = $this->_getItemsData();
112
  $items=array();
113
  foreach ($data as $itemData) {
114
- // MANA BEGIN
115
  $items[] = $this->_createItemEx($itemData);
116
- // MANA END
117
  }
118
- // MANA BEGIN: enable additional filter item processing
119
  /* @var $ext Mana_Filters_Helper_Extended */ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
120
  $items = $ext->processFilterItems($this, $items);
121
  // MANA END
@@ -123,54 +237,86 @@ class Mana_Filters_Model_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Pr
123
  return $this;
124
  }
125
  /**
126
- * Returns all values currently selected for this filter
127
- */
128
- public function getMSelectedValues() {
129
- $values = Mage::app()->getRequest()->getParam($this->_requestVar);
130
- return Mage::helper('mana_core')->sanitizeNumber(urldecode($values), array(
131
- '_', array('sep' => ',', 'as_string' => true)
132
- ));
133
- }
134
- /**
135
- * Depending on current filter values, returns available filter options from database
136
- * and additionally whether individual options are selected or not.
137
- * @return array
138
- * @see Mage_Catalog_Model_Layer_Filter_Price::_getItemsData()
139
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
140
- * changes are marked with comments.
141
  */
142
- protected function _getItemsData()
143
  {
144
- $range = $this->getPriceRange();
145
- $dbRanges = $this->getRangeItemCounts($range);
146
- $data = array();
147
 
148
- // MANA BEGIN
149
- $selectedIndexes = array();
150
- foreach ($this->getMSelectedValues() as $selection) {
151
- if (strpos($selection, ',') !== false) {
152
- list($index, $range) = explode(',', $selection);
153
- $selectedIndexes[] = $index;
154
- }
155
  }
156
- // MANA END
157
-
158
- foreach ($dbRanges as $index=>$count) {
159
- $data[] = array(
160
- 'label' => $this->_renderItemLabel($range, $index),
161
- 'value' => $index . ',' . $range,
162
- 'count' => $count,
163
- // MANA BEGIN
164
- 'm_selected' => in_array($index, $selectedIndexes),
165
- // MANA END
166
- );
167
  }
 
168
 
169
- return $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
- public function getPriceRange()
 
172
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  $range = $this->getData('price_range');
 
 
 
 
 
 
174
  if (!$range) {
175
  if (Mage::helper('mana_db')->hasOverriddenValueEx($this->getFilterOptions(), 24)) {
176
  $range = (float)$this->getFilterOptions()->getRangeStep();
@@ -194,87 +340,74 @@ class Mana_Filters_Model_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Pr
194
  $calculation = 'auto';
195
  }
196
  if ($calculation == 'auto') {
197
- $index = 1;
198
- do {
199
- $range = pow(10, (strlen(floor($maxPrice)) - $index));
200
- $items = $this->getRangeItemCounts($range);
201
- $index++;
202
  }
203
- while($range > self::MIN_RANGE_POWER && count($items) < 2);
 
 
 
 
 
 
 
 
 
 
204
 
205
 
206
- while (ceil($maxPrice / $range) > 25) {
207
- $range *= 10;
 
208
  }
209
  } else {
210
  $range = Mage::app()->getStore()->getConfig('catalog/layered_navigation/price_range_step');
211
  }
212
  }
213
 
214
- $this->setData('price_range', $range);
215
  }
216
-
217
- return $range;
 
 
218
  }
219
  /**
220
- * This method locates resource type which should do all dirty job with the database. In this override, we
221
- * instruct Magento to take our resource type, not standard.
222
- * @see Mage_Catalog_Model_Layer_Filter_Price::_getResource()
223
  */
224
- protected function _getResource()
225
- {
226
- if (is_null($this->_resource)) {
227
- $this->_resource = Mage::getResourceModel((string)$this->getDisplayOptions()->resource);
228
- }
229
- return $this->_resource;
230
- }
231
- public function getLowestPossibleValue() {
232
- return 0;
233
- }
234
- public function getHighestPossibleValue() {
235
- return (int)ceil($this->getMaxPriceInt());
236
- }
237
- public function getCurrentRangeLowerBound() {
238
- $selections = $this->getMSelectedValues();
239
- if ($selections && count($selections) == 1) {
240
- if (strpos($selections[0], ',') !== false) {
241
- list($index, $range) = explode(',', $selections[0]);
242
- return $index;
243
- }
244
- }
245
- return $this->getLowestPossibleValue();
246
- }
247
- public function getCurrentRangeHigherBound() {
248
- $selections = $this->getMSelectedValues();
249
- if ($selections && count($selections) == 1) {
250
- if (strpos($selections[0], ',') !== false) {
251
- list($index, $range) = explode(',', $selections[0]);
252
- return $range;
253
- }
254
- }
255
- return $this->getHighestPossibleValue();
256
- }
257
- public function getRemoveUrl() {
258
- $query = array($this->getRequestVar()=>$this->getResetValue());
259
- $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
260
- $params['_current'] = true;
261
- $params['_use_rewrite'] = true;
262
- $params['_query'] = $query;
263
- return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
264
- }
265
- public function getName() {
266
- return $this->getFilterOptions()->getName();
267
  }
268
- public function getMaxPriceInt() {
269
- $maxPrice = $this->getData('max_price_int');
270
- if (is_null($maxPrice)) {
271
- $maxPrice = $this->_getResource()->getMaxPrice($this);
272
- $maxPrice = ceil($maxPrice);
273
- $this->setData('max_price_int', $maxPrice);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  }
275
- return $maxPrice;
276
  }
277
- public function getDecimalDigits() {
278
- return 0;
 
279
  }
 
 
280
  }
10
  * @author Mana Team
11
  * Injected instead of standard catalog/layer_filter_attribute in Mana_Filters_Block_Filter_Price constructor.
12
  */
13
+ class Mana_Filters_Model_Filter_Price
14
+ extends Mage_Catalog_Model_Layer_Filter_Price
15
+ implements Mana_Filters_Interface_Filter
16
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Prepare text of item label
19
  *
36
  return Mage::helper('catalog')->__('%s - %s', $fromPrice, $toPrice);
37
  }
38
  }
39
+
40
  /**
41
+ * Depending on current filter values, returns available filter options from database
42
+ * and additionally whether individual options are selected or not.
43
+ * @return array
44
+ * @see Mage_Catalog_Model_Layer_Filter_Price::_getItemsData()
45
+ * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
46
+ * changes are marked with comments.
47
  */
48
+ protected function _getItemsData()
49
  {
50
+ /* @var $query Mana_Filters_Model_Query */
51
+ $query = $this->getQuery();
52
+
53
+ $range = $this->getPriceRange();
54
+ $dbRanges = $query->getFilterCounts($this->getFilterOptions()->getCode());
55
+ if ($this->_getIsFilterable() == 2) {
56
+ $nonEmptyRanges = $dbRanges;
57
+ $dbRanges = array();
58
+ for ($i = 1; ($i - 1) * $range < $this->getMaxPriceInt(); $i++) {
59
+ $dbRanges[$i] = isset($nonEmptyRanges[$i]) ? $nonEmptyRanges[$i] : 0;
60
+ }
61
+ }
62
+ $data = array();
63
+
64
+ $selectedIndexes = array();
65
+ foreach ($this->getMSelectedValues() as $selection) {
66
+ if (strpos($selection, ',') !== false) {
67
+ list($index, $range) = explode(',', $selection);
68
+ $selectedIndexes[] = $index;
69
+ }
70
+ }
71
+
72
+ foreach ($dbRanges as $index => $count) {
73
+ $isSelected = in_array($index, $selectedIndexes);
74
+ $data[] = array(
75
+ 'label' => $this->_renderItemLabel($range, $index),
76
+ 'value' => $index . ',' . $range,
77
+ 'count' => $count,
78
+ 'm_selected' => $isSelected,
79
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse() ? !$isSelected : $isSelected,
80
+ );
81
+ }
82
+
83
+ return $data;
84
+ }
85
+
86
+ public function getLowestPossibleValue() {
87
+ return 0;
88
+ }
89
+
90
+ public function getHighestPossibleValue()
91
+ {
92
+ return (int)ceil($this->getMaxPriceInt());
93
+ }
94
+
95
+ protected $_hasNoResults = false;
96
+ public function hasNoResults() {
97
+ return $this->_hasNoResults;
98
+ }
99
+
100
+ protected $_isMaxPriceIntCalculated = false;
101
+ protected $_maxPriceInt;
102
+ public function getMaxPriceInt() {
103
+ if (!$this->_isMaxPriceIntCalculated) {
104
+ /* @var $query Mana_Filters_Model_Query */
105
+ $query = $this->getQuery();
106
+ $queryResult = $query->getFilterRange($this->getFilterOptions()->getCode());
107
+ $this->_maxPriceInt = $queryResult['max'];
108
+ if (!$this->_maxPriceInt && $this->_getIsFilterable() == 2) {
109
+ $rootCategory = Mage::getModel('catalog/category')
110
+ ->setStoreId(Mage::app()->getStore()->getId())
111
+ ->load(Mage::app()->getStore()->getRootCategoryId());
112
+ $currentCategory = $this->getLayer()->getCurrentCategory();
113
+ $this->getLayer()->setCurrentCategory($rootCategory);
114
+ $queryResult = $query->getFilterRange($this->getFilterOptions()->getCode(), false,
115
+ $this->getLayer()->getProductCollection(), false);
116
+ $this->getLayer()->setCurrentCategory($currentCategory);
117
+ $this->_maxPriceInt = $queryResult['max'];
118
+ $this->_hasNoResults = true;
119
+ }
120
+ $this->_isMaxPriceIntCalculated = true;
121
+ }
122
+ return $this->_maxPriceInt;
123
+ }
124
+ public function getDecimalDigits() {
125
+ return 0;
126
+ }
127
+
128
+ #region Mana_Filters_Interface_Filter methods
129
+ /**
130
+ * Returns whether this filter is applied
131
+ *
132
+ * @return bool
133
+ */
134
+ public function isApplied() {
135
+ $appliedValues = $this->getMSelectedValues();
136
+
137
+ return !empty($appliedValues);
138
  }
139
+ /**
140
+ * Applies filter values provided in URL to a given product collection
141
+ *
142
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
143
+ * @return void
144
+ */
145
+ public function applyToCollection($collection) {
146
+ $this->_getResource()->applyToCollection($collection, $this, $this->getMSelectedValues());
147
+ }
148
+ /**
149
+ * Returns true if counting should be done on main collection query and false if a separated query should be done
150
+ * Typically it should return false; however there are some cases (like not applied Solr facets) when it should
151
+ * return true.
152
+ *
153
+ * @return bool
154
+ */
155
+ public function isCountedOnMainCollection() {
156
+ return false;
157
+ }
158
+ /**
159
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
160
+ * Typically, this method should return final result - option id/count pairs for option lists or
161
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
162
+ * object and later processCounts() extracts actual counts from this collections.
163
+ *
164
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
165
+ * @return mixed
166
+ */
167
+ public function countOnCollection($collection) {
168
+ $counts = $this->_getResource()->countOnCollection($collection, $this);
169
+ return $counts;
170
+ }
171
+
172
+ public function getRangeOnCollection($collection)
173
+ {
174
+ $min = 0;
175
+ $max = $this->_getResource()->getMaxPriceOnCollection($this, $collection);
176
+ $max = ceil($max);
177
+ $this->setData('max_price_int', $max);
178
+ return compact('min', 'max');
179
+ }
180
+
181
+ /**
182
+ * Returns option id/count pairs for option lists or min/max pair for slider. Typically, this method just returns
183
+ * $counts. However, in some cases (like not applied Solr facets) this method gets a collection object with Solr
184
+ * results and extracts those results.
185
+ *
186
+ * @param mixed $counts
187
+ * @return array
188
+ */
189
+ public function processCounts($counts) {
190
+ return $counts;
191
+ }
192
+ /**
193
+ * Returns whether a given filter $modelToBeApplied should be applied when this filter is being counted. Typically,
194
+ * returns true for all filters except this one.
195
+ *
196
+ * @param $modelToBeApplied
197
+ * @return mixed
198
+ */
199
+ public function isFilterAppliedWhenCounting($modelToBeApplied) {
200
+ return $modelToBeApplied != $this;
201
+ }
202
+ #endregion
203
+
204
+ #region common part for all mana_filters/filter_* models
205
  /**
206
  * Creates in-memory representation of a single option of a filter
207
  * @param array $data
208
  * @return Mana_Filters_Model_Item
209
+ * This method is cloned from method _createItem() in parent class (method body was pasted from parent class
210
  * completely rewritten.
211
+ * Standard method did not give us possibility to initialize non-standard fields.
212
  */
213
  protected function _createItemEx($data)
214
  {
216
  ->setData($data)
217
  ->setFilter($this);
218
  }
219
+ /**
220
  * Initializes internal array of in-memory representations of options of a filter
221
  * @return Mana_Filters_Model_Filter_Attribute
222
  * @see Mage_Catalog_Model_Layer_Filter_Abstract::_initItems()
228
  $data = $this->_getItemsData();
229
  $items=array();
230
  foreach ($data as $itemData) {
 
231
  $items[] = $this->_createItemEx($itemData);
 
232
  }
 
233
  /* @var $ext Mana_Filters_Helper_Extended */ $ext = Mage::helper(strtolower('Mana_Filters/Extended'));
234
  $items = $ext->processFilterItems($this, $items);
235
  // MANA END
237
  return $this;
238
  }
239
  /**
240
+ * This method locates resource type which should do all dirty job with the database. In this override, we
241
+ * instruct Magento to take our resource type, not standard.
242
+ * @see Mage_Catalog_Model_Layer_Filter_Price::_getResource()
 
 
 
 
 
 
 
 
 
 
 
 
243
  */
244
+ protected function _getResource()
245
  {
246
+ if (is_null($this->_resource)) {
247
+ /* @var $helper Mana_Filters_Helper_Data */
248
+ $helper = Mage::helper(strtolower('Mana_Filters'));
249
 
250
+ $this->_resource = Mage::getResourceModel($helper->getFilterTypeName('resource', $this->getFilterOptions()));
 
 
 
 
 
 
251
  }
252
+ return $this->_resource;
253
+ }
254
+ protected function _getIsFilterable()
255
+ {
256
+ switch ($this->getMode()) {
257
+ case 'category':
258
+ return $this->getFilterOptions()->getIsEnabled();
259
+ case 'search':
260
+ return $this->getFilterOptions()->getIsEnabledInSearch();
261
+ default:
262
+ throw new Exception('Not implemented');
263
  }
264
+ }
265
 
266
+ public function getRemoveUrl()
267
+ {
268
+ $query = array($this->getRequestVar() => $this->getResetValue());
269
+ $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
270
+ $params['_current'] = true;
271
+ $params['_use_rewrite'] = true;
272
+ $params['_m_escape'] = '';
273
+ $params['_query'] = $query;
274
+
275
+ return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
276
+ }
277
+
278
+ protected function _getIsFilterableAttribute($attribute)
279
+ {
280
+ return $this->_getIsFilterable(); //return $this->getFilterOptions()->getIsEnabled();
281
  }
282
+
283
+ public function getName()
284
  {
285
+ return $this->getFilterOptions()->getName();
286
+ }
287
+ #endregion
288
+
289
+ #region Methods common for Prices and Decimals
290
+
291
+ public function getCurrentRangeLowerBound() {
292
+ $selections = $this->getMSelectedValues();
293
+ if ($selections && count($selections) == 1) {
294
+ if (strpos($selections[0], ',') !== false) {
295
+ list($index, $range) = explode(',', $selections[0]);
296
+ return $index;
297
+ }
298
+ }
299
+ return $this->getLowestPossibleValue();
300
+ }
301
+ public function getCurrentRangeHigherBound() {
302
+ $selections = $this->getMSelectedValues();
303
+ if ($selections && count($selections) == 1) {
304
+ if (strpos($selections[0], ',') !== false) {
305
+ list($index, $range) = explode(',', $selections[0]);
306
+ return $range;
307
+ }
308
+ }
309
+ return $this->getHighestPossibleValue();
310
+ }
311
+
312
+ public function getPriceRange() {
313
  $range = $this->getData('price_range');
314
+
315
+ $value = $this->getMSelectedValues();
316
+ if (!empty($value)) {
317
+ list($index, $range) = explode(',', $value[0]);
318
+ }
319
+
320
  if (!$range) {
321
  if (Mage::helper('mana_db')->hasOverriddenValueEx($this->getFilterOptions(), 24)) {
322
  $range = (float)$this->getFilterOptions()->getRangeStep();
340
  $calculation = 'auto';
341
  }
342
  if ($calculation == 'auto') {
343
+ if ($this->hasNoResults()) {
344
+ $range = 1;
345
+ while (ceil($maxPrice / $range) > 10) {
346
+ $range *= 10;
347
+ }
348
  }
349
+ else {
350
+ $index = 1;
351
+ do {
352
+ $range = pow(10, (strlen(floor($maxPrice)) - $index));
353
+ $this->setData('price_range', $range);
354
+ /* @var $query Mana_Filters_Model_Query */
355
+ $query = $this->getQuery();
356
+ $items = $query->getFilterCounts($this->getFilterOptions()->getCode(), false);
357
+ $index++;
358
+ }
359
+ while($range > self::MIN_RANGE_POWER && count($items) < 2);
360
 
361
 
362
+ while (ceil($maxPrice / $range) > 25) {
363
+ $range *= 10;
364
+ }
365
  }
366
  } else {
367
  $range = Mage::app()->getStore()->getConfig('catalog/layered_navigation/price_range_step');
368
  }
369
  }
370
 
 
371
  }
372
+ $this->setData('price_range', $range);
373
+ return $this->getData('price_range');
374
+ }
375
+ public function init() {
376
  }
377
  /**
378
+ * Returns all values currently selected for this filter
 
 
379
  */
380
+ public function getMSelectedValues() {
381
+ $values = Mage::helper('mana_core')->sanitizeRequestNumberParam($this->_requestVar,
382
+ array(array('sep' => '_', 'as_string' => true), array('sep' => ',', 'as_string' => true)));
383
+ return $values ? array_filter(explode('_', $values)) : array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
385
+
386
+ /**
387
+ * Adds all selected items of this filters to the layered navigation state object
388
+ *
389
+ * @return void
390
+ */
391
+ public function addToState()
392
+ {
393
+ foreach ($this->getMSelectedValues() as $selection) {
394
+ list($index, $range) = explode(',', $selection);
395
+ $this->getLayer()->getState()->addFilter(
396
+ $this->_createItemEx(
397
+ array(
398
+ 'label' => $this->_renderItemLabel($range, $index),
399
+ 'value' => $selection,
400
+ 'm_selected' => true,
401
+ 'm_show_selected' => $this->getFilterOptions()->getIsReverse(),
402
+ )
403
+ )
404
+ );
405
  }
 
406
  }
407
+
408
+ public function isUpperBoundInclusive() {
409
+ return $this->_getResource()->isUpperBoundInclusive();
410
  }
411
+ #endregion
412
+
413
  }
app/code/local/Mana/Filters/Model/Filter2.php CHANGED
@@ -12,6 +12,8 @@
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2 extends Mana_Db_Model_Object {
 
 
15
  /**
16
  * Invoked during model creation process, this method associates this model with resource and resource
17
  * collection classes
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2 extends Mana_Db_Model_Object {
15
+ protected $_eventPrefix = 'mana_filter';
16
+
17
  /**
18
  * Invoked during model creation process, this method associates this model with resource and resource
19
  * collection classes
app/code/local/Mana/Filters/Model/Filter2/Store.php CHANGED
@@ -12,6 +12,7 @@
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2_Store extends Mana_Filters_Model_Filter2 {
 
15
  /**
16
  * Invoked during model creation process, this method associates this model with resource and resource
17
  * collection classes
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2_Store extends Mana_Filters_Model_Filter2 {
15
+ protected $_eventPrefix = 'mana_filter_store';
16
  /**
17
  * Invoked during model creation process, this method associates this model with resource and resource
18
  * collection classes
app/code/local/Mana/Filters/Model/Filter2/Value.php CHANGED
@@ -12,6 +12,7 @@
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2_Value extends Mana_Db_Model_Object {
 
15
  /**
16
  * Invoked during model creation process, this method associates this model with resource and resource
17
  * collection classes
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2_Value extends Mana_Db_Model_Object {
15
+ protected $_eventPrefix = 'mana_filter_value';
16
  /**
17
  * Invoked during model creation process, this method associates this model with resource and resource
18
  * collection classes
app/code/local/Mana/Filters/Model/Filter2/Value/Store.php CHANGED
@@ -12,6 +12,7 @@
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2_Value_Store extends Mana_Filters_Model_Filter2_Value {
 
15
  /**
16
  * Invoked during model creation process, this method associates this model with resource and resource
17
  * collection classes
12
  * @author Mana Team
13
  */
14
  class Mana_Filters_Model_Filter2_Value_Store extends Mana_Filters_Model_Filter2_Value {
15
+ protected $_eventPrefix = 'mana_filter_value_store';
16
  /**
17
  * Invoked during model creation process, this method associates this model with resource and resource
18
  * collection classes
app/code/local/Mana/Filters/Model/Item.php CHANGED
@@ -35,7 +35,7 @@ class Mana_Filters_Model_Item extends Mage_Catalog_Model_Layer_Filter_Item {
35
  // MANA_END
36
  Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
37
  );
38
- $params = array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query, '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
39
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
40
  }
41
 
@@ -59,7 +59,7 @@ class Mana_Filters_Model_Item extends Mage_Catalog_Model_Layer_Filter_Item {
59
  // MANA_END
60
  Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
61
  );
62
- $params = array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query, '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
63
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
64
  }
65
  /**
@@ -92,17 +92,19 @@ class Mana_Filters_Model_Item extends Mage_Catalog_Model_Layer_Filter_Item {
92
  $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
93
  $params['_current'] = true;
94
  $params['_use_rewrite'] = true;
 
95
  $params['_query'] = $query;
96
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
97
  }
98
- public function getUniqueId() {
99
  /* @var $helper Mana_Filters_Helper_Data */ $helper = Mage::helper(strtolower('Mana_Filters'));
100
- return 'filter_'.$helper->getFilterName($this->getFilter()).'_'.$this->getValue();
101
  }
102
 
103
  public function getSeoValue() {
104
  $urlValue = $this->getValue();
105
- if (((string)Mage::getConfig()->getNode('modules/ManaPro_FilterSeoLinks/active')) == 'true') {
 
106
  $url = Mage::getModel('manapro_filterseolinks/url');
107
  /* @var $url ManaPro_FilterSeoLinks_Model_Url */
108
  $urlValue = $url->encodeValue($this->getFilter()->getRequestVar(), $urlValue);
35
  // MANA_END
36
  Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
37
  );
38
+ $params = array('_current'=>true, '_m_escape' => '', '_use_rewrite'=>true, '_query'=>$query, '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
39
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
40
  }
41
 
59
  // MANA_END
60
  Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
61
  );
62
+ $params = array('_current'=>true, '_m_escape' => '', '_use_rewrite'=>true, '_query'=>$query, '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
63
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
64
  }
65
  /**
92
  $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
93
  $params['_current'] = true;
94
  $params['_use_rewrite'] = true;
95
+ $params['_m_escape'] = '';
96
  $params['_query'] = $query;
97
  return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
98
  }
99
+ public function getUniqueId($block) {
100
  /* @var $helper Mana_Filters_Helper_Data */ $helper = Mage::helper(strtolower('Mana_Filters'));
101
+ return 'filter_'.$helper->getFilterName($block, $this->getFilter()).'_'.$this->getValue();
102
  }
103
 
104
  public function getSeoValue() {
105
  $urlValue = $this->getValue();
106
+ /* @var $core Mana_Core_Helper_Data */ $core = Mage::helper(strtolower('Mana_Core'));
107
+ if (Mage::app()->getRequest()->getParam('m-seo-enabled', true) && ((string)Mage::getConfig()->getNode('modules/ManaPro_FilterSeoLinks/active')) == 'true') {
108
  $url = Mage::getModel('manapro_filterseolinks/url');
109
  /* @var $url ManaPro_FilterSeoLinks_Model_Url */
110
  $urlValue = $url->encodeValue($this->getFilter()->getRequestVar(), $urlValue);
app/code/local/Mana/Filters/Model/Observer.php CHANGED
@@ -45,4 +45,28 @@ class Mana_Filters_Model_Observer {
45
  }
46
  }
47
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
45
  }
46
  }
47
  }
48
+ /**
49
+ * REPLACE THIS WITH DESCRIPTION (handles event "prepare_catalog_product_index_select")
50
+ * @param Varien_Event_Observer $observer
51
+ */
52
+ public function fixAttributeIndexerSelectForConfigurableProductDefaultValues($observer) {
53
+ /* @var $select Varien_Db_Select */ $select = $observer->getEvent()->getSelect();
54
+ /* @var $entityField Zend_Db_Expr */ $entityField = $observer->getEvent()->getEntityField();
55
+
56
+ /* @var $res Mage_Core_Model_Resource */ $res = Mage::getSingleton('core/resource');
57
+
58
+ if (in_array((string)$entityField, array('pvd.entity_id', 'pid.entity_id', '`pvd`.`entity_id`', '`pid`.`entity_id`'))) {
59
+ $select
60
+ ->joinInner(
61
+ array('m_configurable_product' => $res->getTableName('catalog/product')),
62
+ 'm_configurable_product.entity_id = '.$entityField, null)
63
+ ->joinInner(
64
+ array('m_configurable_attribute' => $res->getTableName('catalog/eav_attribute')),
65
+ 'm_configurable_attribute.attribute_id = ' . str_replace('entity_id', 'attribute_id', (string)$entityField), null)
66
+ ->joinInner(
67
+ array('m_set_relation' => $res->getTableName('eav/entity_attribute')),
68
+ 'm_set_relation.attribute_set_id = m_configurable_product.attribute_set_id AND m_set_relation.attribute_id = m_configurable_attribute.attribute_id', null)
69
+ ->where("NOT((m_configurable_product.type_id = 'configurable') AND (m_configurable_attribute.is_configurable = 1))");
70
+ }
71
+ }
72
  }
app/code/local/Mana/Filters/Model/Query.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ * @method Mage_Catalog_Model_Layer getLayer()
11
+ * @method Mana_Filters_Model_Query setLayer(Mage_Catalog_Model_Layer $value)
12
+ */
13
+ class Mana_Filters_Model_Query extends Varien_Object
14
+ {
15
+ protected $_isInitialized = false;
16
+ protected $_isApplied = false;
17
+ /**
18
+ * @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
19
+ */
20
+ protected $_productCollection;
21
+ /**
22
+ * @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
23
+ */
24
+ protected $_productCollectionPrototype;
25
+ /**
26
+ * @var Varien_Db_Select
27
+ */
28
+ protected $_selectPrototype;
29
+ protected $_filters = array();
30
+
31
+ public function init() {
32
+ if (!$this->_isInitialized) {
33
+ $this->_init();
34
+ $this->_isInitialized = true;
35
+ }
36
+ return $this;
37
+ }
38
+ protected function _init() {
39
+ $this->_productCollection = $this->getLayer()->getProductCollection();
40
+ $this->_productCollectionPrototype = clone $this->_productCollection;
41
+ $this->_selectPrototype = clone $this->_productCollection->getSelect();
42
+ }
43
+ public function getProductCollection() {
44
+ return $this->_productCollection;
45
+ }
46
+ public function createProductCollection() {
47
+ $result = clone $this->_productCollectionPrototype;
48
+ $this->_copyParts($result->getSelect(), $this->_selectPrototype);
49
+
50
+ return $result;
51
+ }
52
+ protected function _copyParts($target, $source) {
53
+ foreach (array(Varien_Db_Select::DISTINCT, Varien_Db_Select::COLUMNS, Varien_Db_Select::UNION,
54
+ Varien_Db_Select::FROM, Varien_Db_Select::WHERE, Varien_Db_Select::GROUP, Varien_Db_Select::HAVING,
55
+ Varien_Db_Select::ORDER, Varien_Db_Select::LIMIT_COUNT, Varien_Db_Select::LIMIT_OFFSET,
56
+ Varien_Db_Select::FOR_UPDATE) as $part)
57
+ {
58
+ $target->setPart($part, $source->getPart($part));
59
+ }
60
+ }
61
+ public function addFilter($code, Mana_Filters_Interface_Filter $model) {
62
+ $isApplied = $model->isApplied();
63
+ $this->_filters[$code] = array('model' => $model, 'isApplied' => $isApplied, 'isApplyProcessed' => false);
64
+ }
65
+ public function apply() {
66
+ foreach ($this->_filters as $code => $filter) {
67
+ if (!$filter['isApplyProcessed']) {
68
+ $model = $filter['model'];
69
+ /* @var $model Mana_Filters_Interface_Filter */
70
+ $model->init();
71
+ if ($filter['isApplied']) {
72
+ $model->applyToCollection($this->getProductCollection());
73
+ $model->addToState();
74
+ }
75
+ if ($isCounted = $model->isCountedOnMainCollection()) {
76
+ $counts = $model->countOnCollection($this->getProductCollection());
77
+ }
78
+ else {
79
+ $counts = null;
80
+ }
81
+ $this->_filters[$code]['isCounted'] = $isCounted;
82
+ $this->_filters[$code]['counts'] = $counts;
83
+ $this->_filters[$code]['isApplyProcessed'] = true;
84
+ }
85
+ }
86
+ return $this;
87
+ }
88
+ protected function _apply() {
89
+ }
90
+
91
+ /**
92
+ * @param string $code
93
+ * @param bool $cache
94
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $originalCollection
95
+ * @param bool $applyFilters
96
+ * @return mixed
97
+ */
98
+ public function getFilterRange($code, $cache = true, $originalCollection = null, $applyFilters = true) {
99
+ $currentFilter = $this->_filters[$code];
100
+ /* @var $currentFilterModel Mana_Filters_Interface_Filter */
101
+ $currentFilterModel = $currentFilter['model'];
102
+
103
+ if (!$cache || !isset($currentFilter['processedRange'])) {
104
+ if ($originalCollection) {
105
+ $preservedSelect = clone $originalCollection->getSelect();
106
+ $collection = clone $originalCollection;
107
+ }
108
+ else {
109
+ $preservedSelect = clone $this->_productCollection->getSelect();
110
+ $collection = $this->createProductCollection($originalCollection);
111
+ }
112
+ if ($applyFilters) {
113
+ foreach ($this->_filters as $filter) {
114
+ /* @var $filterModel Mana_Filters_Interface_Filter */
115
+ $filterModel = $filter['model'];
116
+
117
+ if ($filter['isApplied'] && $currentFilterModel->isFilterAppliedWhenCounting($filterModel)) {
118
+ $filterModel->applyToCollection($collection);
119
+ }
120
+ }
121
+ }
122
+
123
+ $result = $currentFilterModel->getRangeOnCollection($collection);
124
+ if ($cache) {
125
+ $currentFilter['processedRange'] = $result;
126
+ }
127
+
128
+ if ($originalCollection) {
129
+ $this->_copyParts($originalCollection->getSelect(), $preservedSelect);
130
+ }
131
+ else {
132
+ $this->_copyParts($this->_productCollection->getSelect(), $preservedSelect);
133
+ }
134
+ }
135
+ else {
136
+ $result = $currentFilter['processedRange'];
137
+ }
138
+ $this->_filters[$code] = $currentFilter;
139
+
140
+ return $result;
141
+ }
142
+ public function getFilterCounts($code, $cache = true) {
143
+ $currentFilter = $this->_filters[$code];
144
+ /* @var $currentFilterModel Mana_Filters_Interface_Filter */
145
+ $currentFilterModel = $currentFilter['model'];
146
+
147
+ if (!$cache || !isset($currentFilter['processedCounts'])) {
148
+ if (!empty($currentFilter['isCounted'])) {
149
+ $currentFilter['processedCounts'] = $currentFilterModel->processCounts($currentFilter['counts']);
150
+ }
151
+ else {
152
+ $mainSelect = clone $this->_productCollection->getSelect();
153
+
154
+ $collection = $this->createProductCollection();
155
+ foreach ($this->_filters as $filter) {
156
+ /* @var $filterModel Mana_Filters_Interface_Filter */
157
+ $filterModel = $filter['model'];
158
+
159
+ if ($filter['isApplied'] && $currentFilterModel->isFilterAppliedWhenCounting($filterModel)) {
160
+ $filterModel->applyToCollection($collection);
161
+ }
162
+ }
163
+ $counts = $currentFilterModel->countOnCollection($collection);
164
+ $currentFilter['processedCounts'] = $currentFilterModel->processCounts($counts);
165
+
166
+ $this->_copyParts($this->_productCollection->getSelect(), $mainSelect);
167
+ }
168
+ if ($cache) {
169
+ $this->_filters[$code] = $currentFilter;
170
+ }
171
+ }
172
+ return $currentFilter['processedCounts'];
173
+ }
174
+ }
app/code/local/Mana/Filters/Model/Repository.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Repository {
13
+ protected $_filters = array();
14
+
15
+ public function getFilter($name) {
16
+ return isset($this->_filters[$name]) ? $this->_filters[$name] : null;
17
+ }
18
+
19
+ public function setFilter($name, $filter) {
20
+ $this->_filters[$name] = $filter;
21
+ }
22
+ }
app/code/local/Mana/Filters/Model/Solr/Adapter/HttpStream.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Adapter_HttpStream extends Enterprise_Search_Model_Adapter_HttpStream
13
+ {
14
+ /**
15
+ * Prepare fq filter conditions
16
+ *
17
+ * @param array $filters
18
+ * @return array
19
+ */
20
+ protected function _prepareFilters($filters)
21
+ {
22
+ $result = array();
23
+
24
+ if (is_array($filters) && !empty($filters)) {
25
+ foreach ($filters as $field => $value) {
26
+ if (is_array($value)) {
27
+ if (isset($value['from']) || isset($value['to'])) {
28
+ $fieldCondition = $this->_mRenderRangeCondition($field, $value);
29
+ }
30
+ elseif (isset($value['or'])) {
31
+ $fieldCondition = '(' . implode(' OR ', $this->_mRenderCondition($field, $value['or'])) . ')';
32
+ }
33
+ elseif (isset($value['and'])) {
34
+ $fieldCondition = '(' . implode(' AND ', $this->_mRenderCondition($field, $value['and'])) . ')';
35
+ }
36
+ elseif (isset($value['reverse'])) {
37
+ $fieldCondition = '-(' . implode(' OR ', $this->_mRenderCondition($field, $value['reverse'])) . ')';
38
+ }
39
+ else {
40
+ $fieldCondition = '(' . implode(' OR ', $this->_mRenderCondition($field, $value)) . ')';
41
+ }
42
+ }
43
+ else {
44
+ $fieldCondition = $this->_mRenderEqCondition($field, $value);
45
+ }
46
+
47
+ $result[] = $fieldCondition;
48
+ }
49
+ }
50
+
51
+ return $result;
52
+ }
53
+
54
+ protected function _mRenderCondition($field, $parts)
55
+ {
56
+ $fieldCondition = array();
57
+ foreach ($parts as $part) {
58
+ if (is_array($part) && (isset($part['from']) || isset($part['to']))) {
59
+ $fieldCondition[] = $this->_mRenderRangeCondition($field, $part);
60
+ } else {
61
+ $fieldCondition[] = $this->_mRenderEqCondition($field, $part);
62
+ }
63
+ }
64
+
65
+ return $fieldCondition;
66
+ }
67
+
68
+ protected function _mRenderRangeCondition($field, $part)
69
+ {
70
+ $from = (isset($part['from']) && !empty($part['from']))
71
+ ? $this->_prepareFilterQueryText($part['from'])
72
+ : '*';
73
+ $to = (isset($part['to']) && !empty($part['to']))
74
+ ? $this->_prepareFilterQueryText($part['to'])
75
+ : '*';
76
+ return "$field:[$from TO $to]";
77
+ }
78
+
79
+ protected function _mRenderRangeConditionEx($field, $part)
80
+ {
81
+ $from = (isset($part['from']) && !empty($part['from']))
82
+ ? $this->_prepareFilterQueryText($part['from'])
83
+ : '*';
84
+ $to = (isset($part['to']) && !empty($part['to']))
85
+ ? $this->_prepareFilterQueryText($part['to'])
86
+ : '*';
87
+ $o = !empty($part['lower_bound_exclusive']);
88
+ $c = !empty($part['upper_bound_exclusive']);
89
+ if ($from == '*') {
90
+ if ($to == '*') {
91
+ $middle = false;
92
+ $o = $c = false;
93
+ }
94
+ else {
95
+ $middle = $to - 1;
96
+ }
97
+ }
98
+ else {
99
+ if ($to == '*') {
100
+ $middle = $from + 1;
101
+ }
102
+ else {
103
+ $middle = round(($from - $to) / 2, 3);
104
+ }
105
+ }
106
+ if ($middle === false || !$o && !$c) {
107
+ return "$field:[$from TO $to]";
108
+ }
109
+ elseif ($c && $o) {
110
+ return "$field:{{$from} TO $to}";
111
+ }
112
+ elseif ($c) {
113
+ return "($field:[$from TO $middle] OR $field:{{$middle} TO $to})";
114
+ }
115
+ else {
116
+ return "($field:{{$from} TO $middle} OR $field:[$middle TO $to])";
117
+ }
118
+ }
119
+
120
+ protected function _mRenderEqCondition($field, $part)
121
+ {
122
+ $part = $this->_prepareFilterQueryText($part);
123
+ return $this->_prepareFieldCondition($field, $part);
124
+ }
125
+ }
app/code/local/Mana/Filters/Model/Solr/Adapter/PhpExtension.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Adapter_PhpExtension extends Enterprise_Search_Model_Adapter_PhpExtension
13
+ {
14
+ /**
15
+ * Prepare fq filter conditions
16
+ *
17
+ * @param array $filters
18
+ * @return array
19
+ */
20
+ protected function _prepareFilters($filters)
21
+ {
22
+ $result = array();
23
+
24
+ if (is_array($filters) && !empty($filters)) {
25
+ foreach ($filters as $field => $value) {
26
+ if (is_array($value)) {
27
+ if ($field == 'price' || isset($value['from']) || isset($value['to'])) {
28
+ $from = (isset($value['from']) && !empty($value['from']))
29
+ ? $this->_prepareFilterQueryText($value['from'])
30
+ : '*';
31
+ $to = (isset($value['to']) && !empty($value['to']))
32
+ ? $this->_prepareFilterQueryText($value['to'])
33
+ : '*';
34
+ $fieldCondition = "$field:[$from TO $to]";
35
+ } elseif (isset($value['or'])) {
36
+ $fieldCondition = array();
37
+ foreach ($value['or'] as $part) {
38
+ $part = $this->_prepareFilterQueryText($part);
39
+ $fieldCondition[] = $this->_prepareFieldCondition($field, $part);
40
+ }
41
+ $fieldCondition = '(' . implode(' OR ', $fieldCondition) . ')';
42
+ } elseif (isset($value['and'])) {
43
+ $fieldCondition = array();
44
+ foreach ($value['and'] as $part) {
45
+ $part = $this->_prepareFilterQueryText($part);
46
+ $fieldCondition[] = $this->_prepareFieldCondition($field, $part);
47
+ }
48
+ $fieldCondition = '(' . implode(' AND ', $fieldCondition) . ')';
49
+ } elseif (isset($value['reverse'])) {
50
+ $fieldCondition = array();
51
+ foreach ($value as $part) {
52
+ $part = $this->_prepareFilterQueryText($part);
53
+ $fieldCondition[] = $this->_prepareFieldCondition($field, $part);
54
+ }
55
+ $fieldCondition = '-(' . implode(' OR ', $fieldCondition) . ')';
56
+ } else {
57
+ $fieldCondition = array();
58
+ foreach ($value as $part) {
59
+ $part = $this->_prepareFilterQueryText($part);
60
+ $fieldCondition[] = $this->_prepareFieldCondition($field, $part);
61
+ }
62
+ $fieldCondition = '(' . implode(' OR ', $fieldCondition) . ')';
63
+ }
64
+ } else {
65
+ $value = $this->_prepareFilterQueryText($value);
66
+ $fieldCondition = $this->_prepareFieldCondition($field, $value);
67
+ }
68
+
69
+ $result[] = $fieldCondition;
70
+ }
71
+ }
72
+
73
+ return $result;
74
+ }
75
+ }
app/code/local/Mana/Filters/Model/Solr/And/Attribute.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_And_Attribute extends Mana_Filters_Model_Solr_Attribute
13
+ {
14
+ /**
15
+ * @param Enterprise_Search_Model_Resource_Collection $collection
16
+ */
17
+ public function applyToCollection($collection)
18
+ {
19
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
20
+ $facetField = $engine->getSearchEngineFieldName($this->getAttributeModel(), 'nav');
21
+ $collection->addFqFilter(array($facetField => array('and' => $this->getMSelectedValues())));
22
+ }
23
+
24
+ }
app/code/local/Mana/Filters/Model/Solr/Attribute.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Attribute extends Mana_Filters_Model_Filter_Attribute
13
+ {
14
+ public function isCountedOnMainCollection() {
15
+ return !$this->isApplied();
16
+ }
17
+
18
+ public function processCounts($counts) {
19
+ /* @var $collection Enterprise_Search_Model_Resource_Collection */
20
+ $collection = $counts;
21
+
22
+ $attribute = $this->getAttributeModel();
23
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
24
+ $fieldName = $engine->getSearchEngineFieldName($attribute, 'nav');
25
+ return $collection->getFacetedData($fieldName);
26
+
27
+ }
28
+
29
+ /**
30
+ * @param Enterprise_Search_Model_Resource_Collection $collection
31
+ * @return Enterprise_Search_Model_Resource_Collection
32
+ */
33
+ public function countOnCollection($collection)
34
+ {
35
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
36
+ $facetField = $engine->getSearchEngineFieldName($this->getAttributeModel(), 'nav');
37
+ $collection->setFacetCondition($facetField);
38
+
39
+ return $collection;
40
+ }
41
+
42
+ /**
43
+ * @param Enterprise_Search_Model_Resource_Collection $collection
44
+ */
45
+ public function applyToCollection($collection)
46
+ {
47
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
48
+ $facetField = $engine->getSearchEngineFieldName($this->getAttributeModel(), 'nav');
49
+ $collection->addFqFilter(array($facetField => array('or' => $this->getMSelectedValues())));
50
+ }
51
+
52
+ }
app/code/local/Mana/Filters/Model/Solr/Category.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Category extends Mana_Filters_Model_Filter_Category
13
+ {
14
+ public function isCountedOnMainCollection() {
15
+ return true;
16
+ }
17
+
18
+ public function processCounts($counts) {
19
+ /* @var $collection Enterprise_Search_Model_Resource_Collection */
20
+ $collection = $counts;
21
+
22
+ $facetedData = $collection->getFacetedData('category_ids');
23
+ foreach ($this->getCountedCategories() as $category) {
24
+ if (isset($facetedData[$category->getId()])) {
25
+ $category->setProductCount($facetedData[$category->getId()]);
26
+ }
27
+ }
28
+ return $this->getCountedCategories();
29
+ }
30
+
31
+ /**
32
+ * @param Enterprise_Search_Model_Resource_Collection $collection
33
+ * @return Enterprise_Search_Model_Resource_Collection
34
+ */
35
+ public function countOnCollection($collection)
36
+ {
37
+ $useFlat = (bool) Mage::getStoreConfig('catalog/frontend/flat_catalog_category');
38
+ $countedCategories = $this->getCountedCategories();
39
+ $categories = ($countedCategories instanceof Mage_Core_Model_Resource_Db_Collection_Abstract)
40
+ ? $countedCategories->getAllIds()
41
+ : (($useFlat)
42
+ ? array_keys($this->getCountedCategories())
43
+ : array_keys($this->getCountedCategories()->toArray()));
44
+
45
+ $collection->setFacetCondition('category_ids', $categories);
46
+
47
+ return $collection;
48
+ }
49
+
50
+ /**
51
+ * @param Enterprise_Search_Model_Resource_Collection $collection
52
+ */
53
+ public function applyToCollection($collection)
54
+ {
55
+ $collection->addFqFilter(array('category_ids' => array('or' => $this->getMSelectedValues())));
56
+ }
57
+
58
+ public function isFilterAppliedWhenCounting($modelToBeApplied) {
59
+ return true;
60
+ }
61
+ }
app/code/local/Mana/Filters/Model/Solr/Decimal.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Decimal extends Mana_Filters_Model_Filter_Decimal
13
+ {
14
+ public function isCountedOnMainCollection() {
15
+ return !$this->isApplied();
16
+ }
17
+
18
+ public function processCounts($counts) {
19
+ /* @var $collection Enterprise_Search_Model_Resource_Collection */
20
+ $collection = $counts;
21
+
22
+ $attributeCode = $this->getAttributeModel()->getAttributeCode();
23
+ $fieldName = 'attr_decimal_' . $attributeCode;
24
+ $facets = $collection->getFacetedData($fieldName);
25
+ $result = array();
26
+ if (!empty($facets)) {
27
+ foreach ($facets as $key => $value) {
28
+ preg_match('/TO ([\d\.]+)\]$/', $key, $rangeKey);
29
+ $rangeKey = $rangeKey[1] / $this->getRange();
30
+ $rangeKey = round($rangeKey);
31
+ /** @noinspection PhpIllegalArrayKeyTypeInspection */
32
+ $result[$rangeKey] = $value;
33
+ }
34
+ }
35
+ return $result;
36
+ }
37
+
38
+ /**
39
+ * @param Enterprise_Search_Model_Resource_Collection $collection
40
+ * @return mixed
41
+ */
42
+ public function countOnCollection($collection)
43
+ {
44
+ $range = $this->getRange();
45
+ $maxValue = $this->getMaxValue();
46
+ if ($maxValue > 0) {
47
+ $facets = array();
48
+ $facetCount = ceil($maxValue / $range);
49
+ for ($i = 0; $i < $facetCount; $i++) {
50
+ $facets[] = array(
51
+ 'from' => $i * $range,
52
+ 'to' => ($i + 1) * $range - ($this->isUpperBoundInclusive() ? 0 : 0.001),
53
+ );
54
+ }
55
+
56
+ $attributeCode = $this->getAttributeModel()->getAttributeCode();
57
+ $field = 'attr_decimal_' . $attributeCode;
58
+
59
+ $collection->setFacetCondition($field, $facets);
60
+ }
61
+
62
+ return $collection;
63
+ }
64
+
65
+ /**
66
+ * @param Enterprise_Search_Model_Resource_Collection $collection
67
+ */
68
+ public function applyToCollection($collection)
69
+ {
70
+ $attributeCode = $this->getAttributeModel()->getAttributeCode();
71
+ $field = 'attr_decimal_'. $attributeCode;
72
+
73
+ $fq = array();
74
+ foreach ($this->getMSelectedValues() as $selection) {
75
+ list($index, $range) = explode(',', $selection);
76
+ $range = $this->_getResource()->getRange($index, $range);
77
+ $fq[] = array(
78
+ 'from' => $range['from'],
79
+ 'to' => $range['to'] - ($this->isUpperBoundInclusive() ? 0 : 0.001),
80
+ );
81
+ }
82
+
83
+ $collection->addFqFilter(array($field => array('or' => $fq)));
84
+ }
85
+
86
+ public function isFilterAppliedWhenCounting($modelToBeApplied) {
87
+ return false;
88
+ }
89
+ }
app/code/local/Mana/Filters/Model/Solr/Price.php ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Price extends Mana_Filters_Model_Filter_Price
13
+ {
14
+ public function isCountedOnMainCollection() {
15
+ return !$this->isApplied();
16
+ }
17
+
18
+ /**
19
+ * Applies counting query to the current collection. The result should be suitable to processCounts() method.
20
+ * Typically, this method should return final result - option id/count pairs for option lists or
21
+ * min/max pair for slider. However, in some cases (like not applied Solr facets) this method returns collection
22
+ * object and later processCounts() extracts actual counts from this collections.
23
+ *
24
+ * @param Enterprise_Search_Model_Resource_Collection $collection
25
+ * @return mixed
26
+ */
27
+ public function countOnCollection($collection)
28
+ {
29
+ if (Mage::app()->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION) == self::RANGE_CALCULATION_IMPROVED) {
30
+ return $this->_addCalculatedFacetConditionToCollection($collection);
31
+ }
32
+
33
+ $this->_facets = array();
34
+ $range = $this->getPriceRange();
35
+ $maxPrice = $this->getMaxPriceInt();
36
+ if ($maxPrice > 0) {
37
+ $priceFacets = array();
38
+ $facetCount = ceil($maxPrice / $range);
39
+
40
+ for ($i = 0; $i < $facetCount; $i++) {
41
+ $separator = array($i * $range, ($i + 1) * $range);
42
+ $facetedRange = $this->_prepareFacetRange($separator[0], $separator[1]);
43
+ $this->_facets[$facetedRange['from'] . '_' . $facetedRange['to']] = $separator;
44
+ $priceFacets[] = $facetedRange;
45
+ }
46
+
47
+ $collection->setFacetCondition($this->_getFilterField(), $priceFacets);
48
+ }
49
+
50
+ return $collection;
51
+ }
52
+ public function processCounts($counts) {
53
+ /* @var $collection Enterprise_Search_Model_Resource_Collection */
54
+ $collection = $counts;
55
+
56
+ $fieldName = $this->_getFilterField();
57
+ $facets = $collection->getFacetedData($fieldName);
58
+ $result = array();
59
+ if (!empty($facets)) {
60
+ foreach ($facets as $key => $value) {
61
+ preg_match('/TO ([\d\.]+)\]$/', $key, $rangeKey);
62
+ $rangeKey = $rangeKey[1] / $this->getPriceRange();
63
+ $rangeKey = round($rangeKey);
64
+ /** @noinspection PhpIllegalArrayKeyTypeInspection */
65
+ $result[$rangeKey] = $value;
66
+ }
67
+ }
68
+ return $result;
69
+ }
70
+
71
+ /**
72
+ * Applies filter values provided in URL to a given product collection
73
+ *
74
+ * @param Enterprise_Search_Model_Resource_Collection $collection
75
+ * @return void
76
+ */
77
+ public function applyToCollection($collection)
78
+ {
79
+ $field = $this->_getFilterField();
80
+ $fq = array();
81
+ foreach ($this->getMSelectedValues() as $selection) {
82
+ list($index, $range) = explode(',', $selection);
83
+ $range = $this->_getResource()->getPriceRange($index, $range);
84
+ $to = $range['to'];
85
+ if ($to < $this->getMaxPriceInt() && !$this->isUpperBoundInclusive()) {
86
+ $to -= 0.001;
87
+ }
88
+
89
+ $fq[] = array(
90
+ 'from' => $range['from'],
91
+ 'to' => $to,
92
+ );
93
+ }
94
+
95
+ $collection->addFqFilter(array($field => array('or' => $fq)));
96
+ }
97
+
98
+ #region Ported code
99
+ const CACHE_TAG = 'MAXPRICE';
100
+
101
+ /**
102
+ * Whether current price interval is divisible
103
+ *
104
+ * @var bool
105
+ */
106
+ protected $_divisible = true;
107
+
108
+ /**
109
+ * Ranges faceted data
110
+ *
111
+ * @var array
112
+ */
113
+ protected $_facets = array();
114
+
115
+ /**
116
+ * Get facet field name based on current website and customer group
117
+ *
118
+ * @return string
119
+ */
120
+ protected function _getFilterField()
121
+ {
122
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
123
+ $priceField = $engine->getSearchEngineFieldName('price');
124
+
125
+ return $priceField;
126
+ }
127
+
128
+ /**
129
+ * Get data with price separators
130
+ *
131
+ * @param $collection
132
+ * @return array
133
+ */
134
+ protected function _getSeparatorsForCollection($collection)
135
+ {
136
+ $searchParams = $collection->getExtendedSearchParams();
137
+ $intervalParams = $this->getInterval();
138
+ $intervalParams = $intervalParams ? ($intervalParams[0] . '-' . $intervalParams[1]) : '';
139
+ $uniquePart = strtoupper(md5(serialize(
140
+ $searchParams . '_' . $this->getCurrencyRate() . '_' . $intervalParams . '_' . $this->isApplied()
141
+ )));
142
+ $cacheKey = 'PRICE_SEPARATORS_' . $this->getLayer()->getStateKey() . '_' . $uniquePart;
143
+
144
+ $cachedData = Mage::app()->loadCache($cacheKey);
145
+ if (!$cachedData) {
146
+ /** @var $algorithmModel Mage_Catalog_Model_Layer_Filter_Price_Algorithm */
147
+ $algorithmModel = Mage::getSingleton('catalog/layer_filter_price_algorithm');
148
+ $statistics = $collection->getStats($this->_getFilterField());
149
+ $statistics = $statistics[$this->_getFilterField()];
150
+
151
+ $appliedInterval = $this->getInterval();
152
+ if (
153
+ $appliedInterval
154
+ && ($statistics['count'] <= $this->getIntervalDivisionLimit()
155
+ || $appliedInterval[0] == $appliedInterval[1]
156
+ || $appliedInterval[1] === '0')
157
+ ) {
158
+ $algorithmModel->setPricesModel($this)->setStatistics(0, 0, 0, 0);
159
+ $this->_divisible = false;
160
+ } else {
161
+ if ($appliedInterval) {
162
+ $algorithmModel->setLimits($appliedInterval[0], $appliedInterval[1]);
163
+ }
164
+ $algorithmModel->setPricesModel($this)->setStatistics(
165
+ round($statistics['min'] * $this->getCurrencyRate(), 2),
166
+ round($statistics['max'] * $this->getCurrencyRate(), 2),
167
+ $statistics['stddev'] * $this->getCurrencyRate(),
168
+ $statistics['count']
169
+ );
170
+ }
171
+
172
+ $cachedData = array();
173
+ foreach ($algorithmModel->calculateSeparators() as $separator) {
174
+ $cachedData[] = $separator['from'] . '-' . $separator['to'];
175
+ }
176
+ $cachedData = implode(',', $cachedData);
177
+
178
+ $tags = $this->getLayer()->getStateTags();
179
+ $tags[] = self::CACHE_TAG;
180
+ Mage::app()->saveCache($cachedData, $cacheKey, $tags);
181
+ }
182
+
183
+ if (!$cachedData) {
184
+ return array();
185
+ }
186
+
187
+ $cachedData = explode(',', $cachedData);
188
+ foreach ($cachedData as $k => $v) {
189
+ $cachedData[$k] = explode('-', $v);
190
+ }
191
+
192
+ return $cachedData;
193
+ }
194
+
195
+ /**
196
+ * Add params to faceted search generated by algorithm
197
+ *
198
+ * @param $collection
199
+ * @return Enterprise_Search_Model_Catalog_Layer_Filter_Price
200
+ */
201
+ protected function _addCalculatedFacetConditionToCollection($collection)
202
+ {
203
+ $priceFacets = array();
204
+ $this->_facets = array();
205
+ foreach ($this->_getSeparatorsForCollection($collection) as $separator) {
206
+ $facetedRange = $this->_prepareFacetRange($separator[0], $separator[1]);
207
+ $this->_facets[$facetedRange['from'] . '_' . $facetedRange['to']] = $separator;
208
+ $priceFacets[] = $facetedRange;
209
+ }
210
+ $collection->setFacetCondition($this->_getFilterField(), $priceFacets);
211
+
212
+ return $collection;
213
+ }
214
+
215
+ /**
216
+ * Prepare price range to be added to facet conditions
217
+ *
218
+ * @param string|float $from
219
+ * @param string|float $to
220
+ * @return array
221
+ */
222
+ protected function _prepareFacetRange($from, $to)
223
+ {
224
+ if (empty($from)) {
225
+ $from = '';
226
+ }
227
+
228
+ if ($to === '') {
229
+ $to = '';
230
+ } else {
231
+ if ($to === $from || ($to === 0 && $from === '')) {
232
+ $to = $this->_prepareFacetedValue($to, false);
233
+ } else {
234
+ $to = $this->_prepareFacetedValue($to);
235
+ }
236
+ }
237
+
238
+ if ($from !== '') {
239
+ $from = $this->_prepareFacetedValue($from, false);
240
+ }
241
+
242
+ return array('from' => $from, 'to' => $to);
243
+ }
244
+
245
+ /**
246
+ * Prepare faceted value
247
+ *
248
+ * @param float $value
249
+ * @param bool $decrease
250
+ * @return float
251
+ */
252
+ protected function _prepareFacetedValue($value, $decrease = true) {
253
+ if ($this->isUpperBoundInclusive()) {
254
+ $decrease = false;
255
+ }
256
+ // rounding issue
257
+ if ($this->getCurrencyRate() > 1) {
258
+ if ($decrease) {
259
+ $value -= 0.001;
260
+ }
261
+ $value /= $this->getCurrencyRate();
262
+ } else {
263
+ $value /= $this->getCurrencyRate();
264
+ if ($decrease) {
265
+ $value -= 0.001;
266
+ }
267
+ }
268
+ return round($value, 3);
269
+ }
270
+ public function getRangeOnCollection($collection)
271
+ {
272
+ $min = 0;
273
+ $stats = $collection->getStats($this->_getFilterField());
274
+
275
+ $max = $stats[$this->_getFilterField()]['max'];
276
+ if (!is_numeric($max)) {
277
+ $max = parent::getRangeOnCollection($collection);
278
+ } else {
279
+ $max = floor($max * $this->getCurrencyRate());
280
+ }
281
+
282
+ return compact('min', 'max');
283
+ }
284
+
285
+ public function isFilterAppliedWhenCounting($modelToBeApplied) {
286
+ return false;
287
+ }
288
+
289
+ #endregion
290
+ }
app/code/local/Mana/Filters/Model/Solr/Reverse/Attribute.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Reverse_Attribute extends Mana_Filters_Model_Solr_Attribute
13
+ {
14
+ /**
15
+ * @param Enterprise_Search_Model_Resource_Collection $collection
16
+ */
17
+ public function applyToCollection($collection)
18
+ {
19
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
20
+ $facetField = $engine->getSearchEngineFieldName($this->getAttributeModel(), 'nav');
21
+ $collection->addFqFilter(array($facetField => array('reverse' => $this->getMSelectedValues())));
22
+ }
23
+
24
+ }
app/code/local/Mana/Filters/Model/Solr/Reverse/Decimal.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Reverse_Decimal extends Mana_Filters_Model_Solr_Decimal
13
+ {
14
+ /**
15
+ * @param Enterprise_Search_Model_Resource_Collection $collection
16
+ */
17
+ public function applyToCollection($collection)
18
+ {
19
+ $attributeCode = $this->getAttributeModel()->getAttributeCode();
20
+ $field = 'attr_decimal_'. $attributeCode;
21
+
22
+ $fq = array();
23
+ foreach ($this->getMSelectedValues() as $selection) {
24
+ list($index, $range) = explode(',', $selection);
25
+ $fq[] = array(
26
+ 'from' => ($range * ($index - 1)),
27
+ 'to' => $range * $index - ($this->isUpperBoundInclusive() ? 0 : 0.001),
28
+ );
29
+ }
30
+
31
+ $collection->addFqFilter(array($field => array('reverse' => $fq)));
32
+ }
33
+
34
+ }
app/code/local/Mana/Filters/Model/Solr/Reverse/Price.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Model_Solr_Reverse_Price extends Mana_Filters_Model_Solr_Price
13
+ {
14
+ /**
15
+ * Applies filter values provided in URL to a given product collection
16
+ *
17
+ * @param Enterprise_Search_Model_Resource_Collection $collection
18
+ * @return void
19
+ */
20
+ public function applyToCollection($collection)
21
+ {
22
+ $field = $this->_getFilterField();
23
+ $fq = array();
24
+ foreach ($this->getMSelectedValues() as $selection) {
25
+ list($index, $range) = explode(',', $selection);
26
+ $to = $range * $index;
27
+ if ($to < $this->getMaxPriceInt() && !$this->isUpperBoundInclusive()) {
28
+ $to -= 0.001;
29
+ }
30
+
31
+ $fq[] = array(
32
+ 'from' => ($range * ($index - 1)),
33
+ 'to' => $to,
34
+ );
35
+ }
36
+
37
+ $collection->addFqFilter(array($field => array('reverse' => $fq)));
38
+ }
39
+ }
app/code/local/Mana/Filters/Resource/EnterpriseSearch/Engine.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Resource_EnterpriseSearch_Engine extends Enterprise_Search_Model_Resource_Engine {
13
+ /**
14
+ * Define if Layered Navigation is allowed
15
+ *
16
+ * @deprecated after 1.9.1 - use $this->isLayeredNavigationAllowed()
17
+ *
18
+ * @return bool
19
+ */
20
+ public function isLeyeredNavigationAllowed() {
21
+ return $this->isLayeredNavigationAllowed();
22
+ }
23
+ }
app/code/local/Mana/Filters/Resource/Filter/And/Attribute.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * Resource type which contains sql code for applying filters and related operations
10
+ * @author Mana Team
11
+ * Injected instead of standard resource catalog/layer_filter_attribute in
12
+ * Mana_Filters_Model_Filter_Attribute::_getResource().
13
+ */
14
+ class Mana_Filters_Resource_Filter_And_Attribute
15
+ extends Mana_Filters_Resource_Filter_Attribute
16
+ {
17
+ /**
18
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
19
+ * @param Mana_Filters_Resource_Filter_Attribute $model
20
+ * @param array $value
21
+ * @return Mana_Filters_Resource_Filter_Attribute
22
+ */
23
+ public function applyToCollection($collection, $model, $value) {
24
+ $attribute = $model->getAttributeModel();
25
+ $connection = $this->_getReadAdapter();
26
+
27
+ foreach ($value as $i => $singleValue) {
28
+ $tableAlias = $attribute->getAttributeCode() . '_idx' . $i;
29
+ $conditions = array(
30
+ "{$tableAlias}.entity_id = e.entity_id",
31
+ $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
32
+ $connection->quoteInto("{$tableAlias}.store_id = ?", $collection->getStoreId()),
33
+ "{$tableAlias}.value = $singleValue"
34
+ );
35
+ $conditions = join(' AND ', $conditions);
36
+ $collection->getSelect()
37
+ ->distinct()
38
+ ->join(array($tableAlias => $this->getMainTable()), $conditions, array());
39
+ }
40
+
41
+ return $this;
42
+ }
43
+ }
app/code/local/Mana/Filters/Resource/Filter/Attribute.php CHANGED
@@ -11,80 +11,16 @@
11
  * Injected instead of standard resource catalog/layer_filter_attribute in
12
  * Mana_Filters_Model_Filter_Attribute::_getResource().
13
  */
14
- class Mana_Filters_Resource_Filter_Attribute extends Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute {
15
- /**
16
- * Modifies product collection select sql to include only those products which conforms this filter's conditions
17
- * @param Mana_Filters_Model_Filter_Attribute $filter
18
- * @param string $value
19
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
20
- * changes are marked with comments.
21
- * @see Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute::applyFilterToCollection()
22
- */
23
- public function applyFilterToCollection($filter, $value)
24
- {
25
- $collection = $filter->getLayer()->getProductCollection();
26
-
27
- // MANA BEGIN: prevent product to appear twice if it conforms joined codition 2 times (e.g. if product
28
- // has two values assigned for an attribute and both are filtered).
29
- $collection->getSelect()->distinct(true);
30
- // MANA END
31
-
32
- $attribute = $filter->getAttributeModel();
33
- $connection = $this->_getReadAdapter();
34
- switch ($filter->getFilterOptions()->getOperation()) {
35
- case '':
36
- $tableAlias = $attribute->getAttributeCode() . '_idx';
37
- $conditions = array(
38
- "{$tableAlias}.entity_id = e.entity_id",
39
- $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
40
- $connection->quoteInto("{$tableAlias}.store_id = ?", $collection->getStoreId()),
41
- "{$tableAlias}.value in (" . implode(',', array_filter(explode('_', $value))) . ")"
42
- );
43
- $collection->getSelect()
44
- ->distinct()
45
- ->join(
46
- array($tableAlias => $this->getMainTable()),
47
- join(' AND ', $conditions),
48
- array()
49
- );
50
- break;
51
- case 'and':
52
- foreach (explode('_', $value) as $i => $singleValue) {
53
- $tableAlias = $attribute->getAttributeCode() . '_idx'.$i;
54
- $conditions = array(
55
- "{$tableAlias}.entity_id = e.entity_id",
56
- $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
57
- $connection->quoteInto("{$tableAlias}.store_id = ?", $collection->getStoreId()),
58
- "{$tableAlias}.value = $singleValue"
59
- );
60
- $collection->getSelect()
61
- ->distinct()
62
- ->join(
63
- array($tableAlias => $this->getMainTable()),
64
- join(' AND ', $conditions),
65
- array()
66
- );
67
- }
68
- break;
69
- default: throw new Exception('Not implemented');
70
- }
71
-
72
- return $this;
73
- }
74
-
75
  /**
76
- * For each option visible to person as a filter choice counts how many products are there given that all the
77
- * other filters are applied
78
- * @param Mana_Filters_Model_Filter_Attribute $filter
79
- * @return array Each entry in result is int option_id => int count
80
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
81
- * changes are marked with comments.
82
- * @see Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute::getCount()
83
  */
84
- public function getCount($filter)
85
- {
86
- // clone select from collection with filters
87
- $select = clone $filter->getLayer()->getProductCollection()->getSelect();
88
  // reset columns, order and limitation conditions
89
  $select->reset(Zend_Db_Select::COLUMNS);
90
  $select->reset(Zend_Db_Select::ORDER);
@@ -93,38 +29,49 @@ class Mana_Filters_Resource_Filter_Attribute extends Mage_Catalog_Model_Resource
93
  $select->reset(Zend_Db_Select::LIMIT_OFFSET);
94
 
95
  $connection = $this->_getReadAdapter();
96
- $attribute = $filter->getAttributeModel();
97
  $tableAlias = $attribute->getAttributeCode() . '_idx';
98
 
99
- // MANA BEGIN: if there is already applied filter with the same name, then unjoin it from select.
100
- // TODO: comment on Mage::registry('mana_cat_index_from_condition') after we edit category filters
101
- $from = array();
102
- $catIndexCondition = Mage::registry('mana_cat_index_from_condition');
103
- foreach ($select->getPart(Zend_Db_Select::FROM) as $key => $value) {
104
- if ($key != $tableAlias) {
105
- if ($catIndexCondition && ($catIndexCondition == $value['joinCondition'])) {
106
- $value['joinCondition'] = Mage::registry('mana_cat_index_to_condition');
107
- }
108
- $from[$key] = $value;
109
- }
110
- }
111
- $select->setPart(Zend_Db_Select::FROM, $from);
112
- // MANA END
113
-
114
  $conditions = array(
115
  "{$tableAlias}.entity_id = e.entity_id",
116
  $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
117
- $connection->quoteInto("{$tableAlias}.store_id = ?", $filter->getStoreId()),
118
  );
119
 
120
  $select
121
  ->join(
122
  array($tableAlias => $this->getMainTable()),
123
  join(' AND ', $conditions),
124
- array('value', 'count' => "COUNT(DISTINCT {$tableAlias}.entity_id)"))
 
125
  ->group("{$tableAlias}.value");
126
 
127
  return $connection->fetchPairs($select);
128
  }
129
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  }
11
  * Injected instead of standard resource catalog/layer_filter_attribute in
12
  * Mana_Filters_Model_Filter_Attribute::_getResource().
13
  */
14
+ class Mana_Filters_Resource_Filter_Attribute
15
+ extends Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute
16
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
19
+ * @param Mana_Filters_Model_Filter_Attribute $model
20
+ * @return mixed
 
 
 
 
21
  */
22
+ public function countOnCollection($collection, $model) {
23
+ $select = $collection->getSelect();
 
 
24
  // reset columns, order and limitation conditions
25
  $select->reset(Zend_Db_Select::COLUMNS);
26
  $select->reset(Zend_Db_Select::ORDER);
29
  $select->reset(Zend_Db_Select::LIMIT_OFFSET);
30
 
31
  $connection = $this->_getReadAdapter();
32
+ $attribute = $model->getAttributeModel();
33
  $tableAlias = $attribute->getAttributeCode() . '_idx';
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  $conditions = array(
36
  "{$tableAlias}.entity_id = e.entity_id",
37
  $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
38
+ $connection->quoteInto("{$tableAlias}.store_id = ?", $model->getStoreId()),
39
  );
40
 
41
  $select
42
  ->join(
43
  array($tableAlias => $this->getMainTable()),
44
  join(' AND ', $conditions),
45
+ array('value', 'count' => "COUNT(DISTINCT {$tableAlias}.entity_id)")
46
+ )
47
  ->group("{$tableAlias}.value");
48
 
49
  return $connection->fetchPairs($select);
50
  }
51
+
52
+ /**
53
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
54
+ * @param Mana_Filters_Model_Filter_Attribute $model
55
+ * @param array $value
56
+ * @return Mana_Filters_Resource_Filter_Attribute
57
+ */
58
+ public function applyToCollection($collection, $model, $value) {
59
+ $attribute = $model->getAttributeModel();
60
+ $connection = $this->_getReadAdapter();
61
+
62
+ $tableAlias = $attribute->getAttributeCode() . '_idx';
63
+ $conditions = array(
64
+ "{$tableAlias}.entity_id = e.entity_id",
65
+ $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
66
+ $connection->quoteInto("{$tableAlias}.store_id = ?", $collection->getStoreId()),
67
+ "{$tableAlias}.value in (" . implode(',', array_filter($value)) . ")"
68
+ );
69
+ $conditions = join(' AND ', $conditions);
70
+ $collection->getSelect()
71
+ ->distinct()
72
+ ->join(array($tableAlias => $this->getMainTable()), $conditions, array());
73
+
74
+ return $this;
75
+ }
76
+
77
  }
app/code/local/Mana/Filters/Resource/Filter/Decimal.php CHANGED
@@ -13,18 +13,47 @@
13
  */
14
  class Mana_Filters_Resource_Filter_Decimal extends Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Decimal {
15
  /**
16
- * Applies one or more price filters to currently viewed product collection
17
- * @param Mana_Filters_Model_Filter_Price $filter
18
- * @param array $selections
19
- * @return Mana_Filters_Resource_Filter_Price
20
- * This method is cloned from method applyFilterToCollection() in parent class (method body was pasted from parent class
21
- * and changed as needed. All changes marked with comments
22
- * Standard method did not give us possibility to filter multiple ranges.
23
  */
24
- public function applyFilterToCollectionEx($filter, $selections)
25
- {
26
- $collection = $filter->getLayer()->getProductCollection();
27
- $attribute = $filter->getAttributeModel();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  $connection = $this->_getReadAdapter();
29
  $tableAlias = $attribute->getAttributeCode() . '_idx';
30
  $conditions = array(
@@ -41,62 +70,59 @@ class Mana_Filters_Resource_Filter_Decimal extends Mage_Catalog_Model_Resource_E
41
 
42
  // MANA BEGIN: modify select formation to include multiple price ranges
43
  $condition = '';
44
- foreach ($selections as $selection) {
45
  list($index, $range) = explode(',', $selection);
46
  $range = $this->getRange($index, $range);
47
  if ($condition != '') $condition .= ' OR ';
48
  $condition .= '(('."{$tableAlias}.value" . ' >= '. $range['from'].') '.
49
- 'AND ('."{$tableAlias}.value" . ($this->_isUpperBoundInclusive() ? ' <= ' : ' < '). $range['to'].'))';
50
  }
51
  $collection->getSelect()
52
  ->distinct()
53
  ->where($condition);
54
  // MANA END
55
-
56
  return $this;
57
  }
58
- protected function _isUpperBoundInclusive() {
 
 
59
  return false;
60
  }
61
- /**
62
- * For each option visible to person as a filter choice counts how many products are there given that all the
63
- * other filters are applied
64
- * @param Mana_Filters_Model_Filter_Price $filter
65
- * @param int $range The whole price range is split into several using this range step
66
- * @return array Each entry in result is int index => int count
67
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
68
- * changes are marked with comments.
69
- * @see Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute::getCount()
70
- */
71
- public function getCount($filter, $range)
72
  {
73
- $select = $this->_getSelect($filter);
74
- $adapter = $this->_getReadAdapter();
 
 
 
 
 
75
 
76
- $countExpr = new Zend_Db_Expr("COUNT(*)");
77
- $rangeExpr = new Zend_Db_Expr("FLOOR(decimal_index.value / {$range}) + 1");
78
 
79
- $select->columns(array(
80
- 'range' => $rangeExpr,
81
- 'count' => $countExpr
82
- ));
83
- $select->group('range');
 
 
84
 
85
- // MANA BEGIN: make sure price filter is not applied
86
- Mage::helper('mana_filters')->resetProductCollectionWhereClause($select);
87
- // MANA END
88
-
89
- return $adapter->fetchPairs($select);
90
  }
 
91
  /**
92
  * Retrieve maximal price for attribute
93
  *
94
  * @param Mage_Catalog_Model_Layer_Filter_Price $filter
95
  * @return float
96
  */
97
- public function getMinMax($filter)
98
  {
99
- $select = $this->_getSelect($filter);
100
  $connection = $this->_getReadAdapter();
101
 
102
  $table = 'decimal_index';
@@ -106,24 +132,6 @@ class Mana_Filters_Resource_Filter_Decimal extends Mage_Catalog_Model_Resource_E
106
  'max_value' => new Zend_Db_Expr('MAX(decimal_index.value)'),
107
  ));
108
  Mage::helper('mana_filters')->resetProductCollectionWhereClause($select);
109
- $from = $select->getPart(Zend_Db_Select::FROM);
110
- foreach ($from as $key => $options) {
111
- if ($key == 'cat_index') {
112
- /* @var $layer Mage_Catalog_Model_Layer */ $layer = Mage::getSingleton('catalog/layer');
113
- $needle = "cat_index.category_id='";
114
- $startPos = strpos($options['joinCondition'], $needle);
115
- if ($startPos === false) throw new Exception('Not implemented');
116
- $endPos = strpos($options['joinCondition'], "'", $startPos + strlen($needle));
117
- $from[$key]['joinCondition'] =
118
- substr($options['joinCondition'], 0, $startPos + strlen($needle)).
119
- $layer->getCurrentCategory()->getId().
120
- substr($options['joinCondition'], $endPos);
121
- }
122
- // elseif (strrpos($key, '_idx') === strlen($key) - strlen('_idx')) {
123
- // unset($from[$key]);
124
- // }
125
- }
126
- $select->setPart(Zend_Db_Select::FROM, $from);
127
 
128
  $result = $connection->fetchRow($select);
129
  return array($result['min_value'], $result['max_value']);
13
  */
14
  class Mana_Filters_Resource_Filter_Decimal extends Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Decimal {
15
  /**
16
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
17
+ * @param Mana_Filters_Model_Filter_Attribute $model
18
+ * @return Mana_Filters_Resource_Filter_Decimal
 
 
 
 
19
  */
20
+ public function countOnCollection($collection, $model) {
21
+ $select = $collection->getSelect();
22
+ $select->reset(Zend_Db_Select::COLUMNS);
23
+ $select->reset(Zend_Db_Select::ORDER);
24
+ $select->reset(Zend_Db_Select::LIMIT_COUNT);
25
+ $select->reset(Zend_Db_Select::LIMIT_OFFSET);
26
+
27
+ $attributeId = $model->getAttributeModel()->getId();
28
+ $storeId = $collection->getStoreId();
29
+
30
+ $select->join(
31
+ array('decimal_index' => $this->getMainTable()),
32
+ 'e.entity_id = decimal_index.entity_id'.
33
+ ' AND ' . $this->_getReadAdapter()->quoteInto('decimal_index.attribute_id = ?', $attributeId) .
34
+ ' AND ' . $this->_getReadAdapter()->quoteInto('decimal_index.store_id = ?', $storeId),
35
+ array()
36
+ );
37
+
38
+ $adapter = $this->_getReadAdapter();
39
+
40
+ $countExpr = new Zend_Db_Expr("COUNT(*)");
41
+ $rangeExpr = new Zend_Db_Expr("FLOOR(decimal_index.value / {$model->getRange()}) + 1");
42
+
43
+ $select->columns(array('range' => $rangeExpr, 'count' => $countExpr));
44
+ $select->group('range');
45
+
46
+ return $adapter->fetchPairs($select);
47
+ }
48
+
49
+ /**
50
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
51
+ * @param Mana_Filters_Model_Filter_Decimal $model
52
+ * @param array $value
53
+ * @return Mana_Filters_Resource_Filter_Decimal
54
+ */
55
+ public function applyToCollection($collection, $model, $value) {
56
+ $attribute = $model->getAttributeModel();
57
  $connection = $this->_getReadAdapter();
58
  $tableAlias = $attribute->getAttributeCode() . '_idx';
59
  $conditions = array(
70
 
71
  // MANA BEGIN: modify select formation to include multiple price ranges
72
  $condition = '';
73
+ foreach ($value as $selection) {
74
  list($index, $range) = explode(',', $selection);
75
  $range = $this->getRange($index, $range);
76
  if ($condition != '') $condition .= ' OR ';
77
  $condition .= '(('."{$tableAlias}.value" . ' >= '. $range['from'].') '.
78
+ 'AND ('."{$tableAlias}.value" . ($this->isUpperBoundInclusive() ? ' <= ' : ' < '). $range['to'].'))';
79
  }
80
  $collection->getSelect()
81
  ->distinct()
82
  ->where($condition);
83
  // MANA END
84
+
85
  return $this;
86
  }
87
+
88
+
89
+ public function isUpperBoundInclusive() {
90
  return false;
91
  }
92
+
93
+ protected function _getSelectForCollection($filter, $collection)
 
 
 
 
 
 
 
 
 
94
  {
95
+ // clone select from collection with filters
96
+ $select = clone $collection->getSelect();
97
+ // reset columns, order and limitation conditions
98
+ $select->reset(Zend_Db_Select::COLUMNS);
99
+ $select->reset(Zend_Db_Select::ORDER);
100
+ $select->reset(Zend_Db_Select::LIMIT_COUNT);
101
+ $select->reset(Zend_Db_Select::LIMIT_OFFSET);
102
 
103
+ $attributeId = $filter->getAttributeModel()->getId();
104
+ $storeId = $collection->getStoreId();
105
 
106
+ $select->join(
107
+ array('decimal_index' => $this->getMainTable()),
108
+ 'e.entity_id = decimal_index.entity_id'.
109
+ ' AND ' . $this->_getReadAdapter()->quoteInto('decimal_index.attribute_id = ?', $attributeId) .
110
+ ' AND ' . $this->_getReadAdapter()->quoteInto('decimal_index.store_id = ?', $storeId),
111
+ array()
112
+ );
113
 
114
+ return $select;
 
 
 
 
115
  }
116
+
117
  /**
118
  * Retrieve maximal price for attribute
119
  *
120
  * @param Mage_Catalog_Model_Layer_Filter_Price $filter
121
  * @return float
122
  */
123
+ public function getMinMaxForCollection($filter, $collection)
124
  {
125
+ $select = $this->_getSelect($filter, $collection);
126
  $connection = $this->_getReadAdapter();
127
 
128
  $table = 'decimal_index';
132
  'max_value' => new Zend_Db_Expr('MAX(decimal_index.value)'),
133
  ));
134
  Mage::helper('mana_filters')->resetProductCollectionWhereClause($select);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  $result = $connection->fetchRow($select);
137
  return array($result['min_value'], $result['max_value']);
app/code/local/Mana/Filters/Resource/Filter/Price.php CHANGED
@@ -12,70 +12,97 @@
12
  * Mana_Filters_Model_Filter_Price::_getResource().
13
  */
14
  class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Price {
15
- /**
16
- * Applies one or more price filters to currently viewed product collection
17
- * @param Mana_Filters_Model_Filter_Price $filter
18
- * @param array $selections
19
- * @return Mana_Filters_Resource_Filter_Price
20
- * This method is cloned from method applyFilterToCollection() in parent class (method body was pasted from parent class
21
- * and changed as needed. All changes marked with comments
22
- * Standard method did not give us possibility to filter multiple ranges.
23
- */
24
- public function applyFilterToCollectionEx($filter, $selections)
25
  {
26
- $collection = $filter->getLayer()->getProductCollection();
27
  $collection->addPriceData($filter->getCustomerGroupId(), $filter->getWebsiteId());
28
 
29
- $select = $collection->getSelect();
30
- $response = $this->_dispatchPreparePriceEvent($filter, $select);
 
 
 
31
 
32
- $table = $this->_getIndexTableAlias();
33
- $additional = join('', $response->getAdditionalCalculations());
34
- $fix = $this->_getConfigurablePriceFix();
35
- $rate = $filter->getCurrencyRate();
36
- $precision = 2;//$filter->getDecimalDigits();
37
- if ($this->_isUpperBoundInclusive()) {
38
- $priceExpr = new Zend_Db_Expr("ROUND(({$table}.min_price {$additional} {$fix}) * {$rate}, $precision)");
 
 
 
 
 
39
  }
40
- else {
41
- $priceExpr = new Zend_Db_Expr("({$table}.min_price {$additional} {$fix}) * {$rate}");
 
 
 
 
 
 
 
 
 
42
  }
 
43
 
44
- // MANA BEGIN: modify select formation to include multiple price ranges
45
- $condition = '';
46
- foreach ($selections as $selection) {
47
- list($index, $range) = explode(',', $selection);
48
- $range = $this->getPriceRange($index, $range);
49
- if ($condition != '') $condition .= ' OR ';
50
- $condition .= '(('.$priceExpr . ' >= '. $range['from'].') '.
51
- 'AND ('.$priceExpr . ($this->_isUpperBoundInclusive() ? ' <= ' : ' < '). $range['to'].'))';
52
  }
53
- $select
54
- ->distinct()
55
- ->where($condition);
56
- // MANA END
57
- return $this;
 
 
 
 
 
 
58
  }
59
- protected function _isUpperBoundInclusive() {
60
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
 
62
  /**
63
- * For each option visible to person as a filter choice counts how many products are there given that all the
64
- * other filters are applied
65
- * @param Mana_Filters_Model_Filter_Price $filter
66
- * @param int $range The whole price range is split into several using this range step
67
- * @return array Each entry in result is int index => int count
68
- * This method is overridden by copying (method body was pasted from parent class and modified as needed). All
69
- * changes are marked with comments.
70
- * @see Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute::getCount()
71
  */
72
- public function getCount($filter, $range) {
73
  if (Mage::helper('mana_core')->isMageVersionEqualOrGreater('1.7')) {
74
  $table = Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS;
75
- $select = $this->_getSelect($filter);
76
- $priceExpression = $this->_getFullPriceExpression($filter, $select);
77
 
78
- $range = floatval($range);
79
  if ($range == 0) {
80
  $range = 1;
81
  }
@@ -95,15 +122,15 @@ class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav
95
  return $this->_getReadAdapter()->fetchPairs($select);
96
  }
97
  else {
98
- $select = $this->_getSelect($filter);
99
  $connection = $this->_getReadAdapter();
100
- $response = $this->_dispatchPreparePriceEvent($filter, $select);
101
  $table = $this->_getIndexTableAlias();
102
  $additional = join('', $response->getAdditionalCalculations());
103
  $fix = $this->_getConfigurablePriceFix();
104
- $rate = $filter->getCurrencyRate();
105
- $countExpr = new Zend_Db_Expr('COUNT(*)');
106
- $rangeExpr = new Zend_Db_Expr("FLOOR((({$table}.min_price {$additional} {$fix}) * {$rate}) / {$range}) + 1");
107
 
108
  $select->columns(array(
109
  'range' => $rangeExpr,
@@ -117,10 +144,52 @@ class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav
117
  $select->where("{$table}.min_price > 0");
118
  $select->group('range');
119
 
120
- $result = $connection->fetchPairs($select);
121
  }
 
122
 
123
- return $result;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
125
  /**
126
  * Retrieve maximal price for attribute
@@ -128,9 +197,9 @@ class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav
128
  * @param Mage_Catalog_Model_Layer_Filter_Price $filter
129
  * @return float
130
  */
131
- public function getMaxPrice($filter)
132
  {
133
- $select = $this->_getSelect($filter);
134
  $connection = $this->_getReadAdapter();
135
  $response = $this->_dispatchPreparePriceEvent($filter, $select);
136
 
@@ -143,29 +212,10 @@ class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav
143
  $additional = join('', $response->getAdditionalCalculations());
144
  }
145
 
146
- $maxPriceExpr = new Zend_Db_Expr("MAX({$table}.min_price {$additional}) AS m_max_price");
 
147
 
148
- // MANA BEGIN: make sure no filter is applied
149
  Mage::helper('mana_filters')->resetProductCollectionWhereClause($select);
150
- $from = $select->getPart(Zend_Db_Select::FROM);
151
- foreach ($from as $key => $options) {
152
- if ($key == 'cat_index') {
153
- /* @var $layer Mage_Catalog_Model_Layer */ $layer = Mage::getSingleton('catalog/layer');
154
- $needle = "cat_index.category_id='";
155
- $startPos = strpos($options['joinCondition'], $needle);
156
- if ($startPos === false) throw new Exception('Not implemented');
157
- $endPos = strpos($options['joinCondition'], "'", $startPos + strlen($needle));
158
- $from[$key]['joinCondition'] =
159
- substr($options['joinCondition'], 0, $startPos + strlen($needle)).
160
- $layer->getCurrentCategory()->getId().
161
- substr($options['joinCondition'], $endPos);
162
- }
163
- //elseif (strrpos($key, '_idx') === strlen($key) - strlen('_idx')) {
164
- // unset($from[$key]);
165
- //}
166
- }
167
- $select->setPart(Zend_Db_Select::FROM, $from);
168
- // MANA END
169
  $select->columns(array($maxPriceExpr))->order('m_max_price DESC');
170
 
171
  $result = $connection->fetchOne($select) * $filter->getCurrencyRate();
@@ -186,7 +236,7 @@ class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav
186
  }
187
  /* @var $db Mage_Core_Model_Resource */ $db = Mage::getSingleton('core/resource');
188
  $request = Mage::app()->getRequest();
189
- $subselect = '';
190
 
191
  $values = array();
192
  foreach (Mage::helper('mana_filters')->getFilterOptionsCollection() as $filter) {
@@ -196,13 +246,13 @@ class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav
196
  }
197
  if (count($values) > 0) {
198
  $values = implode(',', $values);
199
- $subselect = "SELECT SUM(super_price.pricing_value) ".
200
  "FROM {$db->getTableName('catalog/product_super_attribute')} AS super ".
201
  "INNER JOIN {$db->getTableName('catalog/product_super_attribute_pricing')} AS super_price ".
202
  "ON super.product_super_attribute_id = super_price.product_super_attribute_id AND ".
203
  "super_price.is_percent = 0 AND super_price.value_index IN ($values) ".
204
  "WHERE super.product_id = e.entity_id";
205
  }
206
- return $subselect ? " + COALESCE(($subselect), 0)" : '';
207
  }
208
  }
12
  * Mana_Filters_Model_Filter_Price::_getResource().
13
  */
14
  class Mana_Filters_Resource_Filter_Price extends Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Price {
15
+ protected function _getSelectOnCollection($collection, $filter)
16
+ {
17
+ if (Mage::helper('mana_core')->isMageVersionEqualOrGreater('1.7')) {
18
+ return $this->_getSelectOnCollection_1_7($collection, $filter);
19
+ }
20
+ else {
21
+ return $this->_getSelectOnCollection_old($collection, $filter);
22
+ }
23
+ }
24
+ protected function _getSelectOnCollection_1_7($collection, $filter)
25
  {
 
26
  $collection->addPriceData($filter->getCustomerGroupId(), $filter->getWebsiteId());
27
 
28
+ if (!is_null($collection->getCatalogPreparedSelect())) {
29
+ $select = clone $collection->getCatalogPreparedSelect();
30
+ } else {
31
+ $select = clone $collection->getSelect();
32
+ }
33
 
34
+ // reset columns, order and limitation conditions
35
+ $select->reset(Zend_Db_Select::COLUMNS);
36
+ $select->reset(Zend_Db_Select::ORDER);
37
+ $select->reset(Zend_Db_Select::LIMIT_COUNT);
38
+ $select->reset(Zend_Db_Select::LIMIT_OFFSET);
39
+
40
+ // remove join with main table
41
+ $fromPart = $select->getPart(Zend_Db_Select::FROM);
42
+ if (!isset($fromPart[Mage_Catalog_Model_Resource_Product_Collection::INDEX_TABLE_ALIAS])
43
+ || !isset($fromPart[Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS])
44
+ ) {
45
+ return $select;
46
  }
47
+
48
+ // processing FROM part
49
+ $priceIndexJoinPart = $fromPart[Mage_Catalog_Model_Resource_Product_Collection::INDEX_TABLE_ALIAS];
50
+ $priceIndexJoinConditions = explode('AND', $priceIndexJoinPart['joinCondition']);
51
+ $priceIndexJoinPart['joinType'] = Zend_Db_Select::FROM;
52
+ $priceIndexJoinPart['joinCondition'] = null;
53
+ $fromPart[Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS] = $priceIndexJoinPart;
54
+ unset($fromPart[Mage_Catalog_Model_Resource_Product_Collection::INDEX_TABLE_ALIAS]);
55
+ $select->setPart(Zend_Db_Select::FROM, $fromPart);
56
+ foreach ($fromPart as $key => $fromJoinItem) {
57
+ $fromPart[$key]['joinCondition'] = $this->_replaceTableAlias($fromJoinItem['joinCondition']);
58
  }
59
+ $select->setPart(Zend_Db_Select::FROM, $fromPart);
60
 
61
+ // processing WHERE part
62
+ $wherePart = $select->getPart(Zend_Db_Select::WHERE);
63
+ foreach ($wherePart as $key => $wherePartItem) {
64
+ $wherePart[$key] = $this->_replaceTableAlias($wherePartItem);
 
 
 
 
65
  }
66
+ $select->setPart(Zend_Db_Select::WHERE, $wherePart);
67
+ $excludeJoinPart = Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS . '.entity_id';
68
+ foreach ($priceIndexJoinConditions as $condition) {
69
+ if (strpos($condition, $excludeJoinPart) !== false) {
70
+ continue;
71
+ }
72
+ $select->where($this->_replaceTableAlias($condition));
73
+ }
74
+ $select->where($this->_getPriceExpression($filter, $select) . ' IS NOT NULL');
75
+
76
+ return $select;
77
  }
78
+
79
+ protected function _getSelectOnCollection_old($collection, $filter)
80
+ {
81
+ $collection->addPriceData($filter->getCustomerGroupId(), $filter->getWebsiteId());
82
+
83
+ $select = clone $collection->getSelect();
84
+
85
+ // reset columns, order and limitation conditions
86
+ $select->reset(Zend_Db_Select::COLUMNS);
87
+ $select->reset(Zend_Db_Select::ORDER);
88
+ $select->reset(Zend_Db_Select::LIMIT_COUNT);
89
+ $select->reset(Zend_Db_Select::LIMIT_OFFSET);
90
+
91
+ return $select;
92
  }
93
+
94
  /**
95
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
96
+ * @param Mana_Filters_Model_Filter_Price $model
97
+ * @return Mana_Filters_Resource_Filter_Price
 
 
 
 
 
98
  */
99
+ public function countOnCollection($collection, $model) {
100
  if (Mage::helper('mana_core')->isMageVersionEqualOrGreater('1.7')) {
101
  $table = Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS;
102
+ $select = $this->_getSelectOnCollection($collection, $model);
103
+ $priceExpression = $this->_getFullPriceExpression($model, $select);
104
 
105
+ $range = floatval($model->getPriceRange());
106
  if ($range == 0) {
107
  $range = 1;
108
  }
122
  return $this->_getReadAdapter()->fetchPairs($select);
123
  }
124
  else {
125
+ $select = $this->_getSelectOnCollection($collection, $model);
126
  $connection = $this->_getReadAdapter();
127
+ $response = $this->_dispatchPreparePriceEvent($model, $select);
128
  $table = $this->_getIndexTableAlias();
129
  $additional = join('', $response->getAdditionalCalculations());
130
  $fix = $this->_getConfigurablePriceFix();
131
+ $rate = $model->getCurrencyRate();
132
+ $countExpr = new Zend_Db_Expr('COUNT(DISTINCT e.entity_id)');
133
+ $rangeExpr = new Zend_Db_Expr("FLOOR((({$table}.min_price {$additional} {$fix}) * {$rate}) / {$model->getPriceRange()}) + 1");
134
 
135
  $select->columns(array(
136
  'range' => $rangeExpr,
144
  $select->where("{$table}.min_price > 0");
145
  $select->group('range');
146
 
147
+ return $connection->fetchPairs($select);
148
  }
149
+ }
150
 
151
+ /**
152
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
153
+ * @param Mana_Filters_Model_Filter_Price $model
154
+ * @param array $value
155
+ * @return Mana_Filters_Resource_Filter_Price
156
+ */
157
+ public function applyToCollection($collection, $model, $value) {
158
+ $collection->addPriceData($model->getCustomerGroupId(), $model->getWebsiteId());
159
+
160
+ $select = $collection->getSelect();
161
+ $response = $this->_dispatchPreparePriceEvent($model, $select);
162
+
163
+ $table = $this->_getIndexTableAlias();
164
+ $additional = join('', $response->getAdditionalCalculations());
165
+ $fix = $this->_getConfigurablePriceFix();
166
+ $rate = $model->getCurrencyRate();
167
+ $precision = 2;//$filter->getDecimalDigits();
168
+ if ($this->isUpperBoundInclusive()) {
169
+ $priceExpr = new Zend_Db_Expr("ROUND(({$table}.min_price {$additional} {$fix}) * {$rate}, $precision)");
170
+ }
171
+ else {
172
+ $priceExpr = new Zend_Db_Expr("({$table}.min_price {$additional} {$fix}) * {$rate}");
173
+ }
174
+
175
+ $condition = '';
176
+ foreach ($model->getMSelectedValues() as $selection) {
177
+ list($index, $range) = explode(',', $selection);
178
+ $range = $this->getPriceRange($index, $range);
179
+ if ($condition != '') $condition .= ' OR ';
180
+ $condition .= '(('.$priceExpr . ' >= '. $range['from'].') '.
181
+ 'AND ('.$priceExpr . ($this->isUpperBoundInclusive() ? ' <= ' : ' < '). $range['to'].'))';
182
+ }
183
+ $select
184
+ ->distinct()
185
+ ->where($condition);
186
+ return $this;
187
+ }
188
+
189
+
190
+
191
+ public function isUpperBoundInclusive() {
192
+ return false;
193
  }
194
  /**
195
  * Retrieve maximal price for attribute
197
  * @param Mage_Catalog_Model_Layer_Filter_Price $filter
198
  * @return float
199
  */
200
+ public function getMaxPriceOnCollection($filter, $collection)
201
  {
202
+ $select = $this->_getSelectOnCollection($collection, $filter);
203
  $connection = $this->_getReadAdapter();
204
  $response = $this->_dispatchPreparePriceEvent($filter, $select);
205
 
212
  $additional = join('', $response->getAdditionalCalculations());
213
  }
214
 
215
+ $fix = $this->_getConfigurablePriceFix();
216
+ $maxPriceExpr = new Zend_Db_Expr("MAX({$table}.min_price {$additional} {$fix}) AS m_max_price");
217
 
 
218
  Mage::helper('mana_filters')->resetProductCollectionWhereClause($select);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  $select->columns(array($maxPriceExpr))->order('m_max_price DESC');
220
 
221
  $result = $connection->fetchOne($select) * $filter->getCurrencyRate();
236
  }
237
  /* @var $db Mage_Core_Model_Resource */ $db = Mage::getSingleton('core/resource');
238
  $request = Mage::app()->getRequest();
239
+ $subSelect = '';
240
 
241
  $values = array();
242
  foreach (Mage::helper('mana_filters')->getFilterOptionsCollection() as $filter) {
246
  }
247
  if (count($values) > 0) {
248
  $values = implode(',', $values);
249
+ $subSelect = "SELECT SUM(super_price.pricing_value) ".
250
  "FROM {$db->getTableName('catalog/product_super_attribute')} AS super ".
251
  "INNER JOIN {$db->getTableName('catalog/product_super_attribute_pricing')} AS super_price ".
252
  "ON super.product_super_attribute_id = super_price.product_super_attribute_id AND ".
253
  "super_price.is_percent = 0 AND super_price.value_index IN ($values) ".
254
  "WHERE super.product_id = e.entity_id";
255
  }
256
+ return $subSelect ? " + COALESCE(($subSelect), 0)" : '';
257
  }
258
  }
app/code/local/Mana/Filters/Resource/Filter/Reverse/Attribute.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * Resource type which contains sql code for applying filters and related operations
10
+ * @author Mana Team
11
+ * Injected instead of standard resource catalog/layer_filter_attribute in
12
+ * Mana_Filters_Model_Filter_Attribute::_getResource().
13
+ */
14
+ class Mana_Filters_Resource_Filter_Reverse_Attribute
15
+ extends Mana_Filters_Resource_Filter_Attribute
16
+ {
17
+ /**
18
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
19
+ * @param Mana_Filters_Resource_Filter_Attribute $model
20
+ * @param array $value
21
+ * @return Mana_Filters_Resource_Filter_Attribute
22
+ */
23
+ public function applyToCollection($collection, $model, $value) {
24
+ $attribute = $model->getAttributeModel();
25
+ $connection = $this->_getReadAdapter();
26
+
27
+ $tableAlias = $attribute->getAttributeCode() . '_idx';
28
+ $conditions = array(
29
+ "{$tableAlias}.entity_id = e.entity_id",
30
+ $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
31
+ $connection->quoteInto("{$tableAlias}.store_id = ?", $collection->getStoreId()),
32
+ "{$tableAlias}.value in (" . implode(',', array_filter($value)) . ")"
33
+ );
34
+ $conditions = join(' AND ', $conditions);
35
+ $collection->getSelect()
36
+ ->distinct()
37
+ ->where("NOT EXISTS (SELECT * ".
38
+ "FROM `{$this->getMainTable()}` AS `$tableAlias` ".
39
+ "WHERE {$conditions})");
40
+
41
+ return $this;
42
+ }
43
+ }
app/code/local/Mana/Filters/Resource/Filter/Reverse/Decimal.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * Resource type which contains sql code for applying filters and related operations
10
+ * @author Mana Team
11
+ * Injected instead of standard resource catalog/layer_filter_attribute in
12
+ * Mana_Filters_Model_Filter_Price::_getResource().
13
+ */
14
+ class Mana_Filters_Resource_Filter_Reverse_Decimal extends Mana_Filters_Resource_Filter_Decimal {
15
+ /**
16
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
17
+ * @param Mana_Filters_Model_Filter_Decimal $model
18
+ * @param array $value
19
+ * @return Mana_Filters_Resource_Filter_Decimal
20
+ */
21
+ public function applyToCollection($collection, $model, $value) {
22
+ $attribute = $model->getAttributeModel();
23
+ $connection = $this->_getReadAdapter();
24
+ $tableAlias = $attribute->getAttributeCode() . '_idx';
25
+ $conditions = array(
26
+ "{$tableAlias}.entity_id = e.entity_id",
27
+ $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
28
+ $connection->quoteInto("{$tableAlias}.store_id = ?", $collection->getStoreId())
29
+ );
30
+
31
+ $collection->getSelect()->join(
32
+ array($tableAlias => $this->getMainTable()),
33
+ join(' AND ', $conditions),
34
+ array()
35
+ );
36
+
37
+ // MANA BEGIN: modify select formation to include multiple price ranges
38
+ $condition = '';
39
+ foreach ($value as $selection) {
40
+ list($index, $range) = explode(',', $selection);
41
+ $range = $this->getRange($index, $range);
42
+ if ($condition != '') $condition .= ' OR ';
43
+ $condition .= '(('."{$tableAlias}.value" . ' >= '. $range['from'].') '.
44
+ 'AND ('."{$tableAlias}.value" . ($this->isUpperBoundInclusive() ? ' <= ' : ' < '). $range['to'].'))';
45
+ }
46
+ $collection->getSelect()
47
+ ->distinct()
48
+ ->where("NOT ($condition)");
49
+ // MANA END
50
+
51
+ return $this;
52
+ }
53
+
54
+ }
app/code/local/Mana/Filters/Resource/Filter/Reverse/Price.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * Resource type which contains sql code for applying filters and related operations
10
+ * @author Mana Team
11
+ * Injected instead of standard resource catalog/layer_filter_attribute in
12
+ * Mana_Filters_Model_Filter_Price::_getResource().
13
+ */
14
+ class Mana_Filters_Resource_Filter_Reverse_Price extends Mana_Filters_Resource_Filter_Price {
15
+ /**
16
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
17
+ * @param Mana_Filters_Model_Filter_Price $model
18
+ * @param array $value
19
+ * @return Mana_Filters_Resource_Filter_Price
20
+ */
21
+ public function applyToCollection($collection, $model, $value) {
22
+ $collection->addPriceData($model->getCustomerGroupId(), $model->getWebsiteId());
23
+
24
+ $select = $collection->getSelect();
25
+ $response = $this->_dispatchPreparePriceEvent($model, $select);
26
+
27
+ $table = $this->_getIndexTableAlias();
28
+ $additional = join('', $response->getAdditionalCalculations());
29
+ $fix = $this->_getConfigurablePriceFix();
30
+ $rate = $model->getCurrencyRate();
31
+ $precision = 2;//$filter->getDecimalDigits();
32
+ if ($this->isUpperBoundInclusive()) {
33
+ $priceExpr = new Zend_Db_Expr("ROUND(({$table}.min_price {$additional} {$fix}) * {$rate}, $precision)");
34
+ }
35
+ else {
36
+ $priceExpr = new Zend_Db_Expr("({$table}.min_price {$additional} {$fix}) * {$rate}");
37
+ }
38
+
39
+ $condition = '';
40
+ foreach ($model->getMSelectedValues() as $selection) {
41
+ list($index, $range) = explode(',', $selection);
42
+ $range = $this->getPriceRange($index, $range);
43
+ if ($condition != '') $condition .= ' OR ';
44
+ $condition .= '(('.$priceExpr . ' >= '. $range['from'].') '.
45
+ 'AND ('.$priceExpr . ($this->isUpperBoundInclusive() ? ' <= ' : ' < '). $range['to'].'))';
46
+ }
47
+ $select
48
+ ->distinct()
49
+ ->where("NOT ($condition)");
50
+ return $this;
51
+ }
52
+
53
+ }
app/code/local/Mana/Filters/Resource/Filter2.php CHANGED
@@ -13,6 +13,48 @@
13
  * @author Mana Team
14
  */
15
  class Mana_Filters_Resource_Filter2 extends Mana_Db_Resource_Object {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Invoked during resource model creation process, this method associates this resource model with model class
18
  * and with DB table name
@@ -44,7 +86,8 @@ class Mana_Filters_Resource_Filter2 extends Mana_Db_Resource_Object {
44
  ->where('eav_attribute_additional.is_filterable <> 0')
45
  ->columns(array(
46
  'target.default_mask0 AS default_mask0',
47
- 'eav_attribute_additional.is_filterable AS is_enabled',
 
48
  'eav_attribute.frontend_label AS name',
49
  'eav_attribute_additional.is_filterable_in_search AS is_enabled_in_search',
50
  'eav_attribute_additional.position AS position',
@@ -68,6 +111,7 @@ class Mana_Filters_Resource_Filter2 extends Mana_Db_Resource_Object {
68
  ->where("target.code = ?", 'category')
69
  ->columns(array(
70
  'target.default_mask0 AS default_mask0',
 
71
  '(1) AS is_enabled',
72
  "('Category') AS name",
73
  '(1) AS is_enabled_in_search',
@@ -99,22 +143,22 @@ class Mana_Filters_Resource_Filter2 extends Mana_Db_Resource_Object {
99
  ->setType($values['type'])
100
  ->setData('_m_prevent_replication', true);
101
 
102
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 0)) {
103
  $object->setIsEnabled($values['is_enabled']);
104
  }
105
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 1)) {
106
  $object->setDisplay(Mage::helper('mana_db')->getLatestConfig('mana_filters/display/'.$object->getType()));
107
  }
108
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 2)) {
109
  $object->setName($values['name']);
110
  }
111
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 4)) {
112
  $object->setIsEnabledInSearch($values['is_enabled_in_search']);
113
  }
114
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 5)) {
115
  $object->setPosition($values['position']);
116
  }
117
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 25)) {
118
  $object->setSortMethod(Mage::helper('mana_db')->getLatestConfig('mana_filters/display/sort_method'));
119
  }
120
  }
@@ -240,13 +284,14 @@ class Mana_Filters_Resource_Filter2 extends Mana_Db_Resource_Object {
240
  }
241
 
242
  protected function _addEditedData($object, $fields, $useDefault) {
243
- Mage::helper('mana_db')->updateDefaultableField($object, 'is_enabled', 0, $fields, $useDefault);
244
- Mage::helper('mana_db')->updateDefaultableField($object, 'display', 1, $fields, $useDefault);
245
- Mage::helper('mana_db')->updateDefaultableField($object, 'name', 2, $fields, $useDefault);
246
- Mage::helper('mana_db')->updateDefaultableField($object, 'is_enabled_in_search', 4, $fields, $useDefault);
247
- Mage::helper('mana_db')->updateDefaultableField($object, 'position', 5, $fields, $useDefault);
248
- Mage::helper('mana_db')->updateDefaultableField($object, 'sort_method', 25, $fields, $useDefault);
249
- Mage::helper('mana_db')->updateDefaultableField($object, 'operation', 27, $fields, $useDefault);
 
250
  }
251
  protected function _afterSave(Mage_Core_Model_Abstract $object) {
252
  if ($edit = $object->getValueData()) {
13
  * @author Mana Team
14
  */
15
  class Mana_Filters_Resource_Filter2 extends Mana_Db_Resource_Object {
16
+ #region bit indexes for default_mask field(s)
17
+ const DM_IS_ENABLED = 0;
18
+ const DM_DISPLAY = 1;
19
+ const DM_NAME = 2;
20
+ const DM_SHOW_MORE_ITEM_COUNT = 3;
21
+ const DM_IS_ENABLED_IN_SEARCH = 4;
22
+ const DM_POSITION = 5;
23
+ const DM_IMAGE_WIDTH = 6;
24
+ const DM_IMAGE_HEIGHT = 7;
25
+
26
+ const DM_IMAGE_BORDER_RADIUS = 8;
27
+ const DM_SLIDER_NUMBER_FORMAT = 9;
28
+ const DM_SLIDER_MANUAL_ENTRY = 10;
29
+ const DM_SLIDER_NUMBER_FORMAT2 = 11;
30
+ const DM_SLIDER_THRESHOLD = 12;
31
+ const DM_SLIDER_USE_EXISTING_VALUES = 13;
32
+ const DM_IMAGE_NORMAL = 14;
33
+ const DM_IMAGE_SELECTED = 15;
34
+
35
+ const DM_IMAGE_NORMAL_HOVERED = 16;
36
+ const DM_IMAGE_SELECTED_HOVERED = 17;
37
+ const DM_STATE_WIDTH = 18;
38
+ const DM_STATE_HEIGHT = 19;
39
+ const DM_STATE_BORDER_RADIUS = 20;
40
+ const DM_STATE_IMAGE = 21;
41
+ const DM_SLIDER_DECIMAL_DIGITS = 22;
42
+ const DM_SLIDER_DECIMAL_DIGITS2 = 23;
43
+
44
+ const DM_RANGE_STEP = 24;
45
+ const DM_SORT_METHOD = 25;
46
+ const DM_SHOW_MORE_METHOD = 26;
47
+ const DM_OPERATION = 27;
48
+ const DM_HELP = 28;
49
+ const DM_SHOW_IN = 29;
50
+ const DM_THOUSAND_SEPARATOR = 30;
51
+
52
+ const DM_COLLAPSEABLE = 32;
53
+ const DM_HELP_WIDTH = 33;
54
+
55
+ const DM_IS_REVERSE = 34;
56
+ #endregion
57
+
58
  /**
59
  * Invoked during resource model creation process, this method associates this resource model with model class
60
  * and with DB table name
86
  ->where('eav_attribute_additional.is_filterable <> 0')
87
  ->columns(array(
88
  'target.default_mask0 AS default_mask0',
89
+ 'target.default_mask1 AS default_mask1',
90
+ 'eav_attribute_additional.is_filterable AS is_enabled',
91
  'eav_attribute.frontend_label AS name',
92
  'eav_attribute_additional.is_filterable_in_search AS is_enabled_in_search',
93
  'eav_attribute_additional.position AS position',
111
  ->where("target.code = ?", 'category')
112
  ->columns(array(
113
  'target.default_mask0 AS default_mask0',
114
+ 'target.default_mask1 AS default_mask1',
115
  '(1) AS is_enabled',
116
  "('Category') AS name",
117
  '(1) AS is_enabled_in_search',
143
  ->setType($values['type'])
144
  ->setData('_m_prevent_replication', true);
145
 
146
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_IS_ENABLED)) {
147
  $object->setIsEnabled($values['is_enabled']);
148
  }
149
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_DISPLAY)) {
150
  $object->setDisplay(Mage::helper('mana_db')->getLatestConfig('mana_filters/display/'.$object->getType()));
151
  }
152
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_NAME)) {
153
  $object->setName($values['name']);
154
  }
155
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_IS_ENABLED_IN_SEARCH)) {
156
  $object->setIsEnabledInSearch($values['is_enabled_in_search']);
157
  }
158
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_POSITION)) {
159
  $object->setPosition($values['position']);
160
  }
161
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_SORT_METHOD)) {
162
  $object->setSortMethod(Mage::helper('mana_db')->getLatestConfig('mana_filters/display/sort_method'));
163
  }
164
  }
284
  }
285
 
286
  protected function _addEditedData($object, $fields, $useDefault) {
287
+ Mage::helper('mana_db')->updateDefaultableField($object, 'is_enabled', Mana_Filters_Resource_Filter2::DM_IS_ENABLED, $fields, $useDefault);
288
+ Mage::helper('mana_db')->updateDefaultableField($object, 'display', Mana_Filters_Resource_Filter2::DM_DISPLAY, $fields, $useDefault);
289
+ Mage::helper('mana_db')->updateDefaultableField($object, 'name', Mana_Filters_Resource_Filter2::DM_NAME, $fields, $useDefault);
290
+ Mage::helper('mana_db')->updateDefaultableField($object, 'is_enabled_in_search', Mana_Filters_Resource_Filter2::DM_IS_ENABLED_IN_SEARCH, $fields, $useDefault);
291
+ Mage::helper('mana_db')->updateDefaultableField($object, 'position', Mana_Filters_Resource_Filter2::DM_POSITION, $fields, $useDefault);
292
+ Mage::helper('mana_db')->updateDefaultableField($object, 'sort_method', Mana_Filters_Resource_Filter2::DM_SORT_METHOD, $fields, $useDefault);
293
+ Mage::helper('mana_db')->updateDefaultableField($object, 'operation', Mana_Filters_Resource_Filter2::DM_OPERATION, $fields, $useDefault);
294
+ Mage::helper('mana_db')->updateDefaultableField($object, 'is_reverse', Mana_Filters_Resource_Filter2::DM_IS_REVERSE, $fields, $useDefault);
295
  }
296
  protected function _afterSave(Mage_Core_Model_Abstract $object) {
297
  if ($edit = $object->getValueData()) {
app/code/local/Mana/Filters/Resource/Filter2/Store.php CHANGED
@@ -44,6 +44,7 @@ class Mana_Filters_Resource_Filter2_Store extends Mana_Filters_Resource_Filter2
44
  ->distinct()
45
  ->columns(array(
46
  'target.default_mask0 AS default_mask0',
 
47
  'global.is_enabled AS is_enabled',
48
  'global.display AS display',
49
  'COALESCE(eav_attribute_label.value, global.name) AS name',
@@ -51,6 +52,7 @@ class Mana_Filters_Resource_Filter2_Store extends Mana_Filters_Resource_Filter2
51
  'global.position AS position',
52
  'global.sort_method AS sort_method',
53
  'global.operation AS operation',
 
54
  ));
55
  if ($options['trackKeys']) {
56
  if (($keys = $options['targets'][$globalEntityName]->getSavedKeys()) && count($keys)) {
@@ -81,27 +83,30 @@ class Mana_Filters_Resource_Filter2_Store extends Mana_Filters_Resource_Filter2
81
  ->setStoreId($values['store_id'])
82
  ->setData('_m_prevent_replication', true);
83
 
84
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 0)) {
85
  $object->setIsEnabled($values['is_enabled']);
86
  }
87
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 1)) {
88
  $object->setDisplay($values['display']);
89
  }
90
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 2)) {
91
  $object->setName($values['name']);
92
  }
93
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 4)) {
94
  $object->setIsEnabledInSearch($values['is_enabled_in_search']);
95
  }
96
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 5)) {
97
  $object->setPosition($values['position']);
98
  }
99
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 25)) {
100
  $object->setSortMethod($values['sort_method']);
101
  }
102
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 27)) {
103
  $object->setOperation($values['operation']);
104
  }
 
 
 
105
  }
106
  /**
107
  * Enter description here ...
@@ -114,7 +119,7 @@ class Mana_Filters_Resource_Filter2_Store extends Mana_Filters_Resource_Filter2
114
  ->from(array('global' => Mage::getSingleton('core/resource')->getTableName($globalEntityName)), 'global.id AS global_id')
115
  ->from(array('core_store' => Mage::getSingleton('core/resource')->getTableName('core_store')), 'core_store.store_id AS store_id')
116
  ->joinLeft(array('target' => Mage::getSingleton('core/resource')->getTableName($this->getEntityName())),
117
- 'target.global_id = global.id AND target.store_id = core_store.store_id', null)
118
  ->joinLeft(array('eav_attribute' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
119
  'global.code = eav_attribute.attribute_code', null)
120
  ->joinLeft(array('eav_attribute_label' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_label')),
@@ -131,6 +136,7 @@ class Mana_Filters_Resource_Filter2_Store extends Mana_Filters_Resource_Filter2
131
  'global.position AS position',
132
  'global.sort_method AS sort_method',
133
  'global.operation AS operation',
 
134
  ));
135
  if ($options['trackKeys']) {
136
  if (($keys = $options['targets'][$globalEntityName]->getSavedKeys()) && count($keys)) {
@@ -163,6 +169,7 @@ class Mana_Filters_Resource_Filter2_Store extends Mana_Filters_Resource_Filter2
163
  $object->setPosition($values['position']);
164
  $object->setSortMethod($values['sort_method']);
165
  $object->setOperation($values['operation']);
 
166
  }
167
  /**
168
  * Enter description here ...
44
  ->distinct()
45
  ->columns(array(
46
  'target.default_mask0 AS default_mask0',
47
+ 'target.default_mask1 AS default_mask1',
48
  'global.is_enabled AS is_enabled',
49
  'global.display AS display',
50
  'COALESCE(eav_attribute_label.value, global.name) AS name',
52
  'global.position AS position',
53
  'global.sort_method AS sort_method',
54
  'global.operation AS operation',
55
+ 'global.is_reverse AS is_reverse',
56
  ));
57
  if ($options['trackKeys']) {
58
  if (($keys = $options['targets'][$globalEntityName]->getSavedKeys()) && count($keys)) {
83
  ->setStoreId($values['store_id'])
84
  ->setData('_m_prevent_replication', true);
85
 
86
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_IS_ENABLED)) {
87
  $object->setIsEnabled($values['is_enabled']);
88
  }
89
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_DISPLAY)) {
90
  $object->setDisplay($values['display']);
91
  }
92
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_NAME)) {
93
  $object->setName($values['name']);
94
  }
95
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_IS_ENABLED_IN_SEARCH)) {
96
  $object->setIsEnabledInSearch($values['is_enabled_in_search']);
97
  }
98
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_POSITION)) {
99
  $object->setPosition($values['position']);
100
  }
101
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_SORT_METHOD)) {
102
  $object->setSortMethod($values['sort_method']);
103
  }
104
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_OPERATION)) {
105
  $object->setOperation($values['operation']);
106
  }
107
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2::DM_IS_REVERSE)) {
108
+ $object->setIsReverse($values['is_reverse']);
109
+ }
110
  }
111
  /**
112
  * Enter description here ...
119
  ->from(array('global' => Mage::getSingleton('core/resource')->getTableName($globalEntityName)), 'global.id AS global_id')
120
  ->from(array('core_store' => Mage::getSingleton('core/resource')->getTableName('core_store')), 'core_store.store_id AS store_id')
121
  ->joinLeft(array('target' => Mage::getSingleton('core/resource')->getTableName($this->getEntityName())),
122
+ 'target.global_id = global.id AND target.store_id = core_store.store_id', null)
123
  ->joinLeft(array('eav_attribute' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
124
  'global.code = eav_attribute.attribute_code', null)
125
  ->joinLeft(array('eav_attribute_label' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_label')),
136
  'global.position AS position',
137
  'global.sort_method AS sort_method',
138
  'global.operation AS operation',
139
+ 'global.is_reverse AS is_reverse',
140
  ));
141
  if ($options['trackKeys']) {
142
  if (($keys = $options['targets'][$globalEntityName]->getSavedKeys()) && count($keys)) {
169
  $object->setPosition($values['position']);
170
  $object->setSortMethod($values['sort_method']);
171
  $object->setOperation($values['operation']);
172
+ $object->setIsReverse($values['is_reverse']);
173
  }
174
  /**
175
  * Enter description here ...
app/code/local/Mana/Filters/Resource/Filter2/Value.php CHANGED
@@ -13,6 +13,17 @@
13
  * @author Mana Team
14
  */
15
  class Mana_Filters_Resource_Filter2_Value extends Mana_Db_Resource_Object {
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Invoked during resource model creation process, this method associates this resource model with model class
18
  * and with DB table name
@@ -80,10 +91,10 @@ class Mana_Filters_Resource_Filter2_Value extends Mana_Db_Resource_Object {
80
  ->setValueId($values['value_id'])
81
  ->setData('_m_prevent_replication', true);
82
 
83
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 0)) {
84
  $object->setName($values['name']);
85
  }
86
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 1)) {
87
  $object->setPosition($values['position']);
88
  }
89
  }
13
  * @author Mana Team
14
  */
15
  class Mana_Filters_Resource_Filter2_Value extends Mana_Db_Resource_Object {
16
+ #region bit indexes for default_mask field(s)
17
+ const DM_NAME = 0;
18
+ const DM_POSITION = 1;
19
+ const DM_COLOR = 2;
20
+ const DM_NORMAL_IMAGE = 3;
21
+ const DM_SELECTED_IMAGE = 4;
22
+ const DM_NORMAL_HOVERED_IMAGE = 5;
23
+ const DM_SELECTED_HOVERED_IMAGE = 6;
24
+ const DM_STATE_IMAGE = 7;
25
+ #endregion
26
+
27
  /**
28
  * Invoked during resource model creation process, this method associates this resource model with model class
29
  * and with DB table name
91
  ->setValueId($values['value_id'])
92
  ->setData('_m_prevent_replication', true);
93
 
94
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2_Value::DM_NAME)) {
95
  $object->setName($values['name']);
96
  }
97
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2_Value::DM_POSITION)) {
98
  $object->setPosition($values['position']);
99
  }
100
  }
app/code/local/Mana/Filters/Resource/Filter2/Value/Store.php CHANGED
@@ -90,10 +90,10 @@ class Mana_Filters_Resource_Filter2_Value_Store extends Mana_Filters_Resource_Fi
90
  ->setValueId($values['value_id'])
91
  ->setData('_m_prevent_replication', true);
92
 
93
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 0)) {
94
  $object->setName($values['name']);
95
  }
96
- if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, 1)) {
97
  $object->setPosition($values['position']);
98
  }
99
  }
90
  ->setValueId($values['value_id'])
91
  ->setData('_m_prevent_replication', true);
92
 
93
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2_Value::DM_NAME)) {
94
  $object->setName($values['name']);
95
  }
96
+ if (!Mage::helper('mana_db')->hasOverriddenValue($object, $values, Mana_Filters_Resource_Filter2_Value::DM_POSITION)) {
97
  $object->setPosition($values['position']);
98
  }
99
  }
app/code/local/Mana/Filters/Resource/Indexer/Source.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Resource_Indexer_Source extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav_Source {
13
+ public function reindexEntities($processIds) {
14
+ $adapter = $this->_getWriteAdapter();
15
+
16
+ $this->clearTemporaryIndexTable();
17
+
18
+ if (!is_array($processIds)) {
19
+ $processIds = array($processIds);
20
+ }
21
+
22
+ $parentIds = $this->getRelationsByChild($processIds);
23
+ if ($parentIds) {
24
+ $processIds = array_unique(array_merge($processIds, $parentIds));
25
+ }
26
+ $childIds = $this->getRelationsByParent($processIds);
27
+ if ($childIds) {
28
+ $processIds = array_unique(array_merge($processIds, $childIds));
29
+ }
30
+
31
+ $this->_prepareIndex($processIds);
32
+ $this->_prepareRelationIndex($processIds);
33
+ $this->_removeNotVisibleEntityFromIndex();
34
+
35
+ $adapter->beginTransaction();
36
+ try {
37
+ // remove old index
38
+ $where = $adapter->quoteInto('entity_id IN(?)', $processIds);
39
+ $adapter->delete($this->getMainTable(), $where);
40
+
41
+ // insert new index
42
+ $this->insertFromTable($this->getIdxTable(), $this->getMainTable());
43
+
44
+ $adapter->commit();
45
+ } catch (Exception $e) {
46
+ $adapter->rollBack();
47
+ throw $e;
48
+ }
49
+
50
+ return $this;
51
+ }
52
+ }
app/code/local/Mana/Filters/Resource/Solr/And/Attribute.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Resource_Solr_And_Attribute extends Mana_Filters_Resource_Solr_Attribute
13
+ {
14
+ /**
15
+ * @param Enterprise_Search_Model_Resource_Collection $collection
16
+ * @param Mana_Filters_Model_Filter_Attribute $model
17
+ * @param array $value
18
+ * @return Mana_Filters_Resource_Solr_Attribute
19
+ */
20
+ public function applyToCollection($collection, $model, $value)
21
+ {
22
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
23
+ $facetField = $engine->getSearchEngineFieldName($model->getAttributeModel(), 'nav');
24
+ $collection->addFqFilter(array($facetField => array('and' => $value)));
25
+ }
26
+ }
app/code/local/Mana/Filters/Resource/Solr/Attribute.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Resource_Solr_Attribute extends Mana_Filters_Resource_Filter_Attribute
13
+ {
14
+ /**
15
+ * @param Enterprise_Search_Model_Resource_Collection $collection
16
+ * @param Mana_Filters_Model_Filter_Attribute $model
17
+ * @return Mana_Filters_Resource_Solr_Attribute
18
+ */
19
+ public function countOnCollection($collection, $model)
20
+ {
21
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
22
+ $facetField = $engine->getSearchEngineFieldName($model->getAttributeModel(), 'nav');
23
+ $collection->setFacetCondition($facetField);
24
+
25
+ return $collection;
26
+ }
27
+
28
+ /**
29
+ * @param Enterprise_Search_Model_Resource_Collection $collection
30
+ * @param Mana_Filters_Model_Filter_Attribute $model
31
+ * @param array $value
32
+ * @return Mana_Filters_Resource_Solr_Attribute
33
+ */
34
+ public function applyToCollection($collection, $model, $value)
35
+ {
36
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
37
+ $facetField = $engine->getSearchEngineFieldName($model->getAttributeModel(), 'nav');
38
+ $collection->addFqFilter(array($facetField => array('or' => $value)));
39
+ }
40
+ }
app/code/local/Mana/Filters/Resource/Solr/Reverse/Attribute.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://www.manadev.com/license Proprietary License
7
+ */
8
+ /**
9
+ * @author Mana Team
10
+ *
11
+ */
12
+ class Mana_Filters_Resource_Solr_Reverse_Attribute extends Mana_Filters_Resource_Solr_Attribute
13
+ {
14
+ /**
15
+ * @param Enterprise_Search_Model_Resource_Collection $collection
16
+ * @param Mana_Filters_Model_Filter_Attribute $model
17
+ * @param array $value
18
+ * @return Mana_Filters_Resource_Solr_Attribute
19
+ */
20
+ public function applyToCollection($collection, $model, $value)
21
+ {
22
+ $engine = Mage::getResourceSingleton('enterprise_search/engine');
23
+ $facetField = $engine->getSearchEngineFieldName($model->getAttributeModel(), 'nav');
24
+ $collection->addFqFilter(array($facetField => array('reverse' => $value)));
25
+ }
26
+ }
app/code/local/Mana/Filters/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <Mana_Filters>
13
  <!-- This version number identifies version of database tables specific to this extension. It is written to
14
  core_resource table. -->
15
- <version>12.04.24.17</version>
16
  </Mana_Filters>
17
  </modules>
18
 
@@ -58,7 +58,13 @@
58
  <resourceModel>mana_filters_resources</resourceModel>
59
  <!-- INSERT HERE: resource section name -->
60
  </mana_filters>
61
-
 
 
 
 
 
 
62
  <!-- BASED ON SNIPPET: Resources/Resource support (config.xml) -->
63
  <!-- This says that string 'mana_filters' corresponds to Mana_Filters_Resource pseudo-namespace in
64
  getResourceModel() calls. -->
@@ -73,8 +79,13 @@
73
  <!-- INSERT HERE: table-entity mappings -->
74
  </entities>
75
  </mana_filters_resources>
76
-
77
- <!-- INSERT HERE: rewrites, ... -->
 
 
 
 
 
78
  </models>
79
 
80
  <!-- BASED ON SNIPPET: Resources/Installation script support (config.xml) -->
@@ -114,6 +125,16 @@
114
  </mana_filters>
115
  </observers>
116
  </catalog_entity_attribute_save_commit_after>
 
 
 
 
 
 
 
 
 
 
117
  </events>
118
  <!-- INSERT HERE: blocks, models, ... -->
119
  </global>
@@ -172,7 +193,8 @@
172
  <price>list</price>
173
  <category>standard</category>
174
  <decimal>list</decimal>
175
- </display>
 
176
  <general>
177
  <is_multiselect>1</is_multiselect>
178
  <adjust_configurable_price>1</adjust_configurable_price>
@@ -191,7 +213,12 @@
191
  <title>Text (Multiple Select Enabled)</title><!-- this one is displayed in admin -->
192
  <block>mana_filters/filter</block>
193
  <model>mana_filters/filter_attribute</model>
194
- <resource>mana_filters/filter_attribute</resource>
 
 
 
 
 
195
  <template>mana/filters/items/list.phtml</template><!-- PHTML to be rendered -->
196
  <sort_order>50</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
197
  </list>
@@ -199,7 +226,12 @@
199
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
200
  <block>mana_filters/filter</block>
201
  <model>mana_filters/filter_attribute</model>
202
- <resource>mana_filters/filter_attribute</resource>
 
 
 
 
 
203
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
204
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
205
  </standard>
@@ -210,7 +242,10 @@
210
  <title>Text (Multiple Select Enabled)</title><!-- this one is displayed in admin -->
211
  <block>mana_filters/filter</block>
212
  <model>mana_filters/filter_price</model>
 
 
213
  <resource>mana_filters/filter_price</resource>
 
214
  <template>mana/filters/items/list.phtml</template><!-- PHTML to be rendered -->
215
  <sort_order>50</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
216
  </list>
@@ -218,7 +253,10 @@
218
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
219
  <block>mana_filters/filter</block>
220
  <model>mana_filters/filter_price</model>
 
 
221
  <resource>mana_filters/filter_price</resource>
 
222
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
223
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
224
  </standard>
@@ -229,6 +267,7 @@
229
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
230
  <block>mana_filters/filter</block>
231
  <model>mana_filters/filter_category</model>
 
232
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
233
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
234
  </standard>
@@ -238,16 +277,22 @@
238
  <list translate="title" module="mana_filters">
239
  <title>Text (Multiple Select Enabled)</title><!-- this one is displayed in admin -->
240
  <block>mana_filters/filter</block>
241
- <model>mana_filters/filter_decimal</model>
242
- <resource>mana_filters/filter_decimal</resource>
 
 
 
243
  <template>mana/filters/items/list.phtml</template><!-- PHTML to be rendered -->
244
  <sort_order>50</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
245
  </list>
246
  <standard translate="title" module="mana_filters">
247
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
248
  <block>mana_filters/filter</block>
249
- <model>mana_filters/filter_decimal</model>
250
- <resource>mana_filters/filter_decimal</resource>
 
 
 
251
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
252
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
253
  </standard>
12
  <Mana_Filters>
13
  <!-- This version number identifies version of database tables specific to this extension. It is written to
14
  core_resource table. -->
15
+ <version>12.12.21.19</version>
16
  </Mana_Filters>
17
  </modules>
18
 
58
  <resourceModel>mana_filters_resources</resourceModel>
59
  <!-- INSERT HERE: resource section name -->
60
  </mana_filters>
61
+
62
+ <enterprise_search>
63
+ <rewrite>
64
+ <adapter_httpStream>Mana_Filters_Model_Solr_Adapter_HttpStream</adapter_httpStream>
65
+ <adapter_phpExtension>Mana_Filters_Model_Solr_Adapter_PhpExtension</adapter_phpExtension>
66
+ </rewrite>
67
+ </enterprise_search>
68
  <!-- BASED ON SNIPPET: Resources/Resource support (config.xml) -->
69
  <!-- This says that string 'mana_filters' corresponds to Mana_Filters_Resource pseudo-namespace in
70
  getResourceModel() calls. -->
79
  <!-- INSERT HERE: table-entity mappings -->
80
  </entities>
81
  </mana_filters_resources>
82
+
83
+ <catalog_resource_eav_mysql4>
84
+ <rewrite>
85
+ <product_indexer_eav_source>Mana_Filters_Resource_Indexer_Source</product_indexer_eav_source>
86
+ </rewrite>
87
+ </catalog_resource_eav_mysql4>
88
+ <!-- INSERT HERE: rewrites, ... -->
89
  </models>
90
 
91
  <!-- BASED ON SNIPPET: Resources/Installation script support (config.xml) -->
125
  </mana_filters>
126
  </observers>
127
  </catalog_entity_attribute_save_commit_after>
128
+ <prepare_catalog_product_index_select><!-- this is event name this module listens for -->
129
+ <observers>
130
+ <mana_filters>
131
+ <class>mana_filters/observer</class>
132
+ <!-- model name of class containing event handler methods -->
133
+ <method>fixAttributeIndexerSelectForConfigurableProductDefaultValues</method>
134
+ <!-- event handler method name -->
135
+ </mana_filters>
136
+ </observers>
137
+ </prepare_catalog_product_index_select>
138
  </events>
139
  <!-- INSERT HERE: blocks, models, ... -->
140
  </global>
193
  <price>list</price>
194
  <category>standard</category>
195
  <decimal>list</decimal>
196
+ <count>1</count>
197
+ </display>
198
  <general>
199
  <is_multiselect>1</is_multiselect>
200
  <adjust_configurable_price>1</adjust_configurable_price>
213
  <title>Text (Multiple Select Enabled)</title><!-- this one is displayed in admin -->
214
  <block>mana_filters/filter</block>
215
  <model>mana_filters/filter_attribute</model>
216
+ <solr_model>mana_filters/solr_attribute</solr_model>
217
+ <solr_and_model>mana_filters/solr_and_attribute</solr_and_model>
218
+ <solr_reverse_model>mana_filters/solr_reverse_attribute</solr_reverse_model>
219
+ <resource>mana_filters/filter_attribute</resource>
220
+ <and_resource>mana_filters/filter_and_attribute</and_resource>
221
+ <reverse_resource>mana_filters/filter_reverse_attribute</reverse_resource>
222
  <template>mana/filters/items/list.phtml</template><!-- PHTML to be rendered -->
223
  <sort_order>50</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
224
  </list>
226
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
227
  <block>mana_filters/filter</block>
228
  <model>mana_filters/filter_attribute</model>
229
+ <solr_model>mana_filters/solr_attribute</solr_model>
230
+ <solr_and_model>mana_filters/solr_and_attribute</solr_and_model>
231
+ <solr_reverse_model>mana_filters/solr_reverse_attribute</solr_reverse_model>
232
+ <resource>mana_filters/filter_attribute</resource>
233
+ <and_resource>mana_filters/filter_and_attribute</and_resource>
234
+ <reverse_resource>mana_filters/filter_reverse_attribute</reverse_resource>
235
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
236
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
237
  </standard>
242
  <title>Text (Multiple Select Enabled)</title><!-- this one is displayed in admin -->
243
  <block>mana_filters/filter</block>
244
  <model>mana_filters/filter_price</model>
245
+ <solr_model>mana_filters/solr_price</solr_model>
246
+ <solr_reverse_model>mana_filters/solr_reverse_price</solr_reverse_model>
247
  <resource>mana_filters/filter_price</resource>
248
+ <reverse_resource>mana_filters/filter_reverse_price</reverse_resource>
249
  <template>mana/filters/items/list.phtml</template><!-- PHTML to be rendered -->
250
  <sort_order>50</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
251
  </list>
253
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
254
  <block>mana_filters/filter</block>
255
  <model>mana_filters/filter_price</model>
256
+ <solr_model>mana_filters/solr_price</solr_model>
257
+ <solr_reverse_model>mana_filters/solr_reverse_price</solr_reverse_model>
258
  <resource>mana_filters/filter_price</resource>
259
+ <reverse_resource>mana_filters/filter_reverse_price</reverse_resource>
260
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
261
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
262
  </standard>
267
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
268
  <block>mana_filters/filter</block>
269
  <model>mana_filters/filter_category</model>
270
+ <solr_model>mana_filters/solr_category</solr_model>
271
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
272
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
273
  </standard>
277
  <list translate="title" module="mana_filters">
278
  <title>Text (Multiple Select Enabled)</title><!-- this one is displayed in admin -->
279
  <block>mana_filters/filter</block>
280
+ <model>mana_filters/filter_decimal</model>
281
+ <solr_model>mana_filters/solr_decimal</solr_model>
282
+ <solr_reverse_model>mana_filters/solr_reverse_decimal</solr_reverse_model>
283
+ <resource>mana_filters/filter_decimal</resource>
284
+ <reverse_resource>mana_filters/filter_reverse_decimal</reverse_resource>
285
  <template>mana/filters/items/list.phtml</template><!-- PHTML to be rendered -->
286
  <sort_order>50</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
287
  </list>
288
  <standard translate="title" module="mana_filters">
289
  <title>Text (One Item Can Be Selected At A Time)</title><!-- this one is displayed in admin -->
290
  <block>mana_filters/filter</block>
291
+ <model>mana_filters/filter_decimal</model>
292
+ <solr_model>mana_filters/solr_decimal</solr_model>
293
+ <solr_reverse_model>mana_filters/solr_reverse_decimal</solr_reverse_model>
294
+ <resource>mana_filters/filter_decimal</resource>
295
+ <reverse_resource>mana_filters/filter_reverse_decimal</reverse_resource>
296
  <template>mana/filters/items/standard.phtml</template><!-- PHTML to be rendered -->
297
  <sort_order>100</sort_order><!-- Position in "Display as" list. The item with least position is the default one. -->
298
  </standard>
app/code/local/Mana/Filters/sql/mana_filters_setup/mysql4-upgrade-12.10.25.17-12.10.25.18.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* BASED ON SNIPPET: Resources/Install/upgrade script */
4
+ if (defined('COMPILER_INCLUDE_PATH')) {
5
+ throw new Exception(Mage::helper('mana_core')->__('This Magento installation contains pending database installation/upgrade scripts. Please turn off Magento compilation feature while installing/upgrading new modules in Admin Panel menu System->Tools->Compilation.'));
6
+ }
7
+
8
+ /* @var $installer Mage_Core_Model_Resource_Setup */
9
+ $installer = $this;
10
+ if (method_exists($this->getConnection(), 'allowDdlCache')) {
11
+ $this->getConnection()->allowDdlCache();
12
+ }
13
+
14
+ foreach (array('mana_filters/filter2', 'mana_filters/filter2_store') as $table) {
15
+ $installer->run("
16
+ ALTER TABLE `{$this->getTable($table)}` ADD COLUMN (
17
+ `default_mask1` int unsigned NOT NULL default '0'
18
+ );
19
+ ");
20
+ }
21
+
22
+ if (method_exists($this->getConnection(), 'disallowDdlCache')) {
23
+ $this->getConnection()->disallowDdlCache();
24
+ }
25
+ $installer->endSetup();
26
+
app/code/local/Mana/Filters/sql/mana_filters_setup/mysql4-upgrade-12.11.02.16-12.11.13.15.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* BASED ON SNIPPET: Resources/Install/upgrade script */
4
+ if (defined('COMPILER_INCLUDE_PATH')) {
5
+ throw new Exception(Mage::helper('mana_core')->__('This Magento installation contains pending database installation/upgrade scripts. Please turn off Magento compilation feature while installing/upgrading new modules in Admin Panel menu System->Tools->Compilation.'));
6
+ }
7
+
8
+ /* @var $installer Mage_Core_Model_Resource_Setup */
9
+ $installer = $this;
10
+ if (method_exists($this->getConnection(), 'allowDdlCache')) {
11
+ $this->getConnection()->allowDdlCache();
12
+ }
13
+
14
+ foreach (array('mana_filters/filter2', 'mana_filters/filter2_store') as $table) {
15
+ $installer->run("
16
+ ALTER TABLE `{$this->getTable($table)}` ADD COLUMN (
17
+ `is_reverse` tinyint NOT NULL default '0'
18
+ );
19
+ ");
20
+ }
21
+
22
+ if (method_exists($this->getConnection(), 'disallowDdlCache')) {
23
+ $this->getConnection()->disallowDdlCache();
24
+ }
25
+ $installer->endSetup();
26
+
app/design/frontend/base/default/layout/mana_filters.xml CHANGED
@@ -28,6 +28,9 @@ examples on what kind of actions can be applied to referenced blocks.
28
  <reference name="head">
29
  <action method="addCss"><stylesheet>css/mana_filters.css</stylesheet></action>
30
  </reference>
 
 
 
31
  </catalog_category_layered>
32
  <catalogsearch_result_index> <!-- find all catalog search result page -->
33
  <reference name="left"> <!-- find left column block -->
@@ -38,5 +41,22 @@ examples on what kind of actions can be applied to referenced blocks.
38
  <reference name="head">
39
  <action method="addCss"><stylesheet>css/mana_filters.css</stylesheet></action>
40
  </reference>
 
 
 
41
  </catalogsearch_result_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  </layout>
28
  <reference name="head">
29
  <action method="addCss"><stylesheet>css/mana_filters.css</stylesheet></action>
30
  </reference>
31
+ <reference name="mana.catalog.leftnav">
32
+ <action method="setTemplate" ifconfig="mana_filters/advanced/enabled"><template>manapro/filteradvanced/view.phtml</template></action>
33
+ </reference>
34
  </catalog_category_layered>
35
  <catalogsearch_result_index> <!-- find all catalog search result page -->
36
  <reference name="left"> <!-- find left column block -->
41
  <reference name="head">
42
  <action method="addCss"><stylesheet>css/mana_filters.css</stylesheet></action>
43
  </reference>
44
+ <reference name="mana.catalogsearch.leftnav">
45
+ <action method="setTemplate" ifconfig="mana_filters/advanced/enabled"><template>manapro/filteradvanced/view.phtml</template></action>
46
+ </reference>
47
  </catalogsearch_result_index>
48
+ <cms_page_layered>
49
+ <reference name="left"> <!-- find left column block -->
50
+ <block type="mana_filters/view" name="mana.catalog.leftnav" before="-" template="catalog/layer/view.phtml"/>
51
+ </reference>
52
+ <reference name="head">
53
+ <action method="addCss"><stylesheet>css/mana_filters.css</stylesheet></action>
54
+ </reference>
55
+ <reference name="mana.catalog.leftnav">
56
+ <action method="setTemplate" ifconfig="mana_filters/advanced/enabled"><template>manapro/filteradvanced/view.phtml</template></action>
57
+ </reference>
58
+ <reference name="content">
59
+ <block type="core/template" name="cms.products" template="mana/filters/cms.phtml" />
60
+ </reference>
61
+ </cms_page_layered>
62
  </layout>
app/design/frontend/base/default/template/mana/filters/cms.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Mana
4
+ * @package Mana_Filters
5
+ * @copyright Copyright (c) http://www.manadev.com
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ ?>
9
+ <?php echo $this->getChildHtml('product_list') ?>
app/design/frontend/base/default/template/mana/filters/items/list.phtml CHANGED
@@ -14,9 +14,9 @@
14
  */
15
  /* @var $this Mana_Filters_Block_Filter_Attribute */
16
  ?>
17
- <ol class="m-filter-item-list">
18
  <?php foreach ($this->getItems() as $_item): ?>
19
- <li <?php if ($_item->getMSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
20
  <?php // MANA BEGIN ?>
21
  <?php if ($_item->getMSelected()): ?>
22
  <span class="m-selected-filter-item"><?php echo $_item->getLabel() ?></span>
@@ -27,7 +27,9 @@
27
  <?php endif; ?>
28
  <?php endif; ?>
29
  <?php // MANA END ?>
30
- (<?php echo $_item->getCount() ?>)
 
 
31
  </li>
32
  <?php endforeach ?>
33
  </ol>
14
  */
15
  /* @var $this Mana_Filters_Block_Filter_Attribute */
16
  ?>
17
+ <ol class="m-filter-item-list <?php echo $this->getFilterOptions()->getIsReverse() ? 'm-reverse' : '' ?>">
18
  <?php foreach ($this->getItems() as $_item): ?>
19
+ <li <?php if ($_item->getMShowSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
20
  <?php // MANA BEGIN ?>
21
  <?php if ($_item->getMSelected()): ?>
22
  <span class="m-selected-filter-item"><?php echo $_item->getLabel() ?></span>
27
  <?php endif; ?>
28
  <?php endif; ?>
29
  <?php // MANA END ?>
30
+ <?php if (Mage::getStoreConfigFlag('mana_filters/display/count')) : ?>
31
+ (<?php echo $_item->getCount() ?>)
32
+ <?php endif; ?>
33
  </li>
34
  <?php endforeach ?>
35
  </ol>
app/design/frontend/base/default/template/mana/filters/items/list_popup.phtml CHANGED
@@ -23,15 +23,17 @@ list($rowCount, $columnCount) = $showmore->getPopupDimensions($items, $MAX_ROW_C
23
  <ol class="m-columns">
24
  <?php for ($columnIndex = 0; $columnIndex < $columnCount; $columnIndex++) : if ($columnIndex * $rowCount + $rowIndex < count($items)) : ?>
25
  <?php $_item = $items[$columnIndex * $rowCount + $rowIndex]; ?>
26
- <li <?php if ($_item->getMSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
27
- <?php if ($_item->getCount() > 0): ?>
28
  <a href="#" title="<?php echo $_item->getLabel() ?>"
29
- onClick="jQuery(this).parent().toggleClass('m-selected-ln-item'); jQuery(this).children().toggleClass('m-selected-filter-item'); return jQuery.mShowMorePopupSelect('<?php echo $_item->getSeoValue() ?>', jQuery(this).parent().hasClass('m-selected-ln-item'));">
30
- <span <?php if ($_item->getMSelected()): ?>class="m-selected-filter-item"<?php endif; ?> ><?php echo $_item->getLabel() ?></span>
31
  </a>
32
- <?php else: echo $_item->getLabel(); ?>
 
 
 
33
  <?php endif; ?>
34
- (<?php echo $_item->getCount() ?>)
35
  </li>
36
  <?php endif; endfor; ?>
37
  </ol>
23
  <ol class="m-columns">
24
  <?php for ($columnIndex = 0; $columnIndex < $columnCount; $columnIndex++) : if ($columnIndex * $rowCount + $rowIndex < count($items)) : ?>
25
  <?php $_item = $items[$columnIndex * $rowCount + $rowIndex]; ?>
26
+ <li <?php if ($_item->getMShowSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
27
+ <?php //if ($_item->getCount() > 0): ?>
28
  <a href="#" title="<?php echo $_item->getLabel() ?>"
29
+ onClick="jQuery(this).parent().toggleClass('m-selected-ln-item'); jQuery(this).children().toggleClass('m-selected-filter-item'); return jQuery.mShowMorePopupSelect('<?php echo $_item->getSeoValue() ?>', <?php echo $this->getFilterOptions()->getIsReverse() ? '!' : '' ?> jQuery(this).parent().hasClass('m-selected-ln-item'));">
30
+ <span <?php if ($_item->getMShowSelected()): ?>class="m-selected-filter-item"<?php endif; ?> ><?php echo $_item->getLabel() ?></span>
31
  </a>
32
+ <?php //else: echo $_item->getLabel(); ?>
33
+ <?php //endif; ?>
34
+ <?php if (Mage::getStoreConfigFlag('mana_filters/display/count')) : ?>
35
+ (<?php echo $_item->getCount() ?>)
36
  <?php endif; ?>
 
37
  </li>
38
  <?php endif; endfor; ?>
39
  </ol>
app/design/frontend/base/default/template/mana/filters/items/standard.phtml CHANGED
@@ -14,9 +14,9 @@
14
  */
15
  /* @var $this Mana_Filters_Block_Filter_Attribute */
16
  ?>
17
- <ol class="m-filter-item-list">
18
  <?php foreach ($this->getItems() as $_item): ?>
19
- <li <?php if ($_item->getMSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
20
  <?php // MANA BEGIN ?>
21
  <?php if ($_item->getMSelected()): ?>
22
  <span class="m-selected-filter-item"><?php echo $_item->getLabel() ?></span>
@@ -27,7 +27,9 @@
27
  <?php endif; ?>
28
  <?php endif; ?>
29
  <?php // MANA END ?>
30
- (<?php echo $_item->getCount() ?>)
 
 
31
  </li>
32
  <?php endforeach ?>
33
  </ol>
14
  */
15
  /* @var $this Mana_Filters_Block_Filter_Attribute */
16
  ?>
17
+ <ol class="m-filter-item-list <?php echo $this->getFilterOptions()->getIsReverse() ? 'm-reverse' : '' ?>">
18
  <?php foreach ($this->getItems() as $_item): ?>
19
+ <li <?php if ($_item->getMShowSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
20
  <?php // MANA BEGIN ?>
21
  <?php if ($_item->getMSelected()): ?>
22
  <span class="m-selected-filter-item"><?php echo $_item->getLabel() ?></span>
27
  <?php endif; ?>
28
  <?php endif; ?>
29
  <?php // MANA END ?>
30
+ <?php if (Mage::getStoreConfigFlag('mana_filters/display/count')) : ?>
31
+ (<?php echo $_item->getCount() ?>)
32
+ <?php endif; ?>
33
  </li>
34
  <?php endforeach ?>
35
  </ol>
app/design/frontend/base/default/template/mana/filters/items/standard_popup.phtml CHANGED
@@ -23,7 +23,7 @@ list($rowCount, $columnCount) = $showmore->getPopupDimensions($items, $MAX_ROW_C
23
  <ol class="m-columns">
24
  <?php for ($columnIndex = 0; $columnIndex < $columnCount; $columnIndex++) : if ($columnIndex * $rowCount + $rowIndex < count($items)) : ?>
25
  <?php $_item = $items[$columnIndex * $rowCount + $rowIndex]; ?>
26
- <li <?php if ($_item->getMSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
27
  <?php if ($_item->getMSelected()): ?>
28
  <span class="m-selected-filter-item"><?php echo $_item->getLabel() ?></span>
29
  <?php else : ?>
@@ -33,7 +33,9 @@ list($rowCount, $columnCount) = $showmore->getPopupDimensions($items, $MAX_ROW_C
33
  <?php else: echo $_item->getLabel() ?>
34
  <?php endif; ?>
35
  <?php endif; ?>
36
- (<?php echo $_item->getCount() ?>)
 
 
37
  </li>
38
  <?php endif; endfor; ?>
39
  </ol>
23
  <ol class="m-columns">
24
  <?php for ($columnIndex = 0; $columnIndex < $columnCount; $columnIndex++) : if ($columnIndex * $rowCount + $rowIndex < count($items)) : ?>
25
  <?php $_item = $items[$columnIndex * $rowCount + $rowIndex]; ?>
26
+ <li <?php if ($_item->getMShowSelected()): ?>class="m-selected-ln-item"<?php endif; ?>>
27
  <?php if ($_item->getMSelected()): ?>
28
  <span class="m-selected-filter-item"><?php echo $_item->getLabel() ?></span>
29
  <?php else : ?>
33
  <?php else: echo $_item->getLabel() ?>
34
  <?php endif; ?>
35
  <?php endif; ?>
36
+ <?php if (Mage::getStoreConfigFlag('mana_filters/display/count')) : ?>
37
+ (<?php echo $_item->getCount() ?>)
38
+ <?php endif; ?>
39
  </li>
40
  <?php endif; endfor; ?>
41
  </ol>
app/design/frontend/base/default/template/mana/filters/state.phtml CHANGED
@@ -16,7 +16,9 @@
16
  <?php $_filters = $this->getActiveFilters() ?>
17
  <?php if(!empty($_filters)): ?>
18
  <div class="currently">
 
19
  <p class="block-subtitle"><?php echo $this->__('Currently Shopping by:') ?></p>
 
20
  <ol>
21
  <?php foreach ($_filters as $_filter): ?>
22
  <?php if ($_html = $this->getValueHtml($_filter)) : ?>
@@ -24,12 +26,12 @@
24
  <?php else : ?>
25
  <li>
26
  <a href="<?php echo $_filter->getRemoveUrl() ?>" title="<?php echo $this->__('Remove This Item') ?>" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
27
- <span class="label"><?php echo $this->__($_filter->getName()) ?>:</span> <?php echo $this->stripTags($_filter->getLabel()) ?>
28
  </li>
29
  <?php endif; ?>
30
  <?php endforeach; ?>
31
  </ol>
32
- <?php if (!Mage::helper('mana_core')->isMageVersionEqualOrGreater('1.7')) : ?>
33
  <div class="actions"><a href="<?php echo $this->getClearUrl() ?>"><?php echo $this->__('Clear All') ?></a></div>
34
  <?php endif; ?>
35
  </div>
16
  <?php $_filters = $this->getActiveFilters() ?>
17
  <?php if(!empty($_filters)): ?>
18
  <div class="currently">
19
+ <?php if (Mage::helper('mana_filters')->renderHtml($this->getParentBlock(), 'currently_shopping_by')) : ?>
20
  <p class="block-subtitle"><?php echo $this->__('Currently Shopping by:') ?></p>
21
+ <?php endif; ?>
22
  <ol>
23
  <?php foreach ($_filters as $_filter): ?>
24
  <?php if ($_html = $this->getValueHtml($_filter)) : ?>
26
  <?php else : ?>
27
  <li>
28
  <a href="<?php echo $_filter->getRemoveUrl() ?>" title="<?php echo $this->__('Remove This Item') ?>" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
29
+ <span class="label"><?php echo $this->__($_filter->getName()) ?>:</span> <?php echo $_filter->getMShowSelected() ? $this->__('not') : '' ?> <?php echo $this->stripTags($_filter->getLabel()) ?>
30
  </li>
31
  <?php endif; ?>
32
  <?php endforeach; ?>
33
  </ol>
34
+ <?php if (!Mage::helper('mana_core')->isMageVersionEqualOrGreater('1.7') && ($_parent = $this->getParentBlock()) /*&& $_parent->getShowInFilter() != 'above_products'*/) : ?>
35
  <div class="actions"><a href="<?php echo $this->getClearUrl() ?>"><?php echo $this->__('Clear All') ?></a></div>
36
  <?php endif; ?>
37
  </div>
app/locale/en_US/Mana_Filters.csv CHANGED
@@ -18,4 +18,7 @@
18
  "Count","Count"
19
  "Count (selected at the top)","Count (selected at the top)"
20
  "Logical OR","Logical OR"
21
- "Logical AND","Logical AND"
 
 
 
18
  "Count","Count"
19
  "Count (selected at the top)","Count (selected at the top)"
20
  "Logical OR","Logical OR"
21
+ "Logical AND","Logical AND"
22
+ "Reverse Mode","Reverse Mode"
23
+ "If enabled, shows all items as selected and lets user to deselect items he/she is not interested in","If enabled, shows all items as selected and lets user to deselect items he/she is not interested in"
24
+ "not","not"
js/jquery/advListRotator.js CHANGED
@@ -169,6 +169,7 @@ var MAdvancedListRotatorClass = {
169
  // Remove active class from helper
170
  c.$listRotator.children().removeClass(c.settings.activeItemClass);
171
  jQuery(c.settings.helper).children().removeClass(c.settings.helperActiveItemClass);
 
172
 
173
 
174
  var oldSelector = null;
169
  // Remove active class from helper
170
  c.$listRotator.children().removeClass(c.settings.activeItemClass);
171
  jQuery(c.settings.helper).children().removeClass(c.settings.helperActiveItemClass);
172
+ jQuery(this).addClass(c.settings.helperActiveItemClass);
173
 
174
 
175
  var oldSelector = null;
js/jquery/jquery-1.7.2.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*! jQuery v1.7.2 jquery.com | jquery.org/license */
2
+ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},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(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
3
+ a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.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(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.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(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={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,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
4
+ .clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[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","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
5
+
6
+ jQuery.noConflict();
js/jquery/jquery-ui.js CHANGED
@@ -7,7 +7,7 @@
7
  *
8
  * http://docs.jquery.com/UI
9
  */
10
- (function( $, undefined ) {
11
 
12
  // prevent duplicate loading
13
  // this is only a problem because we proxy existing functions
7
  *
8
  * http://docs.jquery.com/UI
9
  */
10
+ ;(function( $, undefined ) {
11
 
12
  // prevent duplicate loading
13
  // this is only a problem because we proxy existing functions
js/jquery/jquery-ui.min.js CHANGED
@@ -6,7 +6,7 @@
6
  * http://jquery.org/license
7
  *
8
  * http://docs.jquery.com/UI
9
- */(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;if(b[d]>0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}}))})(jQuery);/*!
10
  * jQuery UI Widget 1.8.17
11
  *
12
  * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
6
  * http://jquery.org/license
7
  *
8
  * http://docs.jquery.com/UI
9
+ */;(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;if(b[d]>0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}}))})(jQuery);/*!
10
  * jQuery UI Widget 1.8.17
11
  *
12
  * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
js/jquery/jquery.flexslider-min.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery FlexSlider v1.8
3
+ * http://www.woothemes.com/flexslider/
4
+ *
5
+ * Copyright 2012 WooThemes
6
+ * Free to use under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ *
9
+ * Contributing Author: Tyler Smith
10
+ */
11
+ (function(a){a.flexslider=function(c,b){var d=a(c);a.data(c,"flexslider",d);d.init=function(){d.vars=a.extend({},a.flexslider.defaults,b);a.data(c,"flexsliderInit",true);d.container=a(".slides",d).eq(0);d.slides=a(".slides:first > li",d);d.count=d.slides.length;d.animating=false;d.currentSlide=d.vars.slideToStart;d.animatingTo=d.currentSlide;d.atEnd=(d.currentSlide==0)?true:false;d.eventType=("ontouchstart" in document.documentElement)?"touchstart":"click";d.cloneCount=0;d.cloneOffset=0;d.manualPause=false;d.vertical=(d.vars.slideDirection=="vertical");d.prop=(d.vertical)?"top":"marginLeft";d.args={};d.transitions="webkitTransition" in document.body.style&&d.vars.useCSS;if(d.transitions){d.prop="-webkit-transform"}if(d.vars.controlsContainer!=""){d.controlsContainer=a(d.vars.controlsContainer).eq(a(".slides").index(d.container));d.containerExists=d.controlsContainer.length>0}if(d.vars.manualControls!=""){d.manualControls=a(d.vars.manualControls,((d.containerExists)?d.controlsContainer:d));d.manualExists=d.manualControls.length>0}if(d.vars.randomize){d.slides.sort(function(){return(Math.round(Math.random())-0.5)});d.container.empty().append(d.slides)}if(d.vars.animation.toLowerCase()=="slide"){if(d.transitions){d.setTransition(0)}d.css({overflow:"hidden"});if(d.vars.animationLoop){d.cloneCount=2;d.cloneOffset=1;d.container.append(d.slides.filter(":first").clone().addClass("clone")).prepend(d.slides.filter(":last").clone().addClass("clone"))}d.newSlides=a(".slides:first > li",d);var m=(-1*(d.currentSlide+d.cloneOffset));if(d.vertical){d.newSlides.css({display:"block",width:"100%","float":"left"});d.container.height((d.count+d.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){d.css({position:"relative"}).height(d.slides.filter(":first").height());d.args[d.prop]=(d.transitions)?"translate3d(0,"+m*d.height()+"px,0)":m*d.height()+"px";d.container.css(d.args)},100)}else{d.args[d.prop]=(d.transitions)?"translate3d("+m*d.width()+"px,0,0)":m*d.width()+"px";d.container.width((d.count+d.cloneCount)*200+"%").css(d.args);setTimeout(function(){d.newSlides.width(d.width()).css({"float":"left",display:"block"})},100)}}else{d.transitions=false;d.slides.css({width:"100%","float":"left",marginRight:"-100%"}).eq(d.currentSlide).fadeIn(d.vars.animationDuration)}if(d.vars.controlNav){if(d.manualExists){d.controlNav=d.manualControls}else{var e=a('<ol class="flex-control-nav"></ol>');var s=1;for(var t=0;t<d.count;t++){e.append("<li><a>"+s+"</a></li>");s++}if(d.containerExists){a(d.controlsContainer).append(e);d.controlNav=a(".flex-control-nav li a",d.controlsContainer)}else{d.append(e);d.controlNav=a(".flex-control-nav li a",d)}}d.controlNav.eq(d.currentSlide).addClass("active");d.controlNav.bind(d.eventType,function(i){i.preventDefault();if(!a(this).hasClass("active")){(d.controlNav.index(a(this))>d.currentSlide)?d.direction="next":d.direction="prev";d.flexAnimate(d.controlNav.index(a(this)),d.vars.pauseOnAction)}})}if(d.vars.directionNav){var v=a('<ul class="flex-direction-nav"><li><a class="prev" href="#">'+d.vars.prevText+'</a></li><li><a class="next" href="#">'+d.vars.nextText+"</a></li></ul>");if(d.containerExists){a(d.controlsContainer).append(v);d.directionNav=a(".flex-direction-nav li a",d.controlsContainer)}else{d.append(v);d.directionNav=a(".flex-direction-nav li a",d)}if(!d.vars.animationLoop){if(d.currentSlide==0){d.directionNav.filter(".prev").addClass("disabled")}else{if(d.currentSlide==d.count-1){d.directionNav.filter(".next").addClass("disabled")}}}d.directionNav.bind(d.eventType,function(i){i.preventDefault();var j=(a(this).hasClass("next"))?d.getTarget("next"):d.getTarget("prev");if(d.canAdvance(j)){d.flexAnimate(j,d.vars.pauseOnAction)}})}if(d.vars.keyboardNav&&a("ul.slides").length==1){function h(i){if(d.animating){return}else{if(i.keyCode!=39&&i.keyCode!=37){return}else{if(i.keyCode==39){var j=d.getTarget("next")}else{if(i.keyCode==37){var j=d.getTarget("prev")}}if(d.canAdvance(j)){d.flexAnimate(j,d.vars.pauseOnAction)}}}}a(document).bind("keyup",h)}if(d.vars.mousewheel){d.mousewheelEvent=(/Firefox/i.test(navigator.userAgent))?"DOMMouseScroll":"mousewheel";d.bind(d.mousewheelEvent,function(y){y.preventDefault();y=y?y:window.event;var i=y.detail?y.detail*-1:y.originalEvent.wheelDelta/40,j=(i<0)?d.getTarget("next"):d.getTarget("prev");if(d.canAdvance(j)){d.flexAnimate(j,d.vars.pauseOnAction)}})}if(d.vars.slideshow){if(d.vars.pauseOnHover&&d.vars.slideshow){d.hover(function(){d.pause()},function(){if(!d.manualPause){d.resume()}})}d.animatedSlides=setInterval(d.animateSlides,d.vars.slideshowSpeed)}if(d.vars.pausePlay){var q=a('<div class="flex-pauseplay"><span></span></div>');if(d.containerExists){d.controlsContainer.append(q);d.pausePlay=a(".flex-pauseplay span",d.controlsContainer)}else{d.append(q);d.pausePlay=a(".flex-pauseplay span",d)}var n=(d.vars.slideshow)?"pause":"play";d.pausePlay.addClass(n).text((n=="pause")?d.vars.pauseText:d.vars.playText);d.pausePlay.bind(d.eventType,function(i){i.preventDefault();if(a(this).hasClass("pause")){d.pause();d.manualPause=true}else{d.resume();d.manualPause=false}})}if("ontouchstart" in document.documentElement&&d.vars.touch){var w,u,l,r,o,x,p=false;d.each(function(){if("ontouchstart" in document.documentElement){this.addEventListener("touchstart",g,false)}});function g(i){if(d.animating){i.preventDefault()}else{if(i.touches.length==1){d.pause();r=(d.vertical)?d.height():d.width();x=Number(new Date());l=(d.vertical)?(d.currentSlide+d.cloneOffset)*d.height():(d.currentSlide+d.cloneOffset)*d.width();w=(d.vertical)?i.touches[0].pageY:i.touches[0].pageX;u=(d.vertical)?i.touches[0].pageX:i.touches[0].pageY;d.setTransition(0);this.addEventListener("touchmove",k,false);this.addEventListener("touchend",f,false)}}}function k(i){o=(d.vertical)?w-i.touches[0].pageY:w-i.touches[0].pageX;p=(d.vertical)?(Math.abs(o)<Math.abs(i.touches[0].pageX-u)):(Math.abs(o)<Math.abs(i.touches[0].pageY-u));if(!p){i.preventDefault();if(d.vars.animation=="slide"&&d.transitions){if(!d.vars.animationLoop){o=o/((d.currentSlide==0&&o<0||d.currentSlide==d.count-1&&o>0)?(Math.abs(o)/r+2):1)}d.args[d.prop]=(d.vertical)?"translate3d(0,"+(-l-o)+"px,0)":"translate3d("+(-l-o)+"px,0,0)";d.container.css(d.args)}}}function f(j){d.animating=false;if(d.animatingTo==d.currentSlide&&!p&&!(o==null)){var i=(o>0)?d.getTarget("next"):d.getTarget("prev");if(d.canAdvance(i)&&Number(new Date())-x<550&&Math.abs(o)>20||Math.abs(o)>r/2){d.flexAnimate(i,d.vars.pauseOnAction)}else{if(d.vars.animation!=="fade"){d.flexAnimate(d.currentSlide,d.vars.pauseOnAction)}}}this.removeEventListener("touchmove",k,false);this.removeEventListener("touchend",f,false);w=null;u=null;o=null;l=null}}if(d.vars.animation.toLowerCase()=="slide"){a(window).resize(function(){if(!d.animating&&d.is(":visible")){if(d.vertical){d.height(d.slides.filter(":first").height());d.args[d.prop]=(-1*(d.currentSlide+d.cloneOffset))*d.slides.filter(":first").height()+"px";if(d.transitions){d.setTransition(0);d.args[d.prop]=(d.vertical)?"translate3d(0,"+d.args[d.prop]+",0)":"translate3d("+d.args[d.prop]+",0,0)"}d.container.css(d.args)}else{d.newSlides.width(d.width());d.args[d.prop]=(-1*(d.currentSlide+d.cloneOffset))*d.width()+"px";if(d.transitions){d.setTransition(0);d.args[d.prop]=(d.vertical)?"translate3d(0,"+d.args[d.prop]+",0)":"translate3d("+d.args[d.prop]+",0,0)"}d.container.css(d.args)}}})}d.vars.start(d)};d.flexAnimate=function(g,f){if(!d.animating&&d.is(":visible")){d.animating=true;d.animatingTo=g;d.vars.before(d);if(f){d.pause()}if(d.vars.controlNav){d.controlNav.removeClass("active").eq(g).addClass("active")}d.atEnd=(g==0||g==d.count-1)?true:false;if(!d.vars.animationLoop&&d.vars.directionNav){if(g==0){d.directionNav.removeClass("disabled").filter(".prev").addClass("disabled")}else{if(g==d.count-1){d.directionNav.removeClass("disabled").filter(".next").addClass("disabled")}else{d.directionNav.removeClass("disabled")}}}if(!d.vars.animationLoop&&g==d.count-1){d.pause();d.vars.end(d)}if(d.vars.animation.toLowerCase()=="slide"){var e=(d.vertical)?d.slides.filter(":first").height():d.slides.filter(":first").width();if(d.currentSlide==0&&g==d.count-1&&d.vars.animationLoop&&d.direction!="next"){d.slideString="0px"}else{if(d.currentSlide==d.count-1&&g==0&&d.vars.animationLoop&&d.direction!="prev"){d.slideString=(-1*(d.count+1))*e+"px"}else{d.slideString=(-1*(g+d.cloneOffset))*e+"px"}}d.args[d.prop]=d.slideString;if(d.transitions){d.setTransition(d.vars.animationDuration);d.args[d.prop]=(d.vertical)?"translate3d(0,"+d.slideString+",0)":"translate3d("+d.slideString+",0,0)";d.container.css(d.args).one("webkitTransitionEnd transitionend",function(){d.wrapup(e)})}else{d.container.animate(d.args,d.vars.animationDuration,function(){d.wrapup(e)})}}else{d.slides.eq(d.currentSlide).fadeOut(d.vars.animationDuration);d.slides.eq(g).fadeIn(d.vars.animationDuration,function(){d.wrapup()})}}};d.wrapup=function(e){if(d.vars.animation=="slide"){if(d.currentSlide==0&&d.animatingTo==d.count-1&&d.vars.animationLoop){d.args[d.prop]=(-1*d.count)*e+"px";if(d.transitions){d.setTransition(0);d.args[d.prop]=(d.vertical)?"translate3d(0,"+d.args[d.prop]+",0)":"translate3d("+d.args[d.prop]+",0,0)"}d.container.css(d.args)}else{if(d.currentSlide==d.count-1&&d.animatingTo==0&&d.vars.animationLoop){d.args[d.prop]=-1*e+"px";if(d.transitions){d.setTransition(0);d.args[d.prop]=(d.vertical)?"translate3d(0,"+d.args[d.prop]+",0)":"translate3d("+d.args[d.prop]+",0,0)"}d.container.css(d.args)}}}d.animating=false;d.currentSlide=d.animatingTo;d.vars.after(d)};d.animateSlides=function(){if(!d.animating){d.flexAnimate(d.getTarget("next"))}};d.pause=function(){clearInterval(d.animatedSlides);if(d.vars.pausePlay){d.pausePlay.removeClass("pause").addClass("play").text(d.vars.playText)}};d.resume=function(){d.animatedSlides=setInterval(d.animateSlides,d.vars.slideshowSpeed);if(d.vars.pausePlay){d.pausePlay.removeClass("play").addClass("pause").text(d.vars.pauseText)}};d.canAdvance=function(e){if(!d.vars.animationLoop&&d.atEnd){if(d.currentSlide==0&&e==d.count-1&&d.direction!="next"){return false}else{if(d.currentSlide==d.count-1&&e==0&&d.direction=="next"){return false}else{return true}}}else{return true}};d.getTarget=function(e){d.direction=e;if(e=="next"){return(d.currentSlide==d.count-1)?0:d.currentSlide+1}else{return(d.currentSlide==0)?d.count-1:d.currentSlide-1}};d.setTransition=function(e){d.container.css({"-webkit-transition-duration":(e/1000)+"s"})};d.init()};a.flexslider.defaults={animation:"fade",slideDirection:"horizontal",slideshow:true,slideshowSpeed:7000,animationDuration:600,directionNav:true,controlNav:true,keyboardNav:true,mousewheel:false,prevText:"Previous",nextText:"Next",pausePlay:false,pauseText:"Pause",playText:"Play",randomize:false,slideToStart:0,animationLoop:true,pauseOnAction:true,pauseOnHover:false,useCSS:true,touch:true,controlsContainer:"",manualControls:"",start:function(){},before:function(){},after:function(){},end:function(){}};a.fn.flexslider=function(b){return this.each(function(){var c=a(this).find(".slides > li");if(c.length===1){c.fadeIn(400);if(b&&b.start){b.start(a(this))}}else{if(a(this).data("flexsliderInit")!=true){new a.flexslider(this,b)}}})}})(jQuery);
12
+
13
+ jQuery(window).load(function() {
14
+ jQuery('.flexslider').flexslider();
15
+ });
16
+
17
+ /* jQuery(document).ready(function() {
18
+
19
+ // Create the dropdown bases
20
+ jQuery("<select />").appendTo("nav.primary");
21
+
22
+ // Create default option "Go to..."
23
+ jQuery("<option />", {
24
+ "selected": "selected",
25
+ "value" : "",
26
+ "text" : "Go to..."
27
+ }).appendTo("nav select");
28
+
29
+
30
+ // Populate dropdowns with the first menu items
31
+ jQuery("nav.primary li a").each(function() {
32
+ var el = $(this);
33
+ jQuery("<option />", {
34
+ "value" : el.attr("href"),
35
+ "text" : el.text()
36
+ }).appendTo("nav select");
37
+ });
38
+
39
+ //make responsive dropdown menu actually work
40
+ jQuery("nav.primary select").change(function() {
41
+ window.location = $(this).find("option:selected").val();
42
+ });
43
+ });*/
js/jquery/jquery.js CHANGED
@@ -13,7 +13,7 @@
13
  *
14
  * Date: Mon Nov 21 21:11:03 2011 -0500
15
  */
16
- (function( window, undefined ) {
17
 
18
  // Use the correct document accordingly with window argument (sandbox)
19
  var document = window.document,
13
  *
14
  * Date: Mon Nov 21 21:11:03 2011 -0500
15
  */
16
+ ;(function( window, undefined ) {
17
 
18
  // Use the correct document accordingly with window argument (sandbox)
19
  var document = window.document,
js/jquery/jquery.min.js CHANGED
@@ -1,4 +1,4 @@
1
  /*! jQuery v1.7.1 jquery.com | jquery.org/license */
2
- (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},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(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
3
  f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.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(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.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(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={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,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
4
  {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
1
  /*! jQuery v1.7.1 jquery.com | jquery.org/license */
2
+ ;(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},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(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
3
  f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.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(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.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(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={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,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
4
  {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
js/mana/core.js CHANGED
@@ -10,7 +10,7 @@
10
  // a. all variables defined inside of the function belong to function's local scope, that is these variables
11
  // would not interfere with other global variables.
12
  // b. we use jQuery $ notation in not conflicting way (along with prototype, ext, etc.)
13
- (function($) {
14
  // this variables are private to this code block
15
  var _translations = {};
16
  var _options = {};
@@ -39,6 +39,7 @@
39
  else { // register selector-options pairs
40
  _options = $.extend(true, _options, selector);
41
  }
 
42
  };
43
 
44
  $.dynamicUpdate = function (update) {
@@ -241,24 +242,112 @@
241
  $.mSetPopupFadeoutOptions = function(options) {
242
  _popupFadeoutOptions = options;
243
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  $.mClosePopup = function () {
 
245
  $('.m-popup-overlay').fadeOut(_popupFadeoutOptions.overlayTime, function() {
246
  $('.m-popup-overlay').remove();
247
  $('#m-popup').fadeOut(_popupFadeoutOptions.popupTime, function() {
248
  if (_popupFadeoutOptions.callback) {
249
  _popupFadeoutOptions.callback();
250
  }
 
251
  });
252
  })
253
  return false;
254
  };
255
 
256
- $('.m-popup-overlay').live('click', $.mClosePopup);
257
- $(document).keydown(function (e) {
258
- if ($('.m-popup-overlay').length) {
259
- if (e.keyCode == 27) {
260
- return _close();
 
 
 
261
  }
262
- }
263
  });
264
  })(jQuery);
10
  // a. all variables defined inside of the function belong to function's local scope, that is these variables
11
  // would not interfere with other global variables.
12
  // b. we use jQuery $ notation in not conflicting way (along with prototype, ext, etc.)
13
+ ;(function($) {
14
  // this variables are private to this code block
15
  var _translations = {};
16
  var _options = {};
39
  else { // register selector-options pairs
40
  _options = $.extend(true, _options, selector);
41
  }
42
+ $(document).trigger('m-options-changed');
43
  };
44
 
45
  $.dynamicUpdate = function (update) {
242
  $.mSetPopupFadeoutOptions = function(options) {
243
  _popupFadeoutOptions = options;
244
  }
245
+ $.fn.extend({
246
+ mPopup: function(name, options) {
247
+ var o = $.extend({
248
+ fadeOut: { overlayTime: 0, popupTime:500, callback:null },
249
+ fadeIn: { overlayTime: 0, popupTime:500, callback: null },
250
+ overlay: { opacity: 0.2},
251
+ popup: { contentSelector:'.' + name + '-text', containerClass:'m-' + name + '-popup-container', top:100 }
252
+
253
+ }, options);
254
+ $(this).live('click', function() {
255
+ if ($.mPopupClosing()) {
256
+ return false;
257
+ }
258
+ // preparations
259
+ var html = $(o.popup.contentSelector).html();
260
+ $.mSetPopupFadeoutOptions(o.fadeOut);
261
+
262
+ // put overlay to prevent interaction with the page and to catch 'cancel' mouse clicks
263
+ var overlay = $('<div class="m-popup-overlay"> </div>');
264
+ overlay.appendTo(document.body);
265
+ overlay.css({left:0, top:0}).width($(document).width()).height($(document).height());
266
+ overlay.animate({ opacity:o.overlay.opacity }, o.fadeIn.overlayTime, function () {
267
+ // all this code is called when overlay animation is over
268
+
269
+ // fill popup with content
270
+ $('#m-popup')
271
+ .css({"width":"auto", "height":"auto"})
272
+ .html(html)
273
+ .addClass(o.popup.containerClass)
274
+ .css("top", (($(window).height() - $('#m-popup').outerHeight()) / 2) - o.popup.top + $(window).scrollTop() + "px")
275
+ .css("left", (($(window).width() - $('#m-popup').outerWidth()) / 2) + $(window).scrollLeft() + "px")
276
+
277
+ // get intended height and set initial height to 0
278
+ var popupHeight = $('#m-popup').height();
279
+ $('#m-popup').show().height(0);
280
+ $('#m-popup').hide().css({"height":"auto"});
281
+
282
+ // calculate intended popup position
283
+ var css = {
284
+ left:$('#m-popup').css('left'),
285
+ top:$('#m-popup').css('top'),
286
+ width:$('#m-popup').width() + "px",
287
+ height:$('#m-popup').height() + "px"
288
+ };
289
+
290
+ // adjust (the only) child of popup container element
291
+ $('#m-popup').children().each(function () {
292
+ $(this).css({
293
+ width:($('#m-popup').width() + $(this).width() - $(this).outerWidth()) + "px",
294
+ height:($('#m-popup').height() + $(this).height() - $(this).outerHeight()) + "px"
295
+ });
296
+ });
297
+
298
+ // make popup a point
299
+ $('#m-popup')
300
+ .css({
301
+ top:($(window).height() / 2) - o.popup.top + $(window).scrollTop() + "px",
302
+ left:($(window).width() / 2) + $(window).scrollLeft() + "px",
303
+ width:0 + "px",
304
+ height:0 + "px"
305
+ })
306
+ .show();
307
+
308
+ // explode popup to intended size
309
+ $('#m-popup').animate(css, o.fadeIn.popupTime, function () {
310
+ if (o.fadeIn.callback) {
311
+ o.fadeIn.callback();
312
+ }
313
+ });
314
+ });
315
+
316
+ // prevent following to target link of <a> tag
317
+ return false;
318
+ });
319
+ }
320
+ });
321
+ var _popupClosing = false;
322
+ $.mPopupClosing = function (value) {
323
+ if (value !== undefined) {
324
+ _popupClosing = value;
325
+ }
326
+ return _popupClosing;
327
+ };
328
  $.mClosePopup = function () {
329
+ $.mPopupClosing(true);
330
  $('.m-popup-overlay').fadeOut(_popupFadeoutOptions.overlayTime, function() {
331
  $('.m-popup-overlay').remove();
332
  $('#m-popup').fadeOut(_popupFadeoutOptions.popupTime, function() {
333
  if (_popupFadeoutOptions.callback) {
334
  _popupFadeoutOptions.callback();
335
  }
336
+ $.mPopupClosing(false);
337
  });
338
  })
339
  return false;
340
  };
341
 
342
+ $(function () {
343
+ $('.m-popup-overlay').live('click', $.mClosePopup);
344
+ $('#m-popup .m-close-popup').live('click', $.mClosePopup);
345
+ $(document).keydown(function (e) {
346
+ if ($('.m-popup-overlay').length) {
347
+ if (e.keyCode == 27) {
348
+ return $.mClosePopup();
349
+ }
350
  }
351
+ });
352
  });
353
  })(jQuery);
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mana_Filters</name>
4
- <version>12.04.24.23</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Add multiple selection features for attribute and price filters in Magento layered navigation</description>
11
  <notes>Adds multiple selection features for attribute and price filters in Magento layered navigation.</notes>
12
  <authors><author><name>Mana Team</name><user>auto-converted</user><email>team@manadev.com</email></author></authors>
13
- <date>2012-04-24</date>
14
- <time>20:45:33</time>
15
- <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="mana_core.css" hash="146f6612e4af69b09c8dabdd04034956"/></dir><dir name="images"><dir name="mana_core"><file name="m-wait.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="jquery"><file name="ui.css" hash="62f98bcf894e71de2c7923eeb05828b2"/><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="95f9cceeb9d742dd3e917ec16ed754f8"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="f040b255ca13e693da34ab33c7d6b554"/><file name="ui-bg_flat_10_000000_40x100.png" hash="c18cd01623c7fed23c80d53e2f5e7c78"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="5f1847175ba18c41322cb9cb0581e0fb"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="d26e8f463195a7b86f86b7d550cfc114"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="58d2cd501e01573cf537089c694ba899"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="b806658954cb4d16ade8977af737f486"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="384c3f17709ba0f809b023b6e7b10b84"/><file name="ui-icons_228ef1_256x240.png" hash="79f41c0765e9ec18562b20b0801d748b"/><file name="ui-icons_222222_256x240.png" hash="ebe6b6902a408fbf9cac6379a1477525"/><file name="ui-icons_ef8c08_256x240.png" hash="ef9a6ccfe3b14041928ddc708665b226"/><file name="ui-icons_ffd27a_256x240.png" hash="ab8c30acc0e3608fb79e01fccf832c70"/><file name="ui-icons_ffffff_256x240.png" hash="342bc03f6264c75d3f1d7f99e34295b9"/></dir></dir><file name="mana_core.css" hash="e566aabe05bc464047bb4d9ef3695f1e"/><file name="mana_filters.css" hash="f00678b06f12160058a812727a381dd7"/></dir><dir name="images"><dir name="mana_core"><file name="m-wait.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mana_core.xml" hash="72a2a82e5179e3304c1a02a6858f8a9d"/></dir><dir name="template"><dir name="mana"><dir name="core"><file name="js.phtml" hash="3169a7e22fe71ddb50005004a215820d"/><file name="wait.phtml" hash="7c0ffe76e7b3aca2163d9ecc5145e81b"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mana_core.xml" hash="22ba5859103442a7396b17074d94f45e"/><file name="mana_filters.xml" hash="893b40d900cede3037c7eda1634d645f"/></dir><dir name="template"><dir name="mana"><dir name="core"><file name="js.phtml" hash="3169a7e22fe71ddb50005004a215820d"/><file name="popup.phtml" hash="e2823a07a8eefcad23f1ea416e95f84c"/><file name="wait.phtml" hash="2fdb82f90c1aa8705fa76f500b967fef"/></dir><dir name="filters"><file name="state.phtml" hash="d70844ff25c10de0e5a3d130145df38c"/><dir name="items"><file name="list.phtml" hash="234b980f4e1c8f3d242d50090845727d"/><file name="list_popup.phtml" hash="e4abebf68c8a045804e135bd9f74ec55"/><file name="standard.phtml" hash="554ca766d42cff2438aa31be83668068"/><file name="standard_popup.phtml" hash="f483267d4039764edca2558c6c8212aa"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mana_Core.csv" hash="20657952d052290341452e5edc25b286"/><file name="Mana_Db.csv" hash="b8a8006795ee468ef13436c32aa54c90"/><file name="Mana_Filters.csv" hash="5b6d638aae00eb499ac3beb270c6245b"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="advListRotator.js" hash="2c3993aca99e148b25842309c33c3e62"/><file name="fileuploader.js" hash="164c23d4b94b5424c8e1c00057d45ce4"/><file name="history.adapter.jquery.js" hash="8e34662937b6021c290077b353800702"/><file name="history.js" hash="ee99bbb906d9fa3a7487676905334aa0"/><file name="jquery-ui.js" hash="d23281125902b0f5877d919876c474b5"/><file name="jquery-ui.min.js" hash="5b29eb9274308e52eed0fdd7ccaf76d4"/><file name="jquery.easing.js" hash="6c0edab4dbbc8ab1b4dcd05cc2b26a09"/><file name="jquery.js" hash="9799b9486cf5193d7be6043e639b6efc"/><file name="jquery.min.js" hash="ff9bb73638c30e432c8a92c205d7fcc0"/><file name="jquery.noconflict.js" hash="0da09155d7323809b48494da0846bf34"/><file name="jquery.printf.js" hash="c03f5f13cc5ab5c3b9656fb30296a764"/><dir name="validate"><file name="jquery.validate.js" hash="ea4cd5d1e1f8d3a07f90509f5dcc775e"/><dir name="localization"><file name="messages_ar.js" hash="b46940324c76f8134e30df693dbf87a8"/><file name="messages_bg.js" hash="bc4ebf054b6a399abf518ef28bbad839"/><file name="messages_cn.js" hash="886e45b3ffd60a683ecc8e6ea644e519"/><file name="messages_cs.js" hash="6b794f90ab955c17fe02b6553876050c"/><file name="messages_da.js" hash="cc862df2998db2cc18c8276aa7bfe0f0"/><file name="messages_de.js" hash="70a9eb9abfc4365f36718b06b38f6725"/><file name="messages_el.js" hash="92bdb500b4792ef08fb82ece4f359044"/><file name="messages_es.js" hash="2f3a18c6d0377bc4658839a070853ed7"/><file name="messages_fa.js" hash="9dbfbbae786f7240f64a36899bcdbc8e"/><file name="messages_fi.js" hash="d67cfcd1a2840b22085791db1249d0ba"/><file name="messages_fr.js" hash="3081f76c1368d03d2e1a84a7ed9748e2"/><file name="messages_he.js" hash="82a33dd4f27db4c2a36b423d17bcaf7b"/><file name="messages_hu.js" hash="7612f6525fd5922f970d40b5929c88bb"/><file name="messages_it.js" hash="c7c6856ff263bc4a685713a48215cd89"/><file name="messages_kk.js" hash="28c0dac0417ec5e0ec9271bfd11b7129"/><file name="messages_lt.js" hash="d89ef181770f1d43a51a9418bacb9df3"/><file name="messages_lv.js" hash="e08f4d99e7703cb4cd77d9390545180a"/><file name="messages_nl.js" hash="9f8aad8e3d769b0a636a02c672044232"/><file name="messages_no.js" hash="1a00dddbef393a2b8bc2e78934243566"/><file name="messages_pl.js" hash="28cea41b05ff80cc721b6896a2f658ba"/><file name="messages_ptbr.js" hash="194f1a4cbe9483dea4363400e046b923"/><file name="messages_ptpt.js" hash="3a9a7730cc461866e37f2cd8b0507f3a"/><file name="messages_ro.js" hash="eaf4c868e8fde6f5dee2f0a3ee0cbe12"/><file name="messages_ru.js" hash="e3d6e8809230c758b95438de4c783474"/><file name="messages_se.js" hash="20d4f249870e07a1bc5f99e7f194bacd"/><file name="messages_sk.js" hash="b2a93e8947443d5780cc8630008b3760"/><file name="messages_tr.js" hash="7ecf31a65c2eefd8c7da62f65ccf33a7"/><file name="messages_tw.js" hash="b660609f8ddf6b17d71b72aa43512f1f"/><file name="messages_ua.js" hash="80e565078f016c8ea1cffc6c8cdd5a93"/><file name="methods_de.js" hash="a9d8792f8e46298165daaf4e9a5d98ad"/><file name="methods_nl.js" hash="8505eec534134eac849adca1cf8f2f9d"/><file name="methods_pt.js" hash="09b350c9c069b5a82d5811339ac15ab6"/></dir></dir></dir><dir name="mana"><file name="core.js" hash="672763bd3ae0ae2e76ea2537492dfaf5"/></dir></dir></target><target name="magelocal"><dir name="Mana"><dir name="Core"><file name="Profiler.php" hash="750f9a6490534be89ef5a55ddf62db21"/><dir name="Block"><file name="Js.php" hash="91ff5ffba7c31f0096a93100fa03c4fa"/><file name="List.php" hash="8a54149b3d24b8f1447ee77dc7c691ed"/><file name="Singleton.php" hash="5c25b0ceff8210c8c41ef482230354b6"/></dir><dir name="etc"><file name="config.xml" hash="d94108bb88d9073ee7f76dc6c3ac0d15"/></dir><dir name="Helper"><file name="Data.php" hash="afe8042afb8d31829fe8a9d8c472786e"/><file name="Files.php" hash="babe2f6fadc962c9bb10dd3e02cbf547"/><file name="Js.php" hash="c555677ddf63b9f81a962af280e3c83f"/><file name="Lock.php" hash="7567ccb21cef8c90dac0e9bbac321801"/></dir><dir name="Model"><file name="Callback.php" hash="5913c5b47dc55d150c312523cecddb20"/><file name="Eav.php" hash="ed4adbb339497fefe1db29a59c2ed110"/><file name="Object.php" hash="dcb759ec94621a28c4e531715813513c"/><file name="Observer.php" hash="6f340c22a6b058dc0506954856d98e34"/><dir name="Attribute"><file name="Scope.php" hash="7277aac766688c59886cff561b8c44a3"/></dir><dir name="Config"><file name="Default.php" hash="b69bd384a59f38f214f565d21af1ca3a"/></dir><dir name="Html"><file name="Filter.php" hash="ca77f8b76bd39d00001d6dfb12ff6929"/><file name="Parser.php" hash="5f4c098e69b582025f909ddeeab6e630"/><file name="Reader.php" hash="41a66c26ce51f3803eba50cea5b95d96"/><file name="State.php" hash="5952deebd020273729594ace8a2cae9b"/><file name="Token.php" hash="5c7a4ef3150a35b8a6bf9e296e53e739"/></dir><dir name="Source"><file name="Abstract.php" hash="bb05e3ce9f5e01ef2843a5a558a86fd8"/><file name="Config.php" hash="59b1d6927157e4b34bde55794a7a86be"/><file name="Country.php" hash="cd5c9dd00c4456db2e6b4f6316303a8c"/><file name="Yesno.php" hash="3082e75e81e111aed0ac9f1cc17e579e"/></dir></dir><dir name="Resource"><file name="Eav.php" hash="2ada400977d3a8b0883a03998e1a4e47"/><dir name="Attribute"><file name="Collection.php" hash="7f01d6480b5110a431a5b50571a9ec62"/></dir><dir name="Eav"><file name="Collection.php" hash="5153a97a4021aebced2b0a538d10b4e7"/><file name="Setup.php" hash="13360360cbfada91713159a38c82e6b2"/><dir name="Collection"><file name="Derived.php" hash="03a87d87a781c8256b6414fb132ed30e"/></dir></dir><dir name="Virtual"><file name="Collection.php" hash="ac2d11980e9dc015ed0cfbe12fbf3fc7"/></dir></dir><dir name="sql"><dir name="mana_core_setup"><file name="mysql4-install-1.1.1.php" hash="a169406e2cc37282d001e9415eda219a"/></dir></dir></dir><dir name="Db"><dir name="etc"><file name="config.xml" hash="c8cb6a91d6252d491953205ceda65b57"/></dir><dir name="Exception"><file name="Validation.php" hash="0cc427f91decd68cf65db4885e1931e1"/></dir><dir name="Helper"><file name="Data.php" hash="32ab2c2f5b35fc8ebdd5f225e41128ed"/></dir><dir name="Model"><file name="Indexer.php" hash="e5885b2e30a75822545dd515a8f01bc7"/><file name="Object.php" hash="8cfa17709a7fcae03c83fe145585ad79"/><file name="Observer.php" hash="e09ef8342e19928e8e5442ca77be5410"/><file name="Validation.php" hash="f2dd026c3d73f3fd345e1b7abde51e7d"/><dir name="Replication"><file name="Target.php" hash="b918ef992096a72080a743352385b64b"/></dir><dir name="Virtual"><file name="Result.php" hash="33f35c946b2285e62a5a1c08c1bb3ec8"/></dir></dir><dir name="Resource"><file name="Object.php" hash="9106bec7565a3bedaf2de81b18569157"/><file name="Replicate.php" hash="e4c75872344dde3ed8a04744110faace"/><dir name="Edit"><file name="Session.php" hash="8a1a18c16126b2ee6171aaea2af04050"/></dir><dir name="Object"><file name="Collection.php" hash="6f7f393abef136226ed22eb8f45d2fdd"/></dir></dir><dir name="sql"><dir name="mana_db_setup"><file name="mysql4-install-11.09.28.09.php" hash="0d8c0873cbbabb1db406e1c0b709b4de"/><file name="mysql4-upgrade-11.09.28.09-11.09.28.10.php" hash="04ccee17b3b04906e8fed2b1ac9214a3"/><file name="mysql4-upgrade-11.10.08.23-11.10.20.22.php" hash="847b24ea006e99af80cc8980ff7ff021"/></dir></dir></dir><dir name="Filters"><dir name="Block"><file name="Filter.php" hash="6b57b809695f47051afd8605474445d2"/><file name="Layer.php" hash="0f8fac9a9277fb6e204a8ed32b164902"/><file name="Search.php" hash="b75b8c1b8d7da28c2522b5a9aefbcc9e"/><file name="State.php" hash="01c463e189be8362b708138a66ba12d8"/><file name="View.php" hash="4daa82036924550dd3dfccc0e413d46f"/></dir><dir name="etc"><file name="config.xml" hash="f125174ba7f5d9230585d913777b001e"/></dir><dir name="Helper"><file name="Data.php" hash="517d6746e0ac5d790baae1ed2678bf14"/><file name="Extended.php" hash="f4ed7faab4eb1638b60dccd8a0b9a40c"/></dir><dir name="Model"><file name="Filter.php" hash="cd3bc9276ff4566802e2d43280394e6f"/><file name="Filter2.php" hash="ea0814fff3c9b8425d54e27fd2bbbf4c"/><file name="Item.php" hash="b6e0658a2293372e0be441fb31be413a"/><file name="Observer.php" hash="dfba518775cfd27860223a98c28d3fc1"/><file name="Operation.php" hash="54d01ace78c5b6ba3facf1a2f3255618"/><file name="Sort.php" hash="95804fcd46ca143587747dc7dfe9845e"/><dir name="Config"><dir name="Display"><file name="Default.php" hash="e16716300e514ef6ee7fa4c1c5fd3331"/></dir></dir><dir name="Filter"><file name="Attribute.php" hash="026bf0aac2390d46b5adf6d5eae2f057"/><file name="Category.php" hash="81fd90cd6b04a0130ae8acd036999965"/><file name="Decimal.php" hash="1551faf330352a4d5b398bd063fee426"/><file name="Default.php" hash="960d7b6f0fd9c32cf9726e11a62cbb1e"/><file name="Price.php" hash="ce6d6a52687e86479ebfcb79d090baa9"/></dir><dir name="Filter2"><file name="Store.php" hash="285a8ece8303f3c05875607f92303a84"/><file name="Value.php" hash="38d30a7c5845b2550a9345ca918d89db"/><dir name="Value"><file name="Store.php" hash="b8998e8e7122abdab4cd16c7ce1c0868"/></dir></dir><dir name="Source"><file name="Display.php" hash="509e389d33e3175e304ab67ffdb79325"/><file name="Filterable.php" hash="618680f75072220ad711dec6e220d43b"/><dir name="Display"><file name="All.php" hash="1875630a7565c9655c8c8724dad45bba"/><file name="Attribute.php" hash="d2bd347e70e3924490dff6e57274ff40"/><file name="Category.php" hash="437b3f678edd292a0110529aadfb1530"/><file name="Decimal.php" hash="b432f32e93fb1991f8882bfe25f0514e"/><file name="Price.php" hash="c6a017240beaf76666e9f702a9fcd48d"/></dir></dir></dir><dir name="Resource"><file name="Filter.php" hash="e74d789c7751fe0a126b38ab0bd3ac40"/><file name="Filter2.php" hash="537e4ebd838b5fd8fe159c661c4ac02c"/><file name="Setup.php" hash="83b12b7939ac1c7696360f77304d9d84"/><dir name="Filter"><file name="Attribute.php" hash="06ee40ee746d336998c19570475cf617"/><file name="Collection.php" hash="6831f054791977048641d43c288ff53c"/><file name="Decimal.php" hash="f64a8ef372b3dc4a1ae7b35d5bc4e543"/><file name="Price.php" hash="c8b427cc90f6c0634f13119734cd3d53"/><dir name="Attribute"><file name="Collection.php" hash="c854270f63ca3bfd44cfd6ab27888676"/></dir><dir name="Collection"><file name="Derived.php" hash="5240ac10d2989122c49665919a9555ff"/></dir></dir><dir name="Filter2"><file name="Collection.php" hash="822b71198d05e41e90d096cb7cc47fa5"/><file name="Store.php" hash="de788de12d37b5076323d43ae6d9c88e"/><file name="Value.php" hash="d5e89eebdd356143e6008d2cdb15e830"/><dir name="Store"><file name="Collection.php" hash="791101a5eac8aceb6398a24b433a2d1f"/></dir><dir name="Value"><file name="Collection.php" hash="3273b517dd65a46034cb3ef8adb3c610"/><file name="Store.php" hash="023b7bc39ae58da4cc22aa66c1b9e742"/><dir name="Store"><file name="Collection.php" hash="073931492acfc99a3b5cd1ecf7113982"/></dir></dir></dir></dir><dir name="sql"><dir name="mana_filters_setup"><file name="mysql4-install-1.1.1.php" hash="22f7381b5ea9261a2e8a00fda28f28ef"/><file name="mysql4-upgrade-1.1.1-1.9.1.php" hash="04c761bab20de6e0fed68e141fb68112"/><file name="mysql4-upgrade-11.09.24.09-11.09.28.09.php" hash="a007f769d492c43b1e7a583a2763300a"/><file name="mysql4-upgrade-11.10.19.18-11.10.23.01.php" hash="ef0b7b4f4530e5b01f349e3d534ebb16"/><file name="mysql4-upgrade-12.01.14.09-12.01.15.14.php" hash="001d8e035bc798d8779c29ac38912543"/><file name="mysql4-upgrade-12.04.10.23-12.04.17.18.php" hash="48f2d8cc8ca6afe014a95dea808e5087"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mana_Core.xml" hash="8a32ac8e039a3027b868ec4600e8105e"/><file name="Mana_Db.xml" hash="9b4669b284f2a688e165abaac373c358"/><file name="Mana_Filters.xml" hash="85a5d5c92f66f775131459c3bfc2fc30"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mana_Filters</name>
4
+ <version>12.12.21.19</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
10
  <description>Add multiple selection features for attribute and price filters in Magento layered navigation</description>
11
  <notes>Adds multiple selection features for attribute and price filters in Magento layered navigation.</notes>
12
  <authors><author><name>Mana Team</name><user>auto-converted</user><email>team@manadev.com</email></author></authors>
13
+ <date>2012-12-27</date>
14
+ <time>10:41:41</time>
15
+ <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="mana_core.css" hash="146f6612e4af69b09c8dabdd04034956"/></dir><dir name="images"><dir name="mana_core"><file name="m-wait.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="jquery"><file name="ui.css" hash="62f98bcf894e71de2c7923eeb05828b2"/><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="95f9cceeb9d742dd3e917ec16ed754f8"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="f040b255ca13e693da34ab33c7d6b554"/><file name="ui-bg_flat_10_000000_40x100.png" hash="c18cd01623c7fed23c80d53e2f5e7c78"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="5f1847175ba18c41322cb9cb0581e0fb"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="d26e8f463195a7b86f86b7d550cfc114"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="58d2cd501e01573cf537089c694ba899"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="b806658954cb4d16ade8977af737f486"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="384c3f17709ba0f809b023b6e7b10b84"/><file name="ui-icons_228ef1_256x240.png" hash="79f41c0765e9ec18562b20b0801d748b"/><file name="ui-icons_222222_256x240.png" hash="ebe6b6902a408fbf9cac6379a1477525"/><file name="ui-icons_ef8c08_256x240.png" hash="ef9a6ccfe3b14041928ddc708665b226"/><file name="ui-icons_ffd27a_256x240.png" hash="ab8c30acc0e3608fb79e01fccf832c70"/><file name="ui-icons_ffffff_256x240.png" hash="342bc03f6264c75d3f1d7f99e34295b9"/></dir></dir><file name="mana_core.css" hash="e566aabe05bc464047bb4d9ef3695f1e"/><file name="mana_filters.css" hash="14b44583102d94145fea8cd683862ebd"/></dir><dir name="images"><dir name="mana_core"><file name="m-wait.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mana_core.xml" hash="72a2a82e5179e3304c1a02a6858f8a9d"/></dir><dir name="template"><dir name="mana"><dir name="core"><file name="js.phtml" hash="3169a7e22fe71ddb50005004a215820d"/><file name="wait.phtml" hash="7c0ffe76e7b3aca2163d9ecc5145e81b"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mana_core.xml" hash="22ba5859103442a7396b17074d94f45e"/><file name="mana_filters.xml" hash="0437a11880f49cd42d32626d64b22e48"/></dir><dir name="template"><dir name="mana"><dir name="core"><file name="js.phtml" hash="3169a7e22fe71ddb50005004a215820d"/><file name="popup.phtml" hash="e2823a07a8eefcad23f1ea416e95f84c"/><file name="wait.phtml" hash="2fdb82f90c1aa8705fa76f500b967fef"/></dir><dir name="filters"><file name="cms.phtml" hash="63d88786618aaa15d32339d897ce14e9"/><file name="state.phtml" hash="27b45dce9a2ebb0ac92aec5aa5c35844"/><dir name="items"><file name="list.phtml" hash="380890aed1b8b230c704227325ce23be"/><file name="list_popup.phtml" hash="03f5c121616f9fad2ddef4f75522269b"/><file name="standard.phtml" hash="c4cb2a95fbc2177f02a6b6126b1eca39"/><file name="standard_popup.phtml" hash="ed8db31244f443136b319786ad480a9a"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mana_Core.csv" hash="20657952d052290341452e5edc25b286"/><file name="Mana_Db.csv" hash="b8a8006795ee468ef13436c32aa54c90"/><file name="Mana_Filters.csv" hash="2c3987d58f581bdf19c26e8144dbe32f"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="advListRotator.js" hash="6629920522d9fd8364469abe1ae705c9"/><file name="fileuploader.js" hash="164c23d4b94b5424c8e1c00057d45ce4"/><file name="history.adapter.jquery.js" hash="8e34662937b6021c290077b353800702"/><file name="history.js" hash="ee99bbb906d9fa3a7487676905334aa0"/><file name="jquery-1.7.2.min.js" hash="1dc03657e720958e4a6f90c0a980c6a0"/><file name="jquery-ui.js" hash="334c348dae9ff966e88400e3e2d46063"/><file name="jquery-ui.min.js" hash="8b460a695041c5747331e6c2602293f0"/><file name="jquery.easing.js" hash="6c0edab4dbbc8ab1b4dcd05cc2b26a09"/><file name="jquery.flexslider-min.js" hash="c236f33e84d73c1a873ec63cc25d7bd1"/><file name="jquery.js" hash="2a52d4c67811eba24dcf8e01cdba7f6d"/><file name="jquery.min.js" hash="40f5a3a03f129b71c205e94e080e3967"/><file name="jquery.noconflict.js" hash="0da09155d7323809b48494da0846bf34"/><file name="jquery.printf.js" hash="c03f5f13cc5ab5c3b9656fb30296a764"/><dir name="validate"><file name="jquery.validate.js" hash="ea4cd5d1e1f8d3a07f90509f5dcc775e"/><dir name="localization"><file name="messages_ar.js" hash="b46940324c76f8134e30df693dbf87a8"/><file name="messages_bg.js" hash="bc4ebf054b6a399abf518ef28bbad839"/><file name="messages_cn.js" hash="886e45b3ffd60a683ecc8e6ea644e519"/><file name="messages_cs.js" hash="6b794f90ab955c17fe02b6553876050c"/><file name="messages_da.js" hash="cc862df2998db2cc18c8276aa7bfe0f0"/><file name="messages_de.js" hash="70a9eb9abfc4365f36718b06b38f6725"/><file name="messages_el.js" hash="92bdb500b4792ef08fb82ece4f359044"/><file name="messages_es.js" hash="2f3a18c6d0377bc4658839a070853ed7"/><file name="messages_fa.js" hash="9dbfbbae786f7240f64a36899bcdbc8e"/><file name="messages_fi.js" hash="d67cfcd1a2840b22085791db1249d0ba"/><file name="messages_fr.js" hash="3081f76c1368d03d2e1a84a7ed9748e2"/><file name="messages_he.js" hash="82a33dd4f27db4c2a36b423d17bcaf7b"/><file name="messages_hu.js" hash="7612f6525fd5922f970d40b5929c88bb"/><file name="messages_it.js" hash="c7c6856ff263bc4a685713a48215cd89"/><file name="messages_kk.js" hash="28c0dac0417ec5e0ec9271bfd11b7129"/><file name="messages_lt.js" hash="d89ef181770f1d43a51a9418bacb9df3"/><file name="messages_lv.js" hash="e08f4d99e7703cb4cd77d9390545180a"/><file name="messages_nl.js" hash="9f8aad8e3d769b0a636a02c672044232"/><file name="messages_no.js" hash="1a00dddbef393a2b8bc2e78934243566"/><file name="messages_pl.js" hash="28cea41b05ff80cc721b6896a2f658ba"/><file name="messages_ptbr.js" hash="194f1a4cbe9483dea4363400e046b923"/><file name="messages_ptpt.js" hash="3a9a7730cc461866e37f2cd8b0507f3a"/><file name="messages_ro.js" hash="eaf4c868e8fde6f5dee2f0a3ee0cbe12"/><file name="messages_ru.js" hash="e3d6e8809230c758b95438de4c783474"/><file name="messages_se.js" hash="20d4f249870e07a1bc5f99e7f194bacd"/><file name="messages_sk.js" hash="b2a93e8947443d5780cc8630008b3760"/><file name="messages_tr.js" hash="7ecf31a65c2eefd8c7da62f65ccf33a7"/><file name="messages_tw.js" hash="b660609f8ddf6b17d71b72aa43512f1f"/><file name="messages_ua.js" hash="80e565078f016c8ea1cffc6c8cdd5a93"/><file name="methods_de.js" hash="a9d8792f8e46298165daaf4e9a5d98ad"/><file name="methods_nl.js" hash="8505eec534134eac849adca1cf8f2f9d"/><file name="methods_pt.js" hash="09b350c9c069b5a82d5811339ac15ab6"/></dir></dir></dir><dir name="mana"><file name="core.js" hash="d9397b075bdc1abfcac4f91664bb37ce"/></dir></dir></target><target name="magelocal"><dir name="Mana"><dir name="Core"><file name="Profiler.php" hash="750f9a6490534be89ef5a55ddf62db21"/><dir name="Block"><file name="Js.php" hash="91ff5ffba7c31f0096a93100fa03c4fa"/><file name="List.php" hash="8a54149b3d24b8f1447ee77dc7c691ed"/><file name="Singleton.php" hash="74e1cb457680fb2f999af95fa3af26c2"/></dir><dir name="etc"><file name="config.xml" hash="4f9d808598bfa067f9b646313fcc6b98"/></dir><dir name="Helper"><file name="Data.php" hash="7820319e3ed703c84b3484ab2ea761cd"/><file name="Files.php" hash="babe2f6fadc962c9bb10dd3e02cbf547"/><file name="Image.php" hash="75ade04d12f104d05314f2d9343ec539"/><file name="Js.php" hash="c555677ddf63b9f81a962af280e3c83f"/><file name="Layout.php" hash="0a1efd1ec215ec6f5fc3a72a3a0e43d7"/><file name="Lock.php" hash="7567ccb21cef8c90dac0e9bbac321801"/></dir><dir name="Model"><file name="Callback.php" hash="5913c5b47dc55d150c312523cecddb20"/><file name="Eav.php" hash="ed4adbb339497fefe1db29a59c2ed110"/><file name="Object.php" hash="dcb759ec94621a28c4e531715813513c"/><file name="Observer.php" hash="7fd0af32313efd276999421b86904e0d"/><dir name="Attribute"><file name="Scope.php" hash="7277aac766688c59886cff561b8c44a3"/></dir><dir name="Config"><file name="Default.php" hash="b69bd384a59f38f214f565d21af1ca3a"/></dir><dir name="Html"><file name="Filter.php" hash="ca77f8b76bd39d00001d6dfb12ff6929"/><file name="Parser.php" hash="5f4c098e69b582025f909ddeeab6e630"/><file name="Reader.php" hash="41a66c26ce51f3803eba50cea5b95d96"/><file name="State.php" hash="5952deebd020273729594ace8a2cae9b"/><file name="Token.php" hash="5c7a4ef3150a35b8a6bf9e296e53e739"/></dir><dir name="Source"><file name="Abstract.php" hash="bb05e3ce9f5e01ef2843a5a558a86fd8"/><file name="Config.php" hash="59b1d6927157e4b34bde55794a7a86be"/><file name="Country.php" hash="cd5c9dd00c4456db2e6b4f6316303a8c"/><file name="Yesno.php" hash="3082e75e81e111aed0ac9f1cc17e579e"/></dir></dir><dir name="Resource"><file name="Eav.php" hash="2ada400977d3a8b0883a03998e1a4e47"/><dir name="Attribute"><file name="Collection.php" hash="7f01d6480b5110a431a5b50571a9ec62"/></dir><dir name="Eav"><file name="Collection.php" hash="5153a97a4021aebced2b0a538d10b4e7"/><file name="Setup.php" hash="13360360cbfada91713159a38c82e6b2"/><dir name="Collection"><file name="Derived.php" hash="03a87d87a781c8256b6414fb132ed30e"/></dir></dir><dir name="Virtual"><file name="Collection.php" hash="ac2d11980e9dc015ed0cfbe12fbf3fc7"/></dir></dir><dir name="sql"><dir name="mana_core_setup"><file name="mysql4-install-1.1.1.php" hash="a169406e2cc37282d001e9415eda219a"/></dir></dir></dir><dir name="Db"><dir name="etc"><file name="config.xml" hash="c8cb6a91d6252d491953205ceda65b57"/></dir><dir name="Exception"><file name="Validation.php" hash="0cc427f91decd68cf65db4885e1931e1"/></dir><dir name="Helper"><file name="Data.php" hash="d2b447e363c797cd67110d4dba4bb29e"/></dir><dir name="Model"><file name="Indexer.php" hash="e5885b2e30a75822545dd515a8f01bc7"/><file name="Object.php" hash="91dac5c80f75dcb81c1aadaa8984b466"/><file name="Observer.php" hash="e09ef8342e19928e8e5442ca77be5410"/><file name="Validation.php" hash="f2dd026c3d73f3fd345e1b7abde51e7d"/><dir name="Replication"><file name="Target.php" hash="b918ef992096a72080a743352385b64b"/></dir><dir name="Virtual"><file name="Result.php" hash="33f35c946b2285e62a5a1c08c1bb3ec8"/></dir></dir><dir name="Resource"><file name="Object.php" hash="9106bec7565a3bedaf2de81b18569157"/><file name="Replicate.php" hash="e4c75872344dde3ed8a04744110faace"/><dir name="Edit"><file name="Session.php" hash="8a1a18c16126b2ee6171aaea2af04050"/></dir><dir name="Object"><file name="Collection.php" hash="6f7f393abef136226ed22eb8f45d2fdd"/></dir></dir><dir name="sql"><dir name="mana_db_setup"><file name="mysql4-install-11.09.28.09.php" hash="0d8c0873cbbabb1db406e1c0b709b4de"/><file name="mysql4-upgrade-11.09.28.09-11.09.28.10.php" hash="04ccee17b3b04906e8fed2b1ac9214a3"/><file name="mysql4-upgrade-11.10.08.23-11.10.20.22.php" hash="847b24ea006e99af80cc8980ff7ff021"/></dir></dir></dir><dir name="Filters"><dir name="Block"><file name="Filter.php" hash="f10f27c8720ba7143250d88a4fda63ff"/><file name="Layer.php" hash="0f8fac9a9277fb6e204a8ed32b164902"/><file name="Search.php" hash="e7c5d74b36406fb181ba149588070f95"/><file name="State.php" hash="c9a00b949def21806686fa144a997bcb"/><file name="View.php" hash="2209e8ce9702afc676dc959f831c7254"/></dir><dir name="etc"><file name="config.xml" hash="8630dc1b56a7390734aad71520c6c417"/></dir><dir name="Helper"><file name="Data.php" hash="bea1017e4c3db2c11da3cb386fca2955"/><file name="Extended.php" hash="5b065cc2be0a8b96dc4db32bc8279304"/></dir><dir name="Interface"><file name="Filter.php" hash="883a29e42087529428e73b4ae785609a"/></dir><dir name="Model"><file name="Filter.php" hash="cd3bc9276ff4566802e2d43280394e6f"/><file name="Filter2.php" hash="7f99d449c0d875114fc20297165ceb9f"/><file name="Item.php" hash="b5e063d5d18f629e177aa2ac1f7634b1"/><file name="Observer.php" hash="5e25454217ecb4a2df1996ec31f1f395"/><file name="Operation.php" hash="54d01ace78c5b6ba3facf1a2f3255618"/><file name="Query.php" hash="f80a2ba5db7873b5333234f47cdd159b"/><file name="Repository.php" hash="e0cf842a98aa5ae27fc107c18f190fab"/><file name="Sort.php" hash="95804fcd46ca143587747dc7dfe9845e"/><dir name="Config"><dir name="Display"><file name="Default.php" hash="e16716300e514ef6ee7fa4c1c5fd3331"/></dir></dir><dir name="Filter"><file name="Attribute.php" hash="d033a75f6ce1094ab362817a8e6c1c20"/><file name="Category.php" hash="61ea19c09304b0a860f5036639189eaa"/><file name="Common.php" hash="522b1695cf4f4f545c7174b90a8b06ba"/><file name="Decimal.php" hash="33560d2a6e198c7a82e2c2c7e54d4d2c"/><file name="Default.php" hash="960d7b6f0fd9c32cf9726e11a62cbb1e"/><file name="Price.php" hash="ff12a87bed7dbe14299654466b1eeff0"/></dir><dir name="Filter2"><file name="Store.php" hash="89bc5a3572bc0e764d380ca8ee945a0d"/><file name="Value.php" hash="893a4b537779174bf342fc8e01d6a738"/><dir name="Value"><file name="Store.php" hash="695bf8aad7ff431fe5a511098cf23f48"/></dir></dir><dir name="Solr"><file name="Attribute.php" hash="c4c0ba110aeae5785395619a6756a84d"/><file name="Category.php" hash="f9ca1206696ef02d1f6d840b1845def1"/><file name="Decimal.php" hash="08280eac806b30fc490a933e9574b56c"/><file name="Price.php" hash="1ea1433f73c212833bf109f4be14acd7"/><dir name="Adapter"><file name="HttpStream.php" hash="b58657f23ca2829dec0a725f302c525f"/><file name="PhpExtension.php" hash="866e113bce375b16d3a531ba705ffacb"/></dir><dir name="And"><file name="Attribute.php" hash="3df0798bc675483dd4b327299fc00b33"/></dir><dir name="Reverse"><file name="Attribute.php" hash="20259864caa4f5da31a0e9094fe3572b"/><file name="Decimal.php" hash="2b0fbdac8005864d79854be934b01f2c"/><file name="Price.php" hash="60f610029d3689bf5a54588cf0166790"/></dir></dir><dir name="Source"><file name="Display.php" hash="509e389d33e3175e304ab67ffdb79325"/><file name="Filterable.php" hash="618680f75072220ad711dec6e220d43b"/><dir name="Display"><file name="All.php" hash="1875630a7565c9655c8c8724dad45bba"/><file name="Attribute.php" hash="d2bd347e70e3924490dff6e57274ff40"/><file name="Category.php" hash="437b3f678edd292a0110529aadfb1530"/><file name="Decimal.php" hash="b432f32e93fb1991f8882bfe25f0514e"/><file name="Price.php" hash="c6a017240beaf76666e9f702a9fcd48d"/></dir></dir></dir><dir name="Resource"><file name="Filter.php" hash="e74d789c7751fe0a126b38ab0bd3ac40"/><file name="Filter2.php" hash="c78095c70ecedfb8c5003053f2e8c202"/><file name="Setup.php" hash="83b12b7939ac1c7696360f77304d9d84"/><dir name="EnterpriseSearch"><file name="Engine.php" hash="51d77208587d1c55c8d508a3024bd269"/></dir><dir name="Filter"><file name="Attribute.php" hash="030ac9139139d8266ce0cf6cd49b6b01"/><file name="Collection.php" hash="6831f054791977048641d43c288ff53c"/><file name="Decimal.php" hash="9c9bb08b3e265042fe3fb939410db4cb"/><file name="Price.php" hash="63b34feab49ac85349422546a36e0864"/><dir name="And"><file name="Attribute.php" hash="cdc41ca223083360b35bd5f455733cd8"/></dir><dir name="Attribute"><file name="Collection.php" hash="c854270f63ca3bfd44cfd6ab27888676"/></dir><dir name="Collection"><file name="Derived.php" hash="5240ac10d2989122c49665919a9555ff"/></dir><dir name="Reverse"><file name="Attribute.php" hash="0be2e3f5eef03862e13b37deb1f7f7a3"/><file name="Decimal.php" hash="91c32175991f901549a4563f9f010a37"/><file name="Price.php" hash="fb9bc0658f643338c726c90ccf17e402"/></dir></dir><dir name="Filter2"><file name="Collection.php" hash="822b71198d05e41e90d096cb7cc47fa5"/><file name="Store.php" hash="6c0caab4ab867aea518765f95c6fe8a6"/><file name="Value.php" hash="5e02b70cec566f21e14a414bf5c50480"/><dir name="Store"><file name="Collection.php" hash="791101a5eac8aceb6398a24b433a2d1f"/></dir><dir name="Value"><file name="Collection.php" hash="3273b517dd65a46034cb3ef8adb3c610"/><file name="Store.php" hash="489e1849a7eb0d15e71c2392ee89276c"/><dir name="Store"><file name="Collection.php" hash="073931492acfc99a3b5cd1ecf7113982"/></dir></dir></dir><dir name="Indexer"><file name="Source.php" hash="045a7694a29c516f677d636cf3e42dd7"/></dir><dir name="Solr"><file name="Attribute.php" hash="0997d454328326c849092d87c8ba9d5a"/><dir name="And"><file name="Attribute.php" hash="eb89ae5ce09a1f7eb213bc9186a67bd5"/></dir><dir name="Reverse"><file name="Attribute.php" hash="2c314ae2e5d313195452982caeddac6c"/></dir></dir></dir><dir name="sql"><dir name="mana_filters_setup"><file name="mysql4-install-1.1.1.php" hash="22f7381b5ea9261a2e8a00fda28f28ef"/><file name="mysql4-upgrade-1.1.1-1.9.1.php" hash="04c761bab20de6e0fed68e141fb68112"/><file name="mysql4-upgrade-11.09.24.09-11.09.28.09.php" hash="a007f769d492c43b1e7a583a2763300a"/><file name="mysql4-upgrade-11.10.19.18-11.10.23.01.php" hash="ef0b7b4f4530e5b01f349e3d534ebb16"/><file name="mysql4-upgrade-12.01.14.09-12.01.15.14.php" hash="001d8e035bc798d8779c29ac38912543"/><file name="mysql4-upgrade-12.04.10.23-12.04.17.18.php" hash="48f2d8cc8ca6afe014a95dea808e5087"/><file name="mysql4-upgrade-12.10.25.17-12.10.25.18.php" hash="5d726b388ac30fc00cd95bb86ab5641b"/><file name="mysql4-upgrade-12.11.02.16-12.11.13.15.php" hash="11fc0db6ff2f56fe95bfaf89ab758f61"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mana_Core.xml" hash="8a32ac8e039a3027b868ec4600e8105e"/><file name="Mana_Db.xml" hash="9b4669b284f2a688e165abaac373c358"/><file name="Mana_Filters.xml" hash="85a5d5c92f66f775131459c3bfc2fc30"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
skin/frontend/base/default/css/mana_filters.css CHANGED
@@ -5,4 +5,8 @@
5
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
  */
7
  /*.m-filter-item-list .m-selected-filter-item { color: red; }*/
8
- .m-filter-popup .m-selected-ln-item > a { font-weight: bold; text-decoration: none; }
 
 
 
 
5
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
  */
7
  /*.m-filter-item-list .m-selected-filter-item { color: red; }*/
8
+ .m-filter-popup .m-selected-ln-item > a { font-weight: bold; text-decoration: none; }
9
+ .block-layered-nav .btn-remove { margin-top: 3px; }
10
+ .block-layered-nav .currently li { position: relative; padding: 6px 24px 6px 10px; }
11
+ .block-layered-nav .currently .btn-remove { margin-top: 0; position: absolute; right: 4px; top: 9px; margin-left: 0; }
12
+ .block-layered-nav dt { position: relative; }