CommerceLab_News - Version 1.0.0

Version Notes

Version number: 1.0
Stability: Stable
Compatibility: 1.4, 1.5, 1.6, 1.7

Download this release

Release Info

Developer Magento Core Team
Extension CommerceLab_News
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (59) hide show
  1. app/code/community/CommerceLab/News/Block/Adminhtml/Category.php +28 -0
  2. app/code/community/CommerceLab/News/Block/Adminhtml/Category/Edit.php +53 -0
  3. app/code/community/CommerceLab/News/Block/Adminhtml/Category/Edit/Form.php +87 -0
  4. app/code/community/CommerceLab/News/Block/Adminhtml/Category/Grid.php +126 -0
  5. app/code/community/CommerceLab/News/Block/Adminhtml/Comment.php +28 -0
  6. app/code/community/CommerceLab/News/Block/Adminhtml/Comment/Edit.php +61 -0
  7. app/code/community/CommerceLab/News/Block/Adminhtml/Comment/Edit/Form.php +94 -0
  8. app/code/community/CommerceLab/News/Block/Adminhtml/Comment/Grid.php +154 -0
  9. app/code/community/CommerceLab/News/Block/Adminhtml/News.php +28 -0
  10. app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit.php +61 -0
  11. app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Form.php +46 -0
  12. app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Tab/Additional.php +130 -0
  13. app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Tab/Info.php +283 -0
  14. app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Tabs.php +43 -0
  15. app/code/community/CommerceLab/News/Block/Adminhtml/News/Grid.php +194 -0
  16. app/code/community/CommerceLab/News/Block/News.php +271 -0
  17. app/code/community/CommerceLab/News/Block/Newsitem.php +258 -0
  18. app/code/community/CommerceLab/News/Block/Rss.php +68 -0
  19. app/code/community/CommerceLab/News/Controller/Router.php +116 -0
  20. app/code/community/CommerceLab/News/Helper/Data.php +173 -0
  21. app/code/community/CommerceLab/News/Helper/Versions.php +97 -0
  22. app/code/community/CommerceLab/News/Model/Category.php +37 -0
  23. app/code/community/CommerceLab/News/Model/Check.php +81 -0
  24. app/code/community/CommerceLab/News/Model/Comment.php +27 -0
  25. app/code/community/CommerceLab/News/Model/Mysql4/Category.php +76 -0
  26. app/code/community/CommerceLab/News/Model/Mysql4/Category/Collection.php +93 -0
  27. app/code/community/CommerceLab/News/Model/Mysql4/Comment.php +24 -0
  28. app/code/community/CommerceLab/News/Model/Mysql4/Comment/Collection.php +39 -0
  29. app/code/community/CommerceLab/News/Model/Mysql4/News.php +105 -0
  30. app/code/community/CommerceLab/News/Model/Mysql4/News/Collection.php +65 -0
  31. app/code/community/CommerceLab/News/Model/News.php +46 -0
  32. app/code/community/CommerceLab/News/Model/Wysiwyg/Config.php +123 -0
  33. app/code/community/CommerceLab/News/controllers/Adminhtml/CategoryController.php +146 -0
  34. app/code/community/CommerceLab/News/controllers/Adminhtml/CommentController.php +183 -0
  35. app/code/community/CommerceLab/News/controllers/Adminhtml/NewsController.php +379 -0
  36. app/code/community/CommerceLab/News/controllers/IndexController.php +47 -0
  37. app/code/community/CommerceLab/News/controllers/NewsitemController.php +203 -0
  38. app/code/community/CommerceLab/News/controllers/RssController.php +41 -0
  39. app/code/community/CommerceLab/News/etc/config.xml +265 -0
  40. app/code/community/CommerceLab/News/etc/system.xml +300 -0
  41. app/code/community/CommerceLab/News/sql/clnews_setup/mysql4-install-1.0.0.php +122 -0
  42. app/design/frontend/default/default/layout/clnews.xml +74 -0
  43. app/design/frontend/default/default/template/clnews/latest.phtml +32 -0
  44. app/design/frontend/default/default/template/clnews/list.phtml +76 -0
  45. app/design/frontend/default/default/template/clnews/menu.phtml +18 -0
  46. app/design/frontend/default/default/template/clnews/news_print.phtml +47 -0
  47. app/design/frontend/default/default/template/clnews/newsitem.phtml +201 -0
  48. app/etc/modules/CommerceLab_News.xml +9 -0
  49. js/commercelab/noconflict.js +4 -0
  50. js/jquery/jquery-1.4.4.js +7180 -0
  51. js/jquery/jquery-1.7.1-min.js +6 -0
  52. package.xml +46 -0
  53. skin/frontend/default/default/css/clnews/images/i-tags.gif +0 -0
  54. skin/frontend/default/default/css/clnews/images/i_attached.gif +0 -0
  55. skin/frontend/default/default/css/clnews/images/i_print.gif +0 -0
  56. skin/frontend/default/default/css/clnews/images/rss.gif +0 -0
  57. skin/frontend/default/default/css/clnews/style.css +204 -0
  58. skin/frontend/default/default/css/print.css +42 -0
  59. skin/frontend/default/default/images/clnews/ajax-loader.gif +0 -0
app/code/community/CommerceLab/News/Block/Adminhtml/Category.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->_controller = 'adminhtml_category';
23
+ $this->_blockGroup = 'clnews';
24
+ $this->_headerText = Mage::helper('clnews')->__('Category Manager');
25
+ $this->_addButtonLabel = Mage::helper('clnews')->__('Add Category');
26
+ parent::__construct();
27
+ }
28
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Category/Edit.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->_objectId = 'id';
23
+ $this->_blockGroup = 'clnews';
24
+ $this->_controller = 'adminhtml_category';
25
+
26
+ parent::__construct();
27
+
28
+ $this->_updateButton('save', 'label', Mage::helper('clnews')->__('Save Category'));
29
+ $this->_updateButton('delete', 'label', Mage::helper('clnews')->__('Delete Category'));
30
+
31
+ $this->_addButton('saveandcontinue', array(
32
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
33
+ 'onclick' => 'saveAndContinueEdit()',
34
+ 'class' => 'save',
35
+ ), -100);
36
+
37
+ $this->_formScripts[] = "
38
+ function saveAndContinueEdit(){
39
+ editForm.submit($('edit_form').action+'back/edit/');
40
+ }
41
+ ";
42
+ }
43
+
44
+ public function getHeaderText()
45
+ {
46
+ if ( Mage::registry('clnews_data') && Mage::registry('clnews_data')->getId() ) {
47
+ return Mage::helper('clnews')->__("Edit Category '%s'",
48
+ $this->htmlEscape(Mage::registry('clnews_data')->getTitle()));
49
+ } else {
50
+ return Mage::helper('clnews')->__('Add Category');
51
+ }
52
+ }
53
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Category/Edit/Form.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ protected function _prepareForm()
21
+ {
22
+ $form = new Varien_Data_Form(array(
23
+ 'id' => 'edit_form',
24
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
25
+ 'method' => 'post',
26
+ ));
27
+
28
+ $fieldset = $form->addFieldset('category_form',
29
+ array('legend'=>Mage::helper('clnews')->__('Category Information')));
30
+
31
+ $fieldset->addField('title', 'text', array(
32
+ 'label' => Mage::helper('clnews')->__('Title'),
33
+ 'title' => Mage::helper('clnews')->__('Title'),
34
+ 'name' => 'title',
35
+ 'required' => true
36
+ ));
37
+
38
+ $fieldset->addField('url_key', 'text', array(
39
+ 'label' => Mage::helper('clnews')->__('URL Key'),
40
+ 'title' => Mage::helper('clnews')->__('URL Key'),
41
+ 'name' => 'url_key',
42
+ 'required' => true
43
+ ));
44
+
45
+ $fieldset->addField('sort_order', 'text', array(
46
+ 'label' => Mage::helper('clnews')->__('Sort Order'),
47
+ 'name' => 'sort_order',
48
+ ));
49
+
50
+ /**
51
+ * Check is single store mode
52
+ */
53
+ if (!Mage::app()->isSingleStoreMode()) {
54
+ $fieldset->addField('store_id', 'multiselect', array(
55
+ 'name' => 'stores[]',
56
+ 'label' => Mage::helper('cms')->__('Store View'),
57
+ 'title' => Mage::helper('cms')->__('Store View'),
58
+ 'required' => true,
59
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
60
+ ));
61
+ }
62
+
63
+ $fieldset->addField('meta_keywords', 'editor', array(
64
+ 'name' => 'meta_keywords',
65
+ 'label' => Mage::helper('clnews')->__('Keywords'),
66
+ 'title' => Mage::helper('clnews')->__('Meta Keywords'),
67
+ ));
68
+
69
+ $fieldset->addField('meta_description', 'editor', array(
70
+ 'name' => 'meta_description',
71
+ 'label' => Mage::helper('clnews')->__('Description'),
72
+ 'title' => Mage::helper('clnews')->__('Meta Description'),
73
+ ));
74
+
75
+ if ( Mage::getSingleton('adminhtml/session')->getNewsData() ) {
76
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
77
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
78
+ } elseif ( Mage::registry('clnews_data') ) {
79
+ $form->setValues(Mage::registry('clnews_data')->getData());
80
+ }
81
+
82
+ $form->setUseContainer(true);
83
+ $this->setForm($form);
84
+
85
+ return parent::_prepareForm();
86
+ }
87
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Category/Grid.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('categoryGrid');
24
+ $this->setSaveParametersInSession(true);
25
+ }
26
+
27
+ protected function _prepareCollection()
28
+ {
29
+ $collection = Mage::getModel('clnews/category')->getCollection();
30
+ if (!Mage::app()->isSingleStoreMode()) {
31
+ $collection->getSelect()->joinLeft('clnews_category_store', 'main_table.category_id = clnews_category_store.category_id', array('clnews_category_store.store_id as store_id'));
32
+ }
33
+ $this->setCollection($collection);
34
+ return parent::_prepareCollection();
35
+ }
36
+
37
+ protected function _prepareColumns()
38
+ {
39
+ $this->addColumn('category_id', array(
40
+ 'header' => Mage::helper('clnews')->__('ID'),
41
+ 'align' =>'right',
42
+ 'width' => '50',
43
+ 'index' => 'category_id',
44
+ ));
45
+
46
+ $this->addColumn('title', array(
47
+ 'header' => Mage::helper('clnews')->__('Title'),
48
+ 'align' =>'left',
49
+ 'index' => 'title',
50
+ ));
51
+
52
+ $this->addColumn('url_key', array(
53
+ 'header' => Mage::helper('clnews')->__('URL Key'),
54
+ 'align' =>'left',
55
+ 'index' => 'url_key',
56
+ ));
57
+
58
+ if (!Mage::app()->isSingleStoreMode()) {
59
+ $this->addColumn('store_id', array(
60
+ 'header' => Mage::helper('cms')->__('Store View'),
61
+ 'index' => 'store_id',
62
+ 'type' => 'store',
63
+ 'store_all' => true,
64
+ 'store_view' => true,
65
+ 'sortable' => false,
66
+ 'filter_condition_callback'
67
+ => array($this, '_filterStoreCondition'),
68
+ ));
69
+ }
70
+
71
+ $this->addColumn('sort_order', array(
72
+ 'header' => Mage::helper('clnews')->__('Sort Order'),
73
+ 'align' => 'left',
74
+ 'width' => '50',
75
+ 'index' => 'sort_order',
76
+ ));
77
+
78
+ $this->addColumn('action',
79
+ array(
80
+ 'header' => Mage::helper('clnews')->__('Action'),
81
+ 'type' => 'action',
82
+ 'getter' => 'getId',
83
+ 'actions' => array(
84
+ array(
85
+ 'caption' => Mage::helper('clnews')->__('Edit'),
86
+ 'url' => array('base'=> '*/*/edit'),
87
+ 'field' => 'id'
88
+ )
89
+ ),
90
+ 'width' => '70',
91
+ 'index' => 'stores',
92
+ 'is_system' => true,
93
+ 'filter' => false,
94
+ 'sortable' => false,
95
+ ));
96
+ return parent::_prepareColumns();
97
+ }
98
+
99
+ protected function _prepareMassaction()
100
+ {
101
+ $this->setMassactionIdField('category_id');
102
+ $this->getMassactionBlock()->setFormFieldName('category');
103
+
104
+ $this->getMassactionBlock()->addItem('delete', array(
105
+ 'label' => Mage::helper('clnews')->__('Delete'),
106
+ 'url' => $this->getUrl('*/*/massDelete'),
107
+ 'confirm' => Mage::helper('clnews')->__('Are you sure?')
108
+ ));
109
+
110
+ return $this;
111
+ }
112
+
113
+ protected function _filterStoreCondition($collection, $column)
114
+ {
115
+ if (!$value = $column->getFilter()->getValue()) {
116
+ return;
117
+ }
118
+
119
+ $this->getCollection()->addStoreFilter($value);
120
+ }
121
+
122
+ public function getRowUrl($row)
123
+ {
124
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
125
+ }
126
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Comment.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Comment extends Mage_Adminhtml_Block_Widget_Grid_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->_controller = 'adminhtml_comment';
23
+ $this->_blockGroup = 'clnews';
24
+ $this->_headerText = Mage::helper('clnews')->__('Comment Manager');
25
+ parent::__construct();
26
+ $this->_removeButton('add');
27
+ }
28
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Comment/Edit.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Comment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+
24
+ $this->_objectId = 'id';
25
+ $this->_blockGroup = 'clnews';
26
+ $this->_controller = 'adminhtml_comment';
27
+
28
+ $this->_updateButton('save', 'label', Mage::helper('clnews')->__('Save Comment'));
29
+ $this->_updateButton('delete', 'label', Mage::helper('clnews')->__('Delete Comment'));
30
+
31
+ $this->_addButton('saveandcontinue', array(
32
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
33
+ 'onclick' => 'saveAndContinueEdit()',
34
+ 'class' => 'save',
35
+ ), -100);
36
+
37
+ $this->_formScripts[] = "
38
+ function toggleEditor() {
39
+ if (tinyMCE.getInstanceById('clnews_content') == null) {
40
+ tinyMCE.execCommand('mceAddControl', false, 'clnews_content');
41
+ } else {
42
+ tinyMCE.execCommand('mceRemoveControl', false, 'clnews_content');
43
+ }
44
+ }
45
+
46
+ function saveAndContinueEdit(){
47
+ editForm.submit($('edit_form').action+'back/edit/');
48
+ }
49
+ ";
50
+ }
51
+
52
+ public function getHeaderText()
53
+ {
54
+ if ( Mage::registry('clnews_data') && Mage::registry('clnews_data')->getId() ) {
55
+ return Mage::helper('clnews')->__("Edit Comment By '%s'",
56
+ $this->htmlEscape(Mage::registry('clnews_data')->getUser()));
57
+ } else {
58
+ return Mage::helper('clnews')->__('Add Comment');
59
+ }
60
+ }
61
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Comment/Edit/Form.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Comment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ protected function _prepareForm()
21
+ {
22
+ $collection = Mage::getResourceModel('clnews/comment_collection');
23
+
24
+ $news_id = $this->getRequest()->getParam('id');
25
+ $collection->getSelect()->joinLeft('clnews_news', 'main_table.news_id = clnews_news.news_id', 'title');
26
+ $collection->getSelect()->distinct();
27
+ $collection->getSelect()->where('main_table.news_id =' . $news_id);
28
+ $collection->getSelect()->limit(1);
29
+ $data = $collection->getData();
30
+
31
+ $form = new Varien_Data_Form(array(
32
+ 'id' => 'edit_form',
33
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
34
+ 'method' => 'post',
35
+ ));
36
+
37
+ $fieldset = $form->addFieldset('comment_form',
38
+ array('legend'=>Mage::helper('clnews')->__('Comment Information')));
39
+
40
+
41
+ $fieldset->addField('title', 'hidden', array(
42
+ 'label' => Mage::helper('clnews')->__('News Name'),
43
+ 'after_element_html' => '<tr><td class="label"><label for="title">News Name</label></td>
44
+ <td class="value">' .$data[0]['title'] . '</td></tr>',
45
+ ));
46
+
47
+ $fieldset->addField('user', 'text', array(
48
+ 'label' => Mage::helper('clnews')->__('User'),
49
+ 'name' => 'user',
50
+ ));
51
+
52
+ $fieldset->addField('email', 'text', array(
53
+ 'label' => Mage::helper('clnews')->__('Email Address'),
54
+ 'name' => 'email',
55
+ ));
56
+
57
+ $fieldset->addField('comment_status', 'select', array(
58
+ 'label' => Mage::helper('clnews')->__('Status'),
59
+ 'name' => 'comment_status',
60
+ 'values' => array(
61
+ array(
62
+ 'value' => CommerceLab_News_Helper_Data::UNAPPROVED_STATUS,
63
+ 'label' => Mage::helper('clnews')->__('Unapproved'),
64
+ ),
65
+
66
+ array(
67
+ 'value' => CommerceLab_News_Helper_Data::APPROVED_STATUS,
68
+ 'label' => Mage::helper('clnews')->__('Approved'),
69
+ ),
70
+ ),
71
+ ));
72
+
73
+ $fieldset->addField('comment', 'editor', array(
74
+ 'name' => 'comment',
75
+ 'label' => Mage::helper('clnews')->__('Comment'),
76
+ 'title' => Mage::helper('clnews')->__('Comment'),
77
+ 'style' => 'width:500px; height:250px;',
78
+ 'wysiwyg' => false,
79
+ 'required' => false,
80
+ ));
81
+
82
+ if ( Mage::getSingleton('adminhtml/session')->getNewsData() ) {
83
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
84
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
85
+ } elseif ( Mage::registry('clnews_data') ) {
86
+ $form->setValues(Mage::registry('clnews_data')->getData());
87
+ }
88
+
89
+ $form->setUseContainer(true);
90
+ $this->setForm($form);
91
+
92
+ return parent::_prepareForm();
93
+ }
94
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/Comment/Grid.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_Comment_Grid extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('commentGrid');
24
+ $this->setDefaultSort('comment_status');
25
+ $this->setDefaultDir('ASC');
26
+ $this->setSaveParametersInSession(true);
27
+ }
28
+
29
+ protected function _prepareCollection()
30
+ {
31
+ $collection = Mage::getResourceModel('clnews/comment_collection');
32
+ if ($this->getRequest()->getParam('news_id')) {
33
+ $collection->addNewsFilter($this->getRequest()->getParam('news_id'));
34
+ } else {
35
+ $collection->getSelect()->joinLeft('clnews_news', 'main_table.news_id = clnews_news.news_id', array('clnews_news.title as title'));
36
+ }
37
+ $this->setCollection($collection);
38
+ return parent::_prepareCollection();
39
+ }
40
+
41
+ protected function _prepareColumns()
42
+ {
43
+ $this->addColumn('comment', array(
44
+ 'header' => Mage::helper('clnews')->__('Comment'),
45
+ 'align' =>'left',
46
+ 'index' => 'comment',
47
+ ));
48
+
49
+ $this->addColumn('title', array(
50
+ 'header' => Mage::helper('clnews')->__('News Name'),
51
+ 'index' => 'title',
52
+ ));
53
+
54
+ $this->addColumn('user', array(
55
+ 'header' => Mage::helper('clnews')->__('User'),
56
+ 'index' => 'user',
57
+ ));
58
+
59
+ $this->addColumn('email', array(
60
+ 'header' => Mage::helper('clnews')->__('E-mail'),
61
+ 'index' => 'email',
62
+ ));
63
+
64
+ $this->addColumn('created_time', array(
65
+ 'header' => Mage::helper('clnews')->__('Created'),
66
+ 'align' => 'center',
67
+ 'width' => '120px',
68
+ 'type' => 'date',
69
+ 'default' => '--',
70
+ 'index' => 'created_time',
71
+ ));
72
+
73
+ $this->addColumn('comment_status', array(
74
+ 'header' => Mage::helper('clnews')->__('Status'),
75
+ 'align' => 'center',
76
+ 'width' => '80px',
77
+ 'index' => 'comment_status',
78
+ 'type' => 'options',
79
+ 'options' => array(
80
+ CommerceLab_News_Helper_Data::UNAPPROVED_STATUS => 'Unapproved',
81
+ CommerceLab_News_Helper_Data::APPROVED_STATUS => 'Approved',
82
+ ),
83
+ ));
84
+
85
+ $this->addColumn('action',
86
+ array(
87
+ 'header' => Mage::helper('clnews')->__('Action'),
88
+ 'width' => '50',
89
+ 'type' => 'action',
90
+ 'getter' => 'getId',
91
+ 'actions' => array(
92
+ array(
93
+ 'caption' => Mage::helper('clnews')->__('Edit'),
94
+ 'url' => array('base'=> '*/*/edit'),
95
+ 'field' => 'id'
96
+ ),
97
+ ),
98
+ 'filter' => false,
99
+ 'sortable' => false,
100
+ 'index' => 'stores',
101
+ 'is_system' => true,
102
+ ));
103
+ /*
104
+ $this->addColumn('view_news_item',
105
+ array(
106
+ 'header' => Mage::helper('clnews')->__('News Article'),
107
+ 'width' => '100',
108
+ 'type' => 'action',
109
+ 'getter' => 'getId',
110
+ 'actions' => array(
111
+ array(
112
+ 'caption' => Mage::helper('clnews')->__('Go to News Article'),
113
+ 'url' => array('base'=> '* /adminhtml_news/edit'),
114
+ 'field' => 'news_id'
115
+ ),
116
+ ),
117
+ 'filter' => false,
118
+ 'sortable' => false,
119
+ 'index' => 'stores',
120
+ 'is_system' => true,
121
+ ));*/
122
+ return parent::_prepareColumns();
123
+ }
124
+
125
+ protected function _prepareMassaction()
126
+ {
127
+ $this->setMassactionIdField('post_id');
128
+ $this->getMassactionBlock()->setFormFieldName('comments');
129
+
130
+ $this->getMassactionBlock()->addItem('approve', array(
131
+ 'label' => Mage::helper('clnews')->__('Approve'),
132
+ 'url' => $this->getUrl('*/*/massApprove'),
133
+ 'confirm' => Mage::helper('clnews')->__('Are you sure?')
134
+ ));
135
+
136
+ $this->getMassactionBlock()->addItem('unapprove', array(
137
+ 'label' => Mage::helper('clnews')->__('Unapprove'),
138
+ 'url' => $this->getUrl('*/*/massUnapprove'),
139
+ 'confirm' => Mage::helper('clnews')->__('Are you sure?')
140
+ ));
141
+
142
+ $this->getMassactionBlock()->addItem('delete', array(
143
+ 'label' => Mage::helper('clnews')->__('Delete'),
144
+ 'url' => $this->getUrl('*/*/massDelete'),
145
+ 'confirm' => Mage::helper('clnews')->__('Are you sure?')
146
+ ));
147
+ return $this;
148
+ }
149
+
150
+ public function getRowUrl($row)
151
+ {
152
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
153
+ }
154
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News extends Mage_Adminhtml_Block_Widget_Grid_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->_controller = 'adminhtml_news';
23
+ $this->_blockGroup = 'clnews';
24
+ $this->_headerText = Mage::helper('clnews')->__('News Manager');
25
+ $this->_addButtonLabel = Mage::helper('clnews')->__('Add New Article');
26
+ parent::__construct();
27
+ }
28
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->_objectId = 'id';
23
+ $this->_blockGroup = 'clnews';
24
+ $this->_controller = 'adminhtml_news';
25
+
26
+ parent::__construct();
27
+
28
+ $this->_updateButton('save', 'label', Mage::helper('clnews')->__('Save News Article'));
29
+ $this->_updateButton('delete', 'label', Mage::helper('clnews')->__('Delete News Article'));
30
+
31
+ $this->_addButton('saveandcontinue', array(
32
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
33
+ 'onclick' => 'saveAndContinueEdit()',
34
+ 'class' => 'save',
35
+ ), -100);
36
+
37
+ $this->_formScripts[] = "
38
+ function toggleEditor() {
39
+ if (tinyMCE.getInstanceById('block_content') == null) {
40
+ tinyMCE.execCommand('mceAddControl', false, 'block_content');
41
+ } else {
42
+ tinyMCE.execCommand('mceRemoveControl', false, 'block_content');
43
+ }
44
+ }
45
+
46
+ function saveAndContinueEdit(){
47
+ editForm.submit($('edit_form').action+'back/edit/');
48
+ }
49
+ ";
50
+ }
51
+
52
+ public function getHeaderText()
53
+ {
54
+ if (Mage::registry('clnews_data') && Mage::registry('clnews_data')->getId()) {
55
+ return Mage::helper('clnews')->__("Edit News Article '%s'",
56
+ $this->htmlEscape(Mage::registry('clnews_data')->getTitle()));
57
+ } else {
58
+ return Mage::helper('clnews')->__('Add News Article');
59
+ }
60
+ }
61
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Form.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ /**
21
+ * Load Wysiwyg on demand and Prepare layout
22
+ */
23
+ protected function _prepareLayout()
24
+ {
25
+ parent::_prepareLayout();
26
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
27
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
28
+ }
29
+ }
30
+
31
+ protected function _prepareForm()
32
+ {
33
+ $form = new Varien_Data_Form(array(
34
+ 'id' => 'edit_form',
35
+ 'action' => $this->getUrl('*/*/save',
36
+ array('id' => $this->getRequest()->getParam('id'))),
37
+ 'method' => 'post',
38
+ 'enctype' => 'multipart/form-data'
39
+ )
40
+ );
41
+
42
+ $form->setUseContainer(true);
43
+ $this->setForm($form);
44
+ return parent::_prepareForm();
45
+ }
46
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Tab/Additional.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News_Edit_Tab_Additional extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ public function initForm()
21
+ {
22
+ $form = new Varien_Data_Form();
23
+
24
+ $fieldset = $form->addFieldset('news_time_data',
25
+ array('legend'=>Mage::helper('clnews')->__('News Time Settings'), 'style' => 'width: 520px;'));
26
+
27
+ $fieldset->addField('news_time', 'date', array(
28
+ 'name' => 'news_time',
29
+ 'label' => Mage::helper('clnews')->__('News Time'),
30
+ 'title' => Mage::helper('clnews')->__('News Time'),
31
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
32
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
33
+ 'after_element_html' =>
34
+ '<span class="hint" style="white-space:nowrap;"><p class="note">'.
35
+ Mage::helper('clnews')->__('Next to the Article will be stated current time').'</p></span>'
36
+ ));
37
+
38
+ $fieldset->addField('publicate_from_time', 'date', array(
39
+ 'name' => 'publicate_from_time',
40
+ 'label' => Mage::helper('clnews')->__('Publish From:'),
41
+ 'title' => Mage::helper('clnews')->__('Publish From:'),
42
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
43
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
44
+ ));
45
+
46
+ $values = $this->getTimeValues(0, 23);
47
+ $fieldset->addField('publicate_from_hours', 'select', array(
48
+ 'label' => Mage::helper('clnews')->__('Hours'),
49
+ 'name' => 'publicate_from_hours',
50
+ 'style' => 'width: 50px!important;',
51
+ 'values' => $values
52
+ ));
53
+
54
+ $values = $this->getTimeValues(0, 59);
55
+ $fieldset->addField('publicate_from_minutes', 'select', array(
56
+ 'label' => Mage::helper('clnews')->__('Minutes'),
57
+ 'name' => 'publicate_from_minutes',
58
+ 'style' => 'width: 50px!important;',
59
+ 'values' => $values
60
+ ));
61
+
62
+ $fieldset->addField('publicate_to_time', 'date', array(
63
+ 'name' => 'publicate_to_time',
64
+ 'label' => Mage::helper('clnews')->__('Publish Until:'),
65
+ 'title' => Mage::helper('clnews')->__('Publish Until:'),
66
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
67
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
68
+ ));
69
+
70
+ $values = $this->getTimeValues(0, 23);
71
+ $fieldset->addField('publicate_to_hours', 'select', array(
72
+ 'label' => Mage::helper('clnews')->__('Hours'),
73
+ 'name' => 'publicate_to_hours',
74
+ 'style' => 'width: 50px!important;',
75
+ 'values' => $values
76
+ ));
77
+
78
+ $values = $this->getTimeValues(0, 59);
79
+ $fieldset->addField('publicate_to_minutes', 'select', array(
80
+ 'label' => Mage::helper('clnews')->__('Minutes'),
81
+ 'name' => 'publicate_to_minutes',
82
+ 'style' => 'width: 50px!important',
83
+ 'values' => $values
84
+ ));
85
+
86
+ $fieldset = $form->addFieldset('news_meta_data', array('legend'=>Mage::helper('clnews')->__('Meta Data')));
87
+
88
+ $fieldset->addField('meta_keywords', 'editor', array(
89
+ 'name' => 'meta_keywords',
90
+ 'label' => Mage::helper('clnews')->__('Keywords'),
91
+ 'title' => Mage::helper('clnews')->__('Meta Keywords'),
92
+ 'style' => 'width: 520px;',
93
+ ));
94
+
95
+ $fieldset->addField('meta_description', 'editor', array(
96
+ 'name' => 'meta_description',
97
+ 'label' => Mage::helper('clnews')->__('Description'),
98
+ 'title' => Mage::helper('clnews')->__('Meta Description'),
99
+ 'style' => 'width: 520px;',
100
+ ));
101
+
102
+ $fieldset = $form->addFieldset('news_options_data',
103
+ array('legend'=>Mage::helper('clnews')->__('Advanced Post Options')));
104
+
105
+ $fieldset->addField('author', 'text', array(
106
+ 'label' => Mage::helper('clnews')->__('Author name'),
107
+ 'name' => 'author',
108
+ 'style' => 'width: 520px;',
109
+ 'after_element_html' => '<span class="hint"><p class="note">Leave blank to disable</p></span>',
110
+ ));
111
+
112
+ if ( Mage::getSingleton('adminhtml/session')->getNewsData() ) {
113
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
114
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
115
+ } elseif ( Mage::registry('clnews_data') ) {
116
+ $form->setValues(Mage::registry('clnews_data')->getData());
117
+ }
118
+ $this->setForm($form);
119
+ return $this;
120
+ }
121
+
122
+ public function getTimeValues($start, $end)
123
+ {
124
+ $values = array();
125
+ for($i=$start; $i<=$end; $i++) {
126
+ $values[] = array('label' => (strlen($i)>1)?$i:('0'.$i), 'value' => $i);
127
+ }
128
+ return $values;
129
+ }
130
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Tab/Info.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News_Edit_Tab_Info extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ public function initForm()
21
+ {
22
+
23
+ $form = new Varien_Data_Form();
24
+
25
+ $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('clnews')->__('News information')));
26
+
27
+ $fieldset->addField('status', 'select', array(
28
+ 'label' => Mage::helper('clnews')->__('Status'),
29
+ 'name' => 'status',
30
+ 'values' => array(
31
+ array(
32
+ 'value' => 1,
33
+ 'label' => Mage::helper('clnews')->__('Enabled'),
34
+ ),
35
+
36
+ array(
37
+ 'value' => 2,
38
+ 'label' => Mage::helper('clnews')->__('Disabled'),
39
+ ),
40
+ ),
41
+ ));
42
+
43
+ $fieldset->addField('title', 'text', array(
44
+ 'label' => Mage::helper('clnews')->__('Title'),
45
+ 'class' => 'required-entry',
46
+ 'required' => true,
47
+ 'name' => 'title',
48
+ ));
49
+
50
+ $fieldset->addField('url_key', 'text', array(
51
+ 'label' => Mage::helper('clnews')->__('URL Key'),
52
+ 'title' => Mage::helper('clnews')->__('URL Key'),
53
+ 'class' => 'required-entry',
54
+ 'required' => true,
55
+ 'name' => 'url_key',
56
+ 'class' => 'validate-identifier',
57
+ 'after_element_html' => '<div class="hint"><p class="note">e.g. domain.com/news/url_key</p></div>',
58
+ ));
59
+
60
+ /**
61
+ * Check is single store mode
62
+ */
63
+ if (!Mage::app()->isSingleStoreMode()) {
64
+ $fieldset->addField('store_id', 'multiselect', array(
65
+ 'name' => 'stores[]',
66
+ 'label' => Mage::helper('clnews')->__('Store View'),
67
+ 'title' => Mage::helper('clnews')->__('Store View'),
68
+ 'required' => true,
69
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
70
+ ));
71
+ }
72
+ else {
73
+ $fieldset->addField('store_id', 'hidden', array(
74
+ 'name' => 'stores[]',
75
+ 'value' => Mage::app()->getStore(true)->getId()
76
+ ));
77
+ }
78
+
79
+ $categories = array();
80
+ $collection = Mage::getModel('clnews/category')->getCollection()->setOrder('sort_order', 'asc');
81
+ foreach ($collection as $cat) {
82
+ $categories[] = ( array(
83
+ 'label' => (string)$cat->getTitle(),
84
+ 'value' => $cat->getCategoryId()
85
+ ));
86
+ }
87
+ $fieldset->addField('category_id', 'multiselect', array(
88
+ 'name' => 'categories[]',
89
+ 'label' => Mage::helper('clnews')->__('Category'),
90
+ 'title' => Mage::helper('clnews')->__('Category'),
91
+ 'required' => false,
92
+ 'style' => 'height:100px',
93
+ 'values' => $categories,
94
+ ));
95
+
96
+ $fieldset->addField('comments_enabled', 'select', array(
97
+ 'label' => Mage::helper('clnews')->__('Comments'),
98
+ 'name' => 'comments_enabled',
99
+ 'values' => array(
100
+ array(
101
+ 'value' => 1,
102
+ 'label' => Mage::helper('clnews')->__('Enabled'),
103
+ ),
104
+
105
+ array(
106
+ 'value' => 0,
107
+ 'label' => Mage::helper('clnews')->__('Disabled'),
108
+ ),
109
+ ),
110
+ ));
111
+ $newsCollection = Mage::getModel('clnews/news')->getCollection()
112
+ ->addFieldToFilter('news_id', $this->getRequest()->getParam('id'));
113
+ $fieldset->addField('document_save', 'file', array(
114
+ 'label' => Mage::helper('clnews')->__('File'),
115
+ 'required' => false,
116
+ 'name' => 'document_save',
117
+ ));
118
+ $file = $newsCollection->getData();
119
+ if ($this->getRequest()->getParam('id')) {
120
+ $documents = $file[0]['document'];
121
+ $full_path = $file[0]['full_path_document'];
122
+ $tag = $file[0]['tags'];
123
+ } else {
124
+ $documents = NULL;
125
+ $full_path = '';
126
+ $tag = '';
127
+ }
128
+ if ($documents) {
129
+ $fieldset->addField('is_delete', 'checkbox', array(
130
+ 'name' => 'is_delete',
131
+ 'label' => Mage::helper('clnews')->__('Delete File'),
132
+ 'after_element_html' => '<a href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'clnews' . DS . $documents . '" >' . $documents. '</a>',
133
+ ));
134
+
135
+ $fieldset->addField('full_path_document', 'hidden', array(
136
+ 'name' => 'full_path_document',
137
+ 'value' => $full_path,
138
+ ));
139
+ }
140
+
141
+ $fieldset->addField('link', 'text', array(
142
+ 'label' => Mage::helper('clnews')->__('Link Name'),
143
+ 'title' => Mage::helper('clnews')->__('Link Name'),
144
+ 'name' => 'link',
145
+ 'after_element_html' => '<div class="hint"><p class="note">e.g. Download attached document - default</p></div>',
146
+ ));
147
+
148
+ $fieldset->addField('tags', 'text', array(
149
+ 'label' => Mage::helper('clnews')->__('Add Tags'),
150
+ 'title' => Mage::helper('clnews')->__('Add Tags'),
151
+ 'name' => 'tags',
152
+ 'value' => $tag,
153
+ 'after_element_html' => '<div class="hint"><p class="note">Use comma for multiple words</p></div>',
154
+ ));
155
+
156
+ $fieldset->addField('use_full_img', 'checkbox', array(
157
+ 'label' => Mage::helper('clnews')->__('Use Full Description Image'),
158
+ 'required' => false,
159
+ 'name' => 'use_full_img',
160
+ 'checked' => 'checked',
161
+ 'onclick' => 'checkboxSwitch();'
162
+ ));
163
+
164
+ $fieldset->addField('image_short_content', 'image', array(
165
+ 'label' => Mage::helper('clnews')->__('Image for Short Description'),
166
+ 'required' => false,
167
+ 'name' => 'image_short_content',
168
+ 'after_element_html' => '<script type="text/javascript">
169
+ if (!document.getElementById("use_full_img").checked) {
170
+ document.getElementById("image_short_content").disabled=0;
171
+ } else {
172
+ document.getElementById("image_short_content").disabled=1;
173
+ }
174
+
175
+ function checkboxSwitch(){
176
+ if (!document.getElementById("use_full_img").checked) {
177
+ document.getElementById("image_short_content").disabled=0;
178
+ } else {
179
+ document.getElementById("image_short_content").disabled=1;
180
+ }
181
+ };
182
+ </script>',
183
+ ));
184
+
185
+ $fieldset->addField('short_height_resize', 'text', array(
186
+ 'label' => Mage::helper('clnews')->__('Resize Image Height'),
187
+ 'title' => Mage::helper('clnews')->__('Resize Image Height'),
188
+ 'name' => 'short_height_resize',
189
+ 'style' => 'width: 50px;',
190
+ 'after_element_html' => '<span class="hint">px</span>',
191
+ ));
192
+
193
+ $fieldset->addField('short_width_resize', 'text', array(
194
+ 'label' => Mage::helper('clnews')->__('Resize Image Width'),
195
+ 'title' => Mage::helper('clnews')->__('Resize Image Width'),
196
+ 'name' => 'short_width_resize',
197
+ 'style' => 'width: 50px;',
198
+ 'after_element_html' => '<span class="hint">px</span>',
199
+ ));
200
+
201
+ $fieldset->addField('image_short_content_show', 'select', array(
202
+ 'label' => Mage::helper('clnews')->__('Show Image'),
203
+ 'required' => false,
204
+ 'name' => 'image_short_content_show',
205
+ 'values' => array(
206
+ array(
207
+ 'value' => 1,
208
+ 'label' => Mage::helper('clnews')->__('Yes'),
209
+ ),
210
+
211
+ array(
212
+ 'value' => 0,
213
+ 'label' => Mage::helper('clnews')->__('No'),
214
+ ),
215
+ ),
216
+ ));
217
+
218
+ $fieldset->addField('short_content', 'editor', array(
219
+ 'name' => 'short_content',
220
+ 'label' => Mage::helper('clnews')->__('Short Description'),
221
+ 'title' => Mage::helper('clnews')->__('Short Description'),
222
+ 'config' => Mage::getSingleton('clnews/wysiwyg_config')->getConfig()
223
+ ));
224
+
225
+ $fieldset->addField('image_full_content', 'image', array(
226
+ 'label' => Mage::helper('clnews')->__('Image for Full Description'),
227
+ 'required' => false,
228
+ 'name' => 'image_full_content',
229
+ ));
230
+
231
+ $fieldset->addField('full_height_resize', 'text', array(
232
+ 'label' => Mage::helper('clnews')->__('Resize Image Height'),
233
+ 'title' => Mage::helper('clnews')->__('Resize Image Height'),
234
+ 'name' => 'full_height_resize',
235
+ 'style' => 'width: 50px;',
236
+ 'after_element_html' => '<span class="hint">px</span>',
237
+ ));
238
+
239
+ $fieldset->addField('full_width_resize', 'text', array(
240
+ 'label' => Mage::helper('clnews')->__('Resize Image Width'),
241
+ 'title' => Mage::helper('clnews')->__('Resize Image Width'),
242
+ 'name' => 'full_width_resize',
243
+ 'style' => 'width: 50px;',
244
+ 'after_element_html' => '<span class="hint">px</span>',
245
+ ));
246
+
247
+ $fieldset->addField('image_full_content_show', 'select', array(
248
+ 'label' => Mage::helper('clnews')->__('Show Image'),
249
+ 'required' => false,
250
+ 'name' => 'image_full_content_show',
251
+ 'values' => array(
252
+ array(
253
+ 'value' => 1,
254
+ 'label' => Mage::helper('clnews')->__('Yes'),
255
+ ),
256
+
257
+ array(
258
+ 'value' => 0,
259
+ 'label' => Mage::helper('clnews')->__('No'),
260
+ ),
261
+ ),
262
+ ));
263
+
264
+
265
+ $fieldset->addField('full_content', 'editor', array(
266
+ 'name' => 'full_content',
267
+ 'label' => Mage::helper('clnews')->__('Full Description'),
268
+ 'title' => Mage::helper('clnews')->__('Full Description'),
269
+ 'style' => 'height:36em',
270
+ 'config' => Mage::getSingleton('clnews/wysiwyg_config')->getConfig()
271
+ ));
272
+
273
+
274
+ if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
275
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
276
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
277
+ } elseif ( Mage::registry('clnews_data') ) {
278
+ $form->setValues(Mage::registry('clnews_data')->getData());
279
+ }
280
+ $this->setForm($form);
281
+ return $this;
282
+ }
283
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News/Edit/Tabs.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('news_tabs');
24
+ $this->setDestElementId('edit_form');
25
+ $this->setTitle(Mage::helper('clnews')->__('Main Information'));
26
+ }
27
+
28
+ protected function _beforeToHtml()
29
+ {
30
+ $this->addTab('info', array(
31
+ 'label' => Mage::helper('clnews')->__('Main Information'),
32
+ 'content' => $this->getLayout()->createBlock('clnews/adminhtml_news_edit_tab_info')->initForm()->toHtml(),
33
+ ));
34
+
35
+ $this->addTab('additional', array(
36
+ 'label' => Mage::helper('clnews')->__('Additional Options'),
37
+ 'content' => $this->getLayout()
38
+ ->createBlock('clnews/adminhtml_news_edit_tab_additional')->initForm()->toHtml(),
39
+ ));
40
+
41
+ return parent::_beforeToHtml();
42
+ }
43
+ }
app/code/community/CommerceLab/News/Block/Adminhtml/News/Grid.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Adminhtml_News_Grid extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('newsGrid');
24
+ $this->setDefaultSort('news_time');
25
+ $this->setDefaultDir('DESC');
26
+ $this->setSaveParametersInSession(true);
27
+ }
28
+
29
+ protected function _prepareCollection()
30
+ {
31
+ $collection = Mage::getModel('clnews/news')->getCollection();
32
+ if (!Mage::app()->isSingleStoreMode()) {
33
+ $collection->getSelect()->joinLeft('clnews_news_store', 'main_table.news_id = clnews_news_store.news_id', array('clnews_news_store.store_id as store_id'));
34
+ }
35
+ $this->setCollection($collection);
36
+ return parent::_prepareCollection();
37
+ }
38
+
39
+ protected function _prepareColumns()
40
+ {
41
+ $this->addColumn('news_id', array(
42
+ 'header' => Mage::helper('clnews')->__('ID'),
43
+ 'align' =>'right',
44
+ 'width' => '50',
45
+ 'index' => 'news_id',
46
+ ));
47
+
48
+ $this->addColumn('title', array(
49
+ 'header' => Mage::helper('clnews')->__('Title'),
50
+ 'align' =>'left',
51
+ 'index' => 'title',
52
+ ));
53
+
54
+ $this->addColumn('url_key', array(
55
+ 'header' => Mage::helper('clnews')->__('URL Key'),
56
+ 'align' => 'left',
57
+ 'index' => 'url_key',
58
+ ));
59
+
60
+ $this->addColumn('author', array(
61
+ 'header' => Mage::helper('clnews')->__('Author'),
62
+ 'index' => 'author',
63
+ ));
64
+
65
+ if (!Mage::app()->isSingleStoreMode()) {
66
+ $this->addColumn('store_id', array(
67
+ 'header' => Mage::helper('cms')->__('Store View'),
68
+ 'index' => 'store_id',
69
+ 'type' => 'store',
70
+ 'store_all' => true,
71
+ 'store_view' => true,
72
+ 'sortable' => false,
73
+ 'filter_condition_callback'
74
+ => array($this, '_filterStoreCondition'),
75
+ ));
76
+ }
77
+
78
+ $this->addColumn('created_time', array(
79
+ 'header' => Mage::helper('clnews')->__('Created'),
80
+ 'align' => 'left',
81
+ 'width' => '100',
82
+ 'type' => 'datetime',
83
+ 'default' => '--',
84
+ 'index' => 'created_time',
85
+ ));
86
+
87
+ $this->addColumn('update_time', array(
88
+ 'header' => Mage::helper('clnews')->__('Updated'),
89
+ 'align' => 'left',
90
+ 'width' => '100',
91
+ 'type' => 'datetime',
92
+ 'default' => '--',
93
+ 'index' => 'update_time',
94
+ ));
95
+
96
+ $this->addColumn('status', array(
97
+ 'header' => Mage::helper('clnews')->__('Status'),
98
+ 'align' => 'left',
99
+ 'width' => '70',
100
+ 'index' => 'status',
101
+ 'type' => 'options',
102
+ 'options' => array(
103
+ 1 => Mage::helper('clnews')->__('Enabled'),
104
+ 2 => Mage::helper('clnews')->__('Disabled')
105
+ ),
106
+ ));
107
+
108
+ $this->addColumn('action',
109
+ array(
110
+ 'header' => Mage::helper('clnews')->__('Action'),
111
+ 'width' => '60',
112
+ 'type' => 'action',
113
+ 'getter' => 'getId',
114
+ 'actions' => array(
115
+ array(
116
+ 'caption' => Mage::helper('clnews')->__('Edit'),
117
+ 'url' => array('base'=> '*/*/edit'),
118
+ 'field' => 'id'
119
+ ),
120
+ ),
121
+ 'filter' => false,
122
+ 'sortable' => false,
123
+ 'index' => 'stores',
124
+ 'is_system' => true,
125
+ ));
126
+
127
+ $this->addColumn('view_comments',
128
+ array(
129
+ 'header' => Mage::helper('clnews')->__('Comments'),
130
+ 'width' => '100',
131
+ 'type' => 'action',
132
+ 'getter' => 'getId',
133
+ 'actions' => array(
134
+ array(
135
+ 'caption' => Mage::helper('clnews')->__('View comments'),
136
+ 'url' => array('base'=> 'clnews/adminhtml_comment/index'),
137
+ 'field' => 'news_id'
138
+ )
139
+ ),
140
+ 'filter' => false,
141
+ 'sortable' => false,
142
+ 'index' => 'stores',
143
+ 'is_system' => true,
144
+ ));
145
+
146
+ return parent::_prepareColumns();
147
+ }
148
+
149
+ protected function _prepareMassaction()
150
+ {
151
+ $this->setMassactionIdField('news_id');
152
+ $this->getMassactionBlock()->setFormFieldName('clnews');
153
+
154
+ $this->getMassactionBlock()->addItem('delete', array(
155
+ 'label' => Mage::helper('clnews')->__('Delete'),
156
+ 'url' => $this->getUrl('*/*/massDelete'),
157
+ 'confirm' => Mage::helper('clnews')->__('Are you sure?')
158
+ ));
159
+
160
+ $statuses = array(
161
+ 1 => Mage::helper('clnews')->__('Enabled'),
162
+ 0 => Mage::helper('clnews')->__('Disabled')
163
+ );
164
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
165
+ $this->getMassactionBlock()->addItem('status', array(
166
+ 'label'=> Mage::helper('clnews')->__('Change status'),
167
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
168
+ 'additional' => array(
169
+ 'visibility' => array(
170
+ 'name' => 'status',
171
+ 'type' => 'select',
172
+ 'class' => 'required-entry',
173
+ 'label' => Mage::helper('clnews')->__('Status'),
174
+ 'values' => $statuses
175
+ )
176
+ )
177
+ ));
178
+ return $this;
179
+ }
180
+
181
+ protected function _filterStoreCondition($collection, $column)
182
+ {
183
+ if (!$value = $column->getFilter()->getValue()) {
184
+ return;
185
+ }
186
+
187
+ $this->getCollection()->addStoreFilter($value);
188
+ }
189
+
190
+ public function getRowUrl($row)
191
+ {
192
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
193
+ }
194
+ }
app/code/community/CommerceLab/News/Block/News.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_News extends Mage_Core_Block_Template
19
+ {
20
+ protected $_pagesCount = null;
21
+ protected $_currentPage = null;
22
+ protected $_itemsOnPage = 10;
23
+ protected $_pages;
24
+ protected $_latestItemsCount = 2;
25
+
26
+ protected function _construct()
27
+ {
28
+ $this->_currentPage = $this->getRequest()->getParam('page');
29
+ if (!$this->_currentPage) {
30
+ $this->_currentPage=1;
31
+ }
32
+
33
+ $itemsPerPage = (int)Mage::getStoreConfig('clnews/news/itemsperpage');
34
+ if ($itemsPerPage > 0) {
35
+ $this->_itemsOnPage = $itemsPerPage;
36
+ }
37
+
38
+ $latestItemsCount = (int)Mage::getStoreConfig('clnews/news/latestitemscount');
39
+ if ($latestItemsCount > 0) {
40
+ $this->_latestItemsCount = $latestItemsCount;
41
+ }
42
+ }
43
+
44
+ protected function _prepareLayout()
45
+ {
46
+ if ($head = $this->getLayout()->getBlock('head')) {
47
+ // show breadcrumbs
48
+ $moduleName = $this->getRequest()->getModuleName();
49
+ $showBreadcrumbs = (int)Mage::getStoreConfig('clnews/news/showbreadcrumbs');
50
+ if ($showBreadcrumbs && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) && ($moduleName=='clnews')) {
51
+ $breadcrumbs->addCrumb('home',
52
+ array(
53
+ 'label'=>Mage::helper('clnews')->__('Home'),
54
+ 'title'=>Mage::helper('clnews')->__('Go to Home Page'),
55
+ 'link'=> Mage::getBaseUrl()));
56
+ $newsBreadCrumb = array(
57
+ 'label'=>Mage::helper('clnews')->__(Mage::getStoreConfig('clnews/news/title')),
58
+ 'title'=>Mage::helper('clnews')->__('Return to ' .Mage::helper('clnews')->__('News')),
59
+ );
60
+ if ($this->getCategoryKey()) {
61
+ $newsBreadCrumb['link'] = Mage::getUrl($this->getAlias());
62
+ }
63
+ $breadcrumbs->addCrumb('news', $newsBreadCrumb);
64
+
65
+ if ($this->getCategoryKey()) {
66
+ $categories = Mage::getModel('clnews/category')
67
+ ->getCollection()
68
+ ->addFieldToFilter('url_key', $this->getCategoryKey())
69
+ ->setPageSize(1);
70
+ $category = $categories->getFirstItem();
71
+ $breadcrumbs->addCrumb('category',
72
+ array(
73
+ 'label'=>$category->getTitle(),
74
+ 'title'=>Mage::helper('clnews')->__('Go to Home Page'),
75
+ ));
76
+ }
77
+ }
78
+ // set default meta data
79
+ $head->setTitle(Mage::getStoreConfig('clnews/news/metatitle'));
80
+ $head->setKeywords(Mage::getStoreConfig('clnews/news/metakeywords'));
81
+ $head->setDescription(Mage::getStoreConfig('clnews/news/metadescription'));
82
+
83
+ // set category meta data if defined
84
+ $currentCategory = $this->getCurrentCategory();
85
+ if ($currentCategory!=null) {
86
+ if ($currentCategory->getTitle()!='') {
87
+ $head->setTitle($currentCategory->getTitle());
88
+ }
89
+ if ($currentCategory->getMetaKeywords()!='') {
90
+ $head->setKeywords($currentCategory->getMetaKeywords());
91
+ }
92
+ if ($currentCategory->getMetaDescription()!='') {
93
+ $head->setDescription($currentCategory->getMetaDescription());
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ public function getCategoryKey()
100
+ {
101
+ return $this->getRequest()->getParam('category');
102
+ }
103
+
104
+ public function getNewsItems()
105
+ {
106
+ $collection = Mage::getModel('clnews/news')->getCollection();
107
+
108
+ if ($category = $this->getRequest()->getParam('category')) {
109
+ /*$collection
110
+ ->addCategoryFilter($category);
111
+ $this->setCategory($category);*/
112
+ $catCollection = Mage::getModel('clnews/category')->getCollection()
113
+ ->addFieldToFilter('url_key', $category)
114
+ ->addStoreFilter(Mage::app()->getStore()->getId());
115
+ $categoryId = $catCollection->getData();
116
+ if ($categoryId[0]['category_id']) {
117
+ $collection->getSelect()->join('clnews_news_category', 'main_table.news_id = clnews_news_category.news_id','category_id');
118
+ $collection->getSelect()->where('clnews_news_category.category_id =?', $categoryId[0]['category_id']);
119
+ }
120
+ } else {
121
+ $collection->addStoreFilter(Mage::app()->getStore()->getId());
122
+ }
123
+ if ($tag = $this->getRequest()->getParam('q')) {
124
+ $collection = Mage::getModel('clnews/news')->getCollection()->setOrder('news_time', 'desc');
125
+ if (count(Mage::app()->getStores()) > 1) {
126
+ $collection->getSelect()->join('clnews_news_store', 'main_table.news_id = clnews_news_store.news_id','store_id');
127
+ $collection->getSelect()->where('clnews_news_store.store_id =?', Mage::app()->getStore()->getId());
128
+ }
129
+ $tag = urldecode($tag);
130
+ $collection->getSelect()->where("tags LIKE '%". $tag . "%'");
131
+ }
132
+
133
+ $collection
134
+ ->addEnableFilter(1)
135
+ ->addFieldToFilter('publicate_from_time', array('or' => array(
136
+ 0 => array('date' => true, 'to' => date('Y-m-d H:i:s')),
137
+ 1 => array('is' => new Zend_Db_Expr('null'))),
138
+ ), 'left')
139
+ ->addFieldToFilter('publicate_to_time', array('or' => array(
140
+ 0 => array('date' => true, 'from' => date('Y-m-d H:i:s')),
141
+ 1 => array('is' => new Zend_Db_Expr('null'))),
142
+ ), 'left')
143
+ ->setOrder('news_time ', 'desc');
144
+ $this->_pagesCount = ceil($collection->getSize()/$this->_itemsOnPage);
145
+ for ($i=1; $i<=$this->_pagesCount;$i++) {
146
+ $this->_pages[] = $i;
147
+ }
148
+ $this->setLastPageNum($this->_pagesCount);
149
+
150
+ $collection->setPageSize($this->_itemsOnPage);
151
+ $collection->setCurPage($this->_currentPage);
152
+
153
+ foreach ($collection as $item) {
154
+ $comments = Mage::getModel('clnews/comment')->getCollection()
155
+ ->addNewsFilter($item->getNewsId())
156
+ ->addApproveFilter(CommerceLab_News_Helper_Data::APPROVED_STATUS);
157
+ $item->setCommentsCount(count($comments));
158
+ }
159
+ return $collection;
160
+ }
161
+
162
+ public function getLatestNewsItems()
163
+ {
164
+ $collection = Mage::getModel('clnews/news')->getCollection()
165
+ ->addStoreFilter(Mage::app()->getStore()->getId());
166
+ $collection->setPageSize($this->_latestItemsCount);
167
+ $collection
168
+ ->addEnableFilter(1)
169
+ ->addFieldToFilter('publicate_from_time', array('or' => array(
170
+ 0 => array('date' => true, 'to' => date('Y-m-d H:i:s')),
171
+ 1 => array('is' => new Zend_Db_Expr('null'))),
172
+ ), 'left')
173
+ ->addFieldToFilter('publicate_to_time', array('or' => array(
174
+ 0 => array('date' => true, 'from' => date('Y-m-d H:i:s')),
175
+ 1 => array('is' => new Zend_Db_Expr('null'))),
176
+ ), 'left')
177
+ ->setOrder('news_time ', 'desc');
178
+ return $collection;
179
+ }
180
+
181
+ public function getCategories()
182
+ {
183
+ $collection = Mage::getModel('clnews/category')->getCollection()
184
+ ->addStoreFilter(Mage::app()->getStore()->getId())
185
+ ->setOrder('sort_order ', 'asc');
186
+
187
+ foreach ($collection as $item) {
188
+ $item->setLink(Mage::getBaseUrl().$this->getAlias().'/category/'.$item->getUrlKey().'.html');
189
+ }
190
+ return $collection;
191
+ }
192
+
193
+ public function getTopLink()
194
+ {
195
+ $route = Mage::helper('clnews')->getRoute();
196
+ $title = Mage::helper('clnews')->__(Mage::getStoreConfig('clnews/news/title'));
197
+ $this->getParentBlock()->addLink($title, $route, $title, true, array(), 15, null, 'class="top-link-news"');
198
+ }
199
+
200
+ public function getItemUrl($itemId) {
201
+ return $this->getUrl($this->getAlias().'/newsitem/view', array('id' => $itemId));
202
+ }
203
+
204
+ public function isFirstPage()
205
+ {
206
+ if ($this->_currentPage==1) {
207
+ return true;
208
+ }
209
+ return false;
210
+ }
211
+
212
+ public function isLastPage()
213
+ {
214
+ if ($this->_currentPage==$this->_pagesCount) {
215
+ return true;
216
+ }
217
+ return false;
218
+ }
219
+
220
+ public function isPageCurrent($page)
221
+ {
222
+ if ($page==$this->_currentPage) {
223
+ return true;
224
+ }
225
+ return false;
226
+ }
227
+
228
+ public function getPageUrl($page)
229
+ {
230
+ if ($category = $this->getRequest()->getParam('category')) {
231
+ return $this->getUrl('*', array('category' => $category, 'page' => $page));
232
+ } else {
233
+ return $this->getUrl('*', array('page' => $page));
234
+ }
235
+ }
236
+
237
+ public function getNextPageUrl()
238
+ {
239
+ $page = $this->_currentPage+1;
240
+ return $this->getPageUrl($page);
241
+ }
242
+
243
+ public function getPreviousPageUrl()
244
+ {
245
+ $page = $this->_currentPage-1;
246
+ return $this->getPageUrl($page);
247
+ }
248
+
249
+ public function getPages()
250
+ {
251
+ return $this->_pages;
252
+ }
253
+
254
+ public function getAlias()
255
+ {
256
+ return Mage::helper('clnews')->getRoute();
257
+ }
258
+
259
+ public function getCurrentCategory()
260
+ {
261
+ if ($this->getCategoryKey()) {
262
+ $categories = Mage::getModel('clnews/category')
263
+ ->getCollection()
264
+ ->addFieldToFilter('url_key', $this->getCategoryKey())
265
+ ->setPageSize(1);
266
+ $category = $categories->getFirstItem();
267
+ return $category;
268
+ }
269
+ return null;
270
+ }
271
+ }
app/code/community/CommerceLab/News/Block/Newsitem.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Newsitem extends Mage_Core_Block_Template
19
+ {
20
+ protected $_pagesCount = null;
21
+ protected $_currentPage = null;
22
+ protected $_itemsOnPage = 10;
23
+ protected $_pages;
24
+
25
+ protected function _construct()
26
+ {
27
+ $this->_currentPage = $this->getRequest()->getParam('page');
28
+ if (!$this->_currentPage) {
29
+ $this->_currentPage=1;
30
+ }
31
+
32
+ $itemsPerPage = (int)Mage::getStoreConfig('clnews/comments/commentsperpage');
33
+ if ($itemsPerPage > 0) {
34
+ $this->_itemsOnPage = $itemsPerPage;
35
+ }
36
+ }
37
+
38
+ protected function _prepareLayout()
39
+ {
40
+ if ($head = $this->getLayout()->getBlock('head')) {
41
+ $newsitem = $this->getNewsItem();
42
+
43
+ $showBreadcrumbs = (int)Mage::getStoreConfig('clnews/news/showbreadcrumbs');
44
+ if ($showBreadcrumbs && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))) {
45
+ $breadcrumbs->addCrumb('home',
46
+ array(
47
+ 'label'=>Mage::helper('clnews')->__('Home'),
48
+ 'title'=>Mage::helper('clnews')->__('Go to Home Page'),
49
+ 'link'=>Mage::getBaseUrl()
50
+ ));
51
+
52
+ $breadcrumbs->addCrumb('news',
53
+ array(
54
+ 'label'=>Mage::helper('clnews')->__(Mage::getStoreConfig('clnews/news/title')),
55
+ 'title'=>Mage::helper('clnews')->__('Return to ' .Mage::helper('clnews')->__('News')),
56
+ 'link'=>Mage::getUrl(Mage::helper('clnews')->getRoute())
57
+ ));
58
+
59
+ if ($category = $newsitem->getCategory()) {
60
+ $breadcrumbs->addCrumb('category',
61
+ array(
62
+ 'label' => $category->getTitle(),
63
+ 'title' => Mage::helper('clnews')->__('Return to ' .$category->getTitle()),
64
+ 'link' => Mage::getBaseUrl().Mage::helper('clnews')->getRoute().'/category/'.$category->getUrlKey().'.html'
65
+ ));
66
+ }
67
+
68
+ $breadcrumbs->addCrumb('item',
69
+ array(
70
+ 'label'=>$newsitem->getTitle(),
71
+ 'title'=>$newsitem->getTitle()
72
+ ));
73
+ }
74
+
75
+ $head->setTitle($newsitem->getTitle());
76
+ $head->setKeywords($newsitem->getMetaKeywords());
77
+ $head->setDescription($newsitem->getMetaDescription());
78
+ }
79
+ }
80
+
81
+ public function getNewsItem()
82
+ {
83
+ return Mage::registry('newsitem');
84
+ }
85
+
86
+ public function getComments()
87
+ {
88
+ $newsitem = $this->getNewsItem();
89
+
90
+ $collection = Mage::getModel('clnews/comment')->getCollection()
91
+ ->addNewsFilter($newsitem->getNewsId())
92
+ ->addApproveFilter(CommerceLab_News_Helper_Data::APPROVED_STATUS)
93
+ ->setOrder('created_time ', 'asc');
94
+ $this->_pagesCount = ceil($collection->getSize()/$this->_itemsOnPage);
95
+ for ($i=1; $i<=$this->_pagesCount;$i++) {
96
+ $this->_pages[] = $i;
97
+ }
98
+ $this->setLastPageNum($this->_pagesCount);
99
+
100
+ $collection->setPageSize($this->_itemsOnPage);
101
+ $collection->setCurPage($this->_currentPage);
102
+
103
+ return $collection;
104
+ }
105
+
106
+ public function getRequireLogin()
107
+ {
108
+ return Mage::getStoreConfig('clnews/comments/need_login');
109
+ }
110
+
111
+ public function getImageUrl()
112
+ {
113
+ $newsitem = $this->getNewsItem();
114
+ $image = Mage::getBaseUrl('media'). DS .$newsitem->getImage();
115
+ return $image;
116
+ }
117
+
118
+ public function getBackUrl()
119
+ {
120
+ $newsitem = $this->getNewsItem();
121
+ if ($category = $newsitem->getCategory()) {
122
+ return Mage::getBaseUrl().Mage::helper('clnews')->getRoute().'/category/'.$category->getUrlKey().'.html';
123
+ } else {
124
+ return $this->getUrl(Mage::helper('clnews')->getRoute());
125
+ }
126
+ }
127
+
128
+ public function getCategoryByNews($id)
129
+ {
130
+ $data = Mage::getModel('clnews/category')->getCategoryByNewsId($id);
131
+ $data = new Varien_Object($data);
132
+ $collection = Mage::getModel('clnews/category')->getCollection()
133
+ ->addStoreFilter(Mage::app()->getStore()->getId());
134
+ if ($data->getData('0/category_id')!= NULL) {
135
+ $collection->getSelect()->where('main_table.category_id =' . $data->getData('0/category_id'));
136
+ $category = $collection->getFirstItem();
137
+ return $category;
138
+ } else {
139
+ $category = $collection->getFirstItem();
140
+ return $category->setData('title','');
141
+ }
142
+ }
143
+
144
+ public function isFirstPage()
145
+ {
146
+ if ($this->_currentPage==1) {
147
+ return true;
148
+ }
149
+ return false;
150
+ }
151
+
152
+ public function isLastPage()
153
+ {
154
+ if ($this->_currentPage==$this->_pagesCount) {
155
+ return true;
156
+ }
157
+ return false;
158
+ }
159
+
160
+ public function isPageCurrent($page)
161
+ {
162
+ if ($page==$this->_currentPage) {
163
+ return true;
164
+ }
165
+ return false;
166
+ }
167
+
168
+ public function getPageUrl($page, $id)
169
+ {
170
+ if ($category = $this->getRequest()->getParam('category')) {
171
+ return $this->getUrl('*/newsitem/view', array('category' => $category, 'id' => $id, 'page' => $page));
172
+ } else {
173
+ return $this->getUrl('*/newsitem/view', array('id' => $id, 'page' => $page));
174
+ }
175
+ }
176
+
177
+ public function getNextPageUrl()
178
+ {
179
+ $page = $this->_currentPage+1;
180
+ return $this->getPageUrl($page);
181
+ }
182
+
183
+ public function getPreviousPageUrl($id)
184
+ {
185
+ $page = $this->_currentPage-1;
186
+ return $this->getPageUrl($page, $id);
187
+ }
188
+
189
+ public function getPages()
190
+ {
191
+ return $this->_pages;
192
+ }
193
+
194
+ public function getPrintLogoUrl ()
195
+ {
196
+ // load html logo
197
+ $logo = Mage::getStoreConfig('sales/identity/logo_html');
198
+ if (!empty($logo)) {
199
+ $logo = 'sales/store/logo_html/' . $logo;
200
+ }
201
+
202
+ // load default logo
203
+ if (empty($logo)) {
204
+ $logo = Mage::getStoreConfig('sales/identity/logo');
205
+ if (!empty($logo)) {
206
+ // prevent tiff format displaying in html
207
+ if (strtolower(substr($logo, -5)) === '.tiff' || strtolower(substr($logo, -4)) === '.tif') {
208
+ $logo = '';
209
+ }
210
+ else {
211
+ $logo = 'sales/store/logo/' . $logo;
212
+ }
213
+ }
214
+ }
215
+
216
+ // buld url
217
+ if (!empty($logo)) {
218
+ $logo = Mage::getStoreConfig('web/unsecure/base_media_url') . $logo;
219
+ }
220
+ else {
221
+ $logo = '';
222
+ }
223
+
224
+ return $logo;
225
+ }
226
+
227
+ public function getPrintLogoText()
228
+ {
229
+ return Mage::getStoreConfig('sales/identity/address');
230
+ }
231
+
232
+ public function getLang()
233
+ {
234
+ if (!$this->hasData('lang')) {
235
+ $this->setData('lang', substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
236
+ }
237
+ return $this->getData('lang');
238
+ }
239
+
240
+ public function getAbsoluteFooter()
241
+ {
242
+ return Mage::getStoreConfig('design/footer/absolute_footer');
243
+ }
244
+
245
+ public function getBodyClass()
246
+ {
247
+ return $this->_getData('body_class');
248
+ }
249
+
250
+ public function contentFilter($content)
251
+ {
252
+ $helper = Mage::helper('cms');
253
+ $processor = $helper->getPageTemplateProcessor();
254
+ $html = $processor->filter($content);
255
+ //$html = $this->getMessagesBlock()->getGroupedHtml() . $html;
256
+ return $html;
257
+ }
258
+ }
app/code/community/CommerceLab/News/Block/Rss.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Block_Rss extends Mage_Rss_Block_Abstract
19
+ {
20
+ protected function _toHtml()
21
+ {
22
+ $rssObj = Mage::getModel('rss/rss');
23
+
24
+ $data = array('title' => 'News',
25
+ 'description' => 'News',
26
+ 'link' => $this->getUrl('clnews/rss'),
27
+ 'charset' => 'UTF-8',
28
+ 'language' => Mage::getStoreConfig('general/locale/code')
29
+ );
30
+
31
+ $rssObj->_addHeader($data);
32
+
33
+ $collection = Mage::getModel('clnews/news')->getCollection()
34
+ ->addStoreFilter(Mage::app()->getStore()->getId())
35
+ ->setOrder('created_time ', 'desc');
36
+
37
+ $categoryId = $this->getRequest()->getParam('category');
38
+
39
+ if ($categoryId && $category = Mage::getSingleton('clnews/category')->load($categoryId)) {
40
+ $collection->addCategoryFilter($category->getUrlKey());
41
+ }
42
+
43
+ $collection->setPageSize((int)Mage::getStoreConfig('clnews/rss/posts'));
44
+ $collection->setCurPage(1);
45
+
46
+ if ($collection->getSize()>0) {
47
+ foreach ($collection as $item) {
48
+ $data = array(
49
+ 'title' => $item->getTitle(),
50
+ 'link' => $this->getUrl("clnews/newsitem/view", array("id" => $item->getId())),
51
+ 'description' => $item->getShortContent(),
52
+ 'lastUpdate' => strtotime($item->getNewsTime()),
53
+ );
54
+
55
+ $rssObj->_addEntry($data);
56
+ }
57
+ } else {
58
+ $data = array('title' => Mage::helper('clnews')->__('Cannot retrieve the news'),
59
+ 'description' => Mage::helper('clnews')->__('Cannot retrieve the news'),
60
+ 'link' => Mage::getUrl(),
61
+ 'charset' => 'UTF-8',
62
+ );
63
+ $rssObj->_addHeader($data);
64
+ }
65
+
66
+ return $rssObj->createRssXml();
67
+ }
68
+ }
app/code/community/CommerceLab/News/Controller/Router.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract
19
+ {
20
+ public function initControllerRouters($observer)
21
+ {
22
+ $front = $observer->getEvent()->getFront();
23
+ $news = new CommerceLab_News_Controller_Router();
24
+ $front->addRouter('clnews', $news);
25
+ }
26
+
27
+ public function match(Zend_Controller_Request_Http $request)
28
+ {
29
+
30
+ if (!Mage::app()->isInstalled()) {
31
+ Mage::app()->getFrontController()->getResponse()
32
+ ->setRedirect(Mage::getUrl('install'))
33
+ ->sendResponse();
34
+ exit;
35
+ }
36
+
37
+ $route = Mage::helper('clnews')->getRoute();
38
+
39
+ $identifier = $request->getPathInfo();
40
+
41
+ if (substr(str_replace("/", "", $identifier), 0, strlen($route)) != $route) {
42
+ return false;
43
+ }
44
+
45
+
46
+ $identifier = substr_replace($request->getPathInfo(), '', 0, strlen("/" . $route. "/"));
47
+ $identifier = str_replace('.html', '', $identifier);
48
+ $identifier = str_replace('.htm', '', $identifier);
49
+
50
+ if (substr($request->getPathInfo(), 0, 7) !== '/clnews') {
51
+ if ($identifier == '') {
52
+ $request->setModuleName('clnews')
53
+ ->setControllerName('index')
54
+ ->setActionName('index');
55
+ return true;
56
+ } elseif (substr($identifier, 0, 9) === 'category/') {
57
+ $len = strcspn($identifier, '/');
58
+ $key = substr($identifier, ($len+1));
59
+ $request->setModuleName('clnews')
60
+ ->setControllerName('index')
61
+ ->setActionName('index')
62
+ ->setParam('category', $key);
63
+ return true;
64
+ } elseif (substr($identifier, 0, 4) === 'rss/') {
65
+ $request->setModuleName('clnews')
66
+ ->setControllerName('rss')
67
+ ->setActionName('index');
68
+ return true;
69
+ } elseif ($pos = strpos($identifier, '/print/article/')) {
70
+ $param = substr($identifier, $pos+15);
71
+ $param = trim(str_replace('/', '', $param));
72
+ $request->setModuleName('clnews')
73
+ ->setControllerName('newsitem')
74
+ ->setActionName('print')
75
+ ->setParam('article', $param);
76
+ return true;
77
+ } elseif (substr($identifier, 0, 9) === 'newsitem/') {
78
+ $str = str_replace('newsitem/view/id/', '', $identifier);
79
+ $len = strcspn($identifier, '/');
80
+ $id = substr($identifier, 0, $len);
81
+ $request->setModuleName('clnews')
82
+ ->setControllerName('newsitem')
83
+ ->setActionName('view')
84
+ ->setParam('id', $id);
85
+ return true;
86
+ } elseif ($pos = strpos($identifier, '/q/')) {
87
+ $param = substr($identifier, $pos+2);
88
+ $param = trim(str_replace('/', '', $param));
89
+ $request->setModuleName('clnews')
90
+ ->setControllerName('index')
91
+ ->setActionName('index')
92
+ ->setParam('q', $param);
93
+ return true;
94
+ } elseif (substr($identifier, 0, 15) !== 'adminhtml_news/' && strpos($identifier, '/')
95
+ && substr($request->getPathInfo(), 0, strlen($route)+2) === '/'.$route.'/'
96
+ && strpos($identifier, 'category/') === false) {
97
+ $len = strcspn($identifier, '/');
98
+ $category = substr($identifier, 0, $len);
99
+ $key = substr($identifier, ($len+1));
100
+ $request->setModuleName('clnews')
101
+ ->setControllerName('newsitem')
102
+ ->setActionName('view')
103
+ ->setParams(array('category' => $category, 'key' => $key));
104
+ return true;
105
+ } elseif (substr($request->getPathInfo(), 0, strlen($route)+2) === '/'.$route.'/') {
106
+ $request->setModuleName('clnews')
107
+ ->setControllerName('newsitem')
108
+ ->setActionName('view')
109
+ ->setParam('key', $identifier);
110
+ return true;
111
+ }
112
+ }
113
+
114
+ return false;
115
+ }
116
+ }
app/code/community/CommerceLab/News/Helper/Data.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+ const UNAPPROVED_STATUS = 0;
21
+ const APPROVED_STATUS = 1;
22
+
23
+ const XML_PATH_ENABLED = 'news/news/enabled';
24
+ const XML_PATH_TITLE = 'news/news/title';
25
+ const XML_PATH_MENU_LEFT = 'news/news/menuLeft';
26
+ const XML_PATH_MENU_RIGHT = 'news/news/menuRoght';
27
+ const XML_PATH_FOOTER_ENABLED = 'news/news/footerEnabled';
28
+ const XML_PATH_LAYOUT = 'news/news/layout';
29
+
30
+ public function isEnabled()
31
+ {
32
+ return Mage::getStoreConfig( self::XML_PATH_ENABLED );
33
+ }
34
+
35
+ public function isTitle()
36
+ {
37
+ return Mage::getStoreConfig( self::XML_PATH_TITLE );
38
+ }
39
+
40
+ public function isMenuLeft()
41
+ {
42
+ return Mage::getStoreConfig( self::XML_PATH_MENU_LEFT );
43
+ }
44
+
45
+ public function isMenuRight()
46
+ {
47
+ return Mage::getStoreConfig( self::XML_PATH_MENU_RIGHT );
48
+ }
49
+
50
+ public function isFooterEnabled()
51
+ {
52
+ return Mage::getStoreConfig( self::XML_PATH_FOOTER_ENABLED );
53
+ }
54
+
55
+ public function isLayout()
56
+ {
57
+ return Mage::getStoreConfig( self::XML_PATH_LAYOUT );
58
+ }
59
+
60
+ public function getUserName()
61
+ {
62
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
63
+ return trim("{$customer->getFirstname()} {$customer->getLastname()}");
64
+ }
65
+
66
+ public function getRoute(){
67
+ $route = Mage::getStoreConfig('clnews/news/route');
68
+ if (!$route){
69
+ $route = "clnews";
70
+ }
71
+ return $route;
72
+ }
73
+
74
+ public function getUserEmail()
75
+ {
76
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
77
+ return $customer->getEmail();
78
+ }
79
+
80
+ public function getRssLink($categoryId)
81
+ {
82
+ if ($categoryId) {
83
+ return Mage::getUrl('clnews/rss', array('category' => $categoryId));
84
+ } else {
85
+ return Mage::getUrl('clnews/rss');
86
+ }
87
+ }
88
+
89
+ public function getFileUrl($newsitem)
90
+ {
91
+ $file = Mage::getBaseDir('media'). 'clnews' . DS . $newsitem->getDocument();
92
+
93
+ return str_replace(Mage::getBaseDir('media'), Mage::getBaseUrl('media'), $file);
94
+ }
95
+
96
+ public function showAuthor()
97
+ {
98
+ return Mage::getStoreConfig('clnews/news/showauthorofnews');
99
+ }
100
+
101
+ public function showCategory()
102
+ {
103
+ return Mage::getStoreConfig('clnews/news/showcategoryofnews');
104
+ }
105
+
106
+ public function showDate()
107
+ {
108
+ return Mage::getStoreConfig('clnews/news/showdateofnews');
109
+ }
110
+
111
+ public function showTime()
112
+ {
113
+ return Mage::getStoreConfig('clnews/news/showtimeofnews');
114
+ }
115
+
116
+ public function enableLinkRoute()
117
+ {
118
+ return Mage::getStoreConfig('clnews/news/enablelinkrout');
119
+ }
120
+
121
+ public function getLinkRoute()
122
+ {
123
+ return Mage::getStoreConfig('clnews/news/linkrout');
124
+ }
125
+ public function getTagsAccess()
126
+ {
127
+ return Mage::getStoreConfig('clnews/news/tags');
128
+ }
129
+
130
+ public function getGoogleAccess()
131
+ {
132
+ return Mage::getStoreConfig('clnews/news/google');
133
+ }
134
+
135
+ public function getTwitterAccess()
136
+ {
137
+ return Mage::getStoreConfig('clnews/news/twitter');
138
+ }
139
+
140
+ public function getLinkedInAccess()
141
+ {
142
+ return Mage::getStoreConfig('clnews/news/linked_in');
143
+ }
144
+
145
+ public function getFaceBookAccess()
146
+ {
147
+ return Mage::getStoreConfig('clnews/news/facebook');
148
+ }
149
+
150
+ public function resizeImage($imageName, $width=NULL, $height=NULL, $imagePath=NULL)
151
+ {
152
+ $imagePath = str_replace("/", DS, $imagePath);
153
+ $imagePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $imageName;
154
+
155
+ if($width == NULL && $height == NULL) {
156
+ $width = 100;
157
+ $height = 100;
158
+ }
159
+ $resizePath = $width . 'x' . $height;
160
+ $resizePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $resizePath . DS . $imageName;
161
+
162
+ if (file_exists($imagePathFull) && !file_exists($resizePathFull)) {
163
+ $imageObj = new Varien_Image($imagePathFull);
164
+ $imageObj->constrainOnly(TRUE);
165
+ $imageObj->keepAspectRatio(TRUE);
166
+ $imageObj->resize($width,$height);
167
+ $imageObj->save($resizePathFull);
168
+ }
169
+
170
+ $imagePath=str_replace(DS, "/", $imagePath);
171
+ return Mage::getBaseUrl("media") . $imagePath . "/" . $resizePath . "/" . $imageName;
172
+ }
173
+ }
app/code/community/CommerceLab/News/Helper/Versions.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+
19
+ class CommerceLab_News_Helper_Versions extends Mage_Core_Helper_Abstract
20
+ {
21
+
22
+ const EE_PLATFORM = 100;
23
+ const PE_PLATFORM = 10;
24
+ const CE_PLATFORM = 0;
25
+
26
+ const ENTERPRISE_DETECT_COMPANY = 'Enterprise';
27
+ const ENTERPRISE_DETECT_EXTENSION = 'Enterprise';
28
+ const ENTERPRISE_DESIGN_NAME = "enterprise";
29
+ const PROFESSIONAL_DESIGN_NAME = "pro";
30
+
31
+ protected static $_platform = -1;
32
+
33
+ /**
34
+ * Checks which edition is used
35
+ * @return int
36
+ */
37
+ public static function getPlatform()
38
+ {
39
+ if (self::$_platform == -1) {
40
+ $pathToClaim = BP . DS . "app" . DS . "etc" . DS . "modules" . DS . self::ENTERPRISE_DETECT_COMPANY . "_" . self::ENTERPRISE_DETECT_EXTENSION . ".xml";
41
+ $pathToEEConfig = BP . DS . "app" . DS . "code" . DS . "core" . DS . self::ENTERPRISE_DETECT_COMPANY . DS . self::ENTERPRISE_DETECT_EXTENSION . DS . "etc" . DS . "config.xml";
42
+ $isCommunity = !file_exists($pathToClaim) || !file_exists($pathToEEConfig);
43
+ if ($isCommunity) {
44
+ self::$_platform = self::CE_PLATFORM;
45
+ } else {
46
+ $_xml = @simplexml_load_file($pathToEEConfig,'SimpleXMLElement', LIBXML_NOCDATA);
47
+ if(!$_xml===FALSE) {
48
+ $package = (string)$_xml->default->design->package->name;
49
+ $theme = (string)$_xml->install->design->theme->default;
50
+ $skin = (string)$_xml->stores->admin->design->theme->skin;
51
+ $isProffessional = ($package == self::PROFESSIONAL_DESIGN_NAME) && ($theme == self::PROFESSIONAL_DESIGN_NAME) && ($skin == self::PROFESSIONAL_DESIGN_NAME);
52
+ if ($isProffessional) {
53
+ self::$_platform = self::PE_PLATFORM;
54
+ return self::$_platform;
55
+ }
56
+ self::$_platform = self::EE_PLATFORM;
57
+ return self::$_platform;
58
+ }
59
+ self::$_platform = self::EE_PLATFORM;
60
+ }
61
+ }
62
+ return self::$_platform;
63
+ }
64
+
65
+ /**
66
+ * Convert platform from string to int and backwards
67
+ * @static
68
+ * @param $platformCode
69
+ * @return int|string
70
+ */
71
+ public static function convertPlatform($platformCode)
72
+ {
73
+ if (is_numeric($platformCode)) {
74
+ // Convert predefined to letters code
75
+ $platform = ($platformCode == self::EE_PLATFORM ? 'ee' : ($platformCode == self::PE_PLATFORM ? 'pe'
76
+ : 'ce'));
77
+ } elseif (is_string($platformCode)) {
78
+ $platformCode = strtolower($platformCode);
79
+ $platform = ($platformCode == 'ee' ? self::EE_PLATFORM : ($platformCode == 'pe' ? self::PE_PLATFORM
80
+ : self::CE_PLATFORM));
81
+ }else{$platform = self::CE_PLATFORM;}
82
+ return $platform;
83
+ }
84
+
85
+ public static function convertVersion($v)
86
+ {
87
+ $digits = @explode(".", $v);
88
+ $version = 0;
89
+ if (is_array($digits)) {
90
+ foreach ($digits as $k => $v) {
91
+ $version += ($v * pow(10, max(0, (3 - $k))));
92
+ }
93
+
94
+ }
95
+ return $version;
96
+ }
97
+ }
app/code/community/CommerceLab/News/Model/Category.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Category extends Mage_Core_Model_Abstract
19
+ {
20
+ protected function _construct(){
21
+ parent::_construct();
22
+ $this->_init('clnews/category');
23
+ }
24
+
25
+ public function getCategoryByNewsId($id)
26
+ {
27
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
28
+ $select = $db->select()
29
+ ->from(array('clnews_news_category'),
30
+ array('category_id'))
31
+ ->where('news_id = ?', $id);
32
+ $stmt = $db->query($select);
33
+ $result = $stmt->fetchAll();
34
+ return $result;
35
+ }
36
+
37
+ }
app/code/community/CommerceLab/News/Model/Check.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Check extends Mage_Core_Model_Abstract
19
+ {
20
+
21
+ public function checkExtensions()
22
+ {
23
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
24
+ sort($modules);
25
+
26
+ $magentoPlatform = CommerceLab_News_Helper_Versions::getPlatform();
27
+ foreach ($modules as $extensionName) {
28
+ if (strstr($extensionName, 'CommerceLab_') === false) {
29
+ continue;
30
+ }
31
+ if ($extensionName == 'CommerceLab_Core' || $extensionName == 'CommerceLab_All') {
32
+ continue;
33
+ }
34
+ if ($platformNode = $this->getExtensionPlatform($extensionName)) {
35
+ $extensionPlatform = CommerceLab_News_Helper_Versions::convertPlatform($platformNode);
36
+ if ($extensionPlatform < $magentoPlatform) {
37
+ $this->disableExtensionOutput($extensionName);
38
+ Mage::getSingleton('adminhtml/session')
39
+ ->addError(Mage::helper('clnews')->__('Platform version is not correct for News module!'));
40
+ return;
41
+ }
42
+ }
43
+ }
44
+ return $this;
45
+ }
46
+
47
+ public function getExtensionPlatform($extensionName)
48
+ {
49
+ try {
50
+ if ($platform = Mage::getConfig()->getNode("modules/$extensionName/platform")) {
51
+ $platform = strtolower($platform);
52
+ return $platform;
53
+ } else {
54
+ throw new Exception();
55
+ }
56
+ } catch (Exception $e) {
57
+ return false;
58
+ }
59
+ }
60
+
61
+
62
+ public function disableExtensionOutput($extensionName)
63
+ {
64
+ $coll = Mage::getModel('core/config_data')->getCollection();
65
+ $coll->getSelect()->where("path='advanced/modules_disable_output/$extensionName'");
66
+ $i = 0;
67
+ foreach ($coll as $cd) {
68
+ $i++;
69
+ $cd->setValue(1)->save();
70
+ }
71
+ if ($i == 0) {
72
+ Mage::getModel('core/config_data')
73
+ ->setPath("advanced/modules_disable_output/$extensionName")
74
+ ->setValue(1)
75
+ ->save();
76
+ }
77
+ return $this;
78
+ }
79
+
80
+
81
+ }
app/code/community/CommerceLab/News/Model/Comment.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Comment extends Mage_Core_Model_Abstract
19
+ {
20
+ public function _construct(){
21
+ $this->_init('clnews/comment');
22
+ }
23
+
24
+ public function load($id, $field=null){
25
+ return parent::load($id, $field);
26
+ }
27
+ }
app/code/community/CommerceLab/News/Model/Mysql4/Category.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ $this->_init('clnews/category', 'category_id');
23
+ }
24
+
25
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
26
+ {
27
+ $condition = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
28
+ $this->_getWriteAdapter()->delete($this->getTable('category_store'), $condition);
29
+
30
+ if (!$object->getData('stores')) {
31
+ $storeArray = array();
32
+ $storeArray['category_id'] = $object->getId();
33
+ $storeArray['store_id'] = Mage::app()->getStore(true)->getId();
34
+ $this->_getWriteAdapter()->insert($this->getTable('category_store'), $storeArray);
35
+ }
36
+ else {
37
+ foreach ((array)$object->getData('stores') as $store) {
38
+ $storeArray = array();
39
+ $storeArray['category_id'] = $object->getId();
40
+ $storeArray['store_id'] = $store;
41
+ $this->_getWriteAdapter()->insert($this->getTable('category_store'), $storeArray);
42
+ }
43
+ }
44
+ return parent::_afterSave($object);
45
+ }
46
+
47
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
48
+ $select = $this->_getReadAdapter()->select()
49
+ ->from($this->getTable('category_store'))
50
+ ->where('category_id = ?', $object->getId());
51
+
52
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
53
+ $storesArray = array();
54
+ foreach ($data as $row) {
55
+ $storesArray[] = $row['store_id'];
56
+ }
57
+ $object->setData('store_id', $storesArray);
58
+ }
59
+
60
+ return parent::_afterLoad($object);
61
+ }
62
+ /*
63
+ protected function _getLoadSelect($field, $value, $object)
64
+ {
65
+ $select = parent::_getLoadSelect($field, $value, $object);
66
+
67
+ if ($object->getStoreId()) {
68
+ $select->join(array('cps' => $this->getTable('cat_store')), $this->getMainTable().'.cat_id = `cps`.cat_id')
69
+ ->where('`cps`.store_id in (0, ?) ', $object->getStoreId())
70
+ ->order('store_id DESC')
71
+ ->limit(1);
72
+ }
73
+ return $select;
74
+ }
75
+ */
76
+ }
app/code/community/CommerceLab/News/Model/Mysql4/Category/Collection.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
19
+ public function _construct(){
20
+ parent::_construct();
21
+ $this->_init('clnews/category');
22
+ }
23
+
24
+ /*
25
+ public function toOptionArray(){
26
+ return $this->_toOptionArray('identifier', 'title');
27
+ }
28
+
29
+ protected function _afterLoad(){
30
+ $items = $this->getColumnValues('identifier');
31
+ if (count($items)) {
32
+ $select = $this->getConnection()->select()
33
+ ->from($this->getTable('cat'));
34
+ if ($result = $this->getConnection()->fetchPairs($select)) {
35
+ foreach ($this as $item) {
36
+ if (!isset($result[$item->getData('identifier')])) {
37
+ continue;
38
+ }
39
+ }
40
+ }
41
+ }
42
+
43
+ parent::_afterLoad();
44
+ }
45
+
46
+ public function addCatFilter($catId)
47
+ {
48
+ if (!Mage::app()->isSingleStoreMode()) {
49
+ $this->getSelect()->join(
50
+ array('cat_table' => $this->getTable('post_cat')),
51
+ 'main_table.post_id = cat_table.post_id',
52
+ array()
53
+ )
54
+ ->where('cat_table.cat_id = ?', $catId);
55
+
56
+ return $this;
57
+ }
58
+ return $this;
59
+ }
60
+ */
61
+ public function addStoreFilter($store){
62
+ if (!Mage::app()->isSingleStoreMode()) {
63
+ if ($store instanceof Mage_Core_Model_Store) {
64
+ $store = array($store->getId());
65
+ }
66
+
67
+ $this->getSelect()->joinLeft(
68
+ array('store_table' => $this->getTable('category_store')),
69
+ 'main_table.category_id = store_table.category_id',
70
+ array()
71
+ )
72
+ ->where('store_table.store_id = 0
73
+ OR store_table.store_id = \''.$store.'\'
74
+ OR store_table.store_id IS NULL
75
+ ');
76
+
77
+ return $this;
78
+ }
79
+ return $this;
80
+ }
81
+ /*
82
+ public function addPostFilter($postId){
83
+ $this->getSelect()->join(
84
+ array('cat_table' => $this->getTable('post_cat')),
85
+ 'main_table.cat_id = cat_table.cat_id',
86
+ array()
87
+ )
88
+ ->where('cat_table.post_id = ?', $postId);
89
+
90
+ return $this;
91
+ }
92
+ */
93
+ }
app/code/community/CommerceLab/News/Model/Mysql4/Comment.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Mysql4_Comment extends Mage_Core_Model_Mysql4_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ $this->_init('clnews/comment', 'comment_id');
23
+ }
24
+ }
app/code/community/CommerceLab/News/Model/Mysql4/Comment/Collection.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Mysql4_Comment_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->_init('clnews/comment');
24
+ }
25
+
26
+ public function addApproveFilter($status)
27
+ {
28
+ $this->getSelect()
29
+ ->where('comment_status = ?', $status);
30
+ return $this;
31
+ }
32
+
33
+ public function addNewsFilter($newsId)
34
+ {
35
+ $this->getSelect()
36
+ ->where('news_id = ?', $newsId);
37
+ return $this;
38
+ }
39
+ }
app/code/community/CommerceLab/News/Model/Mysql4/News.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Mysql4_News extends Mage_Core_Model_Mysql4_Abstract
19
+ {
20
+ public function _construct(){
21
+ $this->_init('clnews/news', 'news_id');
22
+ }
23
+
24
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
25
+ {
26
+ $condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
27
+ $this->_getWriteAdapter()->delete($this->getTable('news_store'), $condition);
28
+
29
+ //print_r((array)$object->getData('stores'));
30
+ //die;
31
+ if (count($object->getData('stores')) && (!in_array(0, (array)$object->getData('stores')))) {
32
+ foreach ((array)$object->getData('stores') as $store) {
33
+ $data = array();
34
+ $data['news_id'] = $object->getId();
35
+ $data['store_id'] = $store;
36
+ $this->_getWriteAdapter()->insert($this->getTable('news_store'), $data);
37
+ }
38
+ } else {
39
+ $data = array();
40
+ $data['news_id'] = $object->getId();
41
+ $data['store_id'] = '0';
42
+ $this->_getWriteAdapter()->insert($this->getTable('news_store'), $data);
43
+ }
44
+
45
+ $condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
46
+ $this->_getWriteAdapter()->delete($this->getTable('news_category'), $condition);
47
+
48
+ foreach ((array)$object->getData('categories') as $category) {
49
+ $data = array();
50
+ $data['news_id'] = $object->getId();
51
+ $data['category_id'] = $category;
52
+ $this->_getWriteAdapter()->insert($this->getTable('news_category'), $data);
53
+ }
54
+
55
+ return parent::_afterSave($object);
56
+ }
57
+
58
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
59
+ {
60
+ $select = $this->_getReadAdapter()->select()
61
+ ->from($this->getTable('news_store'))
62
+ ->where('news_id = ?', $object->getId());
63
+
64
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
65
+ $stores = array();
66
+ foreach ($data as $row) {
67
+ $stores[] = $row['store_id'];
68
+ }
69
+ $object->setData('store_id', $stores);
70
+ }
71
+
72
+ $select = $this->_getReadAdapter()->select()
73
+ ->from($this->getTable('news_category'))
74
+ ->where('news_id = ?', $object->getId());
75
+
76
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
77
+ $categories = array();
78
+ foreach ($data as $row) {
79
+ $categories[] = $row['category_id'];
80
+ }
81
+ $object->setData('category_id', $categories);
82
+ }
83
+
84
+ return parent::_afterLoad($object);
85
+ }
86
+
87
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object){
88
+ $adapter = $this->_getReadAdapter();
89
+ $adapter->delete($this->getTable('clnews/news_category'), 'news_id='.$object->getId());
90
+ $adapter->delete($this->getTable('clnews/comment'), 'news_id='.$object->getId());
91
+ }
92
+ /*
93
+ protected function _getLoadSelect($field, $value, $object)
94
+ {
95
+
96
+ $select = parent::_getLoadSelect($field, $value, $object);
97
+ if ($object->getCategoryId()) {
98
+ $select->join(array(
99
+ 'category_store_table' => $this->getTable('category_store')),
100
+ $this->getMainTable().'.category_id = category_store_table.category_id')
101
+ ->where('category_store_table.store_id in (0, ?) ', Mage::app()->getStore()->getId());
102
+ }
103
+ return $select;
104
+ }*/
105
+ }
app/code/community/CommerceLab/News/Model/Mysql4/News/Collection.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Mysql4_News_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->_init('clnews/news');
24
+ }
25
+
26
+ public function addEnableFilter($status)
27
+ {
28
+ $this->getSelect()
29
+ ->where('status = ?', $status);
30
+ return $this;
31
+ }
32
+
33
+ public function addCategoryFilter($categoryId)
34
+ {
35
+ $this->getSelect()->join(
36
+ array('news_category_table' => $this->getTable('news_category')),
37
+ 'main_table.news_id = news_category_table.news_id',
38
+ array()
39
+ )->join(
40
+ array('category_table' => $this->getTable('category')),
41
+ 'news_category_table.category_id = category_table.category_id',
42
+ array()
43
+ )->join(
44
+ array('category_store_table' => $this->getTable('category_store')),
45
+ 'category_table.category_id = category_store_table.category_id',
46
+ array()
47
+ )
48
+ ->where('category_table.url_key = "'.$categoryId.'"')
49
+ ->where('category_store_table.store_id in (?)', array(0, Mage::app()->getStore()->getId()))
50
+ ;
51
+ return $this;
52
+ }
53
+
54
+ public function addStoreFilter($store)
55
+ {
56
+ $this->getSelect()->join(
57
+ array('news_store_table' => $this->getTable('news_store')),
58
+ 'main_table.news_id = news_store_table.news_id',
59
+ array()
60
+ )
61
+ ->where('news_store_table.store_id in (?)', array(0, $store));
62
+ $this->getSelect()->distinct();
63
+ return $this;
64
+ }
65
+ }
app/code/community/CommerceLab/News/Model/News.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_News extends Mage_Core_Model_Abstract
19
+ {
20
+ public function _construct(){
21
+ parent::_construct();
22
+ $this->_init('clnews/news');
23
+ }
24
+
25
+ public function getUrl($category = '') {
26
+ if ($category) {
27
+ $url = Mage::getBaseUrl().Mage::helper('clnews')->getRoute().'/'.$category.'/'.$this->getUrlKey().'.html';
28
+ } else {
29
+ $url = Mage::getBaseUrl().Mage::helper('clnews')->getRoute().'/'.$this->getUrlKey().'.html';
30
+ }
31
+ return $url;
32
+ }
33
+
34
+ /**
35
+ * Reset all model data
36
+ *
37
+ * @return CommerceLab_News_Model_News
38
+ */
39
+ public function reset()
40
+ {
41
+ $this->setData(array());
42
+ $this->setOrigData();
43
+ $this->_attributes = null;
44
+ return $this;
45
+ }
46
+ }
app/code/community/CommerceLab/News/Model/Wysiwyg/Config.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config
19
+ {
20
+ /**
21
+ * Wysiwyg behaviour
22
+ */
23
+ const WYSIWYG_ENABLED = 'enabled';
24
+ const WYSIWYG_HIDDEN = 'hidden';
25
+ const WYSIWYG_DISABLED = 'disabled';
26
+ const IMAGE_DIRECTORY = 'wysiwyg';
27
+
28
+ /**
29
+ * Return Wysiwyg config as Varien_Object
30
+ *
31
+ * Config options description:
32
+ *
33
+ * enabled: Enabled Visual Editor or not
34
+ * hidden: Show Visual Editor on page load or not
35
+ * use_container: Wrap Editor contents into div or not
36
+ * no_display: Hide Editor container or not (related to use_container)
37
+ * translator: Helper to translate phrases in lib
38
+ * files_browser_*: Files Browser (media, images) settings
39
+ * encode_directives: Encode template directives with JS or not
40
+ *
41
+ * @param $data Varien_Object constructor params to override default config values
42
+ * @return Varien_Object
43
+ */
44
+ public function getConfig($data = array())
45
+ {
46
+ $config = new Varien_Object();
47
+
48
+ $config->setData(array(
49
+ 'enabled' => $this->isEnabled(),
50
+ 'hidden' => $this->isHidden(),
51
+ 'use_container' => false,
52
+ 'add_variables' => true,
53
+ 'add_widgets' => true,
54
+ 'no_display' => false,
55
+ 'translator' => Mage::helper('cms'),
56
+ 'encode_directives' => true,
57
+ 'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
58
+ 'popup_css' =>
59
+ Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
60
+ 'content_css' =>
61
+ Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
62
+ 'width' => '100%',
63
+ 'plugins' => array()
64
+ ));
65
+
66
+ $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
67
+
68
+ if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
69
+ $config->addData(array(
70
+ 'add_images' => true,
71
+ 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
72
+ 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
73
+ 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
74
+ 'encode_directives' => true,
75
+ 'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
76
+ ));
77
+ }
78
+
79
+ if (is_array($data)) {
80
+ $config->addData($data);
81
+ }
82
+
83
+ Mage::dispatchEvent('cms_wysiwyg_config_prepare', array('config' => $config));
84
+
85
+ return $config;
86
+ }
87
+
88
+ /**
89
+ * Return URL for skin images placeholder
90
+ *
91
+ * @return string
92
+ */
93
+ public function getSkinImagePlaceholderUrl()
94
+ {
95
+ return Mage::getDesign()->getSkinUrl('images/wysiwyg/skin_image.png');
96
+ }
97
+
98
+ /**
99
+ * Check whether Wysiwyg is enabled or not
100
+ *
101
+ * @return bool
102
+ */
103
+ public function isEnabled()
104
+ {
105
+ $storeId = $this->getStoreId();
106
+ if (!is_null($storeId)) {
107
+ $wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled', $storeId);
108
+ } else {
109
+ $wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled');
110
+ }
111
+ return in_array($wysiwygState, array(self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN));
112
+ }
113
+
114
+ /**
115
+ * Check whether Wysiwyg is loaded on demand or not
116
+ *
117
+ * @return bool
118
+ */
119
+ public function isHidden()
120
+ {
121
+ return Mage::getStoreConfig('cms/wysiwyg/enabled') == self::WYSIWYG_HIDDEN;
122
+ }
123
+ }
app/code/community/CommerceLab/News/controllers/Adminhtml/CategoryController.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Adminhtml_CategoryController extends Mage_Adminhtml_Controller_action
19
+ {
20
+ public function preDispatch() {
21
+ parent::preDispatch();
22
+ }
23
+
24
+ /**
25
+ * Init actions
26
+ *
27
+ */
28
+ protected function _initAction()
29
+ {
30
+ // load layout, set active menu
31
+ $this->loadLayout()
32
+ ->_setActiveMenu('clnews/category');
33
+ return $this;
34
+ }
35
+
36
+ /**
37
+ * Index action
38
+ */
39
+ public function indexAction() {
40
+ $this->_initAction()
41
+ ->_addContent($this->getLayout()->createBlock('clnews/adminhtml_category'))
42
+ ->renderLayout();
43
+ }
44
+
45
+ public function newAction()
46
+ {
47
+ $this->_forward('edit');
48
+ }
49
+
50
+ public function editAction() {
51
+ $id = $this->getRequest()->getParam('id');
52
+ $model = Mage::getModel('clnews/category');
53
+
54
+ if ($id) {
55
+ $model->load($id);
56
+ if (!$model->getId()) {
57
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('clnews')->__('Page access error'));
58
+ $this->_redirect('*/*/');
59
+ return;
60
+ }
61
+ }
62
+
63
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
64
+ if (! empty($data)) {
65
+ $model->setData($data);
66
+ }
67
+
68
+ Mage::register('clnews_data', $model);
69
+
70
+ $this->_initAction()
71
+ ->_addContent($this->getLayout()->createBlock('clnews/adminhtml_category_edit'));
72
+
73
+ $this->renderLayout();
74
+ }
75
+
76
+
77
+ public function saveAction() {
78
+ // check if data sent
79
+ if ($data = $this->getRequest()->getPost()) {
80
+ $model = Mage::getModel('clnews/category');
81
+ $model->setData($data)
82
+ ->setId($this->getRequest()->getParam('id'));
83
+
84
+ try {
85
+ $model->save();
86
+ Mage::getSingleton('adminhtml/session')
87
+ ->addSuccess(Mage::helper('clnews')->__('Category was successfully saved'));
88
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
89
+
90
+ // check if 'Save and Continue'
91
+ if ($this->getRequest()->getParam('back')) {
92
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
93
+ return;
94
+ }
95
+ $this->_redirect('*/*/');
96
+ return;
97
+ } catch (Exception $e) {
98
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
99
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
100
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
101
+ return;
102
+ }
103
+ }
104
+ $this->_redirect('*/*/');
105
+ }
106
+
107
+ public function deleteAction() {
108
+ if ($id = $this->getRequest()->getParam('id')) {
109
+ try {
110
+ $model = Mage::getModel('clnews/category');
111
+ $model->load($id);
112
+ $model->delete();
113
+
114
+ Mage::getSingleton('adminhtml/session')
115
+ ->addSuccess(Mage::helper('clnews')->__('Category was successfully deleted'));
116
+ $this->_redirect('*/*/');
117
+ } catch (Exception $e) {
118
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
119
+ $this->_redirect('*/*/edit', array('id' => $id));
120
+ }
121
+ }
122
+ $this->_redirect('*/*/');
123
+ }
124
+
125
+ public function massDeleteAction() {
126
+ $categoryIds = $this->getRequest()->getParam('category');
127
+ if (!is_array($categoryIds)) {
128
+ Mage::getSingleton('adminhtml/session')
129
+ ->addError(Mage::helper('adminhtml')->__('Please select categories'));
130
+ } else {
131
+ try {
132
+ foreach ($categoryIds as $categoryId) {
133
+ $model = Mage::getModel('clnews/category')->load($categoryId);
134
+ $model->delete();
135
+ }
136
+ Mage::getSingleton('adminhtml/session')
137
+ ->addSuccess(Mage::helper('adminhtml')
138
+ ->__('%d categories have been successfully deleted',
139
+ count($categoryIds)));
140
+ } catch (Exception $e) {
141
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
142
+ }
143
+ }
144
+ $this->_redirect('*/*/');
145
+ }
146
+ }
app/code/community/CommerceLab/News/controllers/Adminhtml/CommentController.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Adminhtml_CommentController extends Mage_Adminhtml_Controller_action
19
+ {
20
+ public function preDispatch() {
21
+ parent::preDispatch();
22
+ }
23
+
24
+ /**
25
+ * Init actions
26
+ *
27
+ */
28
+ protected function _initAction() {
29
+ // load layout, set active menu
30
+ $this->loadLayout()
31
+ ->_setActiveMenu('clnews/comment');
32
+ return $this;
33
+ }
34
+
35
+ public function indexAction() {
36
+ $this->_initAction()
37
+ ->_addContent($this->getLayout()->createBlock('clnews/adminhtml_comment'))
38
+ ->renderLayout();
39
+ }
40
+
41
+ public function editAction() {
42
+ $id = $this->getRequest()->getParam('id');
43
+ $model = Mage::getModel('clnews/comment');
44
+
45
+ if ($id) {
46
+ $model->load($id);
47
+ if (!$model->getId()) {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('clnews')->__('Page access error'));
49
+ $this->_redirect('*/*/');
50
+ return;
51
+ }
52
+ }
53
+
54
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
55
+ if (!empty($data)) {
56
+ $model->setData($data);
57
+ }
58
+
59
+ Mage::register('clnews_data', $model);
60
+
61
+ $this->loadLayout()
62
+ ->_addContent($this->getLayout()->createBlock('clnews/adminhtml_comment_edit'))
63
+ ->renderLayout();
64
+ }
65
+
66
+ public function saveAction() {
67
+ if ($data = $this->getRequest()->getPost()) {
68
+ $model = Mage::getModel('clnews/comment');
69
+ $model->setData($data)
70
+ ->setId($this->getRequest()->getParam('id'));
71
+
72
+ try {
73
+ $model->setUpdateTime(now())
74
+ ->save();
75
+ Mage::getSingleton('adminhtml/session')
76
+ ->addSuccess(Mage::helper('clnews')->__('Comment was successfully saved'));
77
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
78
+
79
+ if ($this->getRequest()->getParam('back')) {
80
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
81
+ return;
82
+ }
83
+ $this->_redirect('*/*/');
84
+ return;
85
+ } catch (Exception $e) {
86
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
87
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
88
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
89
+ return;
90
+ }
91
+ }
92
+ $this->_redirect('*/*/');
93
+ }
94
+
95
+ public function deleteAction() {
96
+ if ($id = $this->getRequest()->getParam('id')) {
97
+ try {
98
+ $model = Mage::getModel('clnews/comment');
99
+ $model->load($id);
100
+ $model->delete();
101
+
102
+ Mage::getSingleton('adminhtml/session')
103
+ ->addSuccess(Mage::helper('clnews')->__('Comment was successfully deleted'));
104
+ $this->_redirect('*/*/');
105
+ } catch (Exception $e) {
106
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
107
+ $this->_redirect('*/*/edit', array('id' => $id));
108
+ }
109
+ }
110
+ $this->_redirect('*/*/');
111
+ }
112
+
113
+ public function massApproveAction()
114
+ {
115
+ $commentIds = $this->getRequest()->getParam('comments');
116
+ if (!is_array($commentIds)) {
117
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select comment(s)'));
118
+ } else {
119
+ try {
120
+ foreach ($commentIds as $commentId) {
121
+ $model = Mage::getSingleton('clnews/comment')
122
+ ->load($commentId)
123
+ ->setCommentStatus(CommerceLab_News_Helper_Data::APPROVED_STATUS)
124
+ ->setIsMassupdate(true)
125
+ ->save();
126
+ }
127
+ $this->_getSession()
128
+ ->addSuccess($this
129
+ ->__('%d comment(s) have been successfully approved',
130
+ count($commentIds)));
131
+ } catch (Exception $e) {
132
+ $this->_getSession()->addError($e->getMessage());
133
+ }
134
+ }
135
+ $this->_redirect('*/*/');
136
+ }
137
+
138
+ public function massUnapproveAction()
139
+ {
140
+ $commentIds = $this->getRequest()->getParam('comments');
141
+ if (!is_array($commentIds)) {
142
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select comment(s)'));
143
+ } else {
144
+ try {
145
+ foreach ($commentIds as $commentId) {
146
+ $model = Mage::getSingleton('clnews/comment')
147
+ ->load($commentId)
148
+ ->setCommentStatus(CommerceLab_News_Helper_Data::UNAPPROVED_STATUS)
149
+ ->setIsMassupdate(true)
150
+ ->save();
151
+ }
152
+ $this->_getSession()
153
+ ->addSuccess($this
154
+ ->__('%d comment(s) have been successfully unapproved', count($commentIds)));
155
+ } catch (Exception $e) {
156
+ $this->_getSession()->addError($e->getMessage());
157
+ }
158
+ }
159
+ $this->_redirect('*/*/');
160
+ }
161
+
162
+ public function massDeleteAction() {
163
+ $commentIds = $this->getRequest()->getParam('comments');
164
+ if (!is_array($commentIds)) {
165
+ Mage::getSingleton('adminhtml/session')
166
+ ->addError(Mage::helper('adminhtml')->__('Please select comment(s)'));
167
+ } else {
168
+ try {
169
+ foreach ($commentIds as $commentId) {
170
+ $model = Mage::getModel('clnews/comment')->load($commentId);
171
+ $model->delete();
172
+ }
173
+ Mage::getSingleton('adminhtml/session')
174
+ ->addSuccess(Mage::helper('adminhtml')
175
+ ->__('%d comments(s) have been successfully deleted',
176
+ count($commentIds)));
177
+ } catch (Exception $e) {
178
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
179
+ }
180
+ }
181
+ $this->_redirect('*/*/');
182
+ }
183
+ }
app/code/community/CommerceLab/News/controllers/Adminhtml/NewsController.php ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_Adminhtml_NewsController extends Mage_Adminhtml_Controller_action
19
+ {
20
+ public function preDispatch() {
21
+ parent::preDispatch();
22
+ }
23
+
24
+ /**
25
+ * Init actions
26
+ *
27
+ */
28
+ protected function _initAction()
29
+ {
30
+ // load layout, set active menu
31
+ $this->loadLayout()
32
+ ->_setActiveMenu('clnews/items');
33
+ return $this;
34
+ }
35
+
36
+ public function indexAction() {
37
+ $this->_initAction()
38
+ ->_addContent($this->getLayout()->createBlock('clnews/adminhtml_news'))
39
+ ->renderLayout();
40
+ }
41
+
42
+ public function newAction() {
43
+ $this->_forward('edit');
44
+ }
45
+
46
+ public function editAction() {
47
+ $id = $this->getRequest()->getParam('id');
48
+ $model = Mage::getModel('clnews/news')->load($id);
49
+
50
+ if ($id) {
51
+ $model->load($id);
52
+ if (! $model->getId()) {
53
+ Mage::getSingleton('adminhtml/session')
54
+ ->addError(Mage::helper('clnews')->__('News article does not exist'));
55
+ $this->_redirect('*/*/');
56
+ return;
57
+ }
58
+ }
59
+
60
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
61
+
62
+ if (!empty($data)) {
63
+ $model->setData($data);
64
+ }
65
+
66
+ Mage::register('clnews_data', $model);
67
+
68
+ $this->_initAction()
69
+ ->_addContent($this->getLayout()->createBlock('clnews/adminhtml_news_edit'))
70
+ ->_addLeft($this->getLayout()->createBlock('clnews/adminhtml_news_edit_tabs'))
71
+ ->renderLayout();
72
+ }
73
+
74
+ public function saveAction() {
75
+ if ($data = $this->getRequest()->getPost()) {
76
+ $newsCollection = Mage::getModel('clnews/news')->getCollection()
77
+ ->addFieldToFilter('url_key', $data['url_key']);
78
+ $arr = array();
79
+ $arr = $newsCollection->getData();
80
+ if (isset($arr[0]) && $this->getRequest()->getParam('id') == $arr[0]['news_id'] && $data['url_key'] == $arr[0]['url_key']) {
81
+ $sameUrl = null;
82
+ } else {
83
+ $sameUrl = $newsCollection->getData();
84
+ }
85
+ if ($sameUrl != null) {
86
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('clnews')->__('The same news url_key already exists'));
87
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
88
+ } else {
89
+
90
+ if (isset($data['is_delete'])) {
91
+ $isDeleteFile = true;
92
+ } else {
93
+ $isDeleteFile = false;
94
+ }
95
+
96
+ if (isset($_FILES['document_save']['name']) && ($_FILES['document_save']['name'] != '')
97
+ && ($_FILES['document_save']['size'] != 0) ) {
98
+ try {
99
+ $uploader = new Varien_File_Uploader('document_save');
100
+ $uploader->setAllowRenameFiles(false);
101
+
102
+ // Set the file upload mode
103
+ // false -> get the file directly in the specified folder
104
+ // true -> get the file in folders like /media/a/b/
105
+ $uploader->setFilesDispersion(false);
106
+
107
+ $path = Mage::getBaseDir('media') . DS . 'clnews' . DS;
108
+
109
+ //saved the name in DB
110
+ $prefix = time().rand();
111
+ $fileName = $prefix.'.'.pathinfo($_FILES['document_save']['name'], PATHINFO_EXTENSION);
112
+ $uploader->save($path, $fileName);
113
+ $filepath = 'clnews' . DS .$fileName;
114
+ $data['full_path_document'] = $path . $fileName;
115
+ $data['document'] = $fileName;
116
+ $data['document'] = str_replace('\\', '/', $data['document']);
117
+ } catch (Exception $e) {
118
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
119
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
120
+ }
121
+ } elseif ($isDeleteFile === true) {
122
+ unlink($data['full_path_document']);
123
+ $data['document']='';
124
+ } else {
125
+ /// to insert a code for deleting image
126
+ /// ....
127
+ if (isset($data['document'])) {
128
+ $data['document']=$data['document'];
129
+ }
130
+ }
131
+
132
+ if (isset($_FILES['image_short_content']['name']) && ($_FILES['image_short_content']['name'] != '')
133
+ && ($_FILES['image_short_content']['size'] != 0) ) {
134
+ try {
135
+ $uploader = new Varien_File_Uploader('image_short_content');
136
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
137
+ $uploader->setAllowRenameFiles(false);
138
+
139
+ // Set the file upload mode
140
+ // false -> get the file directly in the specified folder
141
+ // true -> get the file in folders like /media/a/b/
142
+ $uploader->setFilesDispersion(false);
143
+
144
+ $path = Mage::getBaseDir('media') . DS . 'clnews' . DS;
145
+
146
+ //saved the name in DB
147
+ $prefix = time().rand();
148
+ $fileName = $prefix.'.'.pathinfo($_FILES['image_short_content']['name'], PATHINFO_EXTENSION);
149
+ $uploader->save($path, $fileName);
150
+ $filepath = 'clnews' . DS .$fileName;
151
+ /*
152
+ if (!getimagesize($filepath)) {
153
+ Mage::throwException($this->__('Disallowed file type.'));
154
+ }*/
155
+ $data['image_short_content'] = $filepath;
156
+ $data['image_short_content'] = str_replace('\\', '/', $data['image_short_content']);
157
+ } catch (Exception $e) {
158
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
159
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
160
+ return;
161
+ }
162
+ } elseif (isset($data['image_short_content']['delete'])) {
163
+ $path = Mage::getBaseDir('media') . DS;
164
+ $result = unlink($path . $data['image_short_content']['value']);
165
+ if ($data['short_height_resize'] && $data['short_width_resize']) {
166
+ $resizePath = Mage::getBaseDir('media') . DS . 'clnews' . DS . $data['short_width_resize'] . 'x' . $data['short_height_resize'] . DS;
167
+ }
168
+ $result = unlink($resizePath . str_replace('clnews/', '', $data['image_short_content']['value']));
169
+ $data['image_short_content'] = '';
170
+ } else {
171
+ if (isset($data['image_short_content']['value'])) {
172
+ $data['image_short_content'] = $data['image_short_content']['value'];
173
+ }
174
+ }
175
+
176
+ if (isset($_FILES['image_full_content']['name']) && ($_FILES['image_full_content']['name'] != '')
177
+ && ($_FILES['image_full_content']['size'] != 0) ) {
178
+ try {
179
+ $uploader = new Varien_File_Uploader('image_full_content');
180
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
181
+ $uploader->setAllowRenameFiles(false);
182
+
183
+ // Set the file upload mode
184
+ // false -> get the file directly in the specified folder
185
+ // true -> get the file in folders like /media/a/b/
186
+ $uploader->setFilesDispersion(false);
187
+
188
+ $path = Mage::getBaseDir('media') . DS . 'clnews' . DS;
189
+
190
+ //saved the name in DB
191
+ $prefix = time().rand();
192
+ $fileName = $prefix.'.'.pathinfo($_FILES['image_full_content']['name'], PATHINFO_EXTENSION);
193
+ $uploader->save($path, $fileName);
194
+ $filepath = 'clnews' . DS .$fileName;
195
+ $data['image_full_content'] = $filepath;
196
+ $data['image_full_content'] = str_replace('\\', '/', $data['image_full_content']);
197
+ } catch (Exception $e) {
198
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
199
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
200
+ return;
201
+ }
202
+ } elseif (isset($data['image_full_content']['delete'])) {
203
+ $path = Mage::getBaseDir('media') . DS;
204
+ $result = unlink($path . $data['image_full_content']['value']);
205
+ if ($data['full_height_resize'] && $data['full_width_resize']) {
206
+ $resizePath = Mage::getBaseDir('media') . DS . 'clnews' . DS . $data['full_width_resize'] . 'x' . $data['full_height_resize'] . DS;
207
+ }
208
+ $result = unlink($resizePath . str_replace('clnews/', '', $data['image_full_content']['value']));
209
+ $data['image_full_content'] = '';
210
+ } else {
211
+ if (isset($data['image_full_content']['value'])) {
212
+ $data['image_full_content'] = $data['image_full_content']['value'];
213
+ }
214
+ }
215
+
216
+ if (isset($data['use_full_img'])) {
217
+ if (isset($data['image_full_content'])) {
218
+ $data['image_short_content'] = $data['image_full_content'];
219
+ }
220
+ }
221
+
222
+ $model = Mage::getModel('clnews/news');
223
+ $hoursFrom = $this->getRequest()->getParam('publicate_from_hours');
224
+ $minutesFrom = $this->getRequest()->getParam('publicate_from_minutes');
225
+ $hoursTo = $this->getRequest()->getParam('publicate_to_hours');
226
+ $minutesTo = $this->getRequest()->getParam('publicate_to_minutes');
227
+ $data['publicate_from_hours'] = $hoursFrom;
228
+ $data['publicate_from_minutes'] = $minutesFrom;
229
+ $data['publicate_to_hours'] = $hoursTo;
230
+ $data['publicate_to_minutes'] = $minutesTo;
231
+ $data['link'] = $this->getRequest()->getParam('link');
232
+ $data['tags'] = $this->getRequest()->getParam('tags');
233
+
234
+ // prepare dates
235
+ if ($this->getRequest()->getParam('news_time')!='') {
236
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
237
+ if (!Zend_Date::isDate($this->getRequest()->getParam('news_time') . ' ' . date("H:i:s"), $dateFormatIso)) {
238
+ throw new Exception($this->__(('News date field is required')));
239
+ }
240
+ $date = new Zend_Date($this->getRequest()->getParam('news_time') . ' ' . date("H:i:s"), $dateFormatIso);
241
+ $dateInfo = $date->toArray();
242
+ $data['news_time'] = preg_replace('/([0-9]{4})\-(.*)/', $dateInfo['year'].'-$2', $date->toString('YYYY-MM-dd HH:mm:ss'));
243
+ } else {
244
+ $data['news_time'] = new Zend_Db_Expr('null');
245
+ }
246
+
247
+ if ($this->getRequest()->getParam('publicate_from_time')!='') {
248
+ if (!Zend_Date::isDate($this->getRequest()->getParam('publicate_from_time'). ' ' . $hoursFrom . ':' . $minutesFrom . ':00', $dateFormatIso)) {
249
+ throw new Exception($this->__(('News date field is required')));
250
+ }
251
+ $date = new Zend_Date($this->getRequest()->getParam('publicate_from_time'). ' ' . $hoursFrom . ':' . $minutesFrom . ':00', $dateFormatIso);
252
+ $dateInfo = $date->toArray();
253
+ $data['publicate_from_time'] = preg_replace('/([0-9]{4})\-(.*)/', $dateInfo['year'].'-$2', $date->toString('YYYY-MM-dd HH:mm:ss'));
254
+ } else {
255
+ $data['publicate_from_time'] = new Zend_Db_Expr('null');
256
+ }
257
+
258
+ if ($this->getRequest()->getParam('publicate_to_time')!='') {
259
+ if (!Zend_Date::isDate($this->getRequest()->getParam('publicate_to_time'). ' ' . $hoursTo . ':' . $minutesTo . ':00', $dateFormatIso)) {
260
+ throw new Exception($this->__(('News date field is required')));
261
+ }
262
+ $date = new Zend_Date($this->getRequest()->getParam('publicate_to_time'). ' ' . $hoursTo . ':' . $minutesTo . ':00', $dateFormatIso);
263
+ $dateInfo = $date->toArray();
264
+ $data['publicate_to_time'] = preg_replace('/([0-9]{4})\-(.*)/', $dateInfo['year'].'-$2', $date->toString('YYYY-MM-dd HH:mm:ss'));
265
+ } else {
266
+ $data['publicate_to_time'] = new Zend_Db_Expr('null');
267
+ }
268
+ $model->setData($data)
269
+ ->setId($this->getRequest()->getParam('id'));
270
+
271
+ try {
272
+ if ($this->getRequest()->getParam('news_time') == NULL) {
273
+ $model->setNewsTime(now());
274
+ $model->setCreatedTime(now());
275
+ } else {
276
+ if (!$newsItemId = $arr[0]['news_id']) {
277
+ $model->setCreatedTime(now());
278
+ }
279
+ }
280
+
281
+ $model->setUpdateTime(now());
282
+
283
+ if ($this->getRequest()->getParam('author') == NULL) {
284
+ $model->setUpdateAuthor(NULL);
285
+ /*$model->setAuthor(Mage::getSingleton('admin/session')->getUser()->getFirstname() .
286
+ " " . Mage::getSingleton('admin/session')->getUser()->getLastname())
287
+ ->setUpdateAuthor(Mage::getSingleton('admin/session')->getUser()->getFirstname() .
288
+ " " . Mage::getSingleton('admin/session')->getUser()->getLastname());*/
289
+ } else {
290
+ $model->setUpdateAuthor(Mage::getSingleton('admin/session')->getUser()->getFirstname() .
291
+ " " . Mage::getSingleton('admin/session')->getUser()->getLastname());
292
+ }
293
+ $model->save();
294
+
295
+ Mage::getSingleton('adminhtml/session')
296
+ ->addSuccess(Mage::helper('clnews')->__('News article has been successfully saved'));
297
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
298
+
299
+ if ($this->getRequest()->getParam('back')) {
300
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
301
+ return;
302
+ }
303
+ $this->_redirect('*/*/');
304
+ return;
305
+ } catch (Exception $e) {
306
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
307
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
308
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
309
+ return;
310
+ }
311
+
312
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('clnews')->__('No items to save'));
313
+ $this->_redirect('*/*/');
314
+ }
315
+ }
316
+ }
317
+
318
+ public function deleteAction() {
319
+ if ($id = $this->getRequest()->getParam('id')) {
320
+ try {
321
+ $model = Mage::getModel('clnews/news');
322
+ $model->load($id);
323
+ $model->delete();
324
+
325
+ Mage::getSingleton('adminhtml/session')
326
+ ->addSuccess(Mage::helper('adminhtml')->__('Item has been successfully deleted'));
327
+ $this->_redirect('*/*/');
328
+ } catch (Exception $e) {
329
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
330
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
331
+ }
332
+ }
333
+ $this->_redirect('*/*/');
334
+ }
335
+
336
+ public function massDeleteAction() {
337
+ $newsIds = $this->getRequest()->getParam('clnews');
338
+ if (!is_array($newsIds)) {
339
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
340
+ } else {
341
+ try {
342
+ $model = Mage::getModel('clnews/news');
343
+ foreach ($newsIds as $newsId) {
344
+ $model->reset()
345
+ ->load($newsId)
346
+ ->delete();
347
+ }
348
+ Mage::getSingleton('adminhtml/session')
349
+ ->addSuccess(Mage::helper('adminhtml')
350
+ ->__('%d record(s) have been successfully deleted', count($newsIds)));
351
+ } catch (Exception $e) {
352
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
353
+ }
354
+ }
355
+ $this->_redirect('*/*/index');
356
+ }
357
+
358
+ public function massStatusAction()
359
+ {
360
+ $newsIds = $this->getRequest()->getParam('clnews');
361
+ if (!is_array($newsIds)) {
362
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
363
+ } else {
364
+ try {
365
+ foreach ($newsIds as $newsId) {
366
+ $model = Mage::getSingleton('clnews/news')
367
+ ->setId($newsId)
368
+ ->setStatus($this->getRequest()->getParam('status'))
369
+ ->save();
370
+ }
371
+ $this->_getSession()
372
+ ->addSuccess($this->__('%d record(s) have been successfully updated', count($newsIds)));
373
+ } catch (Exception $e) {
374
+ $this->_getSession()->addError($e->getMessage());
375
+ }
376
+ }
377
+ $this->_redirect('*/*/index');
378
+ }
379
+ }
app/code/community/CommerceLab/News/controllers/IndexController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_IndexController extends Mage_Core_Controller_Front_Action
19
+ {
20
+ public function indexAction()
21
+ {
22
+ //// check if this category is allowed to view
23
+ if ($category = $this->getRequest()->getParam('category')) {
24
+ $collection = Mage::getModel('clnews/category')->getCollection()
25
+ ->addFieldToFilter('url_key', $category)
26
+ ->addStoreFilter(Mage::app()->getStore()->getId());
27
+ if (count($collection) < 1) {
28
+ $this->_redirect(Mage::helper('clnews')->getRoute());
29
+ }
30
+ }
31
+ if ($tag = $this->getRequest()->getParam('q')) {
32
+ $collection = Mage::getModel('clnews/news')->getCollection()
33
+ ->setOrder('news_time', 'asc');
34
+ if (count(Mage::app()->getStores()) > 1) {
35
+ $collection->getSelect()->join('clnews_news_store', 'main_table.news_id = clnews_news_store.news_id','store_id');
36
+ $collection->getSelect()->where('clnews_news_store.store_id =?', Mage::app()->getStore()->getId());
37
+ }
38
+ $tag = urldecode($tag);
39
+ $collection->getSelect()->where("main_table.tags LIKE '%". $tag . "%'");
40
+ if (count($collection) < 1) {
41
+ $this->_redirect(Mage::helper('clnews')->getRoute());
42
+ }
43
+ }
44
+ $this->loadLayout();
45
+ $this->renderLayout();
46
+ }
47
+ }
app/code/community/CommerceLab/News/controllers/NewsitemController.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_NewsitemController extends Mage_Core_Controller_Front_Action
19
+ {
20
+ public function viewAction()
21
+ {
22
+ $session = Mage::getSingleton('core/session');
23
+ $categoryKey = $this->getRequest()->getParam('category');
24
+ if ($categoryKey) {
25
+ $collection = Mage::getModel('clnews/category')->getCollection()
26
+ ->addFieldToFilter('url_key', $categoryKey);
27
+ $category = $collection->getFirstItem();
28
+ } else {
29
+ $category = null;
30
+ }
31
+
32
+ $news_key = $this->getRequest()->getParam('key');
33
+ $news_id = (int)$this->getRequest()->getParam('id');
34
+ if (preg_match('/[A-Za-z0-9\-\_]+/', $news_key)) {
35
+ $collection = Mage::getModel('clnews/news')->getCollection()
36
+ ->addFieldToFilter('url_key', $news_key)
37
+ ->addEnableFilter(1)
38
+ ->addFieldToFilter('publicate_from_time', array('or' => array(
39
+ 0 => array('date' => true, 'to' => date('Y-m-d H:i:s')),
40
+ 1 => array('is' => new Zend_Db_Expr('null'))),
41
+ ), 'left')
42
+ ->addFieldToFilter('publicate_to_time', array('or' => array(
43
+ 0 => array('date' => true, 'from' => date('Y-m-d H:i:s')),
44
+ 1 => array('is' => new Zend_Db_Expr('null'))),
45
+ ), 'left')
46
+ ->addStoreFilter(Mage::app()->getStore()->getId())
47
+ ->load();
48
+ $newsitem = $collection->getFirstItem();
49
+ if ($newsitem->getData() && $newsitem->getData('status') == 1) {
50
+ if ($category!=null) {
51
+ $newsitem->setCategory($category);
52
+ }
53
+ Mage::register('newsitem', $newsitem);
54
+ } else {
55
+ $this->_forward('NoRoute');
56
+ return;
57
+ }
58
+ }
59
+
60
+ if ( $news_id && !Mage::registry('clnews') ) {
61
+ $newsitem = Mage::getModel('clnews/news')->load($news_id);
62
+ if ($newsitem!=null) {
63
+ if ($category!=null) {
64
+ $newsitem->setCategory($category);
65
+ }
66
+ Mage::register('newsitem', $newsitem);
67
+ } else {
68
+ $this->_redirect(Mage::helper('clnews')->getRoute());
69
+ }
70
+ }
71
+
72
+ if ($data = $this->getRequest()->getPost()) {
73
+ $model = Mage::getModel('clnews/comment');
74
+ $model->setData($data);
75
+ if (!$newsitem->getCommentsEnabled()) {
76
+ $session->addError(Mage::helper('clnews')->__('Comments are not enabled.'));
77
+ $this->_forward('NoRoute');
78
+ return;
79
+ }
80
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
81
+ $model->setUser(Mage::helper('clnews')->getUserName());
82
+ $model->setEmail(Mage::helper('clnews')->getUserEmail());
83
+ }
84
+
85
+ try {
86
+ $model->setCreatedTime(now());
87
+ $model->setComment(htmlspecialchars($model->getComment(), ENT_QUOTES));
88
+ if ((int)Mage::getStoreConfig('clnews/comments/need_confirmation')) {
89
+ $model->setCommentStatus(CommerceLab_News_Helper_Data::UNAPPROVED_STATUS);
90
+ $session->addSuccess(Mage::helper('clnews')->__('Your comment has been successfully sent. It will be added after approval by our admin'));
91
+ } else {
92
+ $model->setCommentStatus(CommerceLab_News_Helper_Data::APPROVED_STATUS);
93
+ $session->addSuccess(Mage::helper('clnews')->__('Thank you for adding a comment.'));
94
+ }
95
+ $model->save();
96
+
97
+ $commentId = $model->getCommentId();
98
+ } catch (Exception $e) {
99
+ $this->_forward('NoRoute');
100
+ }
101
+
102
+ if ((int)Mage::getStoreConfig('clnews/comments/need_confirmation') && Mage::getStoreConfig('clnews/comments/recipient_email') != null && $model->getStatus() == CommerceLab_News_Helper_Data::UNAPPROVED_STATUS && isset($commentId)) {
103
+ $translate = Mage::getSingleton('core/translate');
104
+ /* @var $translate Mage_Core_Model_Translate */
105
+ $translate->setTranslateInline(false);
106
+ try {
107
+ $emailData = new Varien_Object();
108
+ $data["url"] = Mage::getUrl('clnews/adminhtml_comment/edit/id/' . $commentId);
109
+ $emailData->setData($data);
110
+ $mailTemplate = Mage::getModel('core/email_template');
111
+ $mailTemplate->setDesignConfig(array('area' => 'frontend'))
112
+ ->sendTransactional(Mage::getStoreConfig('clnews/comments/email_template'),
113
+ Mage::getStoreConfig('clnews/comments/sender_email_identity'),
114
+ Mage::getStoreConfig('clnews/comments/recipient_email'),
115
+ null,
116
+ array('data' => $emailData));
117
+ $translate->setTranslateInline(true);
118
+ } catch (Exception $e) {
119
+ $translate->setTranslateInline(true);
120
+ }
121
+ }
122
+ $this->_redirectReferer();
123
+ return;
124
+ }
125
+ $this->loadLayout();
126
+ $this->_initLayoutMessages('core/session');
127
+ $this->renderLayout();
128
+ }
129
+
130
+ public function printAction()
131
+ {
132
+ $head = $this->getLayout()->getBlock('head');
133
+ $news_id = (int)$this->getRequest()->getParam('article');
134
+ if ($news_id && !Mage::registry('clnews')) {
135
+ $newsitem = Mage::getModel('clnews/news')->load($news_id);
136
+ if ($newsitem!=null) {
137
+ Mage::register('newsitem', $newsitem);
138
+ } else {
139
+ $this->_redirect(Mage::helper('clnews')->getRoute());
140
+ }
141
+ }
142
+ $block = $this->getLayout()->createBlock('clnews/newsitem')->setTemplate('clnews/news_print.phtml');
143
+ echo $block->toHtml();
144
+ }
145
+
146
+ public function ajaxAction()
147
+ {
148
+ $data = array();
149
+ $pages = array();
150
+ $currentPage = $this->getRequest()->getParam('page');
151
+ if (!$currentPage) {
152
+ $currentPage=1;
153
+ }
154
+
155
+ $itemsPerPage = (int)Mage::getStoreConfig('clnews/comments/commentsperpage');
156
+ if ($itemsPerPage > 0) {
157
+ $itemsOnPage = $itemsPerPage;
158
+ } else {
159
+ $itemsOnPage = 10;
160
+ }
161
+ $collection = Mage::getModel('clnews/comment')->getCollection()
162
+ ->addNewsFilter($this->getRequest()->getParam('id'))
163
+ ->addApproveFilter(CommerceLab_News_Helper_Data::APPROVED_STATUS)
164
+ ->setOrder('created_time ', 'asc');
165
+ $pagesCount = ceil($collection->getSize()/$itemsOnPage);
166
+ for ($i=1; $i<=$pagesCount;$i++) {
167
+ $pages[] = $i;
168
+ }
169
+
170
+ $collection->setPageSize($itemsOnPage);
171
+ $collection->setCurPage($currentPage);
172
+ if ($currentPage == 1) {
173
+ $backPage = 'undefined';
174
+ $fovardPage = $currentPage + 1;
175
+ } elseif ($currentPage == $pagesCount) {
176
+ $backPage = $currentPage -1;
177
+ $fovardPage = 'undefined';
178
+ } else {
179
+ $backPage = $currentPage - 1;
180
+ $fovardPage = $currentPage + 1;
181
+ }
182
+ $k = 0;
183
+ foreach ($collection->getData() as $val) {
184
+ $data['collection'][$k]['comment_id'] = $val['comment_id'];
185
+ $data['collection'][$k]['news_id'] = $val['news_id'];
186
+ $data['collection'][$k]['comment'] = $val['comment'];
187
+ $data['collection'][$k]['status'] = $val['comment_status'];
188
+ $data['collection'][$k]['created_time'] = $val['created_time'];
189
+ $data['collection'][$k]['user'] = $val['user'];
190
+ $data['collection'][$k]['email'] = $val['email'];
191
+ $k++;
192
+ }
193
+ if ($backPage != 'undefined') {
194
+ $data['dat']['back_url'] = 'onclick="AjaxSend(' . $backPage . ',' . $this->getRequest()->getParam('id') . ', true);"';
195
+ }
196
+ if ($fovardPage != 'undefined') {
197
+ $data['dat']['fovard_url'] = 'onclick="AjaxSend(' . $fovardPage . ',' . $this->getRequest()->getParam('id') . ', true);"';
198
+ }
199
+ $data['dat']['cnt'] = count($collection->getData());
200
+ $data = json_encode($data);
201
+ echo $data;
202
+ }
203
+ }
app/code/community/CommerceLab/News/controllers/RssController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ class CommerceLab_News_RssController extends Mage_Core_Controller_Front_Action
19
+ {
20
+ public function indexAction()
21
+ {
22
+ if ((int)Mage::getStoreConfig('clnews/rss/enable')) {
23
+ $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
24
+ $this->loadLayout(false);
25
+ $this->renderLayout();
26
+ } else {
27
+ $this->_forward('NoRoute');
28
+ }
29
+ }
30
+
31
+ public function noRouteAction($coreRoute = null)
32
+ {
33
+ $this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
34
+ $this->getResponse()->setHeader('Status', '404 File not found');
35
+
36
+ $pageId = Mage::getStoreConfig('web/default/cms_no_route');
37
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
38
+ $this->_forward('defaultNoRoute');
39
+ }
40
+ }
41
+ }
app/code/community/CommerceLab/News/etc/config.xml ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <CommerceLab_News>
5
+ <version>1.0.0</version><platform>ce</platform>
6
+ </CommerceLab_News>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <clnews>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>CommerceLab_News</module>
14
+ <frontName>clnews</frontName>
15
+ </args>
16
+ </clnews>
17
+ </routers>
18
+ </admin>
19
+ <frontend>
20
+ <routers>
21
+ <clnews>
22
+ <use>standard</use>
23
+ <args>
24
+ <module>CommerceLab_News</module>
25
+ <frontName>clnews</frontName>
26
+ </args>
27
+ </clnews>
28
+ </routers>
29
+ <layout>
30
+ <updates>
31
+ <clnews>
32
+ <file>clnews.xml</file>
33
+ </clnews>
34
+ </updates>
35
+ </layout>
36
+ <translate>
37
+ <modules>
38
+ <CommerceLab_News>
39
+ <files>
40
+ <default>CommerceLab_News.csv</default>
41
+ </files>
42
+ </CommerceLab_News>
43
+ </modules>
44
+ </translate>
45
+ </frontend>
46
+
47
+ <adminhtml>
48
+ <translate>
49
+ <modules>
50
+ <CommerceLab_News>
51
+ <files>
52
+ <default>CommerceLab_News.csv</default>
53
+ </files>
54
+ </CommerceLab_News>
55
+ </modules>
56
+ </translate>
57
+
58
+ <menu>
59
+ <clnews module="clnews">
60
+ <title>News</title>
61
+ <sort_order>80</sort_order>
62
+ <children>
63
+ <add translate="title" module="clnews">
64
+ <title>Add News Article</title>
65
+ <sort_order>0</sort_order>
66
+ <action>clnews/adminhtml_news/new</action>
67
+ </add>
68
+ <items translate="title" module="clnews">
69
+ <title>News Manager</title>
70
+ <sort_order>10</sort_order>
71
+ <action>clnews/adminhtml_news/index</action>
72
+ </items>
73
+ <category module="clnews">
74
+ <title>Categories</title>
75
+ <sort_order>20</sort_order>
76
+ <action>clnews/adminhtml_category/</action>
77
+ </category>
78
+ <comments module="clnews">
79
+ <title>Comments</title>
80
+ <sort_order>30</sort_order>
81
+ <action>clnews/adminhtml_comment/</action>
82
+ </comments>
83
+ <settings translate="title" module="clnews">
84
+ <title>Settings</title>
85
+ <sort_order>40</sort_order>
86
+ <action>adminhtml/system_config/edit/section/clnews</action>
87
+ </settings>
88
+ </children>
89
+ </clnews>
90
+ </menu>
91
+ <acl>
92
+ <resources>
93
+ <all>
94
+ <title>Allow Everything</title>
95
+ </all>
96
+ <admin>
97
+ <children>
98
+ <clnews>
99
+ <title>News</title>
100
+ <sort_order>50</sort_order>
101
+ <children>
102
+ <items translate="title">
103
+ <title>News</title>
104
+ <sort_order>10</sort_order>
105
+ </items>
106
+ <category translate="title">
107
+ <title>Categories</title>
108
+ <sort_order>20</sort_order>
109
+ </category>
110
+ <comments translate="title">
111
+ <title>Comments</title>
112
+ <sort_order>30</sort_order>
113
+ </comments>
114
+ </children>
115
+ </clnews>
116
+ <system>
117
+ <children>
118
+ <config>
119
+ <children>
120
+ <clnews>
121
+ <title>News Section</title>
122
+ </clnews>
123
+ </children>
124
+ </config>
125
+ </children>
126
+ </system>
127
+ </children>
128
+ </admin>
129
+ </resources>
130
+ </acl>
131
+ <layout>
132
+ <updates>
133
+ <clnews>
134
+ <file>clnews.xml</file>
135
+ </clnews>
136
+ </updates>
137
+ </layout>
138
+ <events>
139
+ <controller_action_predispatch>
140
+ <observers>
141
+ <clnews>
142
+ <type>singleton</type>
143
+ <class>clnews/check</class>
144
+ <method>checkExtensions</method>
145
+ </clnews>
146
+ </observers>
147
+ </controller_action_predispatch>
148
+ </events>
149
+ </adminhtml>
150
+ <global>
151
+ <models>
152
+ <clnews>
153
+ <class>CommerceLab_News_Model</class>
154
+ <resourceModel>clnews_mysql4</resourceModel>
155
+ </clnews>
156
+ <clnews_mysql4>
157
+ <class>CommerceLab_News_Model_Mysql4</class>
158
+ <entities>
159
+ <news>
160
+ <table>clnews_news</table>
161
+ </news>
162
+ <comment>
163
+ <table>clnews_comment</table>
164
+ </comment>
165
+ <category>
166
+ <table>clnews_category</table>
167
+ </category>
168
+ <news_category>
169
+ <table>clnews_news_category</table>
170
+ </news_category>
171
+ <store>
172
+ <table>clnews_store</table>
173
+ </store>
174
+ <news_store>
175
+ <table>clnews_news_store</table>
176
+ </news_store>
177
+ <category_store>
178
+ <table>clnews_category_store</table>
179
+ </category_store>
180
+ </entities>
181
+ </clnews_mysql4>
182
+ </models>
183
+ <resources>
184
+ <clnews_setup>
185
+ <setup>
186
+ <module>CommerceLab_News</module>
187
+ </setup>
188
+ <connection>
189
+ <use>core_setup</use>
190
+ </connection>
191
+ </clnews_setup>
192
+ <clnews_write>
193
+ <connection>
194
+ <use>core_write</use>
195
+ </connection>
196
+ </clnews_write>
197
+ <clnews_read>
198
+ <connection>
199
+ <use>core_read</use>
200
+ </connection>
201
+ </clnews_read>
202
+ </resources>
203
+ <blocks>
204
+ <clnews>
205
+ <class>CommerceLab_News_Block</class>
206
+ </clnews>
207
+ </blocks>
208
+ <helpers>
209
+ <clnews>
210
+ <class>CommerceLab_News_Helper</class>
211
+ </clnews>
212
+ </helpers>
213
+ <events>
214
+ <controller_front_init_routers>
215
+ <observers>
216
+ <clnews>
217
+ <type>singleton</type>
218
+ <class>CommerceLab_News_Controller_Router</class>
219
+ <method>initControllerRouters</method>
220
+ </clnews>
221
+ </observers>
222
+ </controller_front_init_routers>
223
+ </events>
224
+ <rewrite>
225
+ <clnews_category_view>
226
+ <complete />
227
+ <from>#^/clnews/category/([A-Za-z0-9\-\_]+)\.html/*#</from>
228
+ <to>/clnews/index/index/category/$1</to>
229
+ </clnews_category_view>
230
+ <clnews_newsitem_view>
231
+ <complete />
232
+ <from>#^/clnews/([A-Za-z0-9\-\_]+)\.html/*#</from>
233
+ <to>/clnews/newsitem/view/key/$1</to>
234
+ </clnews_newsitem_view>
235
+ <clnews_newsitem_category_view>
236
+ <complete />
237
+ <from>#^/clnews/([A-Za-z0-9\-\_]+)/([A-Za-z0-9\-\_]+)\.html/*#</from>
238
+ <to>/clnews/newsitem/view/category/$1/key/$2</to>
239
+ </clnews_newsitem_category_view>
240
+ </rewrite>
241
+ <template>
242
+ <email>
243
+ <clnews_comments_email_template translate="label" module="clnews">
244
+ <label>New Comment</label>
245
+ <file>clnews/new_comment.html</file>
246
+ <type>text</type>
247
+ </clnews_comments_email_template>
248
+ </email>
249
+ </template>
250
+ </global>
251
+ <default>
252
+ <clnews>
253
+ <news>
254
+ <title>News</title>
255
+ <route>news</route>
256
+ <showbreadcrumbs>1</showbreadcrumbs>
257
+ <itemsperpage>10</itemsperpage>
258
+ <showdateofnews>1</showdateofnews>
259
+ </news>
260
+ <comments>
261
+ <enabled>1</enabled>
262
+ </comments>
263
+ </clnews>
264
+ </default>
265
+ </config>
app/code/community/CommerceLab/News/etc/system.xml ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <clall translate="label" module="clnews">
5
+ <label>CommerceLab Extensions</label>
6
+ <sort_order>300</sort_order>
7
+ </clall>
8
+ </tabs>
9
+ <sections>
10
+ <clnews translate="label" module="clnews">
11
+ <label>News</label>
12
+ <tab>clall</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <news translate="label">
20
+ <label>News Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <title translate="label">
28
+ <label>News Title</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </title>
35
+ <route translate="label">
36
+ <label>Route to News</label>
37
+ <comment>e.g. "news" will make the news accessible from domain.com/news. Should not contain slashes. Leave blank for default - news</comment>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>12</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </route>
44
+ <showbreadcrumbs translate="label">
45
+ <label>Show Breadcrumbs</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>adminhtml/system_config_source_yesno</source_model>
48
+ <sort_order>20</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </showbreadcrumbs>
53
+ <itemsperpage translate="label">
54
+ <label>Articles per Page</label>
55
+ <comment>The number of articles displayed per page</comment>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>30</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </itemsperpage>
62
+ <showlatestnews translate="label">
63
+ <label>Show Latest News Block</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>adminhtml/system_config_source_yesno</source_model>
66
+ <sort_order>31</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </showlatestnews>
71
+ <latestitemscount translate="label">
72
+ <label>Q-ty in the Latest Block</label>
73
+ <comment>Set the number</comment>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>35</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </latestitemscount>
80
+ <showdateofnews translate="label">
81
+ <label>Show Date of the News</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>36</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </showdateofnews>
89
+ <showtimeofnews translate="label">
90
+ <label>Show Time of the News</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>adminhtml/system_config_source_yesno</source_model>
93
+ <sort_order>37</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </showtimeofnews>
98
+ <showauthorofnews translate="label">
99
+ <label>Show Author of the News</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>38</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </showauthorofnews>
107
+ <showcategoryofnews translate="label">
108
+ <label>Show Category of the News</label>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>adminhtml/system_config_source_yesno</source_model>
111
+ <sort_order>39</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </showcategoryofnews>
116
+ <enablelinkrout translate="label">
117
+ <label>Enable Link “View More”</label>
118
+ <comment>default: view more</comment>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>adminhtml/system_config_source_yesno</source_model>
121
+ <sort_order>40</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>1</show_in_store>
125
+ </enablelinkrout>
126
+ <linkrout translate="label">
127
+ <label>Name of the Link</label>
128
+ <comment>example: view more</comment>
129
+ <frontend_type>text</frontend_type>
130
+ <sort_order>41</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ </linkrout>
135
+ <tags translate="label">
136
+ <label>Tags for the News</label>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <sort_order>42</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ </tags>
144
+ <google translate="label">
145
+ <label>Enable Google Button for News</label>
146
+ <frontend_type>select</frontend_type>
147
+ <source_model>adminhtml/system_config_source_yesno</source_model>
148
+ <sort_order>43</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </google>
153
+ <twitter translate="label">
154
+ <label>Enable Twitter Button for News</label>
155
+ <frontend_type>select</frontend_type>
156
+ <source_model>adminhtml/system_config_source_yesno</source_model>
157
+ <sort_order>44</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ </twitter>
162
+ <facebook translate="label">
163
+ <label>Enable Facebook Button for News</label>
164
+ <frontend_type>select</frontend_type>
165
+ <source_model>adminhtml/system_config_source_yesno</source_model>
166
+ <sort_order>45</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ </facebook>
171
+ <linked_in translate="label">
172
+ <label>Enable LinkedIn Button for News</label>
173
+ <frontend_type>select</frontend_type>
174
+ <source_model>adminhtml/system_config_source_yesno</source_model>
175
+ <sort_order>46</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ </linked_in>
180
+ <metatitle translate="label">
181
+ <label>Default Meta Title</label>
182
+ <frontend_type>text</frontend_type>
183
+ <sort_order>47</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ </metatitle>
188
+ <metakeywords translate="label">
189
+ <label>Default Meta Keywords</label>
190
+ <frontend_type>textarea</frontend_type>
191
+ <sort_order>50</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ </metakeywords>
196
+ <metadescription translate="label">
197
+ <label>Default Meta Description</label>
198
+ <frontend_type>textarea</frontend_type>
199
+ <sort_order>60</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+ </metadescription>
204
+ </fields>
205
+ </news>
206
+ <comments translate="label">
207
+ <label>Comments</label>
208
+ <frontend_type>text</frontend_type>
209
+ <sort_order>40</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>1</show_in_website>
212
+ <show_in_store>1</show_in_store>
213
+ <fields>
214
+ <recipient_email translate="label">
215
+ <label>Send comments to email</label>
216
+ <frontend_type>text</frontend_type>
217
+ <sort_order>40</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>1</show_in_website>
220
+ <show_in_store>1</show_in_store>
221
+ </recipient_email>
222
+ <sender_email_identity translate="label">
223
+ <label>Email Sender</label>
224
+ <frontend_type>select</frontend_type>
225
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
226
+ <sort_order>50</sort_order>
227
+ <show_in_default>1</show_in_default>
228
+ <show_in_website>1</show_in_website>
229
+ <show_in_store>1</show_in_store>
230
+ </sender_email_identity>
231
+ <email_template translate="label">
232
+ <label>Email Template</label>
233
+ <frontend_type>select</frontend_type>
234
+ <source_model>adminhtml/system_config_source_email_template</source_model>
235
+ <sort_order>60</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ </email_template>
240
+ <need_confirmation translate="label">
241
+ <label>Is Confirmation Required</label>
242
+ <frontend_type>select</frontend_type>
243
+ <source_model>adminhtml/system_config_source_yesno</source_model>
244
+ <sort_order>70</sort_order>
245
+ <show_in_default>1</show_in_default>
246
+ <show_in_website>1</show_in_website>
247
+ <show_in_store>1</show_in_store>
248
+ </need_confirmation>
249
+ <need_login translate="label">
250
+ <label>Should user be logged in to leave a comment</label>
251
+ <frontend_type>select</frontend_type>
252
+ <source_model>adminhtml/system_config_source_yesno</source_model>
253
+ <sort_order>71</sort_order>
254
+ <show_in_default>1</show_in_default>
255
+ <show_in_website>1</show_in_website>
256
+ <show_in_store>1</show_in_store>
257
+ </need_login>
258
+ <commentsperpage translate="label">
259
+ <label>Comments per Page</label>
260
+ <comment>The number of comments displayed per page</comment>
261
+ <frontend_type>text</frontend_type>
262
+ <sort_order>75</sort_order>
263
+ <show_in_default>1</show_in_default>
264
+ <show_in_website>1</show_in_website>
265
+ <show_in_store>1</show_in_store>
266
+ </commentsperpage>
267
+ </fields>
268
+ </comments>
269
+ <rss translate="label">
270
+ <label>RSS Feed</label>
271
+ <frontend_type>text</frontend_type>
272
+ <sort_order>60</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ <fields>
277
+ <enable translate="label">
278
+ <label>Enable</label>
279
+ <frontend_type>select</frontend_type>
280
+ <source_model>adminhtml/system_config_source_yesno</source_model>
281
+ <sort_order>1</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ </enable>
286
+ <posts translate="label">
287
+ <label>Articles to show</label>
288
+ <comment>Number of articles to show in the RSS feed.</comment>
289
+ <frontend_type>text</frontend_type>
290
+ <sort_order>2</sort_order>
291
+ <show_in_default>1</show_in_default>
292
+ <show_in_website>1</show_in_website>
293
+ <show_in_store>1</show_in_store>
294
+ </posts>
295
+ </fields>
296
+ </rss>
297
+ </groups>
298
+ </clnews>
299
+ </sections>
300
+ </config>
app/code/community/CommerceLab/News/sql/clnews_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommerceLab Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the CommerceLab License Agreement
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://commerce-lab.com/LICENSE.txt
11
+ *
12
+ * @category CommerceLab
13
+ * @package CommerceLab_News
14
+ * @copyright Copyright (c) 2011 CommerceLab Co. (http://commerce-lab.com)
15
+ * @license http://commerce-lab.com/LICENSE.txt
16
+ */
17
+
18
+ $installer = $this;
19
+ $installer->startSetup();
20
+
21
+ try{
22
+ $installer->run("
23
+ DROP TABLE IF EXISTS {$this->getTable('clnews/news')};
24
+ CREATE TABLE {$this->getTable('clnews/news')} (
25
+ `news_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
26
+ `title` varchar(255) NOT NULL DEFAULT '',
27
+ `url_key` varchar(255) NOT NULL DEFAULT '',
28
+ `short_content` text NOT NULL,
29
+ `full_content` text NOT NULL,
30
+ `document` varchar(255) NOT NULL DEFAULT '',
31
+ `image_short_content` varchar(255) NOT NULL DEFAULT '',
32
+ `image_full_content` varchar(255) NOT NULL DEFAULT '',
33
+ `image_short_content_show` int(11) NOT NULL DEFAULT '0',
34
+ `image_full_content_show` int(11) NOT NULL DEFAULT '0',
35
+ `full_path_document` varchar(255) NOT NULL DEFAULT '',
36
+ `status` smallint(6) NOT NULL DEFAULT '0',
37
+ `news_time` datetime DEFAULT NULL,
38
+ `created_time` datetime DEFAULT NULL,
39
+ `update_time` datetime DEFAULT NULL,
40
+ `publicate_from_time` datetime DEFAULT NULL,
41
+ `publicate_to_time` datetime DEFAULT NULL,
42
+ `author` varchar(255) NOT NULL DEFAULT '',
43
+ `meta_keywords` text NOT NULL,
44
+ `meta_description` text NOT NULL,
45
+ `comments_enabled` tinyint(11) NOT NULL,
46
+ `publicate_from_hours` int(11) NOT NULL DEFAULT '0',
47
+ `publicate_to_hours` int(11) NOT NULL DEFAULT '0',
48
+ `publicate_from_minutes` int(11) NOT NULL DEFAULT '0',
49
+ `publicate_to_minutes` int(11) NOT NULL DEFAULT '0',
50
+ `link` varchar(255) NOT NULL DEFAULT '',
51
+ `tags` text NOT NULL,
52
+ `short_height_resize` int(11) DEFAULT NULL,
53
+ `short_width_resize` int(11) DEFAULT NULL,
54
+ `full_width_resize` int(11) DEFAULT NULL,
55
+ `full_height_resize` int(11) DEFAULT NULL,
56
+ PRIMARY KEY ( `news_id` )
57
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
58
+
59
+ INSERT INTO {$this->getTable('clnews/news')} VALUES (NULL, 'Welcome to CommerceLab news', 'test', 'This is a short content', 'This is a content', '', '', '', '0', '0', '', '1', NOW( ), NOW( ), NOW( ), NULL, NULL, 'Test author', 'Meta Keywords', 'Meta Description', '0', '0', '0', '0', '0', '', '', NULL, NULL, NULL, NULL);
60
+
61
+ DROP TABLE IF EXISTS {$this->getTable('clnews/comment')};
62
+ CREATE TABLE {$this->getTable('clnews/comment')} (
63
+ `comment_id` int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
64
+ `news_id` smallint( 11 ) NOT NULL default '0',
65
+ `comment` text NOT NULL ,
66
+ `comment_status` smallint( 6 ) NOT NULL default '0',
67
+ `created_time` datetime default NULL ,
68
+ `user` varchar( 255 ) NOT NULL default '',
69
+ `email` varchar( 255 ) NOT NULL default '',
70
+ PRIMARY KEY ( `comment_id` )
71
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
72
+
73
+ INSERT INTO {$this->getTable('clnews/comment')} (`comment_id` ,`news_id` ,`comment` ,`comment_status` ,`created_time` ,`user` ,`email`)
74
+ VALUES (NULL , '1', 'This is the first comment. It can be edited, deleted or set to unapproved so it is not displayed. This can be done in the admin panel.', '2', NOW( ) , '', '');
75
+
76
+ DROP TABLE IF EXISTS {$this->getTable('clnews/category')};
77
+ CREATE TABLE {$this->getTable('clnews/category')} (
78
+ `category_id` int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
79
+ `title` varchar( 255 ) NOT NULL default '',
80
+ `url_key` varchar( 255 ) NOT NULL default '',
81
+ `sort_order` tinyint ( 6 ) NOT NULL ,
82
+ `meta_keywords` text NOT NULL ,
83
+ `meta_description` text NOT NULL ,
84
+ PRIMARY KEY ( `category_id` )
85
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
86
+
87
+ INSERT INTO {$this->getTable('clnews/category')} (
88
+ `category_id` ,
89
+ `title`,
90
+ `url_key`
91
+ )
92
+ VALUES (
93
+ NULL , 'Default', 'default'
94
+ );
95
+
96
+ SET @last_category_id = LAST_INSERT_ID();
97
+ SELECT @default_store_id:=store_id AS store_id FROM core_store where code = 'admin';
98
+
99
+ DROP TABLE IF EXISTS {$this->getTable('clnews/news_store')};
100
+ CREATE TABLE {$this->getTable('clnews/news_store')} (
101
+ `news_id` smallint(6) unsigned,
102
+ `store_id` smallint(6) unsigned
103
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
104
+
105
+ DROP TABLE IF EXISTS {$this->getTable('clnews/category_store')};
106
+ CREATE TABLE {$this->getTable('clnews/category_store')} (
107
+ `category_id` smallint(6) unsigned ,
108
+ `store_id` smallint(6) unsigned
109
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
110
+
111
+ INSERT INTO {$this->getTable('clnews/category_store')} VALUES (@last_category_id, @default_store_id);
112
+
113
+ DROP TABLE IF EXISTS {$this->getTable('clnews/news_category')};
114
+ CREATE TABLE {$this->getTable('clnews/news_category')} (
115
+ `category_id` smallint(6) unsigned ,
116
+ `news_id` smallint(6) unsigned
117
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
118
+ ");
119
+
120
+ }catch(Exception $e){}
121
+
122
+ $installer->endSetup();
app/design/frontend/default/default/layout/clnews.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category design_default
17
+ * @package Mage
18
+ * @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <layout version="0.1.0">
23
+ <default>
24
+ <reference name="head">
25
+ <action method="addItem"><type>skin_css</type><name>css/clnews/style.css</name></action>
26
+ <action method="addJs"><script>jquery/jquery-1.4.4.js</script></action>
27
+ <action method="addJs"><script>commercelab/noconflict.js</script></action>
28
+ </reference>
29
+ <reference name="root">
30
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
31
+ </reference>
32
+ <reference name="right">
33
+ <block type="clnews/news" name="right.clnews.menu" before="-">
34
+ <action method="setTemplate">
35
+ <template>clnews/menu.phtml</template>
36
+ </action>
37
+ </block>
38
+ <block type="clnews/news" name="right.clnews.latest" after="right.clnews.menu">
39
+ <action method="setTemplate" ifconfig="clnews/news/showlatestnews">
40
+ <template>clnews/latest.phtml</template>
41
+ </action>
42
+ </block>
43
+ </reference>
44
+ <reference name="left">
45
+ <block type="clnews/news" name="left.clnews.menu" before="-">
46
+ <action method="setTemplate">
47
+ <template>clnews/menu.phtml</template>
48
+ </action>
49
+ </block>
50
+ </reference>
51
+ <reference name="top.links">
52
+ <block type="clnews/news" name="top.clnews.link">
53
+ <action method="getTopLink"></action>
54
+ </block>
55
+ </reference>
56
+ </default>
57
+
58
+ <clnews_index_index>
59
+ <reference name="content">
60
+ <block type="clnews/news" name="news" template="clnews/list.phtml"/>
61
+ </reference>
62
+ </clnews_index_index>
63
+
64
+ <clnews_newsitem_view>
65
+ <reference name="content">
66
+ <!-- <block type="core/template" name="contactForm" template="contacts/form.phtml"/> -->
67
+ <block type="clnews/newsitem" name="newsitem" template="clnews/newsitem.phtml"/>
68
+ </reference>
69
+ </clnews_newsitem_view>
70
+
71
+ <clnews_rss_index>
72
+ <block type="clnews/rss" output="toHtml" name="news.rss"/>
73
+ </clnews_rss_index>
74
+ </layout>
app/design/frontend/default/default/template/clnews/latest.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $items = $this->getLatestNewsItems() ?>
2
+ <?php if (count($items)): ?>
3
+ <div class="block news-categories">
4
+ <div class="head block-title">
5
+ <strong><span><?php echo $this->__(Mage::getStoreConfig('clnews/news/title'));?></span></strong>
6
+ </div>
7
+ <div class="block-content">
8
+ <div class="menu-categories">
9
+ <ul>
10
+ <?php foreach ($items as $item): ?>
11
+ <? if ($item->getData('status') == 1):?>
12
+ <li>
13
+ <a href="<?php echo str_replace('clnews', $this->getAlias(), $item->getUrl()) ?>" ><?php echo $item->getTitle();?></a>
14
+ <?php if (Mage::helper('clnews')->showDate()): ?>
15
+ <?php if (Mage::helper('clnews')->showTime()): ?>
16
+ <span class="date"><?php echo Mage::helper('core')->formatDate($item->getNewsTime(), true) ?></span>
17
+ <? else: ?>
18
+ <? $date = Mage::helper('core')->formatDate($item->getNewsTime(), true); ?>
19
+ <? $pos = strpos($date, ' '); ?>
20
+ <? $date = substr($date, 0, $pos);?>
21
+ <span class="date"><?php echo $date; ?></span>
22
+ <? endif; ?>
23
+ <? endif; ?>
24
+ </li>
25
+ <? endif; ?>
26
+ <?php endforeach; ?>
27
+ <li><a href="<?php echo $this->getUrl(Mage::helper('clnews')->getRoute()) ?>">&gt;&gt;</a></li>
28
+ </ul>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <?php endif ?>
app/design/frontend/default/default/template/clnews/list.phtml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h2><?php echo $this->__(Mage::getStoreConfig('clnews/news/title')) ?>
2
+ <?php if (Mage::getStoreConfig('clnews/rss/enable')): ?>
3
+ <?php if ($this->getCurrentCategory()): ?>
4
+ <?php $categoryId = $this->getCurrentCategory()->getId() ?>
5
+ <?php endif ?>
6
+ <a href="<?php echo Mage::Helper('clnews')->getRssLink(isset($categoryId)?$categoryId:null) ?>">
7
+ <img src="<?php echo $this->getSkinUrl('css/clnews/images/rss.gif') ?>">
8
+ </a>
9
+ <?php endif ?>
10
+ </h2>
11
+ <?php $items = $this->getNewsItems() ?>
12
+ <?php foreach ($items as $item): ?>
13
+ <div class="news-item">
14
+ <? if ($item->getImageShortContentShow() == 1): ?>
15
+ <?
16
+ $width = '';
17
+ $height = '';
18
+ if ($item->getShortWidthResize()): $width = $item->getShortWidthResize(); else: $width = '150'; endif;
19
+ if ($item->getShortHeightResize()): $height = $item->getShortHeightResize(); else: $height = '125'; endif;
20
+ ?>
21
+ <div class="news_image"><img src="<?php echo Mage::helper('clnews')->resizeImage(str_replace('clnews/', '', $item->getImageShortContent()), $width, $height, 'clnews'); ?>" /></div>
22
+ <? endif; ?>
23
+ <h5><a href="<?php echo $item->getUrl($this->getCategory()) ?>" ><?php echo $item->getTitle();?></a></h5>
24
+ <?php if (Mage::helper('clnews')->showDate()): ?>
25
+ <?php if (Mage::helper('clnews')->showTime()): ?>
26
+ <span class="date"><?php echo Mage::helper('core')->formatDate($item->getNewsTime(), true) ?></span>
27
+ <? else: ?>
28
+ <? $date = Mage::helper('core')->formatDate($item->getNewsTime(), true); ?>
29
+ <? $pos = strpos($date, ' '); ?>
30
+ <? $date = substr($date, 0, $pos);?>
31
+ <span class="date"><?php echo $date; ?></span>
32
+ <? endif; ?>
33
+ <?php endif ?>
34
+ <?php if ($item->getAuthor()): ?>
35
+ <span class="date">&nbsp;<?php if (Mage::helper('clnews')->showAuthor()): ?>|&nbsp; <?php echo $item->getAuthor() ?><?php endif;?></span>
36
+ <?php endif ?>
37
+ <div class="description">
38
+ <?php echo $item->getShortContent(); ?>
39
+
40
+ <? if(Mage::helper('clnews')->enableLinkRoute()): ?>
41
+ <? if($link = Mage::helper('clnews')->getLinkRoute()): ?>
42
+ <a href="<?php echo $item->getUrl($this->getCategory()) ?>" class="more"><?php echo $link . '&raquo;';?></a>
43
+ <? else: ?>
44
+ <a href="<?php echo $item->getUrl($this->getCategory()) ?>" class="more"><?php echo $this->__('view more') . '&raquo;';?></a>
45
+ <? endif; ?>
46
+ <? endif; ?>
47
+ </div>
48
+
49
+ <div>
50
+ <?php if($item->getCommentsEnabled()): ?>
51
+ <a href="<?php echo $this->getItemUrl($item->getId()) ?>#commentBox" class="comment"><?php echo $item->getCommentsCount(); ?> <?php echo $this->__('Comment(s)') ?></a>
52
+ <?php endif; ?>
53
+ </div>
54
+ </div>
55
+ <?php endforeach; ?>
56
+
57
+
58
+ <?php if($this->getLastPageNum()>1): ?>
59
+ <div class="pager">
60
+ <p class="page">
61
+ <?php if (!$this->isFirstPage()): ?>
62
+ <a href="<?php echo $this->getPreviousPageUrl() ?>"><?php echo $this->__('Previous') ?></a>
63
+ <?php endif;?>
64
+ <?php foreach ($this->getPages() as $_page): ?>
65
+ <?php if ($this->isPageCurrent($_page)): ?>
66
+ <span><?php echo $_page ?></span>
67
+ <?php else: ?>
68
+ <a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a>
69
+ <?php endif ?>
70
+ <?php endforeach; ?>
71
+ <?php if (!$this->isLastPage()): ?>
72
+ <a href="<?php echo $this->getNextPageUrl() ?>"><?php echo $this->__('Next') ?></a>
73
+ <?php endif ?>
74
+ </p>
75
+ </div>
76
+ <?php endif;?>
app/design/frontend/default/default/template/clnews/menu.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $categories = $this->getCategories(); ?>
2
+ <?php if (count($categories)): ?>
3
+ <div class="block news-categories">
4
+ <div class="head block-title">
5
+ <strong><span><?php echo $this->__(Mage::getStoreConfig('clnews/news/title'));?></span></strong>
6
+ </div>
7
+ <div class="block-content">
8
+ <div class="menu-categories">
9
+ <h5><?php echo $this->__('Categories');?></h5>
10
+ <ul>
11
+ <?php foreach ($categories as $category): ?>
12
+ <li><a href="<?php echo $category->getLink(); ?>" ><?php echo $category->getTitle();?></a></li>
13
+ <?php endforeach; ?>
14
+ </ul>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <?php endif ?>
app/design/frontend/default/default/template/clnews/news_print.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
5
+ <link rel="stylesheet" type="text/css" href="<? echo $this->getSkinUrl('css/print.css'); ?>" media="print">
6
+ <script type="text/javascript" src="<? echo $this->getJsUrl(); ?>commercelab/jquery-1.4.2.min.js"></script>
7
+ <style type="text/css">
8
+ body {font:9pt Arial, Helvetica, sans-serif;padding:15px;}
9
+ a {color:#2976c9;}
10
+ .print-head {height:50px;}
11
+ .logo {float:left;margin-right:150px;}
12
+ h4 {clear:both;font-size:10pt;}
13
+ .print {float:left;margin-top:15px;}
14
+ .print img {border:none;margin:2px 4px -2px 0;}
15
+ </style>
16
+ </head>
17
+ <body class="page-print<?php echo $this->getBodyClass()?$this->getBodyClass():'' ?>">
18
+ <div>
19
+ <div class="print-head">
20
+ <img src="<?php echo $this->getPrintLogoUrl() ? $this->getPrintLogoUrl() : $this->getSkinUrl('images/logo_print.gif') ?>" class="logo" alt="" />
21
+ <?php if ($this->getPrintLogoText()):?>
22
+ <address><?php echo nl2br($this->htmlEscape($this->getPrintLogoText())) ?></address>
23
+ <?php endif;?>
24
+
25
+ <a href="javascript:window.print();" class="print"><img class="ic_print" height="16" width="16" alt="" title="" src="<? echo $this->getSkinUrl('images/i_print.gif'); ?>"><?php echo $this->__('Print') ?></a>
26
+ </div>
27
+
28
+ <?php $item = $this->getNewsitem(); ?>
29
+ <h4><?php echo $item->getTitle() ?></h4>
30
+ <?php if (Mage::helper('clnews')->showDate()): ?>
31
+ <?php if (Mage::helper('clnews')->showTime()): ?>
32
+ <span class="date"><?php echo Mage::helper('core')->formatDate($item->getNewsTime(), true) ?></span>
33
+ <? else: ?>
34
+ <? $date = Mage::helper('core')->formatDate($item->getNewsTime(), true); ?>
35
+ <? $pos = strpos($date, ' '); ?>
36
+ <? $date = substr($date, 0, $pos);?>
37
+ <span class="date"><?php echo $date; ?></span>
38
+ <? endif; ?>
39
+ <? endif; ?>
40
+ <?php if (Mage::helper('clnews')->showCategory()): ?>
41
+ <span class="date">&nbsp;|&nbsp; <? echo $this->getCategoryByNews($item->getID())->getData('title'); ?></span>
42
+ <? endif; ?>
43
+ <?php echo $item->getFullContent(); ?>
44
+ <?php echo $this->getAbsoluteFooter(); ?>
45
+ </div>
46
+ </body>
47
+ </html>
app/design/frontend/default/default/template/clnews/newsitem.phtml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
2
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
3
+ <div id="fb-root"></div>
4
+ <script>(function(d, s, id) {
5
+ var js, fjs = d.getElementsByTagName(s)[0];
6
+ if (d.getElementById(id)) return;
7
+ js = d.createElement(s); js.id = id;
8
+ js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1";
9
+ fjs.parentNode.insertBefore(js, fjs);
10
+ }(document, 'script', 'facebook-jssdk'));</script>
11
+ <?php $session = Mage::getSingleton('core/session'); ?>
12
+ <?php $item = $this->getNewsitem(); ?>
13
+ <h4><?php echo $item->getTitle() ?></h4>
14
+ <?php if (Mage::helper('clnews')->showDate()): ?>
15
+ <?php if (Mage::helper('clnews')->showTime()): ?>
16
+ <span class="date"><?php echo Mage::helper('core')->formatDate($item->getNewsTime(), true) ?></span>
17
+ <?php else: ?>
18
+ <?php $date = Mage::helper('core')->formatDate($item->getNewsTime(), true); ?>
19
+ <?php $pos = strpos($date, ' '); ?>
20
+ <?php $date = substr($date, 0, $pos);?>
21
+ <span class="date"><?php echo $date; ?></span>
22
+ <?php endif; ?>
23
+ <?php endif; ?>
24
+ <?php if (Mage::helper('clnews')->showCategory()): ?>
25
+ <?php if ($this->getCategoryByNews($item->getID())->getData('title') != ''): ?>
26
+ <span class="date">&nbsp;|&nbsp; <?php echo $this->getCategoryByNews($item->getID())->getData('title'); ?></span>
27
+ <?php endif; ?>
28
+ <?php endif; ?>
29
+
30
+ <div class="social">
31
+ <?php if (Mage::helper('clnews')->getGoogleAccess()): ?><div class="google_button"><g:plusone></g:plusone></div><?php endif; ?><?php if (Mage::helper('clnews')->getFaceBookAccess()): ?><div class="fb-like" data-send="false" data-layout="button_count" data-width="110" data-show-faces="false"></div><?php endif; ?><?php if (Mage::helper('clnews')->getLinkedInAccess()): ?><script type="IN/Share" data-counter="right"></script><?php endif; ?><?php if (Mage::helper('clnews')->getTwitterAccess()): ?><a href="https://twitter.com/share" class="twitter-share-button">Tweet</a><?php endif; ?>
32
+ <a href="<?php echo $this->getUrl(Mage::helper('clnews')->getRoute() . '/newsitem/print/article/' . $item->getId()); ?>" class="print-btn"><?php echo $this->__('Print Version'); ?></a>
33
+ </div>
34
+ <?php if ($item->getImageFullContentShow() == 1): ?>
35
+ <div class="news_image">
36
+ <?php
37
+ $width = '';
38
+ $height = '';
39
+ if ($item->getFullWidthResize()): $width = $item->getFullWidthResize(); else: $width = '150'; endif;
40
+ if ($item->getFullHeightResize()): $height = $item->getFullHeightResize(); else: $height = '125'; endif;
41
+ ?>
42
+ <img src="<?php echo Mage::helper('clnews')->resizeImage(str_replace('clnews/', '', $item->getImageFullContent()), $width, $height, 'clnews'); ?>" /></div>
43
+ <?php endif; ?>
44
+ <div class="news">
45
+ <?php echo $this->contentFilter($item->getFullContent()); ?>
46
+
47
+ <?php if ($item->getDocument()!=''): ?>
48
+ <p class="loadfile"><a href="<?php echo str_replace('\\', '/', Mage::Helper('clnews')->getFileUrl($item)); ?>"><?php if ($item->getLink()): echo $item->getLink(); else: echo $this->__('Download attached document'); endif; ?></a></p>
49
+ <?php endif ?>
50
+ <?php if (Mage::helper('clnews')->showAuthor()): ?>
51
+ <?php if ($item->getAuthor()): ?>
52
+ <span><?php echo $this->__('Author: ').$item->getAuthor(); ?></span>
53
+ <?php endif; ?>
54
+ <?php endif; ?>
55
+ </div>
56
+
57
+ <p>
58
+ <?php if (Mage::helper('clnews')->getTagsAccess()): ?>
59
+ <?php if ($item->getTags()): ?>
60
+ <?php $arr = preg_split('/,/', $item->getTags()); ?>
61
+ <?php $tags = ''; ?>
62
+ <?php $count = count($arr); ?>
63
+ <?php $k = 1; ?>
64
+ <?php foreach ($arr as $val): ?>
65
+ <?php if ($k == $count): ?>
66
+ <?php $tags .= '<a href="' . $this->getUrl(Mage::helper('clnews')->getRoute() . '/index/index/q/' . urlencode(trim($val)) . '/') . '" >' . trim($val) . '</a> '; ?>
67
+ <?php else: ?>
68
+ <?php $tags .= '<a href="' . $this->getUrl(Mage::helper('clnews')->getRoute() . '/index/index/q/' . urlencode(trim($val)) . '/') . '" >' . trim($val) . '</a>, '; ?>
69
+ <?php endif; ?>
70
+ <?php $k++; ?>
71
+ <?php endforeach; ?>
72
+ <img src="<?php echo $this->getSkinUrl('css/clnews/images/i-tags.gif')?>"/>&nbsp;<?php echo $tags; ?>
73
+ <?php endif; ?>
74
+ <?php endif; ?>
75
+ </p>
76
+ <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
77
+ <div class="news-item-comment">
78
+ <?php if($item->getCommentsEnabled()): ?>
79
+ <?php $comments = $this->getComments(); ?>
80
+ <div>
81
+ <a name="commentBox" ></a>
82
+ <h2><?php echo $this->getCommentTotalString($comments);?></h2>
83
+ </div>
84
+ <div id="clloader" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/clnews/ajax-loader.gif')?>"/></div>
85
+ <div id="comment_block">
86
+ <?php $k = 0;?>
87
+ <?php foreach ($comments as $comment): ?>
88
+ <div id="comment_item_<?php echo $k;?>" class="comment-item">
89
+ <h4 class="username"><?php echo $comment->getUser();?></h4>
90
+ <?php echo $this->__("posted on")?> <?php echo Mage::helper('core')->formatDate($comment->getCreatedTime(), true);?>
91
+ <div><?php echo $comment->getComment();?></div>
92
+ </div>
93
+ <?php $k++;?>
94
+ <?php endforeach; ?>
95
+ </div>
96
+ <?php if($this->getLastPageNum()>1): ?>
97
+ <div class="pager">
98
+ <p class="page">
99
+ <span id="prev"><span class="prev" style="display:none;"><?php echo $this->__('Previous') ?></span></span>
100
+ <?php foreach ($this->getPages() as $_page): ?>
101
+ <?php if ($this->isPageCurrent($_page)): ?>
102
+ <span id="page_<?php echo $_page ?>" class="page current" onclick="AjaxSend(<?php echo $_page ?>, <?php echo $item->getId() ?>, true);"><?php echo $_page ?></span>
103
+ <?php else: ?>
104
+ <span id="page_<?php echo $_page ?>" class="page" onclick="AjaxSend(<?php echo $_page ?>, <?php echo $item->getId() ?>, true);"><?php echo $_page ?></span>
105
+ <?php endif ?>
106
+ <?php endforeach; ?>
107
+ <span id="next"><span class="next"><?php echo $this->__('Next') ?></span></span>
108
+ </p>
109
+ </div>
110
+ <?php endif;?>
111
+ <?php if (!$this->getRequireLogin() || ($this->getRequireLogin()&&$this->helper('customer')->isLoggedIn())): ?>
112
+ <form id="postComment" method="post" action="">
113
+ <h4><?php echo Mage::helper('clnews')->__('Submit Comment') ?></h4>
114
+ <ul>
115
+ <li>
116
+ <?php if (!$this->helper('customer')->isLoggedIn()): ?>
117
+ <div class="input-box">
118
+ <label for="name"><?php echo Mage::helper('clnews')->__('Name') ?> <span class="required">*</span></label>
119
+ <input name="user" id="user" value="<?php echo $this->getCommentName(); ?>" title="<?php echo $this->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('clnews')->getUserName()) ?>" class="required-entry input-text" type="text" />
120
+ </div>
121
+ <div class="clear"></div>
122
+
123
+ <div class="input-box">
124
+ <label for="email"><?php echo Mage::helper('clnews')->__('Email') ?> <span class="required">*</span></label>
125
+ <input name="email" id="email" value="<?php echo $this->getCommentEmail(); ?>" title="<?php echo $this->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('clnews')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text" />
126
+ </div>
127
+ <?php else: ?>
128
+ <input name="post_id" type="hidden" value="<?php echo $item->getPostId();?>" />
129
+ <input name="email" type="hidden" value="<?php echo $this->htmlEscape($this->helper('clnews')->getUserEmail()) ?>"/><br/>
130
+ <input name="user" type="hidden" value="<?php echo $this->htmlEscape($this->helper('clnews')->getUserName()) ?>"/><br/>
131
+ <?php endif ?>
132
+ <div class="clear"></div>
133
+ <div class="input-box">
134
+ <label for="comment"><?php echo Mage::helper('clnews')->__('Comment') ?> <span class="required">*</span></label>
135
+ <textarea name="comment" id="comment" title="<?php echo Mage::helper('clnews')->__('Comment') ?>" class="required-entry input-text" style="height:150px;width:400px;" cols="50" rows="5"><?php echo $this->getCommentText(); ?></textarea>
136
+ </div>
137
+ </li>
138
+ <?php if (Mage::getStoreConfig('clnews/captcha/enabled')): ?>
139
+ <!-- - -->
140
+ <?php endif ?>
141
+ </li>
142
+ </ul>
143
+ <div class="button-set">
144
+ <input name="news_id" type="hidden" value="<?php echo $item->getId() ?>" />
145
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
146
+ <button class="button" type="submit"><span><span><?php echo Mage::helper('clnews')->__('Submit Comment') ?></span></span></button>
147
+ </div>
148
+ </form>
149
+
150
+ <script type="text/javascript">
151
+ var contactForm = new VarienForm('postComment', false);
152
+ </script>
153
+ <?php else: ?>
154
+ <p><?php echo Mage::helper('clnews')->__('You must be logged in to post a comment.');?></p>
155
+ <p><a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>"><?php echo Mage::helper('clnews')->__('click here');?></a> <?php echo Mage::helper('clnews')->__('to log in');?></p>
156
+ <?php endif; ?>
157
+ <?php endif; ?>
158
+
159
+ </div>
160
+ <a href="<?php echo $this->getBackUrl() ?>" class="back">&laquo; Back</a>
161
+ <script type="text/javascript">
162
+ function AjaxSend(page, id, showLoader)
163
+ {
164
+ var url = "<?php echo Mage::getBaseUrl()?>clnews/newsitem/ajax/id/" + id + "/page/" + page + "/";
165
+ if (showLoader) {
166
+ jQuery("#clloader").css("display","block");
167
+ }
168
+ jQuery.ajax({
169
+ url: url,
170
+ dataType: 'json',
171
+ success: function(data) {
172
+ var content = '';
173
+ jQuery(".comment-item").remove();
174
+ for(var i = 0; i < data['dat'].cnt; i++) {
175
+ content = '<div id="comment_item_'+ i +'" class="comment-item"><h4 class="username">'+ data['collection'][i].user +'</h4> <?php echo $this->__("posted on")?> ' + data['collection'][i].created_time + '<div>' + data['collection'][i].comment + '</div></div>';
176
+ jQuery('#comment_block').append(content);
177
+ }
178
+ jQuery(".prev").remove();
179
+ if (typeof(data['dat'].back_url) != 'undefined') {
180
+ jQuery("#prev").append('<span class="prev" ' + data['dat'].back_url + ' ><?php echo $this->__('Previous') ?></span>');
181
+ }
182
+ jQuery(".next").remove();
183
+ if (typeof(data['dat'].fovard_url) != 'undefined') {
184
+ jQuery("#next").append('<span class="next" ' + data['dat'].fovard_url + ' ><?php echo $this->__('Next') ?></span>');
185
+ }
186
+ jQuery("#clloader").css("display","none");
187
+ }
188
+ });
189
+ jQuery(".page").removeClass("current");
190
+ var cl = 'page_' + page;
191
+ jQuery("#" + cl).addClass("current");
192
+ }
193
+ (function() {
194
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
195
+ po.src = 'https://apis.google.com/js/plusone.js';
196
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
197
+ <?php if (count($comments)): ?>
198
+ AjaxSend(1, <?php echo $item->getID() ?>, false);
199
+ <?php endif ?>
200
+ })();
201
+ </script>
app/etc/modules/CommerceLab_News.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <CommerceLab_News>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </CommerceLab_News>
8
+ </modules>
9
+ </config>
js/commercelab/noconflict.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ jQuery.noConflict();
2
+ var CommerceLab = {};
3
+
4
+
js/jquery/jquery-1.4.4.js ADDED
@@ -0,0 +1,7180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.4.4
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2010, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2010, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Thu Nov 11 19:04:53 2010 -0500
15
+ */
16
+ (function( window, undefined ) {
17
+
18
+ // Use the correct document accordingly with window argument (sandbox)
19
+ var document = window.document;
20
+ var jQuery = (function() {
21
+
22
+ // Define a local copy of jQuery
23
+ var jQuery = function( selector, context ) {
24
+ // The jQuery object is actually just the init constructor 'enhanced'
25
+ return new jQuery.fn.init( selector, context );
26
+ },
27
+
28
+ // Map over jQuery in case of overwrite
29
+ _jQuery = window.jQuery,
30
+
31
+ // Map over the $ in case of overwrite
32
+ _$ = window.$,
33
+
34
+ // A central reference to the root jQuery(document)
35
+ rootjQuery,
36
+
37
+ // A simple way to check for HTML strings or ID strings
38
+ // (both of which we optimize for)
39
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
40
+
41
+ // Is it a simple selector
42
+ isSimple = /^.[^:#\[\.,]*$/,
43
+
44
+ // Check if a string has a non-whitespace character in it
45
+ rnotwhite = /\S/,
46
+ rwhite = /\s/,
47
+
48
+ // Used for trimming whitespace
49
+ trimLeft = /^\s+/,
50
+ trimRight = /\s+$/,
51
+
52
+ // Check for non-word characters
53
+ rnonword = /\W/,
54
+
55
+ // Check for digits
56
+ rdigit = /\d/,
57
+
58
+ // Match a standalone tag
59
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
60
+
61
+ // JSON RegExp
62
+ rvalidchars = /^[\],:{}\s]*$/,
63
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
64
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
65
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
66
+
67
+ // Useragent RegExp
68
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
69
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
70
+ rmsie = /(msie) ([\w.]+)/,
71
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
72
+
73
+ // Keep a UserAgent string for use with jQuery.browser
74
+ userAgent = navigator.userAgent,
75
+
76
+ // For matching the engine and version of the browser
77
+ browserMatch,
78
+
79
+ // Has the ready events already been bound?
80
+ readyBound = false,
81
+
82
+ // The functions to execute on DOM ready
83
+ readyList = [],
84
+
85
+ // The ready event handler
86
+ DOMContentLoaded,
87
+
88
+ // Save a reference to some core methods
89
+ toString = Object.prototype.toString,
90
+ hasOwn = Object.prototype.hasOwnProperty,
91
+ push = Array.prototype.push,
92
+ slice = Array.prototype.slice,
93
+ trim = String.prototype.trim,
94
+ indexOf = Array.prototype.indexOf,
95
+
96
+ // [[Class]] -> type pairs
97
+ class2type = {};
98
+
99
+ jQuery.fn = jQuery.prototype = {
100
+ init: function( selector, context ) {
101
+ var match, elem, ret, doc;
102
+
103
+ // Handle $(""), $(null), or $(undefined)
104
+ if ( !selector ) {
105
+ return this;
106
+ }
107
+
108
+ // Handle $(DOMElement)
109
+ if ( selector.nodeType ) {
110
+ this.context = this[0] = selector;
111
+ this.length = 1;
112
+ return this;
113
+ }
114
+
115
+ // The body element only exists once, optimize finding it
116
+ if ( selector === "body" && !context && document.body ) {
117
+ this.context = document;
118
+ this[0] = document.body;
119
+ this.selector = "body";
120
+ this.length = 1;
121
+ return this;
122
+ }
123
+
124
+ // Handle HTML strings
125
+ if ( typeof selector === "string" ) {
126
+ // Are we dealing with HTML string or an ID?
127
+ match = quickExpr.exec( selector );
128
+
129
+ // Verify a match, and that no context was specified for #id
130
+ if ( match && (match[1] || !context) ) {
131
+
132
+ // HANDLE: $(html) -> $(array)
133
+ if ( match[1] ) {
134
+ doc = (context ? context.ownerDocument || context : document);
135
+
136
+ // If a single string is passed in and it's a single tag
137
+ // just do a createElement and skip the rest
138
+ ret = rsingleTag.exec( selector );
139
+
140
+ if ( ret ) {
141
+ if ( jQuery.isPlainObject( context ) ) {
142
+ selector = [ document.createElement( ret[1] ) ];
143
+ jQuery.fn.attr.call( selector, context, true );
144
+
145
+ } else {
146
+ selector = [ doc.createElement( ret[1] ) ];
147
+ }
148
+
149
+ } else {
150
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
151
+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
152
+ }
153
+
154
+ return jQuery.merge( this, selector );
155
+
156
+ // HANDLE: $("#id")
157
+ } else {
158
+ elem = document.getElementById( match[2] );
159
+
160
+ // Check parentNode to catch when Blackberry 4.6 returns
161
+ // nodes that are no longer in the document #6963
162
+ if ( elem && elem.parentNode ) {
163
+ // Handle the case where IE and Opera return items
164
+ // by name instead of ID
165
+ if ( elem.id !== match[2] ) {
166
+ return rootjQuery.find( selector );
167
+ }
168
+
169
+ // Otherwise, we inject the element directly into the jQuery object
170
+ this.length = 1;
171
+ this[0] = elem;
172
+ }
173
+
174
+ this.context = document;
175
+ this.selector = selector;
176
+ return this;
177
+ }
178
+
179
+ // HANDLE: $("TAG")
180
+ } else if ( !context && !rnonword.test( selector ) ) {
181
+ this.selector = selector;
182
+ this.context = document;
183
+ selector = document.getElementsByTagName( selector );
184
+ return jQuery.merge( this, selector );
185
+
186
+ // HANDLE: $(expr, $(...))
187
+ } else if ( !context || context.jquery ) {
188
+ return (context || rootjQuery).find( selector );
189
+
190
+ // HANDLE: $(expr, context)
191
+ // (which is just equivalent to: $(context).find(expr)
192
+ } else {
193
+ return jQuery( context ).find( selector );
194
+ }
195
+
196
+ // HANDLE: $(function)
197
+ // Shortcut for document ready
198
+ } else if ( jQuery.isFunction( selector ) ) {
199
+ return rootjQuery.ready( selector );
200
+ }
201
+
202
+ if (selector.selector !== undefined) {
203
+ this.selector = selector.selector;
204
+ this.context = selector.context;
205
+ }
206
+
207
+ return jQuery.makeArray( selector, this );
208
+ },
209
+
210
+ // Start with an empty selector
211
+ selector: "",
212
+
213
+ // The current version of jQuery being used
214
+ jquery: "1.4.4",
215
+
216
+ // The default length of a jQuery object is 0
217
+ length: 0,
218
+
219
+ // The number of elements contained in the matched element set
220
+ size: function() {
221
+ return this.length;
222
+ },
223
+
224
+ toArray: function() {
225
+ return slice.call( this, 0 );
226
+ },
227
+
228
+ // Get the Nth element in the matched element set OR
229
+ // Get the whole matched element set as a clean array
230
+ get: function( num ) {
231
+ return num == null ?
232
+
233
+ // Return a 'clean' array
234
+ this.toArray() :
235
+
236
+ // Return just the object
237
+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
238
+ },
239
+
240
+ // Take an array of elements and push it onto the stack
241
+ // (returning the new matched element set)
242
+ pushStack: function( elems, name, selector ) {
243
+ // Build a new jQuery matched element set
244
+ var ret = jQuery();
245
+
246
+ if ( jQuery.isArray( elems ) ) {
247
+ push.apply( ret, elems );
248
+
249
+ } else {
250
+ jQuery.merge( ret, elems );
251
+ }
252
+
253
+ // Add the old object onto the stack (as a reference)
254
+ ret.prevObject = this;
255
+
256
+ ret.context = this.context;
257
+
258
+ if ( name === "find" ) {
259
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
260
+ } else if ( name ) {
261
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
262
+ }
263
+
264
+ // Return the newly-formed element set
265
+ return ret;
266
+ },
267
+
268
+ // Execute a callback for every element in the matched set.
269
+ // (You can seed the arguments with an array of args, but this is
270
+ // only used internally.)
271
+ each: function( callback, args ) {
272
+ return jQuery.each( this, callback, args );
273
+ },
274
+
275
+ ready: function( fn ) {
276
+ // Attach the listeners
277
+ jQuery.bindReady();
278
+
279
+ // If the DOM is already ready
280
+ if ( jQuery.isReady ) {
281
+ // Execute the function immediately
282
+ fn.call( document, jQuery );
283
+
284
+ // Otherwise, remember the function for later
285
+ } else if ( readyList ) {
286
+ // Add the function to the wait list
287
+ readyList.push( fn );
288
+ }
289
+
290
+ return this;
291
+ },
292
+
293
+ eq: function( i ) {
294
+ return i === -1 ?
295
+ this.slice( i ) :
296
+ this.slice( i, +i + 1 );
297
+ },
298
+
299
+ first: function() {
300
+ return this.eq( 0 );
301
+ },
302
+
303
+ last: function() {
304
+ return this.eq( -1 );
305
+ },
306
+
307
+ slice: function() {
308
+ return this.pushStack( slice.apply( this, arguments ),
309
+ "slice", slice.call(arguments).join(",") );
310
+ },
311
+
312
+ map: function( callback ) {
313
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
314
+ return callback.call( elem, i, elem );
315
+ }));
316
+ },
317
+
318
+ end: function() {
319
+ return this.prevObject || jQuery(null);
320
+ },
321
+
322
+ // For internal use only.
323
+ // Behaves like an Array's method, not like a jQuery method.
324
+ push: push,
325
+ sort: [].sort,
326
+ splice: [].splice
327
+ };
328
+
329
+ // Give the init function the jQuery prototype for later instantiation
330
+ jQuery.fn.init.prototype = jQuery.fn;
331
+
332
+ jQuery.extend = jQuery.fn.extend = function() {
333
+ var options, name, src, copy, copyIsArray, clone,
334
+ target = arguments[0] || {},
335
+ i = 1,
336
+ length = arguments.length,
337
+ deep = false;
338
+
339
+ // Handle a deep copy situation
340
+ if ( typeof target === "boolean" ) {
341
+ deep = target;
342
+ target = arguments[1] || {};
343
+ // skip the boolean and the target
344
+ i = 2;
345
+ }
346
+
347
+ // Handle case when target is a string or something (possible in deep copy)
348
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
349
+ target = {};
350
+ }
351
+
352
+ // extend jQuery itself if only one argument is passed
353
+ if ( length === i ) {
354
+ target = this;
355
+ --i;
356
+ }
357
+
358
+ for ( ; i < length; i++ ) {
359
+ // Only deal with non-null/undefined values
360
+ if ( (options = arguments[ i ]) != null ) {
361
+ // Extend the base object
362
+ for ( name in options ) {
363
+ src = target[ name ];
364
+ copy = options[ name ];
365
+
366
+ // Prevent never-ending loop
367
+ if ( target === copy ) {
368
+ continue;
369
+ }
370
+
371
+ // Recurse if we're merging plain objects or arrays
372
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
373
+ if ( copyIsArray ) {
374
+ copyIsArray = false;
375
+ clone = src && jQuery.isArray(src) ? src : [];
376
+
377
+ } else {
378
+ clone = src && jQuery.isPlainObject(src) ? src : {};
379
+ }
380
+
381
+ // Never move original objects, clone them
382
+ target[ name ] = jQuery.extend( deep, clone, copy );
383
+
384
+ // Don't bring in undefined values
385
+ } else if ( copy !== undefined ) {
386
+ target[ name ] = copy;
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+ // Return the modified object
393
+ return target;
394
+ };
395
+
396
+ jQuery.extend({
397
+ noConflict: function( deep ) {
398
+ window.$ = _$;
399
+
400
+ if ( deep ) {
401
+ window.jQuery = _jQuery;
402
+ }
403
+
404
+ return jQuery;
405
+ },
406
+
407
+ // Is the DOM ready to be used? Set to true once it occurs.
408
+ isReady: false,
409
+
410
+ // A counter to track how many items to wait for before
411
+ // the ready event fires. See #6781
412
+ readyWait: 1,
413
+
414
+ // Handle when the DOM is ready
415
+ ready: function( wait ) {
416
+ // A third-party is pushing the ready event forwards
417
+ if ( wait === true ) {
418
+ jQuery.readyWait--;
419
+ }
420
+
421
+ // Make sure that the DOM is not already loaded
422
+ if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
423
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
424
+ if ( !document.body ) {
425
+ return setTimeout( jQuery.ready, 1 );
426
+ }
427
+
428
+ // Remember that the DOM is ready
429
+ jQuery.isReady = true;
430
+
431
+ // If a normal DOM Ready event fired, decrement, and wait if need be
432
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
433
+ return;
434
+ }
435
+
436
+ // If there are functions bound, to execute
437
+ if ( readyList ) {
438
+ // Execute all of them
439
+ var fn,
440
+ i = 0,
441
+ ready = readyList;
442
+
443
+ // Reset the list of functions
444
+ readyList = null;
445
+
446
+ while ( (fn = ready[ i++ ]) ) {
447
+ fn.call( document, jQuery );
448
+ }
449
+
450
+ // Trigger any bound ready events
451
+ if ( jQuery.fn.trigger ) {
452
+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
453
+ }
454
+ }
455
+ }
456
+ },
457
+
458
+ bindReady: function() {
459
+ if ( readyBound ) {
460
+ return;
461
+ }
462
+
463
+ readyBound = true;
464
+
465
+ // Catch cases where $(document).ready() is called after the
466
+ // browser event has already occurred.
467
+ if ( document.readyState === "complete" ) {
468
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
469
+ return setTimeout( jQuery.ready, 1 );
470
+ }
471
+
472
+ // Mozilla, Opera and webkit nightlies currently support this event
473
+ if ( document.addEventListener ) {
474
+ // Use the handy event callback
475
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
476
+
477
+ // A fallback to window.onload, that will always work
478
+ window.addEventListener( "load", jQuery.ready, false );
479
+
480
+ // If IE event model is used
481
+ } else if ( document.attachEvent ) {
482
+ // ensure firing before onload,
483
+ // maybe late but safe also for iframes
484
+ document.attachEvent("onreadystatechange", DOMContentLoaded);
485
+
486
+ // A fallback to window.onload, that will always work
487
+ window.attachEvent( "onload", jQuery.ready );
488
+
489
+ // If IE and not a frame
490
+ // continually check to see if the document is ready
491
+ var toplevel = false;
492
+
493
+ try {
494
+ toplevel = window.frameElement == null;
495
+ } catch(e) {}
496
+
497
+ if ( document.documentElement.doScroll && toplevel ) {
498
+ doScrollCheck();
499
+ }
500
+ }
501
+ },
502
+
503
+ // See test/unit/core.js for details concerning isFunction.
504
+ // Since version 1.3, DOM methods and functions like alert
505
+ // aren't supported. They return false on IE (#2968).
506
+ isFunction: function( obj ) {
507
+ return jQuery.type(obj) === "function";
508
+ },
509
+
510
+ isArray: Array.isArray || function( obj ) {
511
+ return jQuery.type(obj) === "array";
512
+ },
513
+
514
+ // A crude way of determining if an object is a window
515
+ isWindow: function( obj ) {
516
+ return obj && typeof obj === "object" && "setInterval" in obj;
517
+ },
518
+
519
+ isNaN: function( obj ) {
520
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
521
+ },
522
+
523
+ type: function( obj ) {
524
+ return obj == null ?
525
+ String( obj ) :
526
+ class2type[ toString.call(obj) ] || "object";
527
+ },
528
+
529
+ isPlainObject: function( obj ) {
530
+ // Must be an Object.
531
+ // Because of IE, we also have to check the presence of the constructor property.
532
+ // Make sure that DOM nodes and window objects don't pass through, as well
533
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
534
+ return false;
535
+ }
536
+
537
+ // Not own constructor property must be Object
538
+ if ( obj.constructor &&
539
+ !hasOwn.call(obj, "constructor") &&
540
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
541
+ return false;
542
+ }
543
+
544
+ // Own properties are enumerated firstly, so to speed up,
545
+ // if last one is own, then all properties are own.
546
+
547
+ var key;
548
+ for ( key in obj ) {}
549
+
550
+ return key === undefined || hasOwn.call( obj, key );
551
+ },
552
+
553
+ isEmptyObject: function( obj ) {
554
+ for ( var name in obj ) {
555
+ return false;
556
+ }
557
+ return true;
558
+ },
559
+
560
+ error: function( msg ) {
561
+ throw msg;
562
+ },
563
+
564
+ parseJSON: function( data ) {
565
+ if ( typeof data !== "string" || !data ) {
566
+ return null;
567
+ }
568
+
569
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
570
+ data = jQuery.trim( data );
571
+
572
+ // Make sure the incoming data is actual JSON
573
+ // Logic borrowed from http://json.org/json2.js
574
+ if ( rvalidchars.test(data.replace(rvalidescape, "@")
575
+ .replace(rvalidtokens, "]")
576
+ .replace(rvalidbraces, "")) ) {
577
+
578
+ // Try to use the native JSON parser first
579
+ return window.JSON && window.JSON.parse ?
580
+ window.JSON.parse( data ) :
581
+ (new Function("return " + data))();
582
+
583
+ } else {
584
+ jQuery.error( "Invalid JSON: " + data );
585
+ }
586
+ },
587
+
588
+ noop: function() {},
589
+
590
+ // Evalulates a script in a global context
591
+ globalEval: function( data ) {
592
+ if ( data && rnotwhite.test(data) ) {
593
+ // Inspired by code by Andrea Giammarchi
594
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
595
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
596
+ script = document.createElement("script");
597
+
598
+ script.type = "text/javascript";
599
+
600
+ if ( jQuery.support.scriptEval ) {
601
+ script.appendChild( document.createTextNode( data ) );
602
+ } else {
603
+ script.text = data;
604
+ }
605
+
606
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
607
+ // This arises when a base node is used (#2709).
608
+ head.insertBefore( script, head.firstChild );
609
+ head.removeChild( script );
610
+ }
611
+ },
612
+
613
+ nodeName: function( elem, name ) {
614
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
615
+ },
616
+
617
+ // args is for internal usage only
618
+ each: function( object, callback, args ) {
619
+ var name, i = 0,
620
+ length = object.length,
621
+ isObj = length === undefined || jQuery.isFunction(object);
622
+
623
+ if ( args ) {
624
+ if ( isObj ) {
625
+ for ( name in object ) {
626
+ if ( callback.apply( object[ name ], args ) === false ) {
627
+ break;
628
+ }
629
+ }
630
+ } else {
631
+ for ( ; i < length; ) {
632
+ if ( callback.apply( object[ i++ ], args ) === false ) {
633
+ break;
634
+ }
635
+ }
636
+ }
637
+
638
+ // A special, fast, case for the most common use of each
639
+ } else {
640
+ if ( isObj ) {
641
+ for ( name in object ) {
642
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
643
+ break;
644
+ }
645
+ }
646
+ } else {
647
+ for ( var value = object[0];
648
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
649
+ }
650
+ }
651
+
652
+ return object;
653
+ },
654
+
655
+ // Use native String.trim function wherever possible
656
+ trim: trim ?
657
+ function( text ) {
658
+ return text == null ?
659
+ "" :
660
+ trim.call( text );
661
+ } :
662
+
663
+ // Otherwise use our own trimming functionality
664
+ function( text ) {
665
+ return text == null ?
666
+ "" :
667
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
668
+ },
669
+
670
+ // results is for internal usage only
671
+ makeArray: function( array, results ) {
672
+ var ret = results || [];
673
+
674
+ if ( array != null ) {
675
+ // The window, strings (and functions) also have 'length'
676
+ // The extra typeof function check is to prevent crashes
677
+ // in Safari 2 (See: #3039)
678
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
679
+ var type = jQuery.type(array);
680
+
681
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
682
+ push.call( ret, array );
683
+ } else {
684
+ jQuery.merge( ret, array );
685
+ }
686
+ }
687
+
688
+ return ret;
689
+ },
690
+
691
+ inArray: function( elem, array ) {
692
+ if ( array.indexOf ) {
693
+ return array.indexOf( elem );
694
+ }
695
+
696
+ for ( var i = 0, length = array.length; i < length; i++ ) {
697
+ if ( array[ i ] === elem ) {
698
+ return i;
699
+ }
700
+ }
701
+
702
+ return -1;
703
+ },
704
+
705
+ merge: function( first, second ) {
706
+ var i = first.length,
707
+ j = 0;
708
+
709
+ if ( typeof second.length === "number" ) {
710
+ for ( var l = second.length; j < l; j++ ) {
711
+ first[ i++ ] = second[ j ];
712
+ }
713
+
714
+ } else {
715
+ while ( second[j] !== undefined ) {
716
+ first[ i++ ] = second[ j++ ];
717
+ }
718
+ }
719
+
720
+ first.length = i;
721
+
722
+ return first;
723
+ },
724
+
725
+ grep: function( elems, callback, inv ) {
726
+ var ret = [], retVal;
727
+ inv = !!inv;
728
+
729
+ // Go through the array, only saving the items
730
+ // that pass the validator function
731
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
732
+ retVal = !!callback( elems[ i ], i );
733
+ if ( inv !== retVal ) {
734
+ ret.push( elems[ i ] );
735
+ }
736
+ }
737
+
738
+ return ret;
739
+ },
740
+
741
+ // arg is for internal usage only
742
+ map: function( elems, callback, arg ) {
743
+ var ret = [], value;
744
+
745
+ // Go through the array, translating each of the items to their
746
+ // new value (or values).
747
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
748
+ value = callback( elems[ i ], i, arg );
749
+
750
+ if ( value != null ) {
751
+ ret[ ret.length ] = value;
752
+ }
753
+ }
754
+
755
+ return ret.concat.apply( [], ret );
756
+ },
757
+
758
+ // A global GUID counter for objects
759
+ guid: 1,
760
+
761
+ proxy: function( fn, proxy, thisObject ) {
762
+ if ( arguments.length === 2 ) {
763
+ if ( typeof proxy === "string" ) {
764
+ thisObject = fn;
765
+ fn = thisObject[ proxy ];
766
+ proxy = undefined;
767
+
768
+ } else if ( proxy && !jQuery.isFunction( proxy ) ) {
769
+ thisObject = proxy;
770
+ proxy = undefined;
771
+ }
772
+ }
773
+
774
+ if ( !proxy && fn ) {
775
+ proxy = function() {
776
+ return fn.apply( thisObject || this, arguments );
777
+ };
778
+ }
779
+
780
+ // Set the guid of unique handler to the same of original handler, so it can be removed
781
+ if ( fn ) {
782
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
783
+ }
784
+
785
+ // So proxy can be declared as an argument
786
+ return proxy;
787
+ },
788
+
789
+ // Mutifunctional method to get and set values to a collection
790
+ // The value/s can be optionally by executed if its a function
791
+ access: function( elems, key, value, exec, fn, pass ) {
792
+ var length = elems.length;
793
+
794
+ // Setting many attributes
795
+ if ( typeof key === "object" ) {
796
+ for ( var k in key ) {
797
+ jQuery.access( elems, k, key[k], exec, fn, value );
798
+ }
799
+ return elems;
800
+ }
801
+
802
+ // Setting one attribute
803
+ if ( value !== undefined ) {
804
+ // Optionally, function values get executed if exec is true
805
+ exec = !pass && exec && jQuery.isFunction(value);
806
+
807
+ for ( var i = 0; i < length; i++ ) {
808
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
809
+ }
810
+
811
+ return elems;
812
+ }
813
+
814
+ // Getting an attribute
815
+ return length ? fn( elems[0], key ) : undefined;
816
+ },
817
+
818
+ now: function() {
819
+ return (new Date()).getTime();
820
+ },
821
+
822
+ // Use of jQuery.browser is frowned upon.
823
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
824
+ uaMatch: function( ua ) {
825
+ ua = ua.toLowerCase();
826
+
827
+ var match = rwebkit.exec( ua ) ||
828
+ ropera.exec( ua ) ||
829
+ rmsie.exec( ua ) ||
830
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
831
+ [];
832
+
833
+ return { browser: match[1] || "", version: match[2] || "0" };
834
+ },
835
+
836
+ browser: {}
837
+ });
838
+
839
+ // Populate the class2type map
840
+ jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
841
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
842
+ });
843
+
844
+ browserMatch = jQuery.uaMatch( userAgent );
845
+ if ( browserMatch.browser ) {
846
+ jQuery.browser[ browserMatch.browser ] = true;
847
+ jQuery.browser.version = browserMatch.version;
848
+ }
849
+
850
+ // Deprecated, use jQuery.browser.webkit instead
851
+ if ( jQuery.browser.webkit ) {
852
+ jQuery.browser.safari = true;
853
+ }
854
+
855
+ if ( indexOf ) {
856
+ jQuery.inArray = function( elem, array ) {
857
+ return indexOf.call( array, elem );
858
+ };
859
+ }
860
+
861
+ // Verify that \s matches non-breaking spaces
862
+ // (IE fails on this test)
863
+ if ( !rwhite.test( "\xA0" ) ) {
864
+ trimLeft = /^[\s\xA0]+/;
865
+ trimRight = /[\s\xA0]+$/;
866
+ }
867
+
868
+ // All jQuery objects should point back to these
869
+ rootjQuery = jQuery(document);
870
+
871
+ // Cleanup functions for the document ready method
872
+ if ( document.addEventListener ) {
873
+ DOMContentLoaded = function() {
874
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
875
+ jQuery.ready();
876
+ };
877
+
878
+ } else if ( document.attachEvent ) {
879
+ DOMContentLoaded = function() {
880
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
881
+ if ( document.readyState === "complete" ) {
882
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
883
+ jQuery.ready();
884
+ }
885
+ };
886
+ }
887
+
888
+ // The DOM ready check for Internet Explorer
889
+ function doScrollCheck() {
890
+ if ( jQuery.isReady ) {
891
+ return;
892
+ }
893
+
894
+ try {
895
+ // If IE is used, use the trick by Diego Perini
896
+ // http://javascript.nwbox.com/IEContentLoaded/
897
+ document.documentElement.doScroll("left");
898
+ } catch(e) {
899
+ setTimeout( doScrollCheck, 1 );
900
+ return;
901
+ }
902
+
903
+ // and execute any waiting functions
904
+ jQuery.ready();
905
+ }
906
+
907
+ // Expose jQuery to the global object
908
+ return (window.jQuery = window.$ = jQuery);
909
+
910
+ })();
911
+
912
+
913
+ (function() {
914
+
915
+ jQuery.support = {};
916
+
917
+ var root = document.documentElement,
918
+ script = document.createElement("script"),
919
+ div = document.createElement("div"),
920
+ id = "script" + jQuery.now();
921
+
922
+ div.style.display = "none";
923
+ div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
924
+
925
+ var all = div.getElementsByTagName("*"),
926
+ a = div.getElementsByTagName("a")[0],
927
+ select = document.createElement("select"),
928
+ opt = select.appendChild( document.createElement("option") );
929
+
930
+ // Can't get basic test support
931
+ if ( !all || !all.length || !a ) {
932
+ return;
933
+ }
934
+
935
+ jQuery.support = {
936
+ // IE strips leading whitespace when .innerHTML is used
937
+ leadingWhitespace: div.firstChild.nodeType === 3,
938
+
939
+ // Make sure that tbody elements aren't automatically inserted
940
+ // IE will insert them into empty tables
941
+ tbody: !div.getElementsByTagName("tbody").length,
942
+
943
+ // Make sure that link elements get serialized correctly by innerHTML
944
+ // This requires a wrapper element in IE
945
+ htmlSerialize: !!div.getElementsByTagName("link").length,
946
+
947
+ // Get the style information from getAttribute
948
+ // (IE uses .cssText insted)
949
+ style: /red/.test( a.getAttribute("style") ),
950
+
951
+ // Make sure that URLs aren't manipulated
952
+ // (IE normalizes it by default)
953
+ hrefNormalized: a.getAttribute("href") === "/a",
954
+
955
+ // Make sure that element opacity exists
956
+ // (IE uses filter instead)
957
+ // Use a regex to work around a WebKit issue. See #5145
958
+ opacity: /^0.55$/.test( a.style.opacity ),
959
+
960
+ // Verify style float existence
961
+ // (IE uses styleFloat instead of cssFloat)
962
+ cssFloat: !!a.style.cssFloat,
963
+
964
+ // Make sure that if no value is specified for a checkbox
965
+ // that it defaults to "on".
966
+ // (WebKit defaults to "" instead)
967
+ checkOn: div.getElementsByTagName("input")[0].value === "on",
968
+
969
+ // Make sure that a selected-by-default option has a working selected property.
970
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
971
+ optSelected: opt.selected,
972
+
973
+ // Will be defined later
974
+ deleteExpando: true,
975
+ optDisabled: false,
976
+ checkClone: false,
977
+ scriptEval: false,
978
+ noCloneEvent: true,
979
+ boxModel: null,
980
+ inlineBlockNeedsLayout: false,
981
+ shrinkWrapBlocks: false,
982
+ reliableHiddenOffsets: true
983
+ };
984
+
985
+ // Make sure that the options inside disabled selects aren't marked as disabled
986
+ // (WebKit marks them as diabled)
987
+ select.disabled = true;
988
+ jQuery.support.optDisabled = !opt.disabled;
989
+
990
+ script.type = "text/javascript";
991
+ try {
992
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
993
+ } catch(e) {}
994
+
995
+ root.insertBefore( script, root.firstChild );
996
+
997
+ // Make sure that the execution of code works by injecting a script
998
+ // tag with appendChild/createTextNode
999
+ // (IE doesn't support this, fails, and uses .text instead)
1000
+ if ( window[ id ] ) {
1001
+ jQuery.support.scriptEval = true;
1002
+ delete window[ id ];
1003
+ }
1004
+
1005
+ // Test to see if it's possible to delete an expando from an element
1006
+ // Fails in Internet Explorer
1007
+ try {
1008
+ delete script.test;
1009
+
1010
+ } catch(e) {
1011
+ jQuery.support.deleteExpando = false;
1012
+ }
1013
+
1014
+ root.removeChild( script );
1015
+
1016
+ if ( div.attachEvent && div.fireEvent ) {
1017
+ div.attachEvent("onclick", function click() {
1018
+ // Cloning a node shouldn't copy over any
1019
+ // bound event handlers (IE does this)
1020
+ jQuery.support.noCloneEvent = false;
1021
+ div.detachEvent("onclick", click);
1022
+ });
1023
+ div.cloneNode(true).fireEvent("onclick");
1024
+ }
1025
+
1026
+ div = document.createElement("div");
1027
+ div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
1028
+
1029
+ var fragment = document.createDocumentFragment();
1030
+ fragment.appendChild( div.firstChild );
1031
+
1032
+ // WebKit doesn't clone checked state correctly in fragments
1033
+ jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
1034
+
1035
+ // Figure out if the W3C box model works as expected
1036
+ // document.body must exist before we can do this
1037
+ jQuery(function() {
1038
+ var div = document.createElement("div");
1039
+ div.style.width = div.style.paddingLeft = "1px";
1040
+
1041
+ document.body.appendChild( div );
1042
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
1043
+
1044
+ if ( "zoom" in div.style ) {
1045
+ // Check if natively block-level elements act like inline-block
1046
+ // elements when setting their display to 'inline' and giving
1047
+ // them layout
1048
+ // (IE < 8 does this)
1049
+ div.style.display = "inline";
1050
+ div.style.zoom = 1;
1051
+ jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
1052
+
1053
+ // Check if elements with layout shrink-wrap their children
1054
+ // (IE 6 does this)
1055
+ div.style.display = "";
1056
+ div.innerHTML = "<div style='width:4px;'></div>";
1057
+ jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
1058
+ }
1059
+
1060
+ div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
1061
+ var tds = div.getElementsByTagName("td");
1062
+
1063
+ // Check if table cells still have offsetWidth/Height when they are set
1064
+ // to display:none and there are still other visible table cells in a
1065
+ // table row; if so, offsetWidth/Height are not reliable for use when
1066
+ // determining if an element has been hidden directly using
1067
+ // display:none (it is still safe to use offsets if a parent element is
1068
+ // hidden; don safety goggles and see bug #4512 for more information).
1069
+ // (only IE 8 fails this test)
1070
+ jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
1071
+
1072
+ tds[0].style.display = "";
1073
+ tds[1].style.display = "none";
1074
+
1075
+ // Check if empty table cells still have offsetWidth/Height
1076
+ // (IE < 8 fail this test)
1077
+ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1078
+ div.innerHTML = "";
1079
+
1080
+ document.body.removeChild( div ).style.display = "none";
1081
+ div = tds = null;
1082
+ });
1083
+
1084
+ // Technique from Juriy Zaytsev
1085
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
1086
+ var eventSupported = function( eventName ) {
1087
+ var el = document.createElement("div");
1088
+ eventName = "on" + eventName;
1089
+
1090
+ var isSupported = (eventName in el);
1091
+ if ( !isSupported ) {
1092
+ el.setAttribute(eventName, "return;");
1093
+ isSupported = typeof el[eventName] === "function";
1094
+ }
1095
+ el = null;
1096
+
1097
+ return isSupported;
1098
+ };
1099
+
1100
+ jQuery.support.submitBubbles = eventSupported("submit");
1101
+ jQuery.support.changeBubbles = eventSupported("change");
1102
+
1103
+ // release memory in IE
1104
+ root = script = div = all = a = null;
1105
+ })();
1106
+
1107
+
1108
+
1109
+ var windowData = {},
1110
+ rbrace = /^(?:\{.*\}|\[.*\])$/;
1111
+
1112
+ jQuery.extend({
1113
+ cache: {},
1114
+
1115
+ // Please use with caution
1116
+ uuid: 0,
1117
+
1118
+ // Unique for each copy of jQuery on the page
1119
+ expando: "jQuery" + jQuery.now(),
1120
+
1121
+ // The following elements throw uncatchable exceptions if you
1122
+ // attempt to add expando properties to them.
1123
+ noData: {
1124
+ "embed": true,
1125
+ // Ban all objects except for Flash (which handle expandos)
1126
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1127
+ "applet": true
1128
+ },
1129
+
1130
+ data: function( elem, name, data ) {
1131
+ if ( !jQuery.acceptData( elem ) ) {
1132
+ return;
1133
+ }
1134
+
1135
+ elem = elem == window ?
1136
+ windowData :
1137
+ elem;
1138
+
1139
+ var isNode = elem.nodeType,
1140
+ id = isNode ? elem[ jQuery.expando ] : null,
1141
+ cache = jQuery.cache, thisCache;
1142
+
1143
+ if ( isNode && !id && typeof name === "string" && data === undefined ) {
1144
+ return;
1145
+ }
1146
+
1147
+ // Get the data from the object directly
1148
+ if ( !isNode ) {
1149
+ cache = elem;
1150
+
1151
+ // Compute a unique ID for the element
1152
+ } else if ( !id ) {
1153
+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
1154
+ }
1155
+
1156
+ // Avoid generating a new cache unless none exists and we
1157
+ // want to manipulate it.
1158
+ if ( typeof name === "object" ) {
1159
+ if ( isNode ) {
1160
+ cache[ id ] = jQuery.extend(cache[ id ], name);
1161
+
1162
+ } else {
1163
+ jQuery.extend( cache, name );
1164
+ }
1165
+
1166
+ } else if ( isNode && !cache[ id ] ) {
1167
+ cache[ id ] = {};
1168
+ }
1169
+
1170
+ thisCache = isNode ? cache[ id ] : cache;
1171
+
1172
+ // Prevent overriding the named cache with undefined values
1173
+ if ( data !== undefined ) {
1174
+ thisCache[ name ] = data;
1175
+ }
1176
+
1177
+ return typeof name === "string" ? thisCache[ name ] : thisCache;
1178
+ },
1179
+
1180
+ removeData: function( elem, name ) {
1181
+ if ( !jQuery.acceptData( elem ) ) {
1182
+ return;
1183
+ }
1184
+
1185
+ elem = elem == window ?
1186
+ windowData :
1187
+ elem;
1188
+
1189
+ var isNode = elem.nodeType,
1190
+ id = isNode ? elem[ jQuery.expando ] : elem,
1191
+ cache = jQuery.cache,
1192
+ thisCache = isNode ? cache[ id ] : id;
1193
+
1194
+ // If we want to remove a specific section of the element's data
1195
+ if ( name ) {
1196
+ if ( thisCache ) {
1197
+ // Remove the section of cache data
1198
+ delete thisCache[ name ];
1199
+
1200
+ // If we've removed all the data, remove the element's cache
1201
+ if ( isNode && jQuery.isEmptyObject(thisCache) ) {
1202
+ jQuery.removeData( elem );
1203
+ }
1204
+ }
1205
+
1206
+ // Otherwise, we want to remove all of the element's data
1207
+ } else {
1208
+ if ( isNode && jQuery.support.deleteExpando ) {
1209
+ delete elem[ jQuery.expando ];
1210
+
1211
+ } else if ( elem.removeAttribute ) {
1212
+ elem.removeAttribute( jQuery.expando );
1213
+
1214
+ // Completely remove the data cache
1215
+ } else if ( isNode ) {
1216
+ delete cache[ id ];
1217
+
1218
+ // Remove all fields from the object
1219
+ } else {
1220
+ for ( var n in elem ) {
1221
+ delete elem[ n ];
1222
+ }
1223
+ }
1224
+ }
1225
+ },
1226
+
1227
+ // A method for determining if a DOM node can handle the data expando
1228
+ acceptData: function( elem ) {
1229
+ if ( elem.nodeName ) {
1230
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
1231
+
1232
+ if ( match ) {
1233
+ return !(match === true || elem.getAttribute("classid") !== match);
1234
+ }
1235
+ }
1236
+
1237
+ return true;
1238
+ }
1239
+ });
1240
+
1241
+ jQuery.fn.extend({
1242
+ data: function( key, value ) {
1243
+ var data = null;
1244
+
1245
+ if ( typeof key === "undefined" ) {
1246
+ if ( this.length ) {
1247
+ var attr = this[0].attributes, name;
1248
+ data = jQuery.data( this[0] );
1249
+
1250
+ for ( var i = 0, l = attr.length; i < l; i++ ) {
1251
+ name = attr[i].name;
1252
+
1253
+ if ( name.indexOf( "data-" ) === 0 ) {
1254
+ name = name.substr( 5 );
1255
+ dataAttr( this[0], name, data[ name ] );
1256
+ }
1257
+ }
1258
+ }
1259
+
1260
+ return data;
1261
+
1262
+ } else if ( typeof key === "object" ) {
1263
+ return this.each(function() {
1264
+ jQuery.data( this, key );
1265
+ });
1266
+ }
1267
+
1268
+ var parts = key.split(".");
1269
+ parts[1] = parts[1] ? "." + parts[1] : "";
1270
+
1271
+ if ( value === undefined ) {
1272
+ data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1273
+
1274
+ // Try to fetch any internally stored data first
1275
+ if ( data === undefined && this.length ) {
1276
+ data = jQuery.data( this[0], key );
1277
+ data = dataAttr( this[0], key, data );
1278
+ }
1279
+
1280
+ return data === undefined && parts[1] ?
1281
+ this.data( parts[0] ) :
1282
+ data;
1283
+
1284
+ } else {
1285
+ return this.each(function() {
1286
+ var $this = jQuery( this ),
1287
+ args = [ parts[0], value ];
1288
+
1289
+ $this.triggerHandler( "setData" + parts[1] + "!", args );
1290
+ jQuery.data( this, key, value );
1291
+ $this.triggerHandler( "changeData" + parts[1] + "!", args );
1292
+ });
1293
+ }
1294
+ },
1295
+
1296
+ removeData: function( key ) {
1297
+ return this.each(function() {
1298
+ jQuery.removeData( this, key );
1299
+ });
1300
+ }
1301
+ });
1302
+
1303
+ function dataAttr( elem, key, data ) {
1304
+ // If nothing was found internally, try to fetch any
1305
+ // data from the HTML5 data-* attribute
1306
+ if ( data === undefined && elem.nodeType === 1 ) {
1307
+ data = elem.getAttribute( "data-" + key );
1308
+
1309
+ if ( typeof data === "string" ) {
1310
+ try {
1311
+ data = data === "true" ? true :
1312
+ data === "false" ? false :
1313
+ data === "null" ? null :
1314
+ !jQuery.isNaN( data ) ? parseFloat( data ) :
1315
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
1316
+ data;
1317
+ } catch( e ) {}
1318
+
1319
+ // Make sure we set the data so it isn't changed later
1320
+ jQuery.data( elem, key, data );
1321
+
1322
+ } else {
1323
+ data = undefined;
1324
+ }
1325
+ }
1326
+
1327
+ return data;
1328
+ }
1329
+
1330
+
1331
+
1332
+
1333
+ jQuery.extend({
1334
+ queue: function( elem, type, data ) {
1335
+ if ( !elem ) {
1336
+ return;
1337
+ }
1338
+
1339
+ type = (type || "fx") + "queue";
1340
+ var q = jQuery.data( elem, type );
1341
+
1342
+ // Speed up dequeue by getting out quickly if this is just a lookup
1343
+ if ( !data ) {
1344
+ return q || [];
1345
+ }
1346
+
1347
+ if ( !q || jQuery.isArray(data) ) {
1348
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
1349
+
1350
+ } else {
1351
+ q.push( data );
1352
+ }
1353
+
1354
+ return q;
1355
+ },
1356
+
1357
+ dequeue: function( elem, type ) {
1358
+ type = type || "fx";
1359
+
1360
+ var queue = jQuery.queue( elem, type ),
1361
+ fn = queue.shift();
1362
+
1363
+ // If the fx queue is dequeued, always remove the progress sentinel
1364
+ if ( fn === "inprogress" ) {
1365
+ fn = queue.shift();
1366
+ }
1367
+
1368
+ if ( fn ) {
1369
+ // Add a progress sentinel to prevent the fx queue from being
1370
+ // automatically dequeued
1371
+ if ( type === "fx" ) {
1372
+ queue.unshift("inprogress");
1373
+ }
1374
+
1375
+ fn.call(elem, function() {
1376
+ jQuery.dequeue(elem, type);
1377
+ });
1378
+ }
1379
+ }
1380
+ });
1381
+
1382
+ jQuery.fn.extend({
1383
+ queue: function( type, data ) {
1384
+ if ( typeof type !== "string" ) {
1385
+ data = type;
1386
+ type = "fx";
1387
+ }
1388
+
1389
+ if ( data === undefined ) {
1390
+ return jQuery.queue( this[0], type );
1391
+ }
1392
+ return this.each(function( i ) {
1393
+ var queue = jQuery.queue( this, type, data );
1394
+
1395
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
1396
+ jQuery.dequeue( this, type );
1397
+ }
1398
+ });
1399
+ },
1400
+ dequeue: function( type ) {
1401
+ return this.each(function() {
1402
+ jQuery.dequeue( this, type );
1403
+ });
1404
+ },
1405
+
1406
+ // Based off of the plugin by Clint Helfers, with permission.
1407
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
1408
+ delay: function( time, type ) {
1409
+ time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
1410
+ type = type || "fx";
1411
+
1412
+ return this.queue( type, function() {
1413
+ var elem = this;
1414
+ setTimeout(function() {
1415
+ jQuery.dequeue( elem, type );
1416
+ }, time );
1417
+ });
1418
+ },
1419
+
1420
+ clearQueue: function( type ) {
1421
+ return this.queue( type || "fx", [] );
1422
+ }
1423
+ });
1424
+
1425
+
1426
+
1427
+
1428
+ var rclass = /[\n\t]/g,
1429
+ rspaces = /\s+/,
1430
+ rreturn = /\r/g,
1431
+ rspecialurl = /^(?:href|src|style)$/,
1432
+ rtype = /^(?:button|input)$/i,
1433
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
1434
+ rclickable = /^a(?:rea)?$/i,
1435
+ rradiocheck = /^(?:radio|checkbox)$/i;
1436
+
1437
+ jQuery.props = {
1438
+ "for": "htmlFor",
1439
+ "class": "className",
1440
+ readonly: "readOnly",
1441
+ maxlength: "maxLength",
1442
+ cellspacing: "cellSpacing",
1443
+ rowspan: "rowSpan",
1444
+ colspan: "colSpan",
1445
+ tabindex: "tabIndex",
1446
+ usemap: "useMap",
1447
+ frameborder: "frameBorder"
1448
+ };
1449
+
1450
+ jQuery.fn.extend({
1451
+ attr: function( name, value ) {
1452
+ return jQuery.access( this, name, value, true, jQuery.attr );
1453
+ },
1454
+
1455
+ removeAttr: function( name, fn ) {
1456
+ return this.each(function(){
1457
+ jQuery.attr( this, name, "" );
1458
+ if ( this.nodeType === 1 ) {
1459
+ this.removeAttribute( name );
1460
+ }
1461
+ });
1462
+ },
1463
+
1464
+ addClass: function( value ) {
1465
+ if ( jQuery.isFunction(value) ) {
1466
+ return this.each(function(i) {
1467
+ var self = jQuery(this);
1468
+ self.addClass( value.call(this, i, self.attr("class")) );
1469
+ });
1470
+ }
1471
+
1472
+ if ( value && typeof value === "string" ) {
1473
+ var classNames = (value || "").split( rspaces );
1474
+
1475
+ for ( var i = 0, l = this.length; i < l; i++ ) {
1476
+ var elem = this[i];
1477
+
1478
+ if ( elem.nodeType === 1 ) {
1479
+ if ( !elem.className ) {
1480
+ elem.className = value;
1481
+
1482
+ } else {
1483
+ var className = " " + elem.className + " ",
1484
+ setClass = elem.className;
1485
+
1486
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1487
+ if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
1488
+ setClass += " " + classNames[c];
1489
+ }
1490
+ }
1491
+ elem.className = jQuery.trim( setClass );
1492
+ }
1493
+ }
1494
+ }
1495
+ }
1496
+
1497
+ return this;
1498
+ },
1499
+
1500
+ removeClass: function( value ) {
1501
+ if ( jQuery.isFunction(value) ) {
1502
+ return this.each(function(i) {
1503
+ var self = jQuery(this);
1504
+ self.removeClass( value.call(this, i, self.attr("class")) );
1505
+ });
1506
+ }
1507
+
1508
+ if ( (value && typeof value === "string") || value === undefined ) {
1509
+ var classNames = (value || "").split( rspaces );
1510
+
1511
+ for ( var i = 0, l = this.length; i < l; i++ ) {
1512
+ var elem = this[i];
1513
+
1514
+ if ( elem.nodeType === 1 && elem.className ) {
1515
+ if ( value ) {
1516
+ var className = (" " + elem.className + " ").replace(rclass, " ");
1517
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1518
+ className = className.replace(" " + classNames[c] + " ", " ");
1519
+ }
1520
+ elem.className = jQuery.trim( className );
1521
+
1522
+ } else {
1523
+ elem.className = "";
1524
+ }
1525
+ }
1526
+ }
1527
+ }
1528
+
1529
+ return this;
1530
+ },
1531
+
1532
+ toggleClass: function( value, stateVal ) {
1533
+ var type = typeof value,
1534
+ isBool = typeof stateVal === "boolean";
1535
+
1536
+ if ( jQuery.isFunction( value ) ) {
1537
+ return this.each(function(i) {
1538
+ var self = jQuery(this);
1539
+ self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
1540
+ });
1541
+ }
1542
+
1543
+ return this.each(function() {
1544
+ if ( type === "string" ) {
1545
+ // toggle individual class names
1546
+ var className,
1547
+ i = 0,
1548
+ self = jQuery( this ),
1549
+ state = stateVal,
1550
+ classNames = value.split( rspaces );
1551
+
1552
+ while ( (className = classNames[ i++ ]) ) {
1553
+ // check each className given, space seperated list
1554
+ state = isBool ? state : !self.hasClass( className );
1555
+ self[ state ? "addClass" : "removeClass" ]( className );
1556
+ }
1557
+
1558
+ } else if ( type === "undefined" || type === "boolean" ) {
1559
+ if ( this.className ) {
1560
+ // store className if set
1561
+ jQuery.data( this, "__className__", this.className );
1562
+ }
1563
+
1564
+ // toggle whole className
1565
+ this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
1566
+ }
1567
+ });
1568
+ },
1569
+
1570
+ hasClass: function( selector ) {
1571
+ var className = " " + selector + " ";
1572
+ for ( var i = 0, l = this.length; i < l; i++ ) {
1573
+ if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
1574
+ return true;
1575
+ }
1576
+ }
1577
+
1578
+ return false;
1579
+ },
1580
+
1581
+ val: function( value ) {
1582
+ if ( !arguments.length ) {
1583
+ var elem = this[0];
1584
+
1585
+ if ( elem ) {
1586
+ if ( jQuery.nodeName( elem, "option" ) ) {
1587
+ // attributes.value is undefined in Blackberry 4.7 but
1588
+ // uses .value. See #6932
1589
+ var val = elem.attributes.value;
1590
+ return !val || val.specified ? elem.value : elem.text;
1591
+ }
1592
+
1593
+ // We need to handle select boxes special
1594
+ if ( jQuery.nodeName( elem, "select" ) ) {
1595
+ var index = elem.selectedIndex,
1596
+ values = [],
1597
+ options = elem.options,
1598
+ one = elem.type === "select-one";
1599
+
1600
+ // Nothing was selected
1601
+ if ( index < 0 ) {
1602
+ return null;
1603
+ }
1604
+
1605
+ // Loop through all the selected options
1606
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
1607
+ var option = options[ i ];
1608
+
1609
+ // Don't return options that are disabled or in a disabled optgroup
1610
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1611
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
1612
+
1613
+ // Get the specific value for the option
1614
+ value = jQuery(option).val();
1615
+
1616
+ // We don't need an array for one selects
1617
+ if ( one ) {
1618
+ return value;
1619
+ }
1620
+
1621
+ // Multi-Selects return an array
1622
+ values.push( value );
1623
+ }
1624
+ }
1625
+
1626
+ return values;
1627
+ }
1628
+
1629
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
1630
+ if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
1631
+ return elem.getAttribute("value") === null ? "on" : elem.value;
1632
+ }
1633
+
1634
+
1635
+ // Everything else, we just grab the value
1636
+ return (elem.value || "").replace(rreturn, "");
1637
+
1638
+ }
1639
+
1640
+ return undefined;
1641
+ }
1642
+
1643
+ var isFunction = jQuery.isFunction(value);
1644
+
1645
+ return this.each(function(i) {
1646
+ var self = jQuery(this), val = value;
1647
+
1648
+ if ( this.nodeType !== 1 ) {
1649
+ return;
1650
+ }
1651
+
1652
+ if ( isFunction ) {
1653
+ val = value.call(this, i, self.val());
1654
+ }
1655
+
1656
+ // Treat null/undefined as ""; convert numbers to string
1657
+ if ( val == null ) {
1658
+ val = "";
1659
+ } else if ( typeof val === "number" ) {
1660
+ val += "";
1661
+ } else if ( jQuery.isArray(val) ) {
1662
+ val = jQuery.map(val, function (value) {
1663
+ return value == null ? "" : value + "";
1664
+ });
1665
+ }
1666
+
1667
+ if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
1668
+ this.checked = jQuery.inArray( self.val(), val ) >= 0;
1669
+
1670
+ } else if ( jQuery.nodeName( this, "select" ) ) {
1671
+ var values = jQuery.makeArray(val);
1672
+
1673
+ jQuery( "option", this ).each(function() {
1674
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
1675
+ });
1676
+
1677
+ if ( !values.length ) {
1678
+ this.selectedIndex = -1;
1679
+ }
1680
+
1681
+ } else {
1682
+ this.value = val;
1683
+ }
1684
+ });
1685
+ }
1686
+ });
1687
+
1688
+ jQuery.extend({
1689
+ attrFn: {
1690
+ val: true,
1691
+ css: true,
1692
+ html: true,
1693
+ text: true,
1694
+ data: true,
1695
+ width: true,
1696
+ height: true,
1697
+ offset: true
1698
+ },
1699
+
1700
+ attr: function( elem, name, value, pass ) {
1701
+ // don't set attributes on text and comment nodes
1702
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
1703
+ return undefined;
1704
+ }
1705
+
1706
+ if ( pass && name in jQuery.attrFn ) {
1707
+ return jQuery(elem)[name](value);
1708
+ }
1709
+
1710
+ var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
1711
+ // Whether we are setting (or getting)
1712
+ set = value !== undefined;
1713
+
1714
+ // Try to normalize/fix the name
1715
+ name = notxml && jQuery.props[ name ] || name;
1716
+
1717
+ // These attributes require special treatment
1718
+ var special = rspecialurl.test( name );
1719
+
1720
+ // Safari mis-reports the default selected property of an option
1721
+ // Accessing the parent's selectedIndex property fixes it
1722
+ if ( name === "selected" && !jQuery.support.optSelected ) {
1723
+ var parent = elem.parentNode;
1724
+ if ( parent ) {
1725
+ parent.selectedIndex;
1726
+
1727
+ // Make sure that it also works with optgroups, see #5701
1728
+ if ( parent.parentNode ) {
1729
+ parent.parentNode.selectedIndex;
1730
+ }
1731
+ }
1732
+ }
1733
+
1734
+ // If applicable, access the attribute via the DOM 0 way
1735
+ // 'in' checks fail in Blackberry 4.7 #6931
1736
+ if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
1737
+ if ( set ) {
1738
+ // We can't allow the type property to be changed (since it causes problems in IE)
1739
+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
1740
+ jQuery.error( "type property can't be changed" );
1741
+ }
1742
+
1743
+ if ( value === null ) {
1744
+ if ( elem.nodeType === 1 ) {
1745
+ elem.removeAttribute( name );
1746
+ }
1747
+
1748
+ } else {
1749
+ elem[ name ] = value;
1750
+ }
1751
+ }
1752
+
1753
+ // browsers index elements by id/name on forms, give priority to attributes.
1754
+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
1755
+ return elem.getAttributeNode( name ).nodeValue;
1756
+ }
1757
+
1758
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
1759
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
1760
+ if ( name === "tabIndex" ) {
1761
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
1762
+
1763
+ return attributeNode && attributeNode.specified ?
1764
+ attributeNode.value :
1765
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
1766
+ 0 :
1767
+ undefined;
1768
+ }
1769
+
1770
+ return elem[ name ];
1771
+ }
1772
+
1773
+ if ( !jQuery.support.style && notxml && name === "style" ) {
1774
+ if ( set ) {
1775
+ elem.style.cssText = "" + value;
1776
+ }
1777
+
1778
+ return elem.style.cssText;
1779
+ }
1780
+
1781
+ if ( set ) {
1782
+ // convert the value to a string (all browsers do this but IE) see #1070
1783
+ elem.setAttribute( name, "" + value );
1784
+ }
1785
+
1786
+ // Ensure that missing attributes return undefined
1787
+ // Blackberry 4.7 returns "" from getAttribute #6938
1788
+ if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
1789
+ return undefined;
1790
+ }
1791
+
1792
+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
1793
+ // Some attributes require a special call on IE
1794
+ elem.getAttribute( name, 2 ) :
1795
+ elem.getAttribute( name );
1796
+
1797
+ // Non-existent attributes return null, we normalize to undefined
1798
+ return attr === null ? undefined : attr;
1799
+ }
1800
+ });
1801
+
1802
+
1803
+
1804
+
1805
+ var rnamespaces = /\.(.*)$/,
1806
+ rformElems = /^(?:textarea|input|select)$/i,
1807
+ rperiod = /\./g,
1808
+ rspace = / /g,
1809
+ rescape = /[^\w\s.|`]/g,
1810
+ fcleanup = function( nm ) {
1811
+ return nm.replace(rescape, "\\$&");
1812
+ },
1813
+ focusCounts = { focusin: 0, focusout: 0 };
1814
+
1815
+ /*
1816
+ * A number of helper functions used for managing events.
1817
+ * Many of the ideas behind this code originated from
1818
+ * Dean Edwards' addEvent library.
1819
+ */
1820
+ jQuery.event = {
1821
+
1822
+ // Bind an event to an element
1823
+ // Original by Dean Edwards
1824
+ add: function( elem, types, handler, data ) {
1825
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
1826
+ return;
1827
+ }
1828
+
1829
+ // For whatever reason, IE has trouble passing the window object
1830
+ // around, causing it to be cloned in the process
1831
+ if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
1832
+ elem = window;
1833
+ }
1834
+
1835
+ if ( handler === false ) {
1836
+ handler = returnFalse;
1837
+ } else if ( !handler ) {
1838
+ // Fixes bug #7229. Fix recommended by jdalton
1839
+ return;
1840
+ }
1841
+
1842
+ var handleObjIn, handleObj;
1843
+
1844
+ if ( handler.handler ) {
1845
+ handleObjIn = handler;
1846
+ handler = handleObjIn.handler;
1847
+ }
1848
+
1849
+ // Make sure that the function being executed has a unique ID
1850
+ if ( !handler.guid ) {
1851
+ handler.guid = jQuery.guid++;
1852
+ }
1853
+
1854
+ // Init the element's event structure
1855
+ var elemData = jQuery.data( elem );
1856
+
1857
+ // If no elemData is found then we must be trying to bind to one of the
1858
+ // banned noData elements
1859
+ if ( !elemData ) {
1860
+ return;
1861
+ }
1862
+
1863
+ // Use a key less likely to result in collisions for plain JS objects.
1864
+ // Fixes bug #7150.
1865
+ var eventKey = elem.nodeType ? "events" : "__events__",
1866
+ events = elemData[ eventKey ],
1867
+ eventHandle = elemData.handle;
1868
+
1869
+ if ( typeof events === "function" ) {
1870
+ // On plain objects events is a fn that holds the the data
1871
+ // which prevents this data from being JSON serialized
1872
+ // the function does not need to be called, it just contains the data
1873
+ eventHandle = events.handle;
1874
+ events = events.events;
1875
+
1876
+ } else if ( !events ) {
1877
+ if ( !elem.nodeType ) {
1878
+ // On plain objects, create a fn that acts as the holder
1879
+ // of the values to avoid JSON serialization of event data
1880
+ elemData[ eventKey ] = elemData = function(){};
1881
+ }
1882
+
1883
+ elemData.events = events = {};
1884
+ }
1885
+
1886
+ if ( !eventHandle ) {
1887
+ elemData.handle = eventHandle = function() {
1888
+ // Handle the second event of a trigger and when
1889
+ // an event is called after a page has unloaded
1890
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
1891
+ jQuery.event.handle.apply( eventHandle.elem, arguments ) :
1892
+ undefined;
1893
+ };
1894
+ }
1895
+
1896
+ // Add elem as a property of the handle function
1897
+ // This is to prevent a memory leak with non-native events in IE.
1898
+ eventHandle.elem = elem;
1899
+
1900
+ // Handle multiple events separated by a space
1901
+ // jQuery(...).bind("mouseover mouseout", fn);
1902
+ types = types.split(" ");
1903
+
1904
+ var type, i = 0, namespaces;
1905
+
1906
+ while ( (type = types[ i++ ]) ) {
1907
+ handleObj = handleObjIn ?
1908
+ jQuery.extend({}, handleObjIn) :
1909
+ { handler: handler, data: data };
1910
+
1911
+ // Namespaced event handlers
1912
+ if ( type.indexOf(".") > -1 ) {
1913
+ namespaces = type.split(".");
1914
+ type = namespaces.shift();
1915
+ handleObj.namespace = namespaces.slice(0).sort().join(".");
1916
+
1917
+ } else {
1918
+ namespaces = [];
1919
+ handleObj.namespace = "";
1920
+ }
1921
+
1922
+ handleObj.type = type;
1923
+ if ( !handleObj.guid ) {
1924
+ handleObj.guid = handler.guid;
1925
+ }
1926
+
1927
+ // Get the current list of functions bound to this event
1928
+ var handlers = events[ type ],
1929
+ special = jQuery.event.special[ type ] || {};
1930
+
1931
+ // Init the event handler queue
1932
+ if ( !handlers ) {
1933
+ handlers = events[ type ] = [];
1934
+
1935
+ // Check for a special event handler
1936
+ // Only use addEventListener/attachEvent if the special
1937
+ // events handler returns false
1938
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
1939
+ // Bind the global event handler to the element
1940
+ if ( elem.addEventListener ) {
1941
+ elem.addEventListener( type, eventHandle, false );
1942
+
1943
+ } else if ( elem.attachEvent ) {
1944
+ elem.attachEvent( "on" + type, eventHandle );
1945
+ }
1946
+ }
1947
+ }
1948
+
1949
+ if ( special.add ) {
1950
+ special.add.call( elem, handleObj );
1951
+
1952
+ if ( !handleObj.handler.guid ) {
1953
+ handleObj.handler.guid = handler.guid;
1954
+ }
1955
+ }
1956
+
1957
+ // Add the function to the element's handler list
1958
+ handlers.push( handleObj );
1959
+
1960
+ // Keep track of which events have been used, for global triggering
1961
+ jQuery.event.global[ type ] = true;
1962
+ }
1963
+
1964
+ // Nullify elem to prevent memory leaks in IE
1965
+ elem = null;
1966
+ },
1967
+
1968
+ global: {},
1969
+
1970
+ // Detach an event or set of events from an element
1971
+ remove: function( elem, types, handler, pos ) {
1972
+ // don't do events on text and comment nodes
1973
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
1974
+ return;
1975
+ }
1976
+
1977
+ if ( handler === false ) {
1978
+ handler = returnFalse;
1979
+ }
1980
+
1981
+ var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
1982
+ eventKey = elem.nodeType ? "events" : "__events__",
1983
+ elemData = jQuery.data( elem ),
1984
+ events = elemData && elemData[ eventKey ];
1985
+
1986
+ if ( !elemData || !events ) {
1987
+ return;
1988
+ }
1989
+
1990
+ if ( typeof events === "function" ) {
1991
+ elemData = events;
1992
+ events = events.events;
1993
+ }
1994
+
1995
+ // types is actually an event object here
1996
+ if ( types && types.type ) {
1997
+ handler = types.handler;
1998
+ types = types.type;
1999
+ }
2000
+
2001
+ // Unbind all events for the element
2002
+ if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
2003
+ types = types || "";
2004
+
2005
+ for ( type in events ) {
2006
+ jQuery.event.remove( elem, type + types );
2007
+ }
2008
+
2009
+ return;
2010
+ }
2011
+
2012
+ // Handle multiple events separated by a space
2013
+ // jQuery(...).unbind("mouseover mouseout", fn);
2014
+ types = types.split(" ");
2015
+
2016
+ while ( (type = types[ i++ ]) ) {
2017
+ origType = type;
2018
+ handleObj = null;
2019
+ all = type.indexOf(".") < 0;
2020
+ namespaces = [];
2021
+
2022
+ if ( !all ) {
2023
+ // Namespaced event handlers
2024
+ namespaces = type.split(".");
2025
+ type = namespaces.shift();
2026
+
2027
+ namespace = new RegExp("(^|\\.)" +
2028
+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
2029
+ }
2030
+
2031
+ eventType = events[ type ];
2032
+
2033
+ if ( !eventType ) {
2034
+ continue;
2035
+ }
2036
+
2037
+ if ( !handler ) {
2038
+ for ( j = 0; j < eventType.length; j++ ) {
2039
+ handleObj = eventType[ j ];
2040
+
2041
+ if ( all || namespace.test( handleObj.namespace ) ) {
2042
+ jQuery.event.remove( elem, origType, handleObj.handler, j );
2043
+ eventType.splice( j--, 1 );
2044
+ }
2045
+ }
2046
+
2047
+ continue;
2048
+ }
2049
+
2050
+ special = jQuery.event.special[ type ] || {};
2051
+
2052
+ for ( j = pos || 0; j < eventType.length; j++ ) {
2053
+ handleObj = eventType[ j ];
2054
+
2055
+ if ( handler.guid === handleObj.guid ) {
2056
+ // remove the given handler for the given type
2057
+ if ( all || namespace.test( handleObj.namespace ) ) {
2058
+ if ( pos == null ) {
2059
+ eventType.splice( j--, 1 );
2060
+ }
2061
+
2062
+ if ( special.remove ) {
2063
+ special.remove.call( elem, handleObj );
2064
+ }
2065
+ }
2066
+
2067
+ if ( pos != null ) {
2068
+ break;
2069
+ }
2070
+ }
2071
+ }
2072
+
2073
+ // remove generic event handler if no more handlers exist
2074
+ if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
2075
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
2076
+ jQuery.removeEvent( elem, type, elemData.handle );
2077
+ }
2078
+
2079
+ ret = null;
2080
+ delete events[ type ];
2081
+ }
2082
+ }
2083
+
2084
+ // Remove the expando if it's no longer used
2085
+ if ( jQuery.isEmptyObject( events ) ) {
2086
+ var handle = elemData.handle;
2087
+ if ( handle ) {
2088
+ handle.elem = null;
2089
+ }
2090
+
2091
+ delete elemData.events;
2092
+ delete elemData.handle;
2093
+
2094
+ if ( typeof elemData === "function" ) {
2095
+ jQuery.removeData( elem, eventKey );
2096
+
2097
+ } else if ( jQuery.isEmptyObject( elemData ) ) {
2098
+ jQuery.removeData( elem );
2099
+ }
2100
+ }
2101
+ },
2102
+
2103
+ // bubbling is internal
2104
+ trigger: function( event, data, elem /*, bubbling */ ) {
2105
+ // Event object or event type
2106
+ var type = event.type || event,
2107
+ bubbling = arguments[3];
2108
+
2109
+ if ( !bubbling ) {
2110
+ event = typeof event === "object" ?
2111
+ // jQuery.Event object
2112
+ event[ jQuery.expando ] ? event :
2113
+ // Object literal
2114
+ jQuery.extend( jQuery.Event(type), event ) :
2115
+ // Just the event type (string)
2116
+ jQuery.Event(type);
2117
+
2118
+ if ( type.indexOf("!") >= 0 ) {
2119
+ event.type = type = type.slice(0, -1);
2120
+ event.exclusive = true;
2121
+ }
2122
+
2123
+ // Handle a global trigger
2124
+ if ( !elem ) {
2125
+ // Don't bubble custom events when global (to avoid too much overhead)
2126
+ event.stopPropagation();
2127
+
2128
+ // Only trigger if we've ever bound an event for it
2129
+ if ( jQuery.event.global[ type ] ) {
2130
+ jQuery.each( jQuery.cache, function() {
2131
+ if ( this.events && this.events[type] ) {
2132
+ jQuery.event.trigger( event, data, this.handle.elem );
2133
+ }
2134
+ });
2135
+ }
2136
+ }
2137
+
2138
+ // Handle triggering a single element
2139
+
2140
+ // don't do events on text and comment nodes
2141
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
2142
+ return undefined;
2143
+ }
2144
+
2145
+ // Clean up in case it is reused
2146
+ event.result = undefined;
2147
+ event.target = elem;
2148
+
2149
+ // Clone the incoming data, if any
2150
+ data = jQuery.makeArray( data );
2151
+ data.unshift( event );
2152
+ }
2153
+
2154
+ event.currentTarget = elem;
2155
+
2156
+ // Trigger the event, it is assumed that "handle" is a function
2157
+ var handle = elem.nodeType ?
2158
+ jQuery.data( elem, "handle" ) :
2159
+ (jQuery.data( elem, "__events__" ) || {}).handle;
2160
+
2161
+ if ( handle ) {
2162
+ handle.apply( elem, data );
2163
+ }
2164
+
2165
+ var parent = elem.parentNode || elem.ownerDocument;
2166
+
2167
+ // Trigger an inline bound script
2168
+ try {
2169
+ if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
2170
+ if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
2171
+ event.result = false;
2172
+ event.preventDefault();
2173
+ }
2174
+ }
2175
+
2176
+ // prevent IE from throwing an error for some elements with some event types, see #3533
2177
+ } catch (inlineError) {}
2178
+
2179
+ if ( !event.isPropagationStopped() && parent ) {
2180
+ jQuery.event.trigger( event, data, parent, true );
2181
+
2182
+ } else if ( !event.isDefaultPrevented() ) {
2183
+ var old,
2184
+ target = event.target,
2185
+ targetType = type.replace( rnamespaces, "" ),
2186
+ isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
2187
+ special = jQuery.event.special[ targetType ] || {};
2188
+
2189
+ if ( (!special._default || special._default.call( elem, event ) === false) &&
2190
+ !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
2191
+
2192
+ try {
2193
+ if ( target[ targetType ] ) {
2194
+ // Make sure that we don't accidentally re-trigger the onFOO events
2195
+ old = target[ "on" + targetType ];
2196
+
2197
+ if ( old ) {
2198
+ target[ "on" + targetType ] = null;
2199
+ }
2200
+
2201
+ jQuery.event.triggered = true;
2202
+ target[ targetType ]();
2203
+ }
2204
+
2205
+ // prevent IE from throwing an error for some elements with some event types, see #3533
2206
+ } catch (triggerError) {}
2207
+
2208
+ if ( old ) {
2209
+ target[ "on" + targetType ] = old;
2210
+ }
2211
+
2212
+ jQuery.event.triggered = false;
2213
+ }
2214
+ }
2215
+ },
2216
+
2217
+ handle: function( event ) {
2218
+ var all, handlers, namespaces, namespace_re, events,
2219
+ namespace_sort = [],
2220
+ args = jQuery.makeArray( arguments );
2221
+
2222
+ event = args[0] = jQuery.event.fix( event || window.event );
2223
+ event.currentTarget = this;
2224
+
2225
+ // Namespaced event handlers
2226
+ all = event.type.indexOf(".") < 0 && !event.exclusive;
2227
+
2228
+ if ( !all ) {
2229
+ namespaces = event.type.split(".");
2230
+ event.type = namespaces.shift();
2231
+ namespace_sort = namespaces.slice(0).sort();
2232
+ namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
2233
+ }
2234
+
2235
+ event.namespace = event.namespace || namespace_sort.join(".");
2236
+
2237
+ events = jQuery.data(this, this.nodeType ? "events" : "__events__");
2238
+
2239
+ if ( typeof events === "function" ) {
2240
+ events = events.events;
2241
+ }
2242
+
2243
+ handlers = (events || {})[ event.type ];
2244
+
2245
+ if ( events && handlers ) {
2246
+ // Clone the handlers to prevent manipulation
2247
+ handlers = handlers.slice(0);
2248
+
2249
+ for ( var j = 0, l = handlers.length; j < l; j++ ) {
2250
+ var handleObj = handlers[ j ];
2251
+
2252
+ // Filter the functions by class
2253
+ if ( all || namespace_re.test( handleObj.namespace ) ) {
2254
+ // Pass in a reference to the handler function itself
2255
+ // So that we can later remove it
2256
+ event.handler = handleObj.handler;
2257
+ event.data = handleObj.data;
2258
+ event.handleObj = handleObj;
2259
+
2260
+ var ret = handleObj.handler.apply( this, args );
2261
+
2262
+ if ( ret !== undefined ) {
2263
+ event.result = ret;
2264
+ if ( ret === false ) {
2265
+ event.preventDefault();
2266
+ event.stopPropagation();
2267
+ }
2268
+ }
2269
+
2270
+ if ( event.isImmediatePropagationStopped() ) {
2271
+ break;
2272
+ }
2273
+ }
2274
+ }
2275
+ }
2276
+
2277
+ return event.result;
2278
+ },
2279
+
2280
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
2281
+
2282
+ fix: function( event ) {
2283
+ if ( event[ jQuery.expando ] ) {
2284
+ return event;
2285
+ }
2286
+
2287
+ // store a copy of the original event object
2288
+ // and "clone" to set read-only properties
2289
+ var originalEvent = event;
2290
+ event = jQuery.Event( originalEvent );
2291
+
2292
+ for ( var i = this.props.length, prop; i; ) {
2293
+ prop = this.props[ --i ];
2294
+ event[ prop ] = originalEvent[ prop ];
2295
+ }
2296
+
2297
+ // Fix target property, if necessary
2298
+ if ( !event.target ) {
2299
+ // Fixes #1925 where srcElement might not be defined either
2300
+ event.target = event.srcElement || document;
2301
+ }
2302
+
2303
+ // check if target is a textnode (safari)
2304
+ if ( event.target.nodeType === 3 ) {
2305
+ event.target = event.target.parentNode;
2306
+ }
2307
+
2308
+ // Add relatedTarget, if necessary
2309
+ if ( !event.relatedTarget && event.fromElement ) {
2310
+ event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
2311
+ }
2312
+
2313
+ // Calculate pageX/Y if missing and clientX/Y available
2314
+ if ( event.pageX == null && event.clientX != null ) {
2315
+ var doc = document.documentElement,
2316
+ body = document.body;
2317
+
2318
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
2319
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
2320
+ }
2321
+
2322
+ // Add which for key events
2323
+ if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
2324
+ event.which = event.charCode != null ? event.charCode : event.keyCode;
2325
+ }
2326
+
2327
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
2328
+ if ( !event.metaKey && event.ctrlKey ) {
2329
+ event.metaKey = event.ctrlKey;
2330
+ }
2331
+
2332
+ // Add which for click: 1 === left; 2 === middle; 3 === right
2333
+ // Note: button is not normalized, so don't use it
2334
+ if ( !event.which && event.button !== undefined ) {
2335
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
2336
+ }
2337
+
2338
+ return event;
2339
+ },
2340
+
2341
+ // Deprecated, use jQuery.guid instead
2342
+ guid: 1E8,
2343
+
2344
+ // Deprecated, use jQuery.proxy instead
2345
+ proxy: jQuery.proxy,
2346
+
2347
+ special: {
2348
+ ready: {
2349
+ // Make sure the ready event is setup
2350
+ setup: jQuery.bindReady,
2351
+ teardown: jQuery.noop
2352
+ },
2353
+
2354
+ live: {
2355
+ add: function( handleObj ) {
2356
+ jQuery.event.add( this,
2357
+ liveConvert( handleObj.origType, handleObj.selector ),
2358
+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
2359
+ },
2360
+
2361
+ remove: function( handleObj ) {
2362
+ jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
2363
+ }
2364
+ },
2365
+
2366
+ beforeunload: {
2367
+ setup: function( data, namespaces, eventHandle ) {
2368
+ // We only want to do this special case on windows
2369
+ if ( jQuery.isWindow( this ) ) {
2370
+ this.onbeforeunload = eventHandle;
2371
+ }
2372
+ },
2373
+
2374
+ teardown: function( namespaces, eventHandle ) {
2375
+ if ( this.onbeforeunload === eventHandle ) {
2376
+ this.onbeforeunload = null;
2377
+ }
2378
+ }
2379
+ }
2380
+ }
2381
+ };
2382
+
2383
+ jQuery.removeEvent = document.removeEventListener ?
2384
+ function( elem, type, handle ) {
2385
+ if ( elem.removeEventListener ) {
2386
+ elem.removeEventListener( type, handle, false );
2387
+ }
2388
+ } :
2389
+ function( elem, type, handle ) {
2390
+ if ( elem.detachEvent ) {
2391
+ elem.detachEvent( "on" + type, handle );
2392
+ }
2393
+ };
2394
+
2395
+ jQuery.Event = function( src ) {
2396
+ // Allow instantiation without the 'new' keyword
2397
+ if ( !this.preventDefault ) {
2398
+ return new jQuery.Event( src );
2399
+ }
2400
+
2401
+ // Event object
2402
+ if ( src && src.type ) {
2403
+ this.originalEvent = src;
2404
+ this.type = src.type;
2405
+ // Event type
2406
+ } else {
2407
+ this.type = src;
2408
+ }
2409
+
2410
+ // timeStamp is buggy for some events on Firefox(#3843)
2411
+ // So we won't rely on the native value
2412
+ this.timeStamp = jQuery.now();
2413
+
2414
+ // Mark it as fixed
2415
+ this[ jQuery.expando ] = true;
2416
+ };
2417
+
2418
+ function returnFalse() {
2419
+ return false;
2420
+ }
2421
+ function returnTrue() {
2422
+ return true;
2423
+ }
2424
+
2425
+ // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2426
+ // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2427
+ jQuery.Event.prototype = {
2428
+ preventDefault: function() {
2429
+ this.isDefaultPrevented = returnTrue;
2430
+
2431
+ var e = this.originalEvent;
2432
+ if ( !e ) {
2433
+ return;
2434
+ }
2435
+
2436
+ // if preventDefault exists run it on the original event
2437
+ if ( e.preventDefault ) {
2438
+ e.preventDefault();
2439
+
2440
+ // otherwise set the returnValue property of the original event to false (IE)
2441
+ } else {
2442
+ e.returnValue = false;
2443
+ }
2444
+ },
2445
+ stopPropagation: function() {
2446
+ this.isPropagationStopped = returnTrue;
2447
+
2448
+ var e = this.originalEvent;
2449
+ if ( !e ) {
2450
+ return;
2451
+ }
2452
+ // if stopPropagation exists run it on the original event
2453
+ if ( e.stopPropagation ) {
2454
+ e.stopPropagation();
2455
+ }
2456
+ // otherwise set the cancelBubble property of the original event to true (IE)
2457
+ e.cancelBubble = true;
2458
+ },
2459
+ stopImmediatePropagation: function() {
2460
+ this.isImmediatePropagationStopped = returnTrue;
2461
+ this.stopPropagation();
2462
+ },
2463
+ isDefaultPrevented: returnFalse,
2464
+ isPropagationStopped: returnFalse,
2465
+ isImmediatePropagationStopped: returnFalse
2466
+ };
2467
+
2468
+ // Checks if an event happened on an element within another element
2469
+ // Used in jQuery.event.special.mouseenter and mouseleave handlers
2470
+ var withinElement = function( event ) {
2471
+ // Check if mouse(over|out) are still within the same parent element
2472
+ var parent = event.relatedTarget;
2473
+
2474
+ // Firefox sometimes assigns relatedTarget a XUL element
2475
+ // which we cannot access the parentNode property of
2476
+ try {
2477
+ // Traverse up the tree
2478
+ while ( parent && parent !== this ) {
2479
+ parent = parent.parentNode;
2480
+ }
2481
+
2482
+ if ( parent !== this ) {
2483
+ // set the correct event type
2484
+ event.type = event.data;
2485
+
2486
+ // handle event if we actually just moused on to a non sub-element
2487
+ jQuery.event.handle.apply( this, arguments );
2488
+ }
2489
+
2490
+ // assuming we've left the element since we most likely mousedover a xul element
2491
+ } catch(e) { }
2492
+ },
2493
+
2494
+ // In case of event delegation, we only need to rename the event.type,
2495
+ // liveHandler will take care of the rest.
2496
+ delegate = function( event ) {
2497
+ event.type = event.data;
2498
+ jQuery.event.handle.apply( this, arguments );
2499
+ };
2500
+
2501
+ // Create mouseenter and mouseleave events
2502
+ jQuery.each({
2503
+ mouseenter: "mouseover",
2504
+ mouseleave: "mouseout"
2505
+ }, function( orig, fix ) {
2506
+ jQuery.event.special[ orig ] = {
2507
+ setup: function( data ) {
2508
+ jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
2509
+ },
2510
+ teardown: function( data ) {
2511
+ jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
2512
+ }
2513
+ };
2514
+ });
2515
+
2516
+ // submit delegation
2517
+ if ( !jQuery.support.submitBubbles ) {
2518
+
2519
+ jQuery.event.special.submit = {
2520
+ setup: function( data, namespaces ) {
2521
+ if ( this.nodeName.toLowerCase() !== "form" ) {
2522
+ jQuery.event.add(this, "click.specialSubmit", function( e ) {
2523
+ var elem = e.target,
2524
+ type = elem.type;
2525
+
2526
+ if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
2527
+ e.liveFired = undefined;
2528
+ return trigger( "submit", this, arguments );
2529
+ }
2530
+ });
2531
+
2532
+ jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
2533
+ var elem = e.target,
2534
+ type = elem.type;
2535
+
2536
+ if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
2537
+ e.liveFired = undefined;
2538
+ return trigger( "submit", this, arguments );
2539
+ }
2540
+ });
2541
+
2542
+ } else {
2543
+ return false;
2544
+ }
2545
+ },
2546
+
2547
+ teardown: function( namespaces ) {
2548
+ jQuery.event.remove( this, ".specialSubmit" );
2549
+ }
2550
+ };
2551
+
2552
+ }
2553
+
2554
+ // change delegation, happens here so we have bind.
2555
+ if ( !jQuery.support.changeBubbles ) {
2556
+
2557
+ var changeFilters,
2558
+
2559
+ getVal = function( elem ) {
2560
+ var type = elem.type, val = elem.value;
2561
+
2562
+ if ( type === "radio" || type === "checkbox" ) {
2563
+ val = elem.checked;
2564
+
2565
+ } else if ( type === "select-multiple" ) {
2566
+ val = elem.selectedIndex > -1 ?
2567
+ jQuery.map( elem.options, function( elem ) {
2568
+ return elem.selected;
2569
+ }).join("-") :
2570
+ "";
2571
+
2572
+ } else if ( elem.nodeName.toLowerCase() === "select" ) {
2573
+ val = elem.selectedIndex;
2574
+ }
2575
+
2576
+ return val;
2577
+ },
2578
+
2579
+ testChange = function testChange( e ) {
2580
+ var elem = e.target, data, val;
2581
+
2582
+ if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
2583
+ return;
2584
+ }
2585
+
2586
+ data = jQuery.data( elem, "_change_data" );
2587
+ val = getVal(elem);
2588
+
2589
+ // the current data will be also retrieved by beforeactivate
2590
+ if ( e.type !== "focusout" || elem.type !== "radio" ) {
2591
+ jQuery.data( elem, "_change_data", val );
2592
+ }
2593
+
2594
+ if ( data === undefined || val === data ) {
2595
+ return;
2596
+ }
2597
+
2598
+ if ( data != null || val ) {
2599
+ e.type = "change";
2600
+ e.liveFired = undefined;
2601
+ return jQuery.event.trigger( e, arguments[1], elem );
2602
+ }
2603
+ };
2604
+
2605
+ jQuery.event.special.change = {
2606
+ filters: {
2607
+ focusout: testChange,
2608
+
2609
+ beforedeactivate: testChange,
2610
+
2611
+ click: function( e ) {
2612
+ var elem = e.target, type = elem.type;
2613
+
2614
+ if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
2615
+ return testChange.call( this, e );
2616
+ }
2617
+ },
2618
+
2619
+ // Change has to be called before submit
2620
+ // Keydown will be called before keypress, which is used in submit-event delegation
2621
+ keydown: function( e ) {
2622
+ var elem = e.target, type = elem.type;
2623
+
2624
+ if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
2625
+ (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
2626
+ type === "select-multiple" ) {
2627
+ return testChange.call( this, e );
2628
+ }
2629
+ },
2630
+
2631
+ // Beforeactivate happens also before the previous element is blurred
2632
+ // with this event you can't trigger a change event, but you can store
2633
+ // information
2634
+ beforeactivate: function( e ) {
2635
+ var elem = e.target;
2636
+ jQuery.data( elem, "_change_data", getVal(elem) );
2637
+ }
2638
+ },
2639
+
2640
+ setup: function( data, namespaces ) {
2641
+ if ( this.type === "file" ) {
2642
+ return false;
2643
+ }
2644
+
2645
+ for ( var type in changeFilters ) {
2646
+ jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
2647
+ }
2648
+
2649
+ return rformElems.test( this.nodeName );
2650
+ },
2651
+
2652
+ teardown: function( namespaces ) {
2653
+ jQuery.event.remove( this, ".specialChange" );
2654
+
2655
+ return rformElems.test( this.nodeName );
2656
+ }
2657
+ };
2658
+
2659
+ changeFilters = jQuery.event.special.change.filters;
2660
+
2661
+ // Handle when the input is .focus()'d
2662
+ changeFilters.focus = changeFilters.beforeactivate;
2663
+ }
2664
+
2665
+ function trigger( type, elem, args ) {
2666
+ args[0].type = type;
2667
+ return jQuery.event.handle.apply( elem, args );
2668
+ }
2669
+
2670
+ // Create "bubbling" focus and blur events
2671
+ if ( document.addEventListener ) {
2672
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2673
+ jQuery.event.special[ fix ] = {
2674
+ setup: function() {
2675
+ if ( focusCounts[fix]++ === 0 ) {
2676
+ document.addEventListener( orig, handler, true );
2677
+ }
2678
+ },
2679
+ teardown: function() {
2680
+ if ( --focusCounts[fix] === 0 ) {
2681
+ document.removeEventListener( orig, handler, true );
2682
+ }
2683
+ }
2684
+ };
2685
+
2686
+ function handler( e ) {
2687
+ e = jQuery.event.fix( e );
2688
+ e.type = fix;
2689
+ return jQuery.event.trigger( e, null, e.target );
2690
+ }
2691
+ });
2692
+ }
2693
+
2694
+ jQuery.each(["bind", "one"], function( i, name ) {
2695
+ jQuery.fn[ name ] = function( type, data, fn ) {
2696
+ // Handle object literals
2697
+ if ( typeof type === "object" ) {
2698
+ for ( var key in type ) {
2699
+ this[ name ](key, data, type[key], fn);
2700
+ }
2701
+ return this;
2702
+ }
2703
+
2704
+ if ( jQuery.isFunction( data ) || data === false ) {
2705
+ fn = data;
2706
+ data = undefined;
2707
+ }
2708
+
2709
+ var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
2710
+ jQuery( this ).unbind( event, handler );
2711
+ return fn.apply( this, arguments );
2712
+ }) : fn;
2713
+
2714
+ if ( type === "unload" && name !== "one" ) {
2715
+ this.one( type, data, fn );
2716
+
2717
+ } else {
2718
+ for ( var i = 0, l = this.length; i < l; i++ ) {
2719
+ jQuery.event.add( this[i], type, handler, data );
2720
+ }
2721
+ }
2722
+
2723
+ return this;
2724
+ };
2725
+ });
2726
+
2727
+ jQuery.fn.extend({
2728
+ unbind: function( type, fn ) {
2729
+ // Handle object literals
2730
+ if ( typeof type === "object" && !type.preventDefault ) {
2731
+ for ( var key in type ) {
2732
+ this.unbind(key, type[key]);
2733
+ }
2734
+
2735
+ } else {
2736
+ for ( var i = 0, l = this.length; i < l; i++ ) {
2737
+ jQuery.event.remove( this[i], type, fn );
2738
+ }
2739
+ }
2740
+
2741
+ return this;
2742
+ },
2743
+
2744
+ delegate: function( selector, types, data, fn ) {
2745
+ return this.live( types, data, fn, selector );
2746
+ },
2747
+
2748
+ undelegate: function( selector, types, fn ) {
2749
+ if ( arguments.length === 0 ) {
2750
+ return this.unbind( "live" );
2751
+
2752
+ } else {
2753
+ return this.die( types, null, fn, selector );
2754
+ }
2755
+ },
2756
+
2757
+ trigger: function( type, data ) {
2758
+ return this.each(function() {
2759
+ jQuery.event.trigger( type, data, this );
2760
+ });
2761
+ },
2762
+
2763
+ triggerHandler: function( type, data ) {
2764
+ if ( this[0] ) {
2765
+ var event = jQuery.Event( type );
2766
+ event.preventDefault();
2767
+ event.stopPropagation();
2768
+ jQuery.event.trigger( event, data, this[0] );
2769
+ return event.result;
2770
+ }
2771
+ },
2772
+
2773
+ toggle: function( fn ) {
2774
+ // Save reference to arguments for access in closure
2775
+ var args = arguments,
2776
+ i = 1;
2777
+
2778
+ // link all the functions, so any of them can unbind this click handler
2779
+ while ( i < args.length ) {
2780
+ jQuery.proxy( fn, args[ i++ ] );
2781
+ }
2782
+
2783
+ return this.click( jQuery.proxy( fn, function( event ) {
2784
+ // Figure out which function to execute
2785
+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
2786
+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
2787
+
2788
+ // Make sure that clicks stop
2789
+ event.preventDefault();
2790
+
2791
+ // and execute the function
2792
+ return args[ lastToggle ].apply( this, arguments ) || false;
2793
+ }));
2794
+ },
2795
+
2796
+ hover: function( fnOver, fnOut ) {
2797
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
2798
+ }
2799
+ });
2800
+
2801
+ var liveMap = {
2802
+ focus: "focusin",
2803
+ blur: "focusout",
2804
+ mouseenter: "mouseover",
2805
+ mouseleave: "mouseout"
2806
+ };
2807
+
2808
+ jQuery.each(["live", "die"], function( i, name ) {
2809
+ jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
2810
+ var type, i = 0, match, namespaces, preType,
2811
+ selector = origSelector || this.selector,
2812
+ context = origSelector ? this : jQuery( this.context );
2813
+
2814
+ if ( typeof types === "object" && !types.preventDefault ) {
2815
+ for ( var key in types ) {
2816
+ context[ name ]( key, data, types[key], selector );
2817
+ }
2818
+
2819
+ return this;
2820
+ }
2821
+
2822
+ if ( jQuery.isFunction( data ) ) {
2823
+ fn = data;
2824
+ data = undefined;
2825
+ }
2826
+
2827
+ types = (types || "").split(" ");
2828
+
2829
+ while ( (type = types[ i++ ]) != null ) {
2830
+ match = rnamespaces.exec( type );
2831
+ namespaces = "";
2832
+
2833
+ if ( match ) {
2834
+ namespaces = match[0];
2835
+ type = type.replace( rnamespaces, "" );
2836
+ }
2837
+
2838
+ if ( type === "hover" ) {
2839
+ types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
2840
+ continue;
2841
+ }
2842
+
2843
+ preType = type;
2844
+
2845
+ if ( type === "focus" || type === "blur" ) {
2846
+ types.push( liveMap[ type ] + namespaces );
2847
+ type = type + namespaces;
2848
+
2849
+ } else {
2850
+ type = (liveMap[ type ] || type) + namespaces;
2851
+ }
2852
+
2853
+ if ( name === "live" ) {
2854
+ // bind live handler
2855
+ for ( var j = 0, l = context.length; j < l; j++ ) {
2856
+ jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
2857
+ { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
2858
+ }
2859
+
2860
+ } else {
2861
+ // unbind live handler
2862
+ context.unbind( "live." + liveConvert( type, selector ), fn );
2863
+ }
2864
+ }
2865
+
2866
+ return this;
2867
+ };
2868
+ });
2869
+
2870
+ function liveHandler( event ) {
2871
+ var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
2872
+ elems = [],
2873
+ selectors = [],
2874
+ events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
2875
+
2876
+ if ( typeof events === "function" ) {
2877
+ events = events.events;
2878
+ }
2879
+
2880
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861)
2881
+ if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
2882
+ return;
2883
+ }
2884
+
2885
+ if ( event.namespace ) {
2886
+ namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
2887
+ }
2888
+
2889
+ event.liveFired = this;
2890
+
2891
+ var live = events.live.slice(0);
2892
+
2893
+ for ( j = 0; j < live.length; j++ ) {
2894
+ handleObj = live[j];
2895
+
2896
+ if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
2897
+ selectors.push( handleObj.selector );
2898
+
2899
+ } else {
2900
+ live.splice( j--, 1 );
2901
+ }
2902
+ }
2903
+
2904
+ match = jQuery( event.target ).closest( selectors, event.currentTarget );
2905
+
2906
+ for ( i = 0, l = match.length; i < l; i++ ) {
2907
+ close = match[i];
2908
+
2909
+ for ( j = 0; j < live.length; j++ ) {
2910
+ handleObj = live[j];
2911
+
2912
+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
2913
+ elem = close.elem;
2914
+ related = null;
2915
+
2916
+ // Those two events require additional checking
2917
+ if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
2918
+ event.type = handleObj.preType;
2919
+ related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
2920
+ }
2921
+
2922
+ if ( !related || related !== elem ) {
2923
+ elems.push({ elem: elem, handleObj: handleObj, level: close.level });
2924
+ }
2925
+ }
2926
+ }
2927
+ }
2928
+
2929
+ for ( i = 0, l = elems.length; i < l; i++ ) {
2930
+ match = elems[i];
2931
+
2932
+ if ( maxLevel && match.level > maxLevel ) {
2933
+ break;
2934
+ }
2935
+
2936
+ event.currentTarget = match.elem;
2937
+ event.data = match.handleObj.data;
2938
+ event.handleObj = match.handleObj;
2939
+
2940
+ ret = match.handleObj.origHandler.apply( match.elem, arguments );
2941
+
2942
+ if ( ret === false || event.isPropagationStopped() ) {
2943
+ maxLevel = match.level;
2944
+
2945
+ if ( ret === false ) {
2946
+ stop = false;
2947
+ }
2948
+ if ( event.isImmediatePropagationStopped() ) {
2949
+ break;
2950
+ }
2951
+ }
2952
+ }
2953
+
2954
+ return stop;
2955
+ }
2956
+
2957
+ function liveConvert( type, selector ) {
2958
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
2959
+ }
2960
+
2961
+ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
2962
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
2963
+ "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
2964
+
2965
+ // Handle event binding
2966
+ jQuery.fn[ name ] = function( data, fn ) {
2967
+ if ( fn == null ) {
2968
+ fn = data;
2969
+ data = null;
2970
+ }
2971
+
2972
+ return arguments.length > 0 ?
2973
+ this.bind( name, data, fn ) :
2974
+ this.trigger( name );
2975
+ };
2976
+
2977
+ if ( jQuery.attrFn ) {
2978
+ jQuery.attrFn[ name ] = true;
2979
+ }
2980
+ });
2981
+
2982
+ // Prevent memory leaks in IE
2983
+ // Window isn't included so as not to unbind existing unload events
2984
+ // More info:
2985
+ // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
2986
+ if ( window.attachEvent && !window.addEventListener ) {
2987
+ jQuery(window).bind("unload", function() {
2988
+ for ( var id in jQuery.cache ) {
2989
+ if ( jQuery.cache[ id ].handle ) {
2990
+ // Try/Catch is to handle iframes being unloaded, see #4280
2991
+ try {
2992
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
2993
+ } catch(e) {}
2994
+ }
2995
+ }
2996
+ });
2997
+ }
2998
+
2999
+
3000
+ /*!
3001
+ * Sizzle CSS Selector Engine - v1.0
3002
+ * Copyright 2009, The Dojo Foundation
3003
+ * Released under the MIT, BSD, and GPL Licenses.
3004
+ * More information: http://sizzlejs.com/
3005
+ */
3006
+ (function(){
3007
+
3008
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
3009
+ done = 0,
3010
+ toString = Object.prototype.toString,
3011
+ hasDuplicate = false,
3012
+ baseHasDuplicate = true;
3013
+
3014
+ // Here we check if the JavaScript engine is using some sort of
3015
+ // optimization where it does not always call our comparision
3016
+ // function. If that is the case, discard the hasDuplicate value.
3017
+ // Thus far that includes Google Chrome.
3018
+ [0, 0].sort(function() {
3019
+ baseHasDuplicate = false;
3020
+ return 0;
3021
+ });
3022
+
3023
+ var Sizzle = function( selector, context, results, seed ) {
3024
+ results = results || [];
3025
+ context = context || document;
3026
+
3027
+ var origContext = context;
3028
+
3029
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
3030
+ return [];
3031
+ }
3032
+
3033
+ if ( !selector || typeof selector !== "string" ) {
3034
+ return results;
3035
+ }
3036
+
3037
+ var m, set, checkSet, extra, ret, cur, pop, i,
3038
+ prune = true,
3039
+ contextXML = Sizzle.isXML( context ),
3040
+ parts = [],
3041
+ soFar = selector;
3042
+
3043
+ // Reset the position of the chunker regexp (start from head)
3044
+ do {
3045
+ chunker.exec( "" );
3046
+ m = chunker.exec( soFar );
3047
+
3048
+ if ( m ) {
3049
+ soFar = m[3];
3050
+
3051
+ parts.push( m[1] );
3052
+
3053
+ if ( m[2] ) {
3054
+ extra = m[3];
3055
+ break;
3056
+ }
3057
+ }
3058
+ } while ( m );
3059
+
3060
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
3061
+
3062
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
3063
+ set = posProcess( parts[0] + parts[1], context );
3064
+
3065
+ } else {
3066
+ set = Expr.relative[ parts[0] ] ?
3067
+ [ context ] :
3068
+ Sizzle( parts.shift(), context );
3069
+
3070
+ while ( parts.length ) {
3071
+ selector = parts.shift();
3072
+
3073
+ if ( Expr.relative[ selector ] ) {
3074
+ selector += parts.shift();
3075
+ }
3076
+
3077
+ set = posProcess( selector, set );
3078
+ }
3079
+ }
3080
+
3081
+ } else {
3082
+ // Take a shortcut and set the context if the root selector is an ID
3083
+ // (but not if it'll be faster if the inner selector is an ID)
3084
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
3085
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
3086
+
3087
+ ret = Sizzle.find( parts.shift(), context, contextXML );
3088
+ context = ret.expr ?
3089
+ Sizzle.filter( ret.expr, ret.set )[0] :
3090
+ ret.set[0];
3091
+ }
3092
+
3093
+ if ( context ) {
3094
+ ret = seed ?
3095
+ { expr: parts.pop(), set: makeArray(seed) } :
3096
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
3097
+
3098
+ set = ret.expr ?
3099
+ Sizzle.filter( ret.expr, ret.set ) :
3100
+ ret.set;
3101
+
3102
+ if ( parts.length > 0 ) {
3103
+ checkSet = makeArray( set );
3104
+
3105
+ } else {
3106
+ prune = false;
3107
+ }
3108
+
3109
+ while ( parts.length ) {
3110
+ cur = parts.pop();
3111
+ pop = cur;
3112
+
3113
+ if ( !Expr.relative[ cur ] ) {
3114
+ cur = "";
3115
+ } else {
3116
+ pop = parts.pop();
3117
+ }
3118
+
3119
+ if ( pop == null ) {
3120
+ pop = context;
3121
+ }
3122
+
3123
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
3124
+ }
3125
+
3126
+ } else {
3127
+ checkSet = parts = [];
3128
+ }
3129
+ }
3130
+
3131
+ if ( !checkSet ) {
3132
+ checkSet = set;
3133
+ }
3134
+
3135
+ if ( !checkSet ) {
3136
+ Sizzle.error( cur || selector );
3137
+ }
3138
+
3139
+ if ( toString.call(checkSet) === "[object Array]" ) {
3140
+ if ( !prune ) {
3141
+ results.push.apply( results, checkSet );
3142
+
3143
+ } else if ( context && context.nodeType === 1 ) {
3144
+ for ( i = 0; checkSet[i] != null; i++ ) {
3145
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
3146
+ results.push( set[i] );
3147
+ }
3148
+ }
3149
+
3150
+ } else {
3151
+ for ( i = 0; checkSet[i] != null; i++ ) {
3152
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
3153
+ results.push( set[i] );
3154
+ }
3155
+ }
3156
+ }
3157
+
3158
+ } else {
3159
+ makeArray( checkSet, results );
3160
+ }
3161
+
3162
+ if ( extra ) {
3163
+ Sizzle( extra, origContext, results, seed );
3164
+ Sizzle.uniqueSort( results );
3165
+ }
3166
+
3167
+ return results;
3168
+ };
3169
+
3170
+ Sizzle.uniqueSort = function( results ) {
3171
+ if ( sortOrder ) {
3172
+ hasDuplicate = baseHasDuplicate;
3173
+ results.sort( sortOrder );
3174
+
3175
+ if ( hasDuplicate ) {
3176
+ for ( var i = 1; i < results.length; i++ ) {
3177
+ if ( results[i] === results[ i - 1 ] ) {
3178
+ results.splice( i--, 1 );
3179
+ }
3180
+ }
3181
+ }
3182
+ }
3183
+
3184
+ return results;
3185
+ };
3186
+
3187
+ Sizzle.matches = function( expr, set ) {
3188
+ return Sizzle( expr, null, null, set );
3189
+ };
3190
+
3191
+ Sizzle.matchesSelector = function( node, expr ) {
3192
+ return Sizzle( expr, null, null, [node] ).length > 0;
3193
+ };
3194
+
3195
+ Sizzle.find = function( expr, context, isXML ) {
3196
+ var set;
3197
+
3198
+ if ( !expr ) {
3199
+ return [];
3200
+ }
3201
+
3202
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
3203
+ var match,
3204
+ type = Expr.order[i];
3205
+
3206
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
3207
+ var left = match[1];
3208
+ match.splice( 1, 1 );
3209
+
3210
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
3211
+ match[1] = (match[1] || "").replace(/\\/g, "");
3212
+ set = Expr.find[ type ]( match, context, isXML );
3213
+
3214
+ if ( set != null ) {
3215
+ expr = expr.replace( Expr.match[ type ], "" );
3216
+ break;
3217
+ }
3218
+ }
3219
+ }
3220
+ }
3221
+
3222
+ if ( !set ) {
3223
+ set = context.getElementsByTagName( "*" );
3224
+ }
3225
+
3226
+ return { set: set, expr: expr };
3227
+ };
3228
+
3229
+ Sizzle.filter = function( expr, set, inplace, not ) {
3230
+ var match, anyFound,
3231
+ old = expr,
3232
+ result = [],
3233
+ curLoop = set,
3234
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
3235
+
3236
+ while ( expr && set.length ) {
3237
+ for ( var type in Expr.filter ) {
3238
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
3239
+ var found, item,
3240
+ filter = Expr.filter[ type ],
3241
+ left = match[1];
3242
+
3243
+ anyFound = false;
3244
+
3245
+ match.splice(1,1);
3246
+
3247
+ if ( left.substr( left.length - 1 ) === "\\" ) {
3248
+ continue;
3249
+ }
3250
+
3251
+ if ( curLoop === result ) {
3252
+ result = [];
3253
+ }
3254
+
3255
+ if ( Expr.preFilter[ type ] ) {
3256
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
3257
+
3258
+ if ( !match ) {
3259
+ anyFound = found = true;
3260
+
3261
+ } else if ( match === true ) {
3262
+ continue;
3263
+ }
3264
+ }
3265
+
3266
+ if ( match ) {
3267
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
3268
+ if ( item ) {
3269
+ found = filter( item, match, i, curLoop );
3270
+ var pass = not ^ !!found;
3271
+
3272
+ if ( inplace && found != null ) {
3273
+ if ( pass ) {
3274
+ anyFound = true;
3275
+
3276
+ } else {
3277
+ curLoop[i] = false;
3278
+ }
3279
+
3280
+ } else if ( pass ) {
3281
+ result.push( item );
3282
+ anyFound = true;
3283
+ }
3284
+ }
3285
+ }
3286
+ }
3287
+
3288
+ if ( found !== undefined ) {
3289
+ if ( !inplace ) {
3290
+ curLoop = result;
3291
+ }
3292
+
3293
+ expr = expr.replace( Expr.match[ type ], "" );
3294
+
3295
+ if ( !anyFound ) {
3296
+ return [];
3297
+ }
3298
+
3299
+ break;
3300
+ }
3301
+ }
3302
+ }
3303
+
3304
+ // Improper expression
3305
+ if ( expr === old ) {
3306
+ if ( anyFound == null ) {
3307
+ Sizzle.error( expr );
3308
+
3309
+ } else {
3310
+ break;
3311
+ }
3312
+ }
3313
+
3314
+ old = expr;
3315
+ }
3316
+
3317
+ return curLoop;
3318
+ };
3319
+
3320
+ Sizzle.error = function( msg ) {
3321
+ throw "Syntax error, unrecognized expression: " + msg;
3322
+ };
3323
+
3324
+ var Expr = Sizzle.selectors = {
3325
+ order: [ "ID", "NAME", "TAG" ],
3326
+
3327
+ match: {
3328
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3329
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3330
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
3331
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
3332
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
3333
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
3334
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
3335
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
3336
+ },
3337
+
3338
+ leftMatch: {},
3339
+
3340
+ attrMap: {
3341
+ "class": "className",
3342
+ "for": "htmlFor"
3343
+ },
3344
+
3345
+ attrHandle: {
3346
+ href: function( elem ) {
3347
+ return elem.getAttribute( "href" );
3348
+ }
3349
+ },
3350
+
3351
+ relative: {
3352
+ "+": function(checkSet, part){
3353
+ var isPartStr = typeof part === "string",
3354
+ isTag = isPartStr && !/\W/.test( part ),
3355
+ isPartStrNotTag = isPartStr && !isTag;
3356
+
3357
+ if ( isTag ) {
3358
+ part = part.toLowerCase();
3359
+ }
3360
+
3361
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
3362
+ if ( (elem = checkSet[i]) ) {
3363
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
3364
+
3365
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
3366
+ elem || false :
3367
+ elem === part;
3368
+ }
3369
+ }
3370
+
3371
+ if ( isPartStrNotTag ) {
3372
+ Sizzle.filter( part, checkSet, true );
3373
+ }
3374
+ },
3375
+
3376
+ ">": function( checkSet, part ) {
3377
+ var elem,
3378
+ isPartStr = typeof part === "string",
3379
+ i = 0,
3380
+ l = checkSet.length;
3381
+
3382
+ if ( isPartStr && !/\W/.test( part ) ) {
3383
+ part = part.toLowerCase();
3384
+
3385
+ for ( ; i < l; i++ ) {
3386
+ elem = checkSet[i];
3387
+
3388
+ if ( elem ) {
3389
+ var parent = elem.parentNode;
3390
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
3391
+ }
3392
+ }
3393
+
3394
+ } else {
3395
+ for ( ; i < l; i++ ) {
3396
+ elem = checkSet[i];
3397
+
3398
+ if ( elem ) {
3399
+ checkSet[i] = isPartStr ?
3400
+ elem.parentNode :
3401
+ elem.parentNode === part;
3402
+ }
3403
+ }
3404
+
3405
+ if ( isPartStr ) {
3406
+ Sizzle.filter( part, checkSet, true );
3407
+ }
3408
+ }
3409
+ },
3410
+
3411
+ "": function(checkSet, part, isXML){
3412
+ var nodeCheck,
3413
+ doneName = done++,
3414
+ checkFn = dirCheck;
3415
+
3416
+ if ( typeof part === "string" && !/\W/.test(part) ) {
3417
+ part = part.toLowerCase();
3418
+ nodeCheck = part;
3419
+ checkFn = dirNodeCheck;
3420
+ }
3421
+
3422
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
3423
+ },
3424
+
3425
+ "~": function( checkSet, part, isXML ) {
3426
+ var nodeCheck,
3427
+ doneName = done++,
3428
+ checkFn = dirCheck;
3429
+
3430
+ if ( typeof part === "string" && !/\W/.test( part ) ) {
3431
+ part = part.toLowerCase();
3432
+ nodeCheck = part;
3433
+ checkFn = dirNodeCheck;
3434
+ }
3435
+
3436
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
3437
+ }
3438
+ },
3439
+
3440
+ find: {
3441
+ ID: function( match, context, isXML ) {
3442
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
3443
+ var m = context.getElementById(match[1]);
3444
+ // Check parentNode to catch when Blackberry 4.6 returns
3445
+ // nodes that are no longer in the document #6963
3446
+ return m && m.parentNode ? [m] : [];
3447
+ }
3448
+ },
3449
+
3450
+ NAME: function( match, context ) {
3451
+ if ( typeof context.getElementsByName !== "undefined" ) {
3452
+ var ret = [],
3453
+ results = context.getElementsByName( match[1] );
3454
+
3455
+ for ( var i = 0, l = results.length; i < l; i++ ) {
3456
+ if ( results[i].getAttribute("name") === match[1] ) {
3457
+ ret.push( results[i] );
3458
+ }
3459
+ }
3460
+
3461
+ return ret.length === 0 ? null : ret;
3462
+ }
3463
+ },
3464
+
3465
+ TAG: function( match, context ) {
3466
+ return context.getElementsByTagName( match[1] );
3467
+ }
3468
+ },
3469
+ preFilter: {
3470
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
3471
+ match = " " + match[1].replace(/\\/g, "") + " ";
3472
+
3473
+ if ( isXML ) {
3474
+ return match;
3475
+ }
3476
+
3477
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
3478
+ if ( elem ) {
3479
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
3480
+ if ( !inplace ) {
3481
+ result.push( elem );
3482
+ }
3483
+
3484
+ } else if ( inplace ) {
3485
+ curLoop[i] = false;
3486
+ }
3487
+ }
3488
+ }
3489
+
3490
+ return false;
3491
+ },
3492
+
3493
+ ID: function( match ) {
3494
+ return match[1].replace(/\\/g, "");
3495
+ },
3496
+
3497
+ TAG: function( match, curLoop ) {
3498
+ return match[1].toLowerCase();
3499
+ },
3500
+
3501
+ CHILD: function( match ) {
3502
+ if ( match[1] === "nth" ) {
3503
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
3504
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
3505
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
3506
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
3507
+
3508
+ // calculate the numbers (first)n+(last) including if they are negative
3509
+ match[2] = (test[1] + (test[2] || 1)) - 0;
3510
+ match[3] = test[3] - 0;
3511
+ }
3512
+
3513
+ // TODO: Move to normal caching system
3514
+ match[0] = done++;
3515
+
3516
+ return match;
3517
+ },
3518
+
3519
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
3520
+ var name = match[1].replace(/\\/g, "");
3521
+
3522
+ if ( !isXML && Expr.attrMap[name] ) {
3523
+ match[1] = Expr.attrMap[name];
3524
+ }
3525
+
3526
+ if ( match[2] === "~=" ) {
3527
+ match[4] = " " + match[4] + " ";
3528
+ }
3529
+
3530
+ return match;
3531
+ },
3532
+
3533
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
3534
+ if ( match[1] === "not" ) {
3535
+ // If we're dealing with a complex expression, or a simple one
3536
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
3537
+ match[3] = Sizzle(match[3], null, null, curLoop);
3538
+
3539
+ } else {
3540
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
3541
+
3542
+ if ( !inplace ) {
3543
+ result.push.apply( result, ret );
3544
+ }
3545
+
3546
+ return false;
3547
+ }
3548
+
3549
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
3550
+ return true;
3551
+ }
3552
+
3553
+ return match;
3554
+ },
3555
+
3556
+ POS: function( match ) {
3557
+ match.unshift( true );
3558
+
3559
+ return match;
3560
+ }
3561
+ },
3562
+
3563
+ filters: {
3564
+ enabled: function( elem ) {
3565
+ return elem.disabled === false && elem.type !== "hidden";
3566
+ },
3567
+
3568
+ disabled: function( elem ) {
3569
+ return elem.disabled === true;
3570
+ },
3571
+
3572
+ checked: function( elem ) {
3573
+ return elem.checked === true;
3574
+ },
3575
+
3576
+ selected: function( elem ) {
3577
+ // Accessing this property makes selected-by-default
3578
+ // options in Safari work properly
3579
+ elem.parentNode.selectedIndex;
3580
+
3581
+ return elem.selected === true;
3582
+ },
3583
+
3584
+ parent: function( elem ) {
3585
+ return !!elem.firstChild;
3586
+ },
3587
+
3588
+ empty: function( elem ) {
3589
+ return !elem.firstChild;
3590
+ },
3591
+
3592
+ has: function( elem, i, match ) {
3593
+ return !!Sizzle( match[3], elem ).length;
3594
+ },
3595
+
3596
+ header: function( elem ) {
3597
+ return (/h\d/i).test( elem.nodeName );
3598
+ },
3599
+
3600
+ text: function( elem ) {
3601
+ return "text" === elem.type;
3602
+ },
3603
+ radio: function( elem ) {
3604
+ return "radio" === elem.type;
3605
+ },
3606
+
3607
+ checkbox: function( elem ) {
3608
+ return "checkbox" === elem.type;
3609
+ },
3610
+
3611
+ file: function( elem ) {
3612
+ return "file" === elem.type;
3613
+ },
3614
+ password: function( elem ) {
3615
+ return "password" === elem.type;
3616
+ },
3617
+
3618
+ submit: function( elem ) {
3619
+ return "submit" === elem.type;
3620
+ },
3621
+
3622
+ image: function( elem ) {
3623
+ return "image" === elem.type;
3624
+ },
3625
+
3626
+ reset: function( elem ) {
3627
+ return "reset" === elem.type;
3628
+ },
3629
+
3630
+ button: function( elem ) {
3631
+ return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
3632
+ },
3633
+
3634
+ input: function( elem ) {
3635
+ return (/input|select|textarea|button/i).test( elem.nodeName );
3636
+ }
3637
+ },
3638
+ setFilters: {
3639
+ first: function( elem, i ) {
3640
+ return i === 0;
3641
+ },
3642
+
3643
+ last: function( elem, i, match, array ) {
3644
+ return i === array.length - 1;
3645
+ },
3646
+
3647
+ even: function( elem, i ) {
3648
+ return i % 2 === 0;
3649
+ },
3650
+
3651
+ odd: function( elem, i ) {
3652
+ return i % 2 === 1;
3653
+ },
3654
+
3655
+ lt: function( elem, i, match ) {
3656
+ return i < match[3] - 0;
3657
+ },
3658
+
3659
+ gt: function( elem, i, match ) {
3660
+ return i > match[3] - 0;
3661
+ },
3662
+
3663
+ nth: function( elem, i, match ) {
3664
+ return match[3] - 0 === i;
3665
+ },
3666
+
3667
+ eq: function( elem, i, match ) {
3668
+ return match[3] - 0 === i;
3669
+ }
3670
+ },
3671
+ filter: {
3672
+ PSEUDO: function( elem, match, i, array ) {
3673
+ var name = match[1],
3674
+ filter = Expr.filters[ name ];
3675
+
3676
+ if ( filter ) {
3677
+ return filter( elem, i, match, array );
3678
+
3679
+ } else if ( name === "contains" ) {
3680
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
3681
+
3682
+ } else if ( name === "not" ) {
3683
+ var not = match[3];
3684
+
3685
+ for ( var j = 0, l = not.length; j < l; j++ ) {
3686
+ if ( not[j] === elem ) {
3687
+ return false;
3688
+ }
3689
+ }
3690
+
3691
+ return true;
3692
+
3693
+ } else {
3694
+ Sizzle.error( "Syntax error, unrecognized expression: " + name );
3695
+ }
3696
+ },
3697
+
3698
+ CHILD: function( elem, match ) {
3699
+ var type = match[1],
3700
+ node = elem;
3701
+
3702
+ switch ( type ) {
3703
+ case "only":
3704
+ case "first":
3705
+ while ( (node = node.previousSibling) ) {
3706
+ if ( node.nodeType === 1 ) {
3707
+ return false;
3708
+ }
3709
+ }
3710
+
3711
+ if ( type === "first" ) {
3712
+ return true;
3713
+ }
3714
+
3715
+ node = elem;
3716
+
3717
+ case "last":
3718
+ while ( (node = node.nextSibling) ) {
3719
+ if ( node.nodeType === 1 ) {
3720
+ return false;
3721
+ }
3722
+ }
3723
+
3724
+ return true;
3725
+
3726
+ case "nth":
3727
+ var first = match[2],
3728
+ last = match[3];
3729
+
3730
+ if ( first === 1 && last === 0 ) {
3731
+ return true;
3732
+ }
3733
+
3734
+ var doneName = match[0],
3735
+ parent = elem.parentNode;
3736
+
3737
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
3738
+ var count = 0;
3739
+
3740
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
3741
+ if ( node.nodeType === 1 ) {
3742
+ node.nodeIndex = ++count;
3743
+ }
3744
+ }
3745
+
3746
+ parent.sizcache = doneName;
3747
+ }
3748
+
3749
+ var diff = elem.nodeIndex - last;
3750
+
3751
+ if ( first === 0 ) {
3752
+ return diff === 0;
3753
+
3754
+ } else {
3755
+ return ( diff % first === 0 && diff / first >= 0 );
3756
+ }
3757
+ }
3758
+ },
3759
+
3760
+ ID: function( elem, match ) {
3761
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
3762
+ },
3763
+
3764
+ TAG: function( elem, match ) {
3765
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
3766
+ },
3767
+
3768
+ CLASS: function( elem, match ) {
3769
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
3770
+ .indexOf( match ) > -1;
3771
+ },
3772
+
3773
+ ATTR: function( elem, match ) {
3774
+ var name = match[1],
3775
+ result = Expr.attrHandle[ name ] ?
3776
+ Expr.attrHandle[ name ]( elem ) :
3777
+ elem[ name ] != null ?
3778
+ elem[ name ] :
3779
+ elem.getAttribute( name ),
3780
+ value = result + "",
3781
+ type = match[2],
3782
+ check = match[4];
3783
+
3784
+ return result == null ?
3785
+ type === "!=" :
3786
+ type === "=" ?
3787
+ value === check :
3788
+ type === "*=" ?
3789
+ value.indexOf(check) >= 0 :
3790
+ type === "~=" ?
3791
+ (" " + value + " ").indexOf(check) >= 0 :
3792
+ !check ?
3793
+ value && result !== false :
3794
+ type === "!=" ?
3795
+ value !== check :
3796
+ type === "^=" ?
3797
+ value.indexOf(check) === 0 :
3798
+ type === "$=" ?
3799
+ value.substr(value.length - check.length) === check :
3800
+ type === "|=" ?
3801
+ value === check || value.substr(0, check.length + 1) === check + "-" :
3802
+ false;
3803
+ },
3804
+
3805
+ POS: function( elem, match, i, array ) {
3806
+ var name = match[2],
3807
+ filter = Expr.setFilters[ name ];
3808
+
3809
+ if ( filter ) {
3810
+ return filter( elem, i, match, array );
3811
+ }
3812
+ }
3813
+ }
3814
+ };
3815
+
3816
+ var origPOS = Expr.match.POS,
3817
+ fescape = function(all, num){
3818
+ return "\\" + (num - 0 + 1);
3819
+ };
3820
+
3821
+ for ( var type in Expr.match ) {
3822
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
3823
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
3824
+ }
3825
+
3826
+ var makeArray = function( array, results ) {
3827
+ array = Array.prototype.slice.call( array, 0 );
3828
+
3829
+ if ( results ) {
3830
+ results.push.apply( results, array );
3831
+ return results;
3832
+ }
3833
+
3834
+ return array;
3835
+ };
3836
+
3837
+ // Perform a simple check to determine if the browser is capable of
3838
+ // converting a NodeList to an array using builtin methods.
3839
+ // Also verifies that the returned array holds DOM nodes
3840
+ // (which is not the case in the Blackberry browser)
3841
+ try {
3842
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
3843
+
3844
+ // Provide a fallback method if it does not work
3845
+ } catch( e ) {
3846
+ makeArray = function( array, results ) {
3847
+ var i = 0,
3848
+ ret = results || [];
3849
+
3850
+ if ( toString.call(array) === "[object Array]" ) {
3851
+ Array.prototype.push.apply( ret, array );
3852
+
3853
+ } else {
3854
+ if ( typeof array.length === "number" ) {
3855
+ for ( var l = array.length; i < l; i++ ) {
3856
+ ret.push( array[i] );
3857
+ }
3858
+
3859
+ } else {
3860
+ for ( ; array[i]; i++ ) {
3861
+ ret.push( array[i] );
3862
+ }
3863
+ }
3864
+ }
3865
+
3866
+ return ret;
3867
+ };
3868
+ }
3869
+
3870
+ var sortOrder, siblingCheck;
3871
+
3872
+ if ( document.documentElement.compareDocumentPosition ) {
3873
+ sortOrder = function( a, b ) {
3874
+ if ( a === b ) {
3875
+ hasDuplicate = true;
3876
+ return 0;
3877
+ }
3878
+
3879
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
3880
+ return a.compareDocumentPosition ? -1 : 1;
3881
+ }
3882
+
3883
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
3884
+ };
3885
+
3886
+ } else {
3887
+ sortOrder = function( a, b ) {
3888
+ var al, bl,
3889
+ ap = [],
3890
+ bp = [],
3891
+ aup = a.parentNode,
3892
+ bup = b.parentNode,
3893
+ cur = aup;
3894
+
3895
+ // The nodes are identical, we can exit early
3896
+ if ( a === b ) {
3897
+ hasDuplicate = true;
3898
+ return 0;
3899
+
3900
+ // If the nodes are siblings (or identical) we can do a quick check
3901
+ } else if ( aup === bup ) {
3902
+ return siblingCheck( a, b );
3903
+
3904
+ // If no parents were found then the nodes are disconnected
3905
+ } else if ( !aup ) {
3906
+ return -1;
3907
+
3908
+ } else if ( !bup ) {
3909
+ return 1;
3910
+ }
3911
+
3912
+ // Otherwise they're somewhere else in the tree so we need
3913
+ // to build up a full list of the parentNodes for comparison
3914
+ while ( cur ) {
3915
+ ap.unshift( cur );
3916
+ cur = cur.parentNode;
3917
+ }
3918
+
3919
+ cur = bup;
3920
+
3921
+ while ( cur ) {
3922
+ bp.unshift( cur );
3923
+ cur = cur.parentNode;
3924
+ }
3925
+
3926
+ al = ap.length;
3927
+ bl = bp.length;
3928
+
3929
+ // Start walking down the tree looking for a discrepancy
3930
+ for ( var i = 0; i < al && i < bl; i++ ) {
3931
+ if ( ap[i] !== bp[i] ) {
3932
+ return siblingCheck( ap[i], bp[i] );
3933
+ }
3934
+ }
3935
+
3936
+ // We ended someplace up the tree so do a sibling check
3937
+ return i === al ?
3938
+ siblingCheck( a, bp[i], -1 ) :
3939
+ siblingCheck( ap[i], b, 1 );
3940
+ };
3941
+
3942
+ siblingCheck = function( a, b, ret ) {
3943
+ if ( a === b ) {
3944
+ return ret;
3945
+ }
3946
+
3947
+ var cur = a.nextSibling;
3948
+
3949
+ while ( cur ) {
3950
+ if ( cur === b ) {
3951
+ return -1;
3952
+ }
3953
+
3954
+ cur = cur.nextSibling;
3955
+ }
3956
+
3957
+ return 1;
3958
+ };
3959
+ }
3960
+
3961
+ // Utility function for retreiving the text value of an array of DOM nodes
3962
+ Sizzle.getText = function( elems ) {
3963
+ var ret = "", elem;
3964
+
3965
+ for ( var i = 0; elems[i]; i++ ) {
3966
+ elem = elems[i];
3967
+
3968
+ // Get the text from text nodes and CDATA nodes
3969
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
3970
+ ret += elem.nodeValue;
3971
+
3972
+ // Traverse everything else, except comment nodes
3973
+ } else if ( elem.nodeType !== 8 ) {
3974
+ ret += Sizzle.getText( elem.childNodes );
3975
+ }
3976
+ }
3977
+
3978
+ return ret;
3979
+ };
3980
+
3981
+ // Check to see if the browser returns elements by name when
3982
+ // querying by getElementById (and provide a workaround)
3983
+ (function(){
3984
+ // We're going to inject a fake input element with a specified name
3985
+ var form = document.createElement("div"),
3986
+ id = "script" + (new Date()).getTime(),
3987
+ root = document.documentElement;
3988
+
3989
+ form.innerHTML = "<a name='" + id + "'/>";
3990
+
3991
+ // Inject it into the root element, check its status, and remove it quickly
3992
+ root.insertBefore( form, root.firstChild );
3993
+
3994
+ // The workaround has to do additional checks after a getElementById
3995
+ // Which slows things down for other browsers (hence the branching)
3996
+ if ( document.getElementById( id ) ) {
3997
+ Expr.find.ID = function( match, context, isXML ) {
3998
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
3999
+ var m = context.getElementById(match[1]);
4000
+
4001
+ return m ?
4002
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
4003
+ [m] :
4004
+ undefined :
4005
+ [];
4006
+ }
4007
+ };
4008
+
4009
+ Expr.filter.ID = function( elem, match ) {
4010
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
4011
+
4012
+ return elem.nodeType === 1 && node && node.nodeValue === match;
4013
+ };
4014
+ }
4015
+
4016
+ root.removeChild( form );
4017
+
4018
+ // release memory in IE
4019
+ root = form = null;
4020
+ })();
4021
+
4022
+ (function(){
4023
+ // Check to see if the browser returns only elements
4024
+ // when doing getElementsByTagName("*")
4025
+
4026
+ // Create a fake element
4027
+ var div = document.createElement("div");
4028
+ div.appendChild( document.createComment("") );
4029
+
4030
+ // Make sure no comments are found
4031
+ if ( div.getElementsByTagName("*").length > 0 ) {
4032
+ Expr.find.TAG = function( match, context ) {
4033
+ var results = context.getElementsByTagName( match[1] );
4034
+
4035
+ // Filter out possible comments
4036
+ if ( match[1] === "*" ) {
4037
+ var tmp = [];
4038
+
4039
+ for ( var i = 0; results[i]; i++ ) {
4040
+ if ( results[i].nodeType === 1 ) {
4041
+ tmp.push( results[i] );
4042
+ }
4043
+ }
4044
+
4045
+ results = tmp;
4046
+ }
4047
+
4048
+ return results;
4049
+ };
4050
+ }
4051
+
4052
+ // Check to see if an attribute returns normalized href attributes
4053
+ div.innerHTML = "<a href='#'></a>";
4054
+
4055
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
4056
+ div.firstChild.getAttribute("href") !== "#" ) {
4057
+
4058
+ Expr.attrHandle.href = function( elem ) {
4059
+ return elem.getAttribute( "href", 2 );
4060
+ };
4061
+ }
4062
+
4063
+ // release memory in IE
4064
+ div = null;
4065
+ })();
4066
+
4067
+ if ( document.querySelectorAll ) {
4068
+ (function(){
4069
+ var oldSizzle = Sizzle,
4070
+ div = document.createElement("div"),
4071
+ id = "__sizzle__";
4072
+
4073
+ div.innerHTML = "<p class='TEST'></p>";
4074
+
4075
+ // Safari can't handle uppercase or unicode characters when
4076
+ // in quirks mode.
4077
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
4078
+ return;
4079
+ }
4080
+
4081
+ Sizzle = function( query, context, extra, seed ) {
4082
+ context = context || document;
4083
+
4084
+ // Make sure that attribute selectors are quoted
4085
+ query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
4086
+
4087
+ // Only use querySelectorAll on non-XML documents
4088
+ // (ID selectors don't work in non-HTML documents)
4089
+ if ( !seed && !Sizzle.isXML(context) ) {
4090
+ if ( context.nodeType === 9 ) {
4091
+ try {
4092
+ return makeArray( context.querySelectorAll(query), extra );
4093
+ } catch(qsaError) {}
4094
+
4095
+ // qSA works strangely on Element-rooted queries
4096
+ // We can work around this by specifying an extra ID on the root
4097
+ // and working up from there (Thanks to Andrew Dupont for the technique)
4098
+ // IE 8 doesn't work on object elements
4099
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
4100
+ var old = context.getAttribute( "id" ),
4101
+ nid = old || id;
4102
+
4103
+ if ( !old ) {
4104
+ context.setAttribute( "id", nid );
4105
+ }
4106
+
4107
+ try {
4108
+ return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
4109
+
4110
+ } catch(pseudoError) {
4111
+ } finally {
4112
+ if ( !old ) {
4113
+ context.removeAttribute( "id" );
4114
+ }
4115
+ }
4116
+ }
4117
+ }
4118
+
4119
+ return oldSizzle(query, context, extra, seed);
4120
+ };
4121
+
4122
+ for ( var prop in oldSizzle ) {
4123
+ Sizzle[ prop ] = oldSizzle[ prop ];
4124
+ }
4125
+
4126
+ // release memory in IE
4127
+ div = null;
4128
+ })();
4129
+ }
4130
+
4131
+ (function(){
4132
+ var html = document.documentElement,
4133
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
4134
+ pseudoWorks = false;
4135
+
4136
+ try {
4137
+ // This should fail with an exception
4138
+ // Gecko does not error, returns false instead
4139
+ matches.call( document.documentElement, "[test!='']:sizzle" );
4140
+
4141
+ } catch( pseudoError ) {
4142
+ pseudoWorks = true;
4143
+ }
4144
+
4145
+ if ( matches ) {
4146
+ Sizzle.matchesSelector = function( node, expr ) {
4147
+ // Make sure that attribute selectors are quoted
4148
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
4149
+
4150
+ if ( !Sizzle.isXML( node ) ) {
4151
+ try {
4152
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
4153
+ return matches.call( node, expr );
4154
+ }
4155
+ } catch(e) {}
4156
+ }
4157
+
4158
+ return Sizzle(expr, null, null, [node]).length > 0;
4159
+ };
4160
+ }
4161
+ })();
4162
+
4163
+ (function(){
4164
+ var div = document.createElement("div");
4165
+
4166
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
4167
+
4168
+ // Opera can't find a second classname (in 9.6)
4169
+ // Also, make sure that getElementsByClassName actually exists
4170
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
4171
+ return;
4172
+ }
4173
+
4174
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
4175
+ div.lastChild.className = "e";
4176
+
4177
+ if ( div.getElementsByClassName("e").length === 1 ) {
4178
+ return;
4179
+ }
4180
+
4181
+ Expr.order.splice(1, 0, "CLASS");
4182
+ Expr.find.CLASS = function( match, context, isXML ) {
4183
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
4184
+ return context.getElementsByClassName(match[1]);
4185
+ }
4186
+ };
4187
+
4188
+ // release memory in IE
4189
+ div = null;
4190
+ })();
4191
+
4192
+ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4193
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4194
+ var elem = checkSet[i];
4195
+
4196
+ if ( elem ) {
4197
+ var match = false;
4198
+
4199
+ elem = elem[dir];
4200
+
4201
+ while ( elem ) {
4202
+ if ( elem.sizcache === doneName ) {
4203
+ match = checkSet[elem.sizset];
4204
+ break;
4205
+ }
4206
+
4207
+ if ( elem.nodeType === 1 && !isXML ){
4208
+ elem.sizcache = doneName;
4209
+ elem.sizset = i;
4210
+ }
4211
+
4212
+ if ( elem.nodeName.toLowerCase() === cur ) {
4213
+ match = elem;
4214
+ break;
4215
+ }
4216
+
4217
+ elem = elem[dir];
4218
+ }
4219
+
4220
+ checkSet[i] = match;
4221
+ }
4222
+ }
4223
+ }
4224
+
4225
+ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4226
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4227
+ var elem = checkSet[i];
4228
+
4229
+ if ( elem ) {
4230
+ var match = false;
4231
+
4232
+ elem = elem[dir];
4233
+
4234
+ while ( elem ) {
4235
+ if ( elem.sizcache === doneName ) {
4236
+ match = checkSet[elem.sizset];
4237
+ break;
4238
+ }
4239
+
4240
+ if ( elem.nodeType === 1 ) {
4241
+ if ( !isXML ) {
4242
+ elem.sizcache = doneName;
4243
+ elem.sizset = i;
4244
+ }
4245
+
4246
+ if ( typeof cur !== "string" ) {
4247
+ if ( elem === cur ) {
4248
+ match = true;
4249
+ break;
4250
+ }
4251
+
4252
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
4253
+ match = elem;
4254
+ break;
4255
+ }
4256
+ }
4257
+
4258
+ elem = elem[dir];
4259
+ }
4260
+
4261
+ checkSet[i] = match;
4262
+ }
4263
+ }
4264
+ }
4265
+
4266
+ if ( document.documentElement.contains ) {
4267
+ Sizzle.contains = function( a, b ) {
4268
+ return a !== b && (a.contains ? a.contains(b) : true);
4269
+ };
4270
+
4271
+ } else if ( document.documentElement.compareDocumentPosition ) {
4272
+ Sizzle.contains = function( a, b ) {
4273
+ return !!(a.compareDocumentPosition(b) & 16);
4274
+ };
4275
+
4276
+ } else {
4277
+ Sizzle.contains = function() {
4278
+ return false;
4279
+ };
4280
+ }
4281
+
4282
+ Sizzle.isXML = function( elem ) {
4283
+ // documentElement is verified for cases where it doesn't yet exist
4284
+ // (such as loading iframes in IE - #4833)
4285
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
4286
+
4287
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
4288
+ };
4289
+
4290
+ var posProcess = function( selector, context ) {
4291
+ var match,
4292
+ tmpSet = [],
4293
+ later = "",
4294
+ root = context.nodeType ? [context] : context;
4295
+
4296
+ // Position selectors must be done after the filter
4297
+ // And so must :not(positional) so we move all PSEUDOs to the end
4298
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
4299
+ later += match[0];
4300
+ selector = selector.replace( Expr.match.PSEUDO, "" );
4301
+ }
4302
+
4303
+ selector = Expr.relative[selector] ? selector + "*" : selector;
4304
+
4305
+ for ( var i = 0, l = root.length; i < l; i++ ) {
4306
+ Sizzle( selector, root[i], tmpSet );
4307
+ }
4308
+
4309
+ return Sizzle.filter( later, tmpSet );
4310
+ };
4311
+
4312
+ // EXPOSE
4313
+ jQuery.find = Sizzle;
4314
+ jQuery.expr = Sizzle.selectors;
4315
+ jQuery.expr[":"] = jQuery.expr.filters;
4316
+ jQuery.unique = Sizzle.uniqueSort;
4317
+ jQuery.text = Sizzle.getText;
4318
+ jQuery.isXMLDoc = Sizzle.isXML;
4319
+ jQuery.contains = Sizzle.contains;
4320
+
4321
+
4322
+ })();
4323
+
4324
+
4325
+ var runtil = /Until$/,
4326
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
4327
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
4328
+ rmultiselector = /,/,
4329
+ isSimple = /^.[^:#\[\.,]*$/,
4330
+ slice = Array.prototype.slice,
4331
+ POS = jQuery.expr.match.POS;
4332
+
4333
+ jQuery.fn.extend({
4334
+ find: function( selector ) {
4335
+ var ret = this.pushStack( "", "find", selector ),
4336
+ length = 0;
4337
+
4338
+ for ( var i = 0, l = this.length; i < l; i++ ) {
4339
+ length = ret.length;
4340
+ jQuery.find( selector, this[i], ret );
4341
+
4342
+ if ( i > 0 ) {
4343
+ // Make sure that the results are unique
4344
+ for ( var n = length; n < ret.length; n++ ) {
4345
+ for ( var r = 0; r < length; r++ ) {
4346
+ if ( ret[r] === ret[n] ) {
4347
+ ret.splice(n--, 1);
4348
+ break;
4349
+ }
4350
+ }
4351
+ }
4352
+ }
4353
+ }
4354
+
4355
+ return ret;
4356
+ },
4357
+
4358
+ has: function( target ) {
4359
+ var targets = jQuery( target );
4360
+ return this.filter(function() {
4361
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
4362
+ if ( jQuery.contains( this, targets[i] ) ) {
4363
+ return true;
4364
+ }
4365
+ }
4366
+ });
4367
+ },
4368
+
4369
+ not: function( selector ) {
4370
+ return this.pushStack( winnow(this, selector, false), "not", selector);
4371
+ },
4372
+
4373
+ filter: function( selector ) {
4374
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
4375
+ },
4376
+
4377
+ is: function( selector ) {
4378
+ return !!selector && jQuery.filter( selector, this ).length > 0;
4379
+ },
4380
+
4381
+ closest: function( selectors, context ) {
4382
+ var ret = [], i, l, cur = this[0];
4383
+
4384
+ if ( jQuery.isArray( selectors ) ) {
4385
+ var match, selector,
4386
+ matches = {},
4387
+ level = 1;
4388
+
4389
+ if ( cur && selectors.length ) {
4390
+ for ( i = 0, l = selectors.length; i < l; i++ ) {
4391
+ selector = selectors[i];
4392
+
4393
+ if ( !matches[selector] ) {
4394
+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
4395
+ jQuery( selector, context || this.context ) :
4396
+ selector;
4397
+ }
4398
+ }
4399
+
4400
+ while ( cur && cur.ownerDocument && cur !== context ) {
4401
+ for ( selector in matches ) {
4402
+ match = matches[selector];
4403
+
4404
+ if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
4405
+ ret.push({ selector: selector, elem: cur, level: level });
4406
+ }
4407
+ }
4408
+
4409
+ cur = cur.parentNode;
4410
+ level++;
4411
+ }
4412
+ }
4413
+
4414
+ return ret;
4415
+ }
4416
+
4417
+ var pos = POS.test( selectors ) ?
4418
+ jQuery( selectors, context || this.context ) : null;
4419
+
4420
+ for ( i = 0, l = this.length; i < l; i++ ) {
4421
+ cur = this[i];
4422
+
4423
+ while ( cur ) {
4424
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
4425
+ ret.push( cur );
4426
+ break;
4427
+
4428
+ } else {
4429
+ cur = cur.parentNode;
4430
+ if ( !cur || !cur.ownerDocument || cur === context ) {
4431
+ break;
4432
+ }
4433
+ }
4434
+ }
4435
+ }
4436
+
4437
+ ret = ret.length > 1 ? jQuery.unique(ret) : ret;
4438
+
4439
+ return this.pushStack( ret, "closest", selectors );
4440
+ },
4441
+
4442
+ // Determine the position of an element within
4443
+ // the matched set of elements
4444
+ index: function( elem ) {
4445
+ if ( !elem || typeof elem === "string" ) {
4446
+ return jQuery.inArray( this[0],
4447
+ // If it receives a string, the selector is used
4448
+ // If it receives nothing, the siblings are used
4449
+ elem ? jQuery( elem ) : this.parent().children() );
4450
+ }
4451
+ // Locate the position of the desired element
4452
+ return jQuery.inArray(
4453
+ // If it receives a jQuery object, the first element is used
4454
+ elem.jquery ? elem[0] : elem, this );
4455
+ },
4456
+
4457
+ add: function( selector, context ) {
4458
+ var set = typeof selector === "string" ?
4459
+ jQuery( selector, context || this.context ) :
4460
+ jQuery.makeArray( selector ),
4461
+ all = jQuery.merge( this.get(), set );
4462
+
4463
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
4464
+ all :
4465
+ jQuery.unique( all ) );
4466
+ },
4467
+
4468
+ andSelf: function() {
4469
+ return this.add( this.prevObject );
4470
+ }
4471
+ });
4472
+
4473
+ // A painfully simple check to see if an element is disconnected
4474
+ // from a document (should be improved, where feasible).
4475
+ function isDisconnected( node ) {
4476
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
4477
+ }
4478
+
4479
+ jQuery.each({
4480
+ parent: function( elem ) {
4481
+ var parent = elem.parentNode;
4482
+ return parent && parent.nodeType !== 11 ? parent : null;
4483
+ },
4484
+ parents: function( elem ) {
4485
+ return jQuery.dir( elem, "parentNode" );
4486
+ },
4487
+ parentsUntil: function( elem, i, until ) {
4488
+ return jQuery.dir( elem, "parentNode", until );
4489
+ },
4490
+ next: function( elem ) {
4491
+ return jQuery.nth( elem, 2, "nextSibling" );
4492
+ },
4493
+ prev: function( elem ) {
4494
+ return jQuery.nth( elem, 2, "previousSibling" );
4495
+ },
4496
+ nextAll: function( elem ) {
4497
+ return jQuery.dir( elem, "nextSibling" );
4498
+ },
4499
+ prevAll: function( elem ) {
4500
+ return jQuery.dir( elem, "previousSibling" );
4501
+ },
4502
+ nextUntil: function( elem, i, until ) {
4503
+ return jQuery.dir( elem, "nextSibling", until );
4504
+ },
4505
+ prevUntil: function( elem, i, until ) {
4506
+ return jQuery.dir( elem, "previousSibling", until );
4507
+ },
4508
+ siblings: function( elem ) {
4509
+ return jQuery.sibling( elem.parentNode.firstChild, elem );
4510
+ },
4511
+ children: function( elem ) {
4512
+ return jQuery.sibling( elem.firstChild );
4513
+ },
4514
+ contents: function( elem ) {
4515
+ return jQuery.nodeName( elem, "iframe" ) ?
4516
+ elem.contentDocument || elem.contentWindow.document :
4517
+ jQuery.makeArray( elem.childNodes );
4518
+ }
4519
+ }, function( name, fn ) {
4520
+ jQuery.fn[ name ] = function( until, selector ) {
4521
+ var ret = jQuery.map( this, fn, until );
4522
+
4523
+ if ( !runtil.test( name ) ) {
4524
+ selector = until;
4525
+ }
4526
+
4527
+ if ( selector && typeof selector === "string" ) {
4528
+ ret = jQuery.filter( selector, ret );
4529
+ }
4530
+
4531
+ ret = this.length > 1 ? jQuery.unique( ret ) : ret;
4532
+
4533
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
4534
+ ret = ret.reverse();
4535
+ }
4536
+
4537
+ return this.pushStack( ret, name, slice.call(arguments).join(",") );
4538
+ };
4539
+ });
4540
+
4541
+ jQuery.extend({
4542
+ filter: function( expr, elems, not ) {
4543
+ if ( not ) {
4544
+ expr = ":not(" + expr + ")";
4545
+ }
4546
+
4547
+ return elems.length === 1 ?
4548
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
4549
+ jQuery.find.matches(expr, elems);
4550
+ },
4551
+
4552
+ dir: function( elem, dir, until ) {
4553
+ var matched = [],
4554
+ cur = elem[ dir ];
4555
+
4556
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
4557
+ if ( cur.nodeType === 1 ) {
4558
+ matched.push( cur );
4559
+ }
4560
+ cur = cur[dir];
4561
+ }
4562
+ return matched;
4563
+ },
4564
+
4565
+ nth: function( cur, result, dir, elem ) {
4566
+ result = result || 1;
4567
+ var num = 0;
4568
+
4569
+ for ( ; cur; cur = cur[dir] ) {
4570
+ if ( cur.nodeType === 1 && ++num === result ) {
4571
+ break;
4572
+ }
4573
+ }
4574
+
4575
+ return cur;
4576
+ },
4577
+
4578
+ sibling: function( n, elem ) {
4579
+ var r = [];
4580
+
4581
+ for ( ; n; n = n.nextSibling ) {
4582
+ if ( n.nodeType === 1 && n !== elem ) {
4583
+ r.push( n );
4584
+ }
4585
+ }
4586
+
4587
+ return r;
4588
+ }
4589
+ });
4590
+
4591
+ // Implement the identical functionality for filter and not
4592
+ function winnow( elements, qualifier, keep ) {
4593
+ if ( jQuery.isFunction( qualifier ) ) {
4594
+ return jQuery.grep(elements, function( elem, i ) {
4595
+ var retVal = !!qualifier.call( elem, i, elem );
4596
+ return retVal === keep;
4597
+ });
4598
+
4599
+ } else if ( qualifier.nodeType ) {
4600
+ return jQuery.grep(elements, function( elem, i ) {
4601
+ return (elem === qualifier) === keep;
4602
+ });
4603
+
4604
+ } else if ( typeof qualifier === "string" ) {
4605
+ var filtered = jQuery.grep(elements, function( elem ) {
4606
+ return elem.nodeType === 1;
4607
+ });
4608
+
4609
+ if ( isSimple.test( qualifier ) ) {
4610
+ return jQuery.filter(qualifier, filtered, !keep);
4611
+ } else {
4612
+ qualifier = jQuery.filter( qualifier, filtered );
4613
+ }
4614
+ }
4615
+
4616
+ return jQuery.grep(elements, function( elem, i ) {
4617
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
4618
+ });
4619
+ }
4620
+
4621
+
4622
+
4623
+
4624
+ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
4625
+ rleadingWhitespace = /^\s+/,
4626
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
4627
+ rtagName = /<([\w:]+)/,
4628
+ rtbody = /<tbody/i,
4629
+ rhtml = /<|&#?\w+;/,
4630
+ rnocache = /<(?:script|object|embed|option|style)/i,
4631
+ // checked="checked" or checked (html5)
4632
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
4633
+ raction = /\=([^="'>\s]+\/)>/g,
4634
+ wrapMap = {
4635
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
4636
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
4637
+ thead: [ 1, "<table>", "</table>" ],
4638
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4639
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4640
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
4641
+ area: [ 1, "<map>", "</map>" ],
4642
+ _default: [ 0, "", "" ]
4643
+ };
4644
+
4645
+ wrapMap.optgroup = wrapMap.option;
4646
+ wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4647
+ wrapMap.th = wrapMap.td;
4648
+
4649
+ // IE can't serialize <link> and <script> tags normally
4650
+ if ( !jQuery.support.htmlSerialize ) {
4651
+ wrapMap._default = [ 1, "div<div>", "</div>" ];
4652
+ }
4653
+
4654
+ jQuery.fn.extend({
4655
+ text: function( text ) {
4656
+ if ( jQuery.isFunction(text) ) {
4657
+ return this.each(function(i) {
4658
+ var self = jQuery( this );
4659
+
4660
+ self.text( text.call(this, i, self.text()) );
4661
+ });
4662
+ }
4663
+
4664
+ if ( typeof text !== "object" && text !== undefined ) {
4665
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
4666
+ }
4667
+
4668
+ return jQuery.text( this );
4669
+ },
4670
+
4671
+ wrapAll: function( html ) {
4672
+ if ( jQuery.isFunction( html ) ) {
4673
+ return this.each(function(i) {
4674
+ jQuery(this).wrapAll( html.call(this, i) );
4675
+ });
4676
+ }
4677
+
4678
+ if ( this[0] ) {
4679
+ // The elements to wrap the target around
4680
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
4681
+
4682
+ if ( this[0].parentNode ) {
4683
+ wrap.insertBefore( this[0] );
4684
+ }
4685
+
4686
+ wrap.map(function() {
4687
+ var elem = this;
4688
+
4689
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
4690
+ elem = elem.firstChild;
4691
+ }
4692
+
4693
+ return elem;
4694
+ }).append(this);
4695
+ }
4696
+
4697
+ return this;
4698
+ },
4699
+
4700
+ wrapInner: function( html ) {
4701
+ if ( jQuery.isFunction( html ) ) {
4702
+ return this.each(function(i) {
4703
+ jQuery(this).wrapInner( html.call(this, i) );
4704
+ });
4705
+ }
4706
+
4707
+ return this.each(function() {
4708
+ var self = jQuery( this ),
4709
+ contents = self.contents();
4710
+
4711
+ if ( contents.length ) {
4712
+ contents.wrapAll( html );
4713
+
4714
+ } else {
4715
+ self.append( html );
4716
+ }
4717
+ });
4718
+ },
4719
+
4720
+ wrap: function( html ) {
4721
+ return this.each(function() {
4722
+ jQuery( this ).wrapAll( html );
4723
+ });
4724
+ },
4725
+
4726
+ unwrap: function() {
4727
+ return this.parent().each(function() {
4728
+ if ( !jQuery.nodeName( this, "body" ) ) {
4729
+ jQuery( this ).replaceWith( this.childNodes );
4730
+ }
4731
+ }).end();
4732
+ },
4733
+
4734
+ append: function() {
4735
+ return this.domManip(arguments, true, function( elem ) {
4736
+ if ( this.nodeType === 1 ) {
4737
+ this.appendChild( elem );
4738
+ }
4739
+ });
4740
+ },
4741
+
4742
+ prepend: function() {
4743
+ return this.domManip(arguments, true, function( elem ) {
4744
+ if ( this.nodeType === 1 ) {
4745
+ this.insertBefore( elem, this.firstChild );
4746
+ }
4747
+ });
4748
+ },
4749
+
4750
+ before: function() {
4751
+ if ( this[0] && this[0].parentNode ) {
4752
+ return this.domManip(arguments, false, function( elem ) {
4753
+ this.parentNode.insertBefore( elem, this );
4754
+ });
4755
+ } else if ( arguments.length ) {
4756
+ var set = jQuery(arguments[0]);
4757
+ set.push.apply( set, this.toArray() );
4758
+ return this.pushStack( set, "before", arguments );
4759
+ }
4760
+ },
4761
+
4762
+ after: function() {
4763
+ if ( this[0] && this[0].parentNode ) {
4764
+ return this.domManip(arguments, false, function( elem ) {
4765
+ this.parentNode.insertBefore( elem, this.nextSibling );
4766
+ });
4767
+ } else if ( arguments.length ) {
4768
+ var set = this.pushStack( this, "after", arguments );
4769
+ set.push.apply( set, jQuery(arguments[0]).toArray() );
4770
+ return set;
4771
+ }
4772
+ },
4773
+
4774
+ // keepData is for internal use only--do not document
4775
+ remove: function( selector, keepData ) {
4776
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
4777
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
4778
+ if ( !keepData && elem.nodeType === 1 ) {
4779
+ jQuery.cleanData( elem.getElementsByTagName("*") );
4780
+ jQuery.cleanData( [ elem ] );
4781
+ }
4782
+
4783
+ if ( elem.parentNode ) {
4784
+ elem.parentNode.removeChild( elem );
4785
+ }
4786
+ }
4787
+ }
4788
+
4789
+ return this;
4790
+ },
4791
+
4792
+ empty: function() {
4793
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
4794
+ // Remove element nodes and prevent memory leaks
4795
+ if ( elem.nodeType === 1 ) {
4796
+ jQuery.cleanData( elem.getElementsByTagName("*") );
4797
+ }
4798
+
4799
+ // Remove any remaining nodes
4800
+ while ( elem.firstChild ) {
4801
+ elem.removeChild( elem.firstChild );
4802
+ }
4803
+ }
4804
+
4805
+ return this;
4806
+ },
4807
+
4808
+ clone: function( events ) {
4809
+ // Do the clone
4810
+ var ret = this.map(function() {
4811
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
4812
+ // IE copies events bound via attachEvent when
4813
+ // using cloneNode. Calling detachEvent on the
4814
+ // clone will also remove the events from the orignal
4815
+ // In order to get around this, we use innerHTML.
4816
+ // Unfortunately, this means some modifications to
4817
+ // attributes in IE that are actually only stored
4818
+ // as properties will not be copied (such as the
4819
+ // the name attribute on an input).
4820
+ var html = this.outerHTML,
4821
+ ownerDocument = this.ownerDocument;
4822
+
4823
+ if ( !html ) {
4824
+ var div = ownerDocument.createElement("div");
4825
+ div.appendChild( this.cloneNode(true) );
4826
+ html = div.innerHTML;
4827
+ }
4828
+
4829
+ return jQuery.clean([html.replace(rinlinejQuery, "")
4830
+ // Handle the case in IE 8 where action=/test/> self-closes a tag
4831
+ .replace(raction, '="$1">')
4832
+ .replace(rleadingWhitespace, "")], ownerDocument)[0];
4833
+ } else {
4834
+ return this.cloneNode(true);
4835
+ }
4836
+ });
4837
+
4838
+ // Copy the events from the original to the clone
4839
+ if ( events === true ) {
4840
+ cloneCopyEvent( this, ret );
4841
+ cloneCopyEvent( this.find("*"), ret.find("*") );
4842
+ }
4843
+
4844
+ // Return the cloned set
4845
+ return ret;
4846
+ },
4847
+
4848
+ html: function( value ) {
4849
+ if ( value === undefined ) {
4850
+ return this[0] && this[0].nodeType === 1 ?
4851
+ this[0].innerHTML.replace(rinlinejQuery, "") :
4852
+ null;
4853
+
4854
+ // See if we can take a shortcut and just use innerHTML
4855
+ } else if ( typeof value === "string" && !rnocache.test( value ) &&
4856
+ (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
4857
+ !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
4858
+
4859
+ value = value.replace(rxhtmlTag, "<$1></$2>");
4860
+
4861
+ try {
4862
+ for ( var i = 0, l = this.length; i < l; i++ ) {
4863
+ // Remove element nodes and prevent memory leaks
4864
+ if ( this[i].nodeType === 1 ) {
4865
+ jQuery.cleanData( this[i].getElementsByTagName("*") );
4866
+ this[i].innerHTML = value;
4867
+ }
4868
+ }
4869
+
4870
+ // If using innerHTML throws an exception, use the fallback method
4871
+ } catch(e) {
4872
+ this.empty().append( value );
4873
+ }
4874
+
4875
+ } else if ( jQuery.isFunction( value ) ) {
4876
+ this.each(function(i){
4877
+ var self = jQuery( this );
4878
+
4879
+ self.html( value.call(this, i, self.html()) );
4880
+ });
4881
+
4882
+ } else {
4883
+ this.empty().append( value );
4884
+ }
4885
+
4886
+ return this;
4887
+ },
4888
+
4889
+ replaceWith: function( value ) {
4890
+ if ( this[0] && this[0].parentNode ) {
4891
+ // Make sure that the elements are removed from the DOM before they are inserted
4892
+ // this can help fix replacing a parent with child elements
4893
+ if ( jQuery.isFunction( value ) ) {
4894
+ return this.each(function(i) {
4895
+ var self = jQuery(this), old = self.html();
4896
+ self.replaceWith( value.call( this, i, old ) );
4897
+ });
4898
+ }
4899
+
4900
+ if ( typeof value !== "string" ) {
4901
+ value = jQuery( value ).detach();
4902
+ }
4903
+
4904
+ return this.each(function() {
4905
+ var next = this.nextSibling,
4906
+ parent = this.parentNode;
4907
+
4908
+ jQuery( this ).remove();
4909
+
4910
+ if ( next ) {
4911
+ jQuery(next).before( value );
4912
+ } else {
4913
+ jQuery(parent).append( value );
4914
+ }
4915
+ });
4916
+ } else {
4917
+ return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
4918
+ }
4919
+ },
4920
+
4921
+ detach: function( selector ) {
4922
+ return this.remove( selector, true );
4923
+ },
4924
+
4925
+ domManip: function( args, table, callback ) {
4926
+ var results, first, fragment, parent,
4927
+ value = args[0],
4928
+ scripts = [];
4929
+
4930
+ // We can't cloneNode fragments that contain checked, in WebKit
4931
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
4932
+ return this.each(function() {
4933
+ jQuery(this).domManip( args, table, callback, true );
4934
+ });
4935
+ }
4936
+
4937
+ if ( jQuery.isFunction(value) ) {
4938
+ return this.each(function(i) {
4939
+ var self = jQuery(this);
4940
+ args[0] = value.call(this, i, table ? self.html() : undefined);
4941
+ self.domManip( args, table, callback );
4942
+ });
4943
+ }
4944
+
4945
+ if ( this[0] ) {
4946
+ parent = value && value.parentNode;
4947
+
4948
+ // If we're in a fragment, just use that instead of building a new one
4949
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
4950
+ results = { fragment: parent };
4951
+
4952
+ } else {
4953
+ results = jQuery.buildFragment( args, this, scripts );
4954
+ }
4955
+
4956
+ fragment = results.fragment;
4957
+
4958
+ if ( fragment.childNodes.length === 1 ) {
4959
+ first = fragment = fragment.firstChild;
4960
+ } else {
4961
+ first = fragment.firstChild;
4962
+ }
4963
+
4964
+ if ( first ) {
4965
+ table = table && jQuery.nodeName( first, "tr" );
4966
+
4967
+ for ( var i = 0, l = this.length; i < l; i++ ) {
4968
+ callback.call(
4969
+ table ?
4970
+ root(this[i], first) :
4971
+ this[i],
4972
+ i > 0 || results.cacheable || this.length > 1 ?
4973
+ fragment.cloneNode(true) :
4974
+ fragment
4975
+ );
4976
+ }
4977
+ }
4978
+
4979
+ if ( scripts.length ) {
4980
+ jQuery.each( scripts, evalScript );
4981
+ }
4982
+ }
4983
+
4984
+ return this;
4985
+ }
4986
+ });
4987
+
4988
+ function root( elem, cur ) {
4989
+ return jQuery.nodeName(elem, "table") ?
4990
+ (elem.getElementsByTagName("tbody")[0] ||
4991
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
4992
+ elem;
4993
+ }
4994
+
4995
+ function cloneCopyEvent(orig, ret) {
4996
+ var i = 0;
4997
+
4998
+ ret.each(function() {
4999
+ if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
5000
+ return;
5001
+ }
5002
+
5003
+ var oldData = jQuery.data( orig[i++] ),
5004
+ curData = jQuery.data( this, oldData ),
5005
+ events = oldData && oldData.events;
5006
+
5007
+ if ( events ) {
5008
+ delete curData.handle;
5009
+ curData.events = {};
5010
+
5011
+ for ( var type in events ) {
5012
+ for ( var handler in events[ type ] ) {
5013
+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
5014
+ }
5015
+ }
5016
+ }
5017
+ });
5018
+ }
5019
+
5020
+ jQuery.buildFragment = function( args, nodes, scripts ) {
5021
+ var fragment, cacheable, cacheresults,
5022
+ doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
5023
+
5024
+ // Only cache "small" (1/2 KB) strings that are associated with the main document
5025
+ // Cloning options loses the selected state, so don't cache them
5026
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
5027
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
5028
+ if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
5029
+ !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
5030
+
5031
+ cacheable = true;
5032
+ cacheresults = jQuery.fragments[ args[0] ];
5033
+ if ( cacheresults ) {
5034
+ if ( cacheresults !== 1 ) {
5035
+ fragment = cacheresults;
5036
+ }
5037
+ }
5038
+ }
5039
+
5040
+ if ( !fragment ) {
5041
+ fragment = doc.createDocumentFragment();
5042
+ jQuery.clean( args, doc, fragment, scripts );
5043
+ }
5044
+
5045
+ if ( cacheable ) {
5046
+ jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
5047
+ }
5048
+
5049
+ return { fragment: fragment, cacheable: cacheable };
5050
+ };
5051
+
5052
+ jQuery.fragments = {};
5053
+
5054
+ jQuery.each({
5055
+ appendTo: "append",
5056
+ prependTo: "prepend",
5057
+ insertBefore: "before",
5058
+ insertAfter: "after",
5059
+ replaceAll: "replaceWith"
5060
+ }, function( name, original ) {
5061
+ jQuery.fn[ name ] = function( selector ) {
5062
+ var ret = [],
5063
+ insert = jQuery( selector ),
5064
+ parent = this.length === 1 && this[0].parentNode;
5065
+
5066
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
5067
+ insert[ original ]( this[0] );
5068
+ return this;
5069
+
5070
+ } else {
5071
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
5072
+ var elems = (i > 0 ? this.clone(true) : this).get();
5073
+ jQuery( insert[i] )[ original ]( elems );
5074
+ ret = ret.concat( elems );
5075
+ }
5076
+
5077
+ return this.pushStack( ret, name, insert.selector );
5078
+ }
5079
+ };
5080
+ });
5081
+
5082
+ jQuery.extend({
5083
+ clean: function( elems, context, fragment, scripts ) {
5084
+ context = context || document;
5085
+
5086
+ // !context.createElement fails in IE with an error but returns typeof 'object'
5087
+ if ( typeof context.createElement === "undefined" ) {
5088
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
5089
+ }
5090
+
5091
+ var ret = [];
5092
+
5093
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
5094
+ if ( typeof elem === "number" ) {
5095
+ elem += "";
5096
+ }
5097
+
5098
+ if ( !elem ) {
5099
+ continue;
5100
+ }
5101
+
5102
+ // Convert html string into DOM nodes
5103
+ if ( typeof elem === "string" && !rhtml.test( elem ) ) {
5104
+ elem = context.createTextNode( elem );
5105
+
5106
+ } else if ( typeof elem === "string" ) {
5107
+ // Fix "XHTML"-style tags in all browsers
5108
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
5109
+
5110
+ // Trim whitespace, otherwise indexOf won't work as expected
5111
+ var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
5112
+ wrap = wrapMap[ tag ] || wrapMap._default,
5113
+ depth = wrap[0],
5114
+ div = context.createElement("div");
5115
+
5116
+ // Go to html and back, then peel off extra wrappers
5117
+ div.innerHTML = wrap[1] + elem + wrap[2];
5118
+
5119
+ // Move to the right depth
5120
+ while ( depth-- ) {
5121
+ div = div.lastChild;
5122
+ }
5123
+
5124
+ // Remove IE's autoinserted <tbody> from table fragments
5125
+ if ( !jQuery.support.tbody ) {
5126
+
5127
+ // String was a <table>, *may* have spurious <tbody>
5128
+ var hasBody = rtbody.test(elem),
5129
+ tbody = tag === "table" && !hasBody ?
5130
+ div.firstChild && div.firstChild.childNodes :
5131
+
5132
+ // String was a bare <thead> or <tfoot>
5133
+ wrap[1] === "<table>" && !hasBody ?
5134
+ div.childNodes :
5135
+ [];
5136
+
5137
+ for ( var j = tbody.length - 1; j >= 0 ; --j ) {
5138
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
5139
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
5140
+ }
5141
+ }
5142
+
5143
+ }
5144
+
5145
+ // IE completely kills leading whitespace when innerHTML is used
5146
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5147
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
5148
+ }
5149
+
5150
+ elem = div.childNodes;
5151
+ }
5152
+
5153
+ if ( elem.nodeType ) {
5154
+ ret.push( elem );
5155
+ } else {
5156
+ ret = jQuery.merge( ret, elem );
5157
+ }
5158
+ }
5159
+
5160
+ if ( fragment ) {
5161
+ for ( i = 0; ret[i]; i++ ) {
5162
+ if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
5163
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
5164
+
5165
+ } else {
5166
+ if ( ret[i].nodeType === 1 ) {
5167
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
5168
+ }
5169
+ fragment.appendChild( ret[i] );
5170
+ }
5171
+ }
5172
+ }
5173
+
5174
+ return ret;
5175
+ },
5176
+
5177
+ cleanData: function( elems ) {
5178
+ var data, id, cache = jQuery.cache,
5179
+ special = jQuery.event.special,
5180
+ deleteExpando = jQuery.support.deleteExpando;
5181
+
5182
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
5183
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
5184
+ continue;
5185
+ }
5186
+
5187
+ id = elem[ jQuery.expando ];
5188
+
5189
+ if ( id ) {
5190
+ data = cache[ id ];
5191
+
5192
+ if ( data && data.events ) {
5193
+ for ( var type in data.events ) {
5194
+ if ( special[ type ] ) {
5195
+ jQuery.event.remove( elem, type );
5196
+
5197
+ } else {
5198
+ jQuery.removeEvent( elem, type, data.handle );
5199
+ }
5200
+ }
5201
+ }
5202
+
5203
+ if ( deleteExpando ) {
5204
+ delete elem[ jQuery.expando ];
5205
+
5206
+ } else if ( elem.removeAttribute ) {
5207
+ elem.removeAttribute( jQuery.expando );
5208
+ }
5209
+
5210
+ delete cache[ id ];
5211
+ }
5212
+ }
5213
+ }
5214
+ });
5215
+
5216
+ function evalScript( i, elem ) {
5217
+ if ( elem.src ) {
5218
+ jQuery.ajax({
5219
+ url: elem.src,
5220
+ async: false,
5221
+ dataType: "script"
5222
+ });
5223
+ } else {
5224
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
5225
+ }
5226
+
5227
+ if ( elem.parentNode ) {
5228
+ elem.parentNode.removeChild( elem );
5229
+ }
5230
+ }
5231
+
5232
+
5233
+
5234
+
5235
+ var ralpha = /alpha\([^)]*\)/i,
5236
+ ropacity = /opacity=([^)]*)/,
5237
+ rdashAlpha = /-([a-z])/ig,
5238
+ rupper = /([A-Z])/g,
5239
+ rnumpx = /^-?\d+(?:px)?$/i,
5240
+ rnum = /^-?\d/,
5241
+
5242
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5243
+ cssWidth = [ "Left", "Right" ],
5244
+ cssHeight = [ "Top", "Bottom" ],
5245
+ curCSS,
5246
+
5247
+ getComputedStyle,
5248
+ currentStyle,
5249
+
5250
+ fcamelCase = function( all, letter ) {
5251
+ return letter.toUpperCase();
5252
+ };
5253
+
5254
+ jQuery.fn.css = function( name, value ) {
5255
+ // Setting 'undefined' is a no-op
5256
+ if ( arguments.length === 2 && value === undefined ) {
5257
+ return this;
5258
+ }
5259
+
5260
+ return jQuery.access( this, name, value, true, function( elem, name, value ) {
5261
+ return value !== undefined ?
5262
+ jQuery.style( elem, name, value ) :
5263
+ jQuery.css( elem, name );
5264
+ });
5265
+ };
5266
+
5267
+ jQuery.extend({
5268
+ // Add in style property hooks for overriding the default
5269
+ // behavior of getting and setting a style property
5270
+ cssHooks: {
5271
+ opacity: {
5272
+ get: function( elem, computed ) {
5273
+ if ( computed ) {
5274
+ // We should always get a number back from opacity
5275
+ var ret = curCSS( elem, "opacity", "opacity" );
5276
+ return ret === "" ? "1" : ret;
5277
+
5278
+ } else {
5279
+ return elem.style.opacity;
5280
+ }
5281
+ }
5282
+ }
5283
+ },
5284
+
5285
+ // Exclude the following css properties to add px
5286
+ cssNumber: {
5287
+ "zIndex": true,
5288
+ "fontWeight": true,
5289
+ "opacity": true,
5290
+ "zoom": true,
5291
+ "lineHeight": true
5292
+ },
5293
+
5294
+ // Add in properties whose names you wish to fix before
5295
+ // setting or getting the value
5296
+ cssProps: {
5297
+ // normalize float css property
5298
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
5299
+ },
5300
+
5301
+ // Get and set the style property on a DOM Node
5302
+ style: function( elem, name, value, extra ) {
5303
+ // Don't set styles on text and comment nodes
5304
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
5305
+ return;
5306
+ }
5307
+
5308
+ // Make sure that we're working with the right name
5309
+ var ret, origName = jQuery.camelCase( name ),
5310
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
5311
+
5312
+ name = jQuery.cssProps[ origName ] || origName;
5313
+
5314
+ // Check if we're setting a value
5315
+ if ( value !== undefined ) {
5316
+ // Make sure that NaN and null values aren't set. See: #7116
5317
+ if ( typeof value === "number" && isNaN( value ) || value == null ) {
5318
+ return;
5319
+ }
5320
+
5321
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
5322
+ if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
5323
+ value += "px";
5324
+ }
5325
+
5326
+ // If a hook was provided, use that value, otherwise just set the specified value
5327
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
5328
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
5329
+ // Fixes bug #5509
5330
+ try {
5331
+ style[ name ] = value;
5332
+ } catch(e) {}
5333
+ }
5334
+
5335
+ } else {
5336
+ // If a hook was provided get the non-computed value from there
5337
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
5338
+ return ret;
5339
+ }
5340
+
5341
+ // Otherwise just get the value from the style object
5342
+ return style[ name ];
5343
+ }
5344
+ },
5345
+
5346
+ css: function( elem, name, extra ) {
5347
+ // Make sure that we're working with the right name
5348
+ var ret, origName = jQuery.camelCase( name ),
5349
+ hooks = jQuery.cssHooks[ origName ];
5350
+
5351
+ name = jQuery.cssProps[ origName ] || origName;
5352
+
5353
+ // If a hook was provided get the computed value from there
5354
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
5355
+ return ret;
5356
+
5357
+ // Otherwise, if a way to get the computed value exists, use that
5358
+ } else if ( curCSS ) {
5359
+ return curCSS( elem, name, origName );
5360
+ }
5361
+ },
5362
+
5363
+ // A method for quickly swapping in/out CSS properties to get correct calculations
5364
+ swap: function( elem, options, callback ) {
5365
+ var old = {};
5366
+
5367
+ // Remember the old values, and insert the new ones
5368
+ for ( var name in options ) {
5369
+ old[ name ] = elem.style[ name ];
5370
+ elem.style[ name ] = options[ name ];
5371
+ }
5372
+
5373
+ callback.call( elem );
5374
+
5375
+ // Revert the old values
5376
+ for ( name in options ) {
5377
+ elem.style[ name ] = old[ name ];
5378
+ }
5379
+ },
5380
+
5381
+ camelCase: function( string ) {
5382
+ return string.replace( rdashAlpha, fcamelCase );
5383
+ }
5384
+ });
5385
+
5386
+ // DEPRECATED, Use jQuery.css() instead
5387
+ jQuery.curCSS = jQuery.css;
5388
+
5389
+ jQuery.each(["height", "width"], function( i, name ) {
5390
+ jQuery.cssHooks[ name ] = {
5391
+ get: function( elem, computed, extra ) {
5392
+ var val;
5393
+
5394
+ if ( computed ) {
5395
+ if ( elem.offsetWidth !== 0 ) {
5396
+ val = getWH( elem, name, extra );
5397
+
5398
+ } else {
5399
+ jQuery.swap( elem, cssShow, function() {
5400
+ val = getWH( elem, name, extra );
5401
+ });
5402
+ }
5403
+
5404
+ if ( val <= 0 ) {
5405
+ val = curCSS( elem, name, name );
5406
+
5407
+ if ( val === "0px" && currentStyle ) {
5408
+ val = currentStyle( elem, name, name );
5409
+ }
5410
+
5411
+ if ( val != null ) {
5412
+ // Should return "auto" instead of 0, use 0 for
5413
+ // temporary backwards-compat
5414
+ return val === "" || val === "auto" ? "0px" : val;
5415
+ }
5416
+ }
5417
+
5418
+ if ( val < 0 || val == null ) {
5419
+ val = elem.style[ name ];
5420
+
5421
+ // Should return "auto" instead of 0, use 0 for
5422
+ // temporary backwards-compat
5423
+ return val === "" || val === "auto" ? "0px" : val;
5424
+ }
5425
+
5426
+ return typeof val === "string" ? val : val + "px";
5427
+ }
5428
+ },
5429
+
5430
+ set: function( elem, value ) {
5431
+ if ( rnumpx.test( value ) ) {
5432
+ // ignore negative width and height values #1599
5433
+ value = parseFloat(value);
5434
+
5435
+ if ( value >= 0 ) {
5436
+ return value + "px";
5437
+ }
5438
+
5439
+ } else {
5440
+ return value;
5441
+ }
5442
+ }
5443
+ };
5444
+ });
5445
+
5446
+ if ( !jQuery.support.opacity ) {
5447
+ jQuery.cssHooks.opacity = {
5448
+ get: function( elem, computed ) {
5449
+ // IE uses filters for opacity
5450
+ return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
5451
+ (parseFloat(RegExp.$1) / 100) + "" :
5452
+ computed ? "1" : "";
5453
+ },
5454
+
5455
+ set: function( elem, value ) {
5456
+ var style = elem.style;
5457
+
5458
+ // IE has trouble with opacity if it does not have layout
5459
+ // Force it by setting the zoom level
5460
+ style.zoom = 1;
5461
+
5462
+ // Set the alpha filter to set the opacity
5463
+ var opacity = jQuery.isNaN(value) ?
5464
+ "" :
5465
+ "alpha(opacity=" + value * 100 + ")",
5466
+ filter = style.filter || "";
5467
+
5468
+ style.filter = ralpha.test(filter) ?
5469
+ filter.replace(ralpha, opacity) :
5470
+ style.filter + ' ' + opacity;
5471
+ }
5472
+ };
5473
+ }
5474
+
5475
+ if ( document.defaultView && document.defaultView.getComputedStyle ) {
5476
+ getComputedStyle = function( elem, newName, name ) {
5477
+ var ret, defaultView, computedStyle;
5478
+
5479
+ name = name.replace( rupper, "-$1" ).toLowerCase();
5480
+
5481
+ if ( !(defaultView = elem.ownerDocument.defaultView) ) {
5482
+ return undefined;
5483
+ }
5484
+
5485
+ if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
5486
+ ret = computedStyle.getPropertyValue( name );
5487
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
5488
+ ret = jQuery.style( elem, name );
5489
+ }
5490
+ }
5491
+
5492
+ return ret;
5493
+ };
5494
+ }
5495
+
5496
+ if ( document.documentElement.currentStyle ) {
5497
+ currentStyle = function( elem, name ) {
5498
+ var left, rsLeft,
5499
+ ret = elem.currentStyle && elem.currentStyle[ name ],
5500
+ style = elem.style;
5501
+
5502
+ // From the awesome hack by Dean Edwards
5503
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
5504
+
5505
+ // If we're not dealing with a regular pixel number
5506
+ // but a number that has a weird ending, we need to convert it to pixels
5507
+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
5508
+ // Remember the original values
5509
+ left = style.left;
5510
+ rsLeft = elem.runtimeStyle.left;
5511
+
5512
+ // Put in the new values to get a computed value out
5513
+ elem.runtimeStyle.left = elem.currentStyle.left;
5514
+ style.left = name === "fontSize" ? "1em" : (ret || 0);
5515
+ ret = style.pixelLeft + "px";
5516
+
5517
+ // Revert the changed values
5518
+ style.left = left;
5519
+ elem.runtimeStyle.left = rsLeft;
5520
+ }
5521
+
5522
+ return ret === "" ? "auto" : ret;
5523
+ };
5524
+ }
5525
+
5526
+ curCSS = getComputedStyle || currentStyle;
5527
+
5528
+ function getWH( elem, name, extra ) {
5529
+ var which = name === "width" ? cssWidth : cssHeight,
5530
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
5531
+
5532
+ if ( extra === "border" ) {
5533
+ return val;
5534
+ }
5535
+
5536
+ jQuery.each( which, function() {
5537
+ if ( !extra ) {
5538
+ val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
5539
+ }
5540
+
5541
+ if ( extra === "margin" ) {
5542
+ val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
5543
+
5544
+ } else {
5545
+ val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
5546
+ }
5547
+ });
5548
+
5549
+ return val;
5550
+ }
5551
+
5552
+ if ( jQuery.expr && jQuery.expr.filters ) {
5553
+ jQuery.expr.filters.hidden = function( elem ) {
5554
+ var width = elem.offsetWidth,
5555
+ height = elem.offsetHeight;
5556
+
5557
+ return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
5558
+ };
5559
+
5560
+ jQuery.expr.filters.visible = function( elem ) {
5561
+ return !jQuery.expr.filters.hidden( elem );
5562
+ };
5563
+ }
5564
+
5565
+
5566
+
5567
+
5568
+ var jsc = jQuery.now(),
5569
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
5570
+ rselectTextarea = /^(?:select|textarea)/i,
5571
+ rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
5572
+ rnoContent = /^(?:GET|HEAD)$/,
5573
+ rbracket = /\[\]$/,
5574
+ jsre = /\=\?(&|$)/,
5575
+ rquery = /\?/,
5576
+ rts = /([?&])_=[^&]*/,
5577
+ rurl = /^(\w+:)?\/\/([^\/?#]+)/,
5578
+ r20 = /%20/g,
5579
+ rhash = /#.*$/,
5580
+
5581
+ // Keep a copy of the old load method
5582
+ _load = jQuery.fn.load;
5583
+
5584
+ jQuery.fn.extend({
5585
+ load: function( url, params, callback ) {
5586
+ if ( typeof url !== "string" && _load ) {
5587
+ return _load.apply( this, arguments );
5588
+
5589
+ // Don't do a request if no elements are being requested
5590
+ } else if ( !this.length ) {
5591
+ return this;
5592
+ }
5593
+
5594
+ var off = url.indexOf(" ");
5595
+ if ( off >= 0 ) {
5596
+ var selector = url.slice(off, url.length);
5597
+ url = url.slice(0, off);
5598
+ }
5599
+
5600
+ // Default to a GET request
5601
+ var type = "GET";
5602
+
5603
+ // If the second parameter was provided
5604
+ if ( params ) {
5605
+ // If it's a function
5606
+ if ( jQuery.isFunction( params ) ) {
5607
+ // We assume that it's the callback
5608
+ callback = params;
5609
+ params = null;
5610
+
5611
+ // Otherwise, build a param string
5612
+ } else if ( typeof params === "object" ) {
5613
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );
5614
+ type = "POST";
5615
+ }
5616
+ }
5617
+
5618
+ var self = this;
5619
+
5620
+ // Request the remote document
5621
+ jQuery.ajax({
5622
+ url: url,
5623
+ type: type,
5624
+ dataType: "html",
5625
+ data: params,
5626
+ complete: function( res, status ) {
5627
+ // If successful, inject the HTML into all the matched elements
5628
+ if ( status === "success" || status === "notmodified" ) {
5629
+ // See if a selector was specified
5630
+ self.html( selector ?
5631
+ // Create a dummy div to hold the results
5632
+ jQuery("<div>")
5633
+ // inject the contents of the document in, removing the scripts
5634
+ // to avoid any 'Permission Denied' errors in IE
5635
+ .append(res.responseText.replace(rscript, ""))
5636
+
5637
+ // Locate the specified elements
5638
+ .find(selector) :
5639
+
5640
+ // If not, just inject the full result
5641
+ res.responseText );
5642
+ }
5643
+
5644
+ if ( callback ) {
5645
+ self.each( callback, [res.responseText, status, res] );
5646
+ }
5647
+ }
5648
+ });
5649
+
5650
+ return this;
5651
+ },
5652
+
5653
+ serialize: function() {
5654
+ return jQuery.param(this.serializeArray());
5655
+ },
5656
+
5657
+ serializeArray: function() {
5658
+ return this.map(function() {
5659
+ return this.elements ? jQuery.makeArray(this.elements) : this;
5660
+ })
5661
+ .filter(function() {
5662
+ return this.name && !this.disabled &&
5663
+ (this.checked || rselectTextarea.test(this.nodeName) ||
5664
+ rinput.test(this.type));
5665
+ })
5666
+ .map(function( i, elem ) {
5667
+ var val = jQuery(this).val();
5668
+
5669
+ return val == null ?
5670
+ null :
5671
+ jQuery.isArray(val) ?
5672
+ jQuery.map( val, function( val, i ) {
5673
+ return { name: elem.name, value: val };
5674
+ }) :
5675
+ { name: elem.name, value: val };
5676
+ }).get();
5677
+ }
5678
+ });
5679
+
5680
+ // Attach a bunch of functions for handling common AJAX events
5681
+ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
5682
+ jQuery.fn[o] = function( f ) {
5683
+ return this.bind(o, f);
5684
+ };
5685
+ });
5686
+
5687
+ jQuery.extend({
5688
+ get: function( url, data, callback, type ) {
5689
+ // shift arguments if data argument was omited
5690
+ if ( jQuery.isFunction( data ) ) {
5691
+ type = type || callback;
5692
+ callback = data;
5693
+ data = null;
5694
+ }
5695
+
5696
+ return jQuery.ajax({
5697
+ type: "GET",
5698
+ url: url,
5699
+ data: data,
5700
+ success: callback,
5701
+ dataType: type
5702
+ });
5703
+ },
5704
+
5705
+ getScript: function( url, callback ) {
5706
+ return jQuery.get(url, null, callback, "script");
5707
+ },
5708
+
5709
+ getJSON: function( url, data, callback ) {
5710
+ return jQuery.get(url, data, callback, "json");
5711
+ },
5712
+
5713
+ post: function( url, data, callback, type ) {
5714
+ // shift arguments if data argument was omited
5715
+ if ( jQuery.isFunction( data ) ) {
5716
+ type = type || callback;
5717
+ callback = data;
5718
+ data = {};
5719
+ }
5720
+
5721
+ return jQuery.ajax({
5722
+ type: "POST",
5723
+ url: url,
5724
+ data: data,
5725
+ success: callback,
5726
+ dataType: type
5727
+ });
5728
+ },
5729
+
5730
+ ajaxSetup: function( settings ) {
5731
+ jQuery.extend( jQuery.ajaxSettings, settings );
5732
+ },
5733
+
5734
+ ajaxSettings: {
5735
+ url: location.href,
5736
+ global: true,
5737
+ type: "GET",
5738
+ contentType: "application/x-www-form-urlencoded",
5739
+ processData: true,
5740
+ async: true,
5741
+ /*
5742
+ timeout: 0,
5743
+ data: null,
5744
+ username: null,
5745
+ password: null,
5746
+ traditional: false,
5747
+ */
5748
+ // This function can be overriden by calling jQuery.ajaxSetup
5749
+ xhr: function() {
5750
+ return new window.XMLHttpRequest();
5751
+ },
5752
+ accepts: {
5753
+ xml: "application/xml, text/xml",
5754
+ html: "text/html",
5755
+ script: "text/javascript, application/javascript",
5756
+ json: "application/json, text/javascript",
5757
+ text: "text/plain",
5758
+ _default: "*/*"
5759
+ }
5760
+ },
5761
+
5762
+ ajax: function( origSettings ) {
5763
+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
5764
+ jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
5765
+
5766
+ s.url = s.url.replace( rhash, "" );
5767
+
5768
+ // Use original (not extended) context object if it was provided
5769
+ s.context = origSettings && origSettings.context != null ? origSettings.context : s;
5770
+
5771
+ // convert data if not already a string
5772
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
5773
+ s.data = jQuery.param( s.data, s.traditional );
5774
+ }
5775
+
5776
+ // Handle JSONP Parameter Callbacks
5777
+ if ( s.dataType === "jsonp" ) {
5778
+ if ( type === "GET" ) {
5779
+ if ( !jsre.test( s.url ) ) {
5780
+ s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
5781
+ }
5782
+ } else if ( !s.data || !jsre.test(s.data) ) {
5783
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
5784
+ }
5785
+ s.dataType = "json";
5786
+ }
5787
+
5788
+ // Build temporary JSONP function
5789
+ if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
5790
+ jsonp = s.jsonpCallback || ("jsonp" + jsc++);
5791
+
5792
+ // Replace the =? sequence both in the query string and the data
5793
+ if ( s.data ) {
5794
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
5795
+ }
5796
+
5797
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
5798
+
5799
+ // We need to make sure
5800
+ // that a JSONP style response is executed properly
5801
+ s.dataType = "script";
5802
+
5803
+ // Handle JSONP-style loading
5804
+ var customJsonp = window[ jsonp ];
5805
+
5806
+ window[ jsonp ] = function( tmp ) {
5807
+ if ( jQuery.isFunction( customJsonp ) ) {
5808
+ customJsonp( tmp );
5809
+
5810
+ } else {
5811
+ // Garbage collect
5812
+ window[ jsonp ] = undefined;
5813
+
5814
+ try {
5815
+ delete window[ jsonp ];
5816
+ } catch( jsonpError ) {}
5817
+ }
5818
+
5819
+ data = tmp;
5820
+ jQuery.handleSuccess( s, xhr, status, data );
5821
+ jQuery.handleComplete( s, xhr, status, data );
5822
+
5823
+ if ( head ) {
5824
+ head.removeChild( script );
5825
+ }
5826
+ };
5827
+ }
5828
+
5829
+ if ( s.dataType === "script" && s.cache === null ) {
5830
+ s.cache = false;
5831
+ }
5832
+
5833
+ if ( s.cache === false && noContent ) {
5834
+ var ts = jQuery.now();
5835
+
5836
+ // try replacing _= if it is there
5837
+ var ret = s.url.replace(rts, "$1_=" + ts);
5838
+
5839
+ // if nothing was replaced, add timestamp to the end
5840
+ s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
5841
+ }
5842
+
5843
+ // If data is available, append data to url for GET/HEAD requests
5844
+ if ( s.data && noContent ) {
5845
+ s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
5846
+ }
5847
+
5848
+ // Watch for a new set of requests
5849
+ if ( s.global && jQuery.active++ === 0 ) {
5850
+ jQuery.event.trigger( "ajaxStart" );
5851
+ }
5852
+
5853
+ // Matches an absolute URL, and saves the domain
5854
+ var parts = rurl.exec( s.url ),
5855
+ remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
5856
+
5857
+ // If we're requesting a remote document
5858
+ // and trying to load JSON or Script with a GET
5859
+ if ( s.dataType === "script" && type === "GET" && remote ) {
5860
+ var head = document.getElementsByTagName("head")[0] || document.documentElement;
5861
+ var script = document.createElement("script");
5862
+ if ( s.scriptCharset ) {
5863
+ script.charset = s.scriptCharset;
5864
+ }
5865
+ script.src = s.url;
5866
+
5867
+ // Handle Script loading
5868
+ if ( !jsonp ) {
5869
+ var done = false;
5870
+
5871
+ // Attach handlers for all browsers
5872
+ script.onload = script.onreadystatechange = function() {
5873
+ if ( !done && (!this.readyState ||
5874
+ this.readyState === "loaded" || this.readyState === "complete") ) {
5875
+ done = true;
5876
+ jQuery.handleSuccess( s, xhr, status, data );
5877
+ jQuery.handleComplete( s, xhr, status, data );
5878
+
5879
+ // Handle memory leak in IE
5880
+ script.onload = script.onreadystatechange = null;
5881
+ if ( head && script.parentNode ) {
5882
+ head.removeChild( script );
5883
+ }
5884
+ }
5885
+ };
5886
+ }
5887
+
5888
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
5889
+ // This arises when a base node is used (#2709 and #4378).
5890
+ head.insertBefore( script, head.firstChild );
5891
+
5892
+ // We handle everything using the script element injection
5893
+ return undefined;
5894
+ }
5895
+
5896
+ var requestDone = false;
5897
+
5898
+ // Create the request object
5899
+ var xhr = s.xhr();
5900
+
5901
+ if ( !xhr ) {
5902
+ return;
5903
+ }
5904
+
5905
+ // Open the socket
5906
+ // Passing null username, generates a login popup on Opera (#2865)
5907
+ if ( s.username ) {
5908
+ xhr.open(type, s.url, s.async, s.username, s.password);
5909
+ } else {
5910
+ xhr.open(type, s.url, s.async);
5911
+ }
5912
+
5913
+ // Need an extra try/catch for cross domain requests in Firefox 3
5914
+ try {
5915
+ // Set content-type if data specified and content-body is valid for this type
5916
+ if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
5917
+ xhr.setRequestHeader("Content-Type", s.contentType);
5918
+ }
5919
+
5920
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
5921
+ if ( s.ifModified ) {
5922
+ if ( jQuery.lastModified[s.url] ) {
5923
+ xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
5924
+ }
5925
+
5926
+ if ( jQuery.etag[s.url] ) {
5927
+ xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
5928
+ }
5929
+ }
5930
+
5931
+ // Set header so the called script knows that it's an XMLHttpRequest
5932
+ // Only send the header if it's not a remote XHR
5933
+ if ( !remote ) {
5934
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
5935
+ }
5936
+
5937
+ // Set the Accepts header for the server, depending on the dataType
5938
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
5939
+ s.accepts[ s.dataType ] + ", */*; q=0.01" :
5940
+ s.accepts._default );
5941
+ } catch( headerError ) {}
5942
+
5943
+ // Allow custom headers/mimetypes and early abort
5944
+ if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
5945
+ // Handle the global AJAX counter
5946
+ if ( s.global && jQuery.active-- === 1 ) {
5947
+ jQuery.event.trigger( "ajaxStop" );
5948
+ }
5949
+
5950
+ // close opended socket
5951
+ xhr.abort();
5952
+ return false;
5953
+ }
5954
+
5955
+ if ( s.global ) {
5956
+ jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
5957
+ }
5958
+
5959
+ // Wait for a response to come back
5960
+ var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
5961
+ // The request was aborted
5962
+ if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
5963
+ // Opera doesn't call onreadystatechange before this point
5964
+ // so we simulate the call
5965
+ if ( !requestDone ) {
5966
+ jQuery.handleComplete( s, xhr, status, data );
5967
+ }
5968
+
5969
+ requestDone = true;
5970
+ if ( xhr ) {
5971
+ xhr.onreadystatechange = jQuery.noop;
5972
+ }
5973
+
5974
+ // The transfer is complete and the data is available, or the request timed out
5975
+ } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
5976
+ requestDone = true;
5977
+ xhr.onreadystatechange = jQuery.noop;
5978
+
5979
+ status = isTimeout === "timeout" ?
5980
+ "timeout" :
5981
+ !jQuery.httpSuccess( xhr ) ?
5982
+ "error" :
5983
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
5984
+ "notmodified" :
5985
+ "success";
5986
+
5987
+ var errMsg;
5988
+
5989
+ if ( status === "success" ) {
5990
+ // Watch for, and catch, XML document parse errors
5991
+ try {
5992
+ // process the data (runs the xml through httpData regardless of callback)
5993
+ data = jQuery.httpData( xhr, s.dataType, s );
5994
+ } catch( parserError ) {
5995
+ status = "parsererror";
5996
+ errMsg = parserError;
5997
+ }
5998
+ }
5999
+
6000
+ // Make sure that the request was successful or notmodified
6001
+ if ( status === "success" || status === "notmodified" ) {
6002
+ // JSONP handles its own success callback
6003
+ if ( !jsonp ) {
6004
+ jQuery.handleSuccess( s, xhr, status, data );
6005
+ }
6006
+ } else {
6007
+ jQuery.handleError( s, xhr, status, errMsg );
6008
+ }
6009
+
6010
+ // Fire the complete handlers
6011
+ if ( !jsonp ) {
6012
+ jQuery.handleComplete( s, xhr, status, data );
6013
+ }
6014
+
6015
+ if ( isTimeout === "timeout" ) {
6016
+ xhr.abort();
6017
+ }
6018
+
6019
+ // Stop memory leaks
6020
+ if ( s.async ) {
6021
+ xhr = null;
6022
+ }
6023
+ }
6024
+ };
6025
+
6026
+ // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
6027
+ // Opera doesn't fire onreadystatechange at all on abort
6028
+ try {
6029
+ var oldAbort = xhr.abort;
6030
+ xhr.abort = function() {
6031
+ if ( xhr ) {
6032
+ // oldAbort has no call property in IE7 so
6033
+ // just do it this way, which works in all
6034
+ // browsers
6035
+ Function.prototype.call.call( oldAbort, xhr );
6036
+ }
6037
+
6038
+ onreadystatechange( "abort" );
6039
+ };
6040
+ } catch( abortError ) {}
6041
+
6042
+ // Timeout checker
6043
+ if ( s.async && s.timeout > 0 ) {
6044
+ setTimeout(function() {
6045
+ // Check to see if the request is still happening
6046
+ if ( xhr && !requestDone ) {
6047
+ onreadystatechange( "timeout" );
6048
+ }
6049
+ }, s.timeout);
6050
+ }
6051
+
6052
+ // Send the data
6053
+ try {
6054
+ xhr.send( noContent || s.data == null ? null : s.data );
6055
+
6056
+ } catch( sendError ) {
6057
+ jQuery.handleError( s, xhr, null, sendError );
6058
+
6059
+ // Fire the complete handlers
6060
+ jQuery.handleComplete( s, xhr, status, data );
6061
+ }
6062
+
6063
+ // firefox 1.5 doesn't fire statechange for sync requests
6064
+ if ( !s.async ) {
6065
+ onreadystatechange();
6066
+ }
6067
+
6068
+ // return XMLHttpRequest to allow aborting the request etc.
6069
+ return xhr;
6070
+ },
6071
+
6072
+ // Serialize an array of form elements or a set of
6073
+ // key/values into a query string
6074
+ param: function( a, traditional ) {
6075
+ var s = [],
6076
+ add = function( key, value ) {
6077
+ // If value is a function, invoke it and return its value
6078
+ value = jQuery.isFunction(value) ? value() : value;
6079
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
6080
+ };
6081
+
6082
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
6083
+ if ( traditional === undefined ) {
6084
+ traditional = jQuery.ajaxSettings.traditional;
6085
+ }
6086
+
6087
+ // If an array was passed in, assume that it is an array of form elements.
6088
+ if ( jQuery.isArray(a) || a.jquery ) {
6089
+ // Serialize the form elements
6090
+ jQuery.each( a, function() {
6091
+ add( this.name, this.value );
6092
+ });
6093
+
6094
+ } else {
6095
+ // If traditional, encode the "old" way (the way 1.3.2 or older
6096
+ // did it), otherwise encode params recursively.
6097
+ for ( var prefix in a ) {
6098
+ buildParams( prefix, a[prefix], traditional, add );
6099
+ }
6100
+ }
6101
+
6102
+ // Return the resulting serialization
6103
+ return s.join("&").replace(r20, "+");
6104
+ }
6105
+ });
6106
+
6107
+ function buildParams( prefix, obj, traditional, add ) {
6108
+ if ( jQuery.isArray(obj) && obj.length ) {
6109
+ // Serialize array item.
6110
+ jQuery.each( obj, function( i, v ) {
6111
+ if ( traditional || rbracket.test( prefix ) ) {
6112
+ // Treat each array item as a scalar.
6113
+ add( prefix, v );
6114
+
6115
+ } else {
6116
+ // If array item is non-scalar (array or object), encode its
6117
+ // numeric index to resolve deserialization ambiguity issues.
6118
+ // Note that rack (as of 1.0.0) can't currently deserialize
6119
+ // nested arrays properly, and attempting to do so may cause
6120
+ // a server error. Possible fixes are to modify rack's
6121
+ // deserialization algorithm or to provide an option or flag
6122
+ // to force array serialization to be shallow.
6123
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
6124
+ }
6125
+ });
6126
+
6127
+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
6128
+ if ( jQuery.isEmptyObject( obj ) ) {
6129
+ add( prefix, "" );
6130
+
6131
+ // Serialize object item.
6132
+ } else {
6133
+ jQuery.each( obj, function( k, v ) {
6134
+ buildParams( prefix + "[" + k + "]", v, traditional, add );
6135
+ });
6136
+ }
6137
+
6138
+ } else {
6139
+ // Serialize scalar item.
6140
+ add( prefix, obj );
6141
+ }
6142
+ }
6143
+
6144
+ // This is still on the jQuery object... for now
6145
+ // Want to move this to jQuery.ajax some day
6146
+ jQuery.extend({
6147
+
6148
+ // Counter for holding the number of active queries
6149
+ active: 0,
6150
+
6151
+ // Last-Modified header cache for next request
6152
+ lastModified: {},
6153
+ etag: {},
6154
+
6155
+ handleError: function( s, xhr, status, e ) {
6156
+ // If a local callback was specified, fire it
6157
+ if ( s.error ) {
6158
+ s.error.call( s.context, xhr, status, e );
6159
+ }
6160
+
6161
+ // Fire the global callback
6162
+ if ( s.global ) {
6163
+ jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
6164
+ }
6165
+ },
6166
+
6167
+ handleSuccess: function( s, xhr, status, data ) {
6168
+ // If a local callback was specified, fire it and pass it the data
6169
+ if ( s.success ) {
6170
+ s.success.call( s.context, data, status, xhr );
6171
+ }
6172
+
6173
+ // Fire the global callback
6174
+ if ( s.global ) {
6175
+ jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
6176
+ }
6177
+ },
6178
+
6179
+ handleComplete: function( s, xhr, status ) {
6180
+ // Process result
6181
+ if ( s.complete ) {
6182
+ s.complete.call( s.context, xhr, status );
6183
+ }
6184
+
6185
+ // The request was completed
6186
+ if ( s.global ) {
6187
+ jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
6188
+ }
6189
+
6190
+ // Handle the global AJAX counter
6191
+ if ( s.global && jQuery.active-- === 1 ) {
6192
+ jQuery.event.trigger( "ajaxStop" );
6193
+ }
6194
+ },
6195
+
6196
+ triggerGlobal: function( s, type, args ) {
6197
+ (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
6198
+ },
6199
+
6200
+ // Determines if an XMLHttpRequest was successful or not
6201
+ httpSuccess: function( xhr ) {
6202
+ try {
6203
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
6204
+ return !xhr.status && location.protocol === "file:" ||
6205
+ xhr.status >= 200 && xhr.status < 300 ||
6206
+ xhr.status === 304 || xhr.status === 1223;
6207
+ } catch(e) {}
6208
+
6209
+ return false;
6210
+ },
6211
+
6212
+ // Determines if an XMLHttpRequest returns NotModified
6213
+ httpNotModified: function( xhr, url ) {
6214
+ var lastModified = xhr.getResponseHeader("Last-Modified"),
6215
+ etag = xhr.getResponseHeader("Etag");
6216
+
6217
+ if ( lastModified ) {
6218
+ jQuery.lastModified[url] = lastModified;
6219
+ }
6220
+
6221
+ if ( etag ) {
6222
+ jQuery.etag[url] = etag;
6223
+ }
6224
+
6225
+ return xhr.status === 304;
6226
+ },
6227
+
6228
+ httpData: function( xhr, type, s ) {
6229
+ var ct = xhr.getResponseHeader("content-type") || "",
6230
+ xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
6231
+ data = xml ? xhr.responseXML : xhr.responseText;
6232
+
6233
+ if ( xml && data.documentElement.nodeName === "parsererror" ) {
6234
+ jQuery.error( "parsererror" );
6235
+ }
6236
+
6237
+ // Allow a pre-filtering function to sanitize the response
6238
+ // s is checked to keep backwards compatibility
6239
+ if ( s && s.dataFilter ) {
6240
+ data = s.dataFilter( data, type );
6241
+ }
6242
+
6243
+ // The filter can actually parse the response
6244
+ if ( typeof data === "string" ) {
6245
+ // Get the JavaScript object, if JSON is used.
6246
+ if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
6247
+ data = jQuery.parseJSON( data );
6248
+
6249
+ // If the type is "script", eval it in global context
6250
+ } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
6251
+ jQuery.globalEval( data );
6252
+ }
6253
+ }
6254
+
6255
+ return data;
6256
+ }
6257
+
6258
+ });
6259
+
6260
+ /*
6261
+ * Create the request object; Microsoft failed to properly
6262
+ * implement the XMLHttpRequest in IE7 (can't request local files),
6263
+ * so we use the ActiveXObject when it is available
6264
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
6265
+ * we need a fallback.
6266
+ */
6267
+ if ( window.ActiveXObject ) {
6268
+ jQuery.ajaxSettings.xhr = function() {
6269
+ if ( window.location.protocol !== "file:" ) {
6270
+ try {
6271
+ return new window.XMLHttpRequest();
6272
+ } catch(xhrError) {}
6273
+ }
6274
+
6275
+ try {
6276
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
6277
+ } catch(activeError) {}
6278
+ };
6279
+ }
6280
+
6281
+ // Does this browser support XHR requests?
6282
+ jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
6283
+
6284
+
6285
+
6286
+
6287
+ var elemdisplay = {},
6288
+ rfxtypes = /^(?:toggle|show|hide)$/,
6289
+ rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
6290
+ timerId,
6291
+ fxAttrs = [
6292
+ // height animations
6293
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
6294
+ // width animations
6295
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
6296
+ // opacity animations
6297
+ [ "opacity" ]
6298
+ ];
6299
+
6300
+ jQuery.fn.extend({
6301
+ show: function( speed, easing, callback ) {
6302
+ var elem, display;
6303
+
6304
+ if ( speed || speed === 0 ) {
6305
+ return this.animate( genFx("show", 3), speed, easing, callback);
6306
+
6307
+ } else {
6308
+ for ( var i = 0, j = this.length; i < j; i++ ) {
6309
+ elem = this[i];
6310
+ display = elem.style.display;
6311
+
6312
+ // Reset the inline display of this element to learn if it is
6313
+ // being hidden by cascaded rules or not
6314
+ if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
6315
+ display = elem.style.display = "";
6316
+ }
6317
+
6318
+ // Set elements which have been overridden with display: none
6319
+ // in a stylesheet to whatever the default browser style is
6320
+ // for such an element
6321
+ if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
6322
+ jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
6323
+ }
6324
+ }
6325
+
6326
+ // Set the display of most of the elements in a second loop
6327
+ // to avoid the constant reflow
6328
+ for ( i = 0; i < j; i++ ) {
6329
+ elem = this[i];
6330
+ display = elem.style.display;
6331
+
6332
+ if ( display === "" || display === "none" ) {
6333
+ elem.style.display = jQuery.data(elem, "olddisplay") || "";
6334
+ }
6335
+ }
6336
+
6337
+ return this;
6338
+ }
6339
+ },
6340
+
6341
+ hide: function( speed, easing, callback ) {
6342
+ if ( speed || speed === 0 ) {
6343
+ return this.animate( genFx("hide", 3), speed, easing, callback);
6344
+
6345
+ } else {
6346
+ for ( var i = 0, j = this.length; i < j; i++ ) {
6347
+ var display = jQuery.css( this[i], "display" );
6348
+
6349
+ if ( display !== "none" ) {
6350
+ jQuery.data( this[i], "olddisplay", display );
6351
+ }
6352
+ }
6353
+
6354
+ // Set the display of the elements in a second loop
6355
+ // to avoid the constant reflow
6356
+ for ( i = 0; i < j; i++ ) {
6357
+ this[i].style.display = "none";
6358
+ }
6359
+
6360
+ return this;
6361
+ }
6362
+ },
6363
+
6364
+ // Save the old toggle function
6365
+ _toggle: jQuery.fn.toggle,
6366
+
6367
+ toggle: function( fn, fn2, callback ) {
6368
+ var bool = typeof fn === "boolean";
6369
+
6370
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
6371
+ this._toggle.apply( this, arguments );
6372
+
6373
+ } else if ( fn == null || bool ) {
6374
+ this.each(function() {
6375
+ var state = bool ? fn : jQuery(this).is(":hidden");
6376
+ jQuery(this)[ state ? "show" : "hide" ]();
6377
+ });
6378
+
6379
+ } else {
6380
+ this.animate(genFx("toggle", 3), fn, fn2, callback);
6381
+ }
6382
+
6383
+ return this;
6384
+ },
6385
+
6386
+ fadeTo: function( speed, to, easing, callback ) {
6387
+ return this.filter(":hidden").css("opacity", 0).show().end()
6388
+ .animate({opacity: to}, speed, easing, callback);
6389
+ },
6390
+
6391
+ animate: function( prop, speed, easing, callback ) {
6392
+ var optall = jQuery.speed(speed, easing, callback);
6393
+
6394
+ if ( jQuery.isEmptyObject( prop ) ) {
6395
+ return this.each( optall.complete );
6396
+ }
6397
+
6398
+ return this[ optall.queue === false ? "each" : "queue" ](function() {
6399
+ // XXX 'this' does not always have a nodeName when running the
6400
+ // test suite
6401
+
6402
+ var opt = jQuery.extend({}, optall), p,
6403
+ isElement = this.nodeType === 1,
6404
+ hidden = isElement && jQuery(this).is(":hidden"),
6405
+ self = this;
6406
+
6407
+ for ( p in prop ) {
6408
+ var name = jQuery.camelCase( p );
6409
+
6410
+ if ( p !== name ) {
6411
+ prop[ name ] = prop[ p ];
6412
+ delete prop[ p ];
6413
+ p = name;
6414
+ }
6415
+
6416
+ if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
6417
+ return opt.complete.call(this);
6418
+ }
6419
+
6420
+ if ( isElement && ( p === "height" || p === "width" ) ) {
6421
+ // Make sure that nothing sneaks out
6422
+ // Record all 3 overflow attributes because IE does not
6423
+ // change the overflow attribute when overflowX and
6424
+ // overflowY are set to the same value
6425
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
6426
+
6427
+ // Set display property to inline-block for height/width
6428
+ // animations on inline elements that are having width/height
6429
+ // animated
6430
+ if ( jQuery.css( this, "display" ) === "inline" &&
6431
+ jQuery.css( this, "float" ) === "none" ) {
6432
+ if ( !jQuery.support.inlineBlockNeedsLayout ) {
6433
+ this.style.display = "inline-block";
6434
+
6435
+ } else {
6436
+ var display = defaultDisplay(this.nodeName);
6437
+
6438
+ // inline-level elements accept inline-block;
6439
+ // block-level elements need to be inline with layout
6440
+ if ( display === "inline" ) {
6441
+ this.style.display = "inline-block";
6442
+
6443
+ } else {
6444
+ this.style.display = "inline";
6445
+ this.style.zoom = 1;
6446
+ }
6447
+ }
6448
+ }
6449
+ }
6450
+
6451
+ if ( jQuery.isArray( prop[p] ) ) {
6452
+ // Create (if needed) and add to specialEasing
6453
+ (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
6454
+ prop[p] = prop[p][0];
6455
+ }
6456
+ }
6457
+
6458
+ if ( opt.overflow != null ) {
6459
+ this.style.overflow = "hidden";
6460
+ }
6461
+
6462
+ opt.curAnim = jQuery.extend({}, prop);
6463
+
6464
+ jQuery.each( prop, function( name, val ) {
6465
+ var e = new jQuery.fx( self, opt, name );
6466
+
6467
+ if ( rfxtypes.test(val) ) {
6468
+ e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
6469
+
6470
+ } else {
6471
+ var parts = rfxnum.exec(val),
6472
+ start = e.cur() || 0;
6473
+
6474
+ if ( parts ) {
6475
+ var end = parseFloat( parts[2] ),
6476
+ unit = parts[3] || "px";
6477
+
6478
+ // We need to compute starting value
6479
+ if ( unit !== "px" ) {
6480
+ jQuery.style( self, name, (end || 1) + unit);
6481
+ start = ((end || 1) / e.cur()) * start;
6482
+ jQuery.style( self, name, start + unit);
6483
+ }
6484
+
6485
+ // If a +=/-= token was provided, we're doing a relative animation
6486
+ if ( parts[1] ) {
6487
+ end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
6488
+ }
6489
+
6490
+ e.custom( start, end, unit );
6491
+
6492
+ } else {
6493
+ e.custom( start, val, "" );
6494
+ }
6495
+ }
6496
+ });
6497
+
6498
+ // For JS strict compliance
6499
+ return true;
6500
+ });
6501
+ },
6502
+
6503
+ stop: function( clearQueue, gotoEnd ) {
6504
+ var timers = jQuery.timers;
6505
+
6506
+ if ( clearQueue ) {
6507
+ this.queue([]);
6508
+ }
6509
+
6510
+ this.each(function() {
6511
+ // go in reverse order so anything added to the queue during the loop is ignored
6512
+ for ( var i = timers.length - 1; i >= 0; i-- ) {
6513
+ if ( timers[i].elem === this ) {
6514
+ if (gotoEnd) {
6515
+ // force the next step to be the last
6516
+ timers[i](true);
6517
+ }
6518
+
6519
+ timers.splice(i, 1);
6520
+ }
6521
+ }
6522
+ });
6523
+
6524
+ // start the next in the queue if the last step wasn't forced
6525
+ if ( !gotoEnd ) {
6526
+ this.dequeue();
6527
+ }
6528
+
6529
+ return this;
6530
+ }
6531
+
6532
+ });
6533
+
6534
+ function genFx( type, num ) {
6535
+ var obj = {};
6536
+
6537
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
6538
+ obj[ this ] = type;
6539
+ });
6540
+
6541
+ return obj;
6542
+ }
6543
+
6544
+ // Generate shortcuts for custom animations
6545
+ jQuery.each({
6546
+ slideDown: genFx("show", 1),
6547
+ slideUp: genFx("hide", 1),
6548
+ slideToggle: genFx("toggle", 1),
6549
+ fadeIn: { opacity: "show" },
6550
+ fadeOut: { opacity: "hide" },
6551
+ fadeToggle: { opacity: "toggle" }
6552
+ }, function( name, props ) {
6553
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
6554
+ return this.animate( props, speed, easing, callback );
6555
+ };
6556
+ });
6557
+
6558
+ jQuery.extend({
6559
+ speed: function( speed, easing, fn ) {
6560
+ var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
6561
+ complete: fn || !fn && easing ||
6562
+ jQuery.isFunction( speed ) && speed,
6563
+ duration: speed,
6564
+ easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
6565
+ };
6566
+
6567
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
6568
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
6569
+
6570
+ // Queueing
6571
+ opt.old = opt.complete;
6572
+ opt.complete = function() {
6573
+ if ( opt.queue !== false ) {
6574
+ jQuery(this).dequeue();
6575
+ }
6576
+ if ( jQuery.isFunction( opt.old ) ) {
6577
+ opt.old.call( this );
6578
+ }
6579
+ };
6580
+
6581
+ return opt;
6582
+ },
6583
+
6584
+ easing: {
6585
+ linear: function( p, n, firstNum, diff ) {
6586
+ return firstNum + diff * p;
6587
+ },
6588
+ swing: function( p, n, firstNum, diff ) {
6589
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
6590
+ }
6591
+ },
6592
+
6593
+ timers: [],
6594
+
6595
+ fx: function( elem, options, prop ) {
6596
+ this.options = options;
6597
+ this.elem = elem;
6598
+ this.prop = prop;
6599
+
6600
+ if ( !options.orig ) {
6601
+ options.orig = {};
6602
+ }
6603
+ }
6604
+
6605
+ });
6606
+
6607
+ jQuery.fx.prototype = {
6608
+ // Simple function for setting a style value
6609
+ update: function() {
6610
+ if ( this.options.step ) {
6611
+ this.options.step.call( this.elem, this.now, this );
6612
+ }
6613
+
6614
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
6615
+ },
6616
+
6617
+ // Get the current size
6618
+ cur: function() {
6619
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
6620
+ return this.elem[ this.prop ];
6621
+ }
6622
+
6623
+ var r = parseFloat( jQuery.css( this.elem, this.prop ) );
6624
+ return r && r > -10000 ? r : 0;
6625
+ },
6626
+
6627
+ // Start an animation from one number to another
6628
+ custom: function( from, to, unit ) {
6629
+ var self = this,
6630
+ fx = jQuery.fx;
6631
+
6632
+ this.startTime = jQuery.now();
6633
+ this.start = from;
6634
+ this.end = to;
6635
+ this.unit = unit || this.unit || "px";
6636
+ this.now = this.start;
6637
+ this.pos = this.state = 0;
6638
+
6639
+ function t( gotoEnd ) {
6640
+ return self.step(gotoEnd);
6641
+ }
6642
+
6643
+ t.elem = this.elem;
6644
+
6645
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
6646
+ timerId = setInterval(fx.tick, fx.interval);
6647
+ }
6648
+ },
6649
+
6650
+ // Simple 'show' function
6651
+ show: function() {
6652
+ // Remember where we started, so that we can go back to it later
6653
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
6654
+ this.options.show = true;
6655
+
6656
+ // Begin the animation
6657
+ // Make sure that we start at a small width/height to avoid any
6658
+ // flash of content
6659
+ this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
6660
+
6661
+ // Start by showing the element
6662
+ jQuery( this.elem ).show();
6663
+ },
6664
+
6665
+ // Simple 'hide' function
6666
+ hide: function() {
6667
+ // Remember where we started, so that we can go back to it later
6668
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
6669
+ this.options.hide = true;
6670
+
6671
+ // Begin the animation
6672
+ this.custom(this.cur(), 0);
6673
+ },
6674
+
6675
+ // Each step of an animation
6676
+ step: function( gotoEnd ) {
6677
+ var t = jQuery.now(), done = true;
6678
+
6679
+ if ( gotoEnd || t >= this.options.duration + this.startTime ) {
6680
+ this.now = this.end;
6681
+ this.pos = this.state = 1;
6682
+ this.update();
6683
+
6684
+ this.options.curAnim[ this.prop ] = true;
6685
+
6686
+ for ( var i in this.options.curAnim ) {
6687
+ if ( this.options.curAnim[i] !== true ) {
6688
+ done = false;
6689
+ }
6690
+ }
6691
+
6692
+ if ( done ) {
6693
+ // Reset the overflow
6694
+ if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
6695
+ var elem = this.elem,
6696
+ options = this.options;
6697
+
6698
+ jQuery.each( [ "", "X", "Y" ], function (index, value) {
6699
+ elem.style[ "overflow" + value ] = options.overflow[index];
6700
+ } );
6701
+ }
6702
+
6703
+ // Hide the element if the "hide" operation was done
6704
+ if ( this.options.hide ) {
6705
+ jQuery(this.elem).hide();
6706
+ }
6707
+
6708
+ // Reset the properties, if the item has been hidden or shown
6709
+ if ( this.options.hide || this.options.show ) {
6710
+ for ( var p in this.options.curAnim ) {
6711
+ jQuery.style( this.elem, p, this.options.orig[p] );
6712
+ }
6713
+ }
6714
+
6715
+ // Execute the complete function
6716
+ this.options.complete.call( this.elem );
6717
+ }
6718
+
6719
+ return false;
6720
+
6721
+ } else {
6722
+ var n = t - this.startTime;
6723
+ this.state = n / this.options.duration;
6724
+
6725
+ // Perform the easing function, defaults to swing
6726
+ var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
6727
+ var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
6728
+ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
6729
+ this.now = this.start + ((this.end - this.start) * this.pos);
6730
+
6731
+ // Perform the next step of the animation
6732
+ this.update();
6733
+ }
6734
+
6735
+ return true;
6736
+ }
6737
+ };
6738
+
6739
+ jQuery.extend( jQuery.fx, {
6740
+ tick: function() {
6741
+ var timers = jQuery.timers;
6742
+
6743
+ for ( var i = 0; i < timers.length; i++ ) {
6744
+ if ( !timers[i]() ) {
6745
+ timers.splice(i--, 1);
6746
+ }
6747
+ }
6748
+
6749
+ if ( !timers.length ) {
6750
+ jQuery.fx.stop();
6751
+ }
6752
+ },
6753
+
6754
+ interval: 13,
6755
+
6756
+ stop: function() {
6757
+ clearInterval( timerId );
6758
+ timerId = null;
6759
+ },
6760
+
6761
+ speeds: {
6762
+ slow: 600,
6763
+ fast: 200,
6764
+ // Default speed
6765
+ _default: 400
6766
+ },
6767
+
6768
+ step: {
6769
+ opacity: function( fx ) {
6770
+ jQuery.style( fx.elem, "opacity", fx.now );
6771
+ },
6772
+
6773
+ _default: function( fx ) {
6774
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
6775
+ fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
6776
+ } else {
6777
+ fx.elem[ fx.prop ] = fx.now;
6778
+ }
6779
+ }
6780
+ }
6781
+ });
6782
+
6783
+ if ( jQuery.expr && jQuery.expr.filters ) {
6784
+ jQuery.expr.filters.animated = function( elem ) {
6785
+ return jQuery.grep(jQuery.timers, function( fn ) {
6786
+ return elem === fn.elem;
6787
+ }).length;
6788
+ };
6789
+ }
6790
+
6791
+ function defaultDisplay( nodeName ) {
6792
+ if ( !elemdisplay[ nodeName ] ) {
6793
+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
6794
+ display = elem.css("display");
6795
+
6796
+ elem.remove();
6797
+
6798
+ if ( display === "none" || display === "" ) {
6799
+ display = "block";
6800
+ }
6801
+
6802
+ elemdisplay[ nodeName ] = display;
6803
+ }
6804
+
6805
+ return elemdisplay[ nodeName ];
6806
+ }
6807
+
6808
+
6809
+
6810
+
6811
+ var rtable = /^t(?:able|d|h)$/i,
6812
+ rroot = /^(?:body|html)$/i;
6813
+
6814
+ if ( "getBoundingClientRect" in document.documentElement ) {
6815
+ jQuery.fn.offset = function( options ) {
6816
+ var elem = this[0], box;
6817
+
6818
+ if ( options ) {
6819
+ return this.each(function( i ) {
6820
+ jQuery.offset.setOffset( this, options, i );
6821
+ });
6822
+ }
6823
+
6824
+ if ( !elem || !elem.ownerDocument ) {
6825
+ return null;
6826
+ }
6827
+
6828
+ if ( elem === elem.ownerDocument.body ) {
6829
+ return jQuery.offset.bodyOffset( elem );
6830
+ }
6831
+
6832
+ try {
6833
+ box = elem.getBoundingClientRect();
6834
+ } catch(e) {}
6835
+
6836
+ var doc = elem.ownerDocument,
6837
+ docElem = doc.documentElement;
6838
+
6839
+ // Make sure we're not dealing with a disconnected DOM node
6840
+ if ( !box || !jQuery.contains( docElem, elem ) ) {
6841
+ return box || { top: 0, left: 0 };
6842
+ }
6843
+
6844
+ var body = doc.body,
6845
+ win = getWindow(doc),
6846
+ clientTop = docElem.clientTop || body.clientTop || 0,
6847
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
6848
+ scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
6849
+ scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
6850
+ top = box.top + scrollTop - clientTop,
6851
+ left = box.left + scrollLeft - clientLeft;
6852
+
6853
+ return { top: top, left: left };
6854
+ };
6855
+
6856
+ } else {
6857
+ jQuery.fn.offset = function( options ) {
6858
+ var elem = this[0];
6859
+
6860
+ if ( options ) {
6861
+ return this.each(function( i ) {
6862
+ jQuery.offset.setOffset( this, options, i );
6863
+ });
6864
+ }
6865
+
6866
+ if ( !elem || !elem.ownerDocument ) {
6867
+ return null;
6868
+ }
6869
+
6870
+ if ( elem === elem.ownerDocument.body ) {
6871
+ return jQuery.offset.bodyOffset( elem );
6872
+ }
6873
+
6874
+ jQuery.offset.initialize();
6875
+
6876
+ var computedStyle,
6877
+ offsetParent = elem.offsetParent,
6878
+ prevOffsetParent = elem,
6879
+ doc = elem.ownerDocument,
6880
+ docElem = doc.documentElement,
6881
+ body = doc.body,
6882
+ defaultView = doc.defaultView,
6883
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
6884
+ top = elem.offsetTop,
6885
+ left = elem.offsetLeft;
6886
+
6887
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
6888
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
6889
+ break;
6890
+ }
6891
+
6892
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
6893
+ top -= elem.scrollTop;
6894
+ left -= elem.scrollLeft;
6895
+
6896
+ if ( elem === offsetParent ) {
6897
+ top += elem.offsetTop;
6898
+ left += elem.offsetLeft;
6899
+
6900
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
6901
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
6902
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
6903
+ }
6904
+
6905
+ prevOffsetParent = offsetParent;
6906
+ offsetParent = elem.offsetParent;
6907
+ }
6908
+
6909
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
6910
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
6911
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
6912
+ }
6913
+
6914
+ prevComputedStyle = computedStyle;
6915
+ }
6916
+
6917
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
6918
+ top += body.offsetTop;
6919
+ left += body.offsetLeft;
6920
+ }
6921
+
6922
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
6923
+ top += Math.max( docElem.scrollTop, body.scrollTop );
6924
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );
6925
+ }
6926
+
6927
+ return { top: top, left: left };
6928
+ };
6929
+ }
6930
+
6931
+ jQuery.offset = {
6932
+ initialize: function() {
6933
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
6934
+ html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
6935
+
6936
+ jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
6937
+
6938
+ container.innerHTML = html;
6939
+ body.insertBefore( container, body.firstChild );
6940
+ innerDiv = container.firstChild;
6941
+ checkDiv = innerDiv.firstChild;
6942
+ td = innerDiv.nextSibling.firstChild.firstChild;
6943
+
6944
+ this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
6945
+ this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
6946
+
6947
+ checkDiv.style.position = "fixed";
6948
+ checkDiv.style.top = "20px";
6949
+
6950
+ // safari subtracts parent border width here which is 5px
6951
+ this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
6952
+ checkDiv.style.position = checkDiv.style.top = "";
6953
+
6954
+ innerDiv.style.overflow = "hidden";
6955
+ innerDiv.style.position = "relative";
6956
+
6957
+ this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
6958
+
6959
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
6960
+
6961
+ body.removeChild( container );
6962
+ body = container = innerDiv = checkDiv = table = td = null;
6963
+ jQuery.offset.initialize = jQuery.noop;
6964
+ },
6965
+
6966
+ bodyOffset: function( body ) {
6967
+ var top = body.offsetTop,
6968
+ left = body.offsetLeft;
6969
+
6970
+ jQuery.offset.initialize();
6971
+
6972
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
6973
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
6974
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
6975
+ }
6976
+
6977
+ return { top: top, left: left };
6978
+ },
6979
+
6980
+ setOffset: function( elem, options, i ) {
6981
+ var position = jQuery.css( elem, "position" );
6982
+
6983
+ // set position first, in-case top/left are set even on static elem
6984
+ if ( position === "static" ) {
6985
+ elem.style.position = "relative";
6986
+ }
6987
+
6988
+ var curElem = jQuery( elem ),
6989
+ curOffset = curElem.offset(),
6990
+ curCSSTop = jQuery.css( elem, "top" ),
6991
+ curCSSLeft = jQuery.css( elem, "left" ),
6992
+ calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
6993
+ props = {}, curPosition = {}, curTop, curLeft;
6994
+
6995
+ // need to be able to calculate position if either top or left is auto and position is absolute
6996
+ if ( calculatePosition ) {
6997
+ curPosition = curElem.position();
6998
+ }
6999
+
7000
+ curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
7001
+ curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
7002
+
7003
+ if ( jQuery.isFunction( options ) ) {
7004
+ options = options.call( elem, i, curOffset );
7005
+ }
7006
+
7007
+ if (options.top != null) {
7008
+ props.top = (options.top - curOffset.top) + curTop;
7009
+ }
7010
+ if (options.left != null) {
7011
+ props.left = (options.left - curOffset.left) + curLeft;
7012
+ }
7013
+
7014
+ if ( "using" in options ) {
7015
+ options.using.call( elem, props );
7016
+ } else {
7017
+ curElem.css( props );
7018
+ }
7019
+ }
7020
+ };
7021
+
7022
+
7023
+ jQuery.fn.extend({
7024
+ position: function() {
7025
+ if ( !this[0] ) {
7026
+ return null;
7027
+ }
7028
+
7029
+ var elem = this[0],
7030
+
7031
+ // Get *real* offsetParent
7032
+ offsetParent = this.offsetParent(),
7033
+
7034
+ // Get correct offsets
7035
+ offset = this.offset(),
7036
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
7037
+
7038
+ // Subtract element margins
7039
+ // note: when an element has margin: auto the offsetLeft and marginLeft
7040
+ // are the same in Safari causing offset.left to incorrectly be 0
7041
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
7042
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
7043
+
7044
+ // Add offsetParent borders
7045
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
7046
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
7047
+
7048
+ // Subtract the two offsets
7049
+ return {
7050
+ top: offset.top - parentOffset.top,
7051
+ left: offset.left - parentOffset.left
7052
+ };
7053
+ },
7054
+
7055
+ offsetParent: function() {
7056
+ return this.map(function() {
7057
+ var offsetParent = this.offsetParent || document.body;
7058
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
7059
+ offsetParent = offsetParent.offsetParent;
7060
+ }
7061
+ return offsetParent;
7062
+ });
7063
+ }
7064
+ });
7065
+
7066
+
7067
+ // Create scrollLeft and scrollTop methods
7068
+ jQuery.each( ["Left", "Top"], function( i, name ) {
7069
+ var method = "scroll" + name;
7070
+
7071
+ jQuery.fn[ method ] = function(val) {
7072
+ var elem = this[0], win;
7073
+
7074
+ if ( !elem ) {
7075
+ return null;
7076
+ }
7077
+
7078
+ if ( val !== undefined ) {
7079
+ // Set the scroll offset
7080
+ return this.each(function() {
7081
+ win = getWindow( this );
7082
+
7083
+ if ( win ) {
7084
+ win.scrollTo(
7085
+ !i ? val : jQuery(win).scrollLeft(),
7086
+ i ? val : jQuery(win).scrollTop()
7087
+ );
7088
+
7089
+ } else {
7090
+ this[ method ] = val;
7091
+ }
7092
+ });
7093
+ } else {
7094
+ win = getWindow( elem );
7095
+
7096
+ // Return the scroll offset
7097
+ return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
7098
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
7099
+ win.document.body[ method ] :
7100
+ elem[ method ];
7101
+ }
7102
+ };
7103
+ });
7104
+
7105
+ function getWindow( elem ) {
7106
+ return jQuery.isWindow( elem ) ?
7107
+ elem :
7108
+ elem.nodeType === 9 ?
7109
+ elem.defaultView || elem.parentWindow :
7110
+ false;
7111
+ }
7112
+
7113
+
7114
+
7115
+
7116
+ // Create innerHeight, innerWidth, outerHeight and outerWidth methods
7117
+ jQuery.each([ "Height", "Width" ], function( i, name ) {
7118
+
7119
+ var type = name.toLowerCase();
7120
+
7121
+ // innerHeight and innerWidth
7122
+ jQuery.fn["inner" + name] = function() {
7123
+ return this[0] ?
7124
+ parseFloat( jQuery.css( this[0], type, "padding" ) ) :
7125
+ null;
7126
+ };
7127
+
7128
+ // outerHeight and outerWidth
7129
+ jQuery.fn["outer" + name] = function( margin ) {
7130
+ return this[0] ?
7131
+ parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
7132
+ null;
7133
+ };
7134
+
7135
+ jQuery.fn[ type ] = function( size ) {
7136
+ // Get window width or height
7137
+ var elem = this[0];
7138
+ if ( !elem ) {
7139
+ return size == null ? null : this;
7140
+ }
7141
+
7142
+ if ( jQuery.isFunction( size ) ) {
7143
+ return this.each(function( i ) {
7144
+ var self = jQuery( this );
7145
+ self[ type ]( size.call( this, i, self[ type ]() ) );
7146
+ });
7147
+ }
7148
+
7149
+ if ( jQuery.isWindow( elem ) ) {
7150
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
7151
+ return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
7152
+ elem.document.body[ "client" + name ];
7153
+
7154
+ // Get document width or height
7155
+ } else if ( elem.nodeType === 9 ) {
7156
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
7157
+ return Math.max(
7158
+ elem.documentElement["client" + name],
7159
+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
7160
+ elem.body["offset" + name], elem.documentElement["offset" + name]
7161
+ );
7162
+
7163
+ // Get or set width or height on the element
7164
+ } else if ( size === undefined ) {
7165
+ var orig = jQuery.css( elem, type ),
7166
+ ret = parseFloat( orig );
7167
+
7168
+ return jQuery.isNaN( ret ) ? orig : ret;
7169
+
7170
+ // Set the width or height on the element (default to pixels if value is unitless)
7171
+ } else {
7172
+ return this.css( type, typeof size === "string" ? size : size + "px" );
7173
+ }
7174
+ };
7175
+
7176
+ });
7177
+
7178
+
7179
+ })(window);
7180
+ jQuery.noConflict();
js/jquery/jquery-1.7.1-min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
5
+
6
+ jQuery.noConflict();
package.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>CommerceLab_News</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This &lt;strong&gt;free Magento News Module&lt;/strong&gt; allows you to deploy full-fledged news on your site. In addition, you can create categories, add comments to each news item, add pictures to news and much more. This &lt;strong&gt;Magento News Extension&lt;/strong&gt; truelly has no rivals! Moreover, it can be used as a &lt;strong&gt;Blog&lt;/strong&gt;! Hurry to obtain this free module!</summary>
10
+ <description>&lt;p&gt;&lt;strong&gt;Magento News Extension&lt;/strong&gt; will help you make your store more interactive and will keep your visitors abreast of the latest business updates, developments and achievements. The opportunity to comment on the news, as well as integration with social networks like Google+, Facebook and Twitter adds yet more value to this &lt;strong&gt;News Magento Extension&lt;/strong&gt;. With its help you can learn the opinion of your customers in more details and let your clients popularise the store by sharing info with their friends.&lt;/p&gt;&#xD;
11
+ &lt;br /&gt;&#xD;
12
+ &lt;p&gt;&lt;strong&gt;News Magento Extension Key Features&lt;/strong&gt;:&lt;/p&gt;&#xD;
13
+ &lt;br /&gt;&#xD;
14
+ &lt;ul class="ul-list"&gt;&#xD;
15
+ &lt;li&gt;Create news categories&lt;/li&gt;&#xD;
16
+ &lt;li&gt;Bind each category to a particular store&lt;/li&gt;&#xD;
17
+ &lt;li&gt;Structural separation of news for a short and full description&lt;/li&gt;&#xD;
18
+ &lt;li&gt;Set a period of news publication (Publish From: Date, Hours, and Minutes; Publish until: Date, Hours and Minutes) &lt;/li&gt;&#xD;
19
+ &lt;li&gt;Set data on publishing (date/time/category)&lt;/li&gt;&#xD;
20
+ &lt;li&gt;Add photos for each news article &#x2013; both to the short and full description&lt;/li&gt;&#xD;
21
+ &lt;li&gt;Set META-data for the news (keywords, description)&lt;/li&gt;&#xD;
22
+ &lt;li&gt;Leave comments on the news page&lt;/li&gt;&#xD;
23
+ &lt;li&gt;Set access parameters to leave comments&lt;/li&gt;&#xD;
24
+ &lt;li&gt;The option of approving/blocking comments&lt;/li&gt;&#xD;
25
+ &lt;li&gt;Ajax pager for easy switching between comments&lt;/li&gt;&#xD;
26
+ &lt;li&gt;Integration with social networks: Google+, Facebook, Twitter and LinkedIn&lt;/li&gt;&#xD;
27
+ &lt;li&gt;Print version for every news for easy opportunity to print it out&lt;/li&gt;&#xD;
28
+ &lt;li&gt;RSS-feed for each news category&lt;/li&gt;&#xD;
29
+ &lt;li&gt;Usage of Magento WYSYWIG-editor for simple news editing&lt;/li&gt;&#xD;
30
+ &lt;li&gt;Easy installation&lt;/li&gt;&#xD;
31
+ &lt;li&gt;Open source&lt;/li&gt;&#xD;
32
+ &lt;li&gt;Compatibility with the latest versions of Magento.&lt;/li&gt;&#xD;
33
+ &lt;/ul&gt;&#xD;
34
+ &lt;br /&gt;&#xD;
35
+ &lt;p&gt;&lt;strong&gt;CommerceLab &#x2013; stay open for the world!&lt;/strong&gt;&lt;/p&gt;&#xD;
36
+ &lt;br /&gt;</description>
37
+ <notes>Version number: 1.0&#xD;
38
+ Stability: Stable&#xD;
39
+ Compatibility: 1.4, 1.5, 1.6, 1.7</notes>
40
+ <authors><author><name>CommerceLab</name><user>auto-converted</user><email>support@commerce-lab.com</email></author></authors>
41
+ <date>2012-03-19</date>
42
+ <time>21:43:15</time>
43
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="CommerceLab"><dir name="News"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="67fbb8494a34d12be38c71d733609a52"/></dir><file name="Edit.php" hash="9360ec5d3aa88fe9dde9f37bd5ed0a80"/><file name="Grid.php" hash="1089d2079e4101a57db30d792013ffc5"/></dir><dir name="Comment"><dir name="Edit"><file name="Form.php" hash="a2f1dd1d22665c5a067a3e42700c701a"/></dir><file name="Edit.php" hash="8de5a9f3de068243fbe0c4eddd58a715"/><file name="Grid.php" hash="6d1dfb07e013e864ead53f3ab1574806"/></dir><dir name="News"><dir name="Edit"><dir name="Tab"><file name="Additional.php" hash="5b0ab5180c2c6192f7a0e6c9a566c09d"/><file name="Info.php" hash="c2e91c7a505ee6ede52ef8ad52b4181c"/></dir><file name="Form.php" hash="9f087b81e9d08db22a719b70c8b504ba"/><file name="Tabs.php" hash="7cfa29c9c00b9e26a9114aef3f3a95e1"/></dir><file name="Edit.php" hash="b509c5c33e895f23d56ff19f085a6b02"/><file name="Grid.php" hash="ad878513ff6b5e1569c62488afa53921"/></dir><file name="Category.php" hash="79b3dde6b9fa76ae62213b7d6e2724b7"/><file name="Comment.php" hash="8be4d51b79855f471d28ebb8efa893cc"/><file name="News.php" hash="ebff7860ffe79041ace0badd257548fa"/></dir><file name="News.php" hash="788dca4c24c60863a289602247e694e1"/><file name="Newsitem.php" hash="263e8591eabbfdf226cb111784eaea54"/><file name="Rss.php" hash="8011e243acfd1f2407ad69f271205315"/></dir><dir name="Controller"><file name="Router.php" hash="9defad284f4ba8ae6adbc1d1479fdb02"/></dir><dir name="Helper"><file name="Data.php" hash="3198da62d7486894b1dfbb0a8cc529c0"/><file name="Versions.php" hash="47847c5ebcbb4afff5db50af3c358df5"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="bcd541e130b269eaa7c881998a1e1ec2"/></dir><dir name="Comment"><file name="Collection.php" hash="0a0735a6169c5b39d8d54a67c2bf181c"/></dir><dir name="News"><file name="Collection.php" hash="3a8d6de820d75ce0caca6319b8b7c780"/></dir><file name="Category.php" hash="09487b65a95b3f26924f3362b5dfc32e"/><file name="Comment.php" hash="50cd3b7a8a7b451723d6038fe0f402d3"/><file name="News.php" hash="7d4c3d7ba217fbe82f3b8c94ead8f9ec"/></dir><dir name="Wysiwyg"><file name="Config.php" hash="44527a7977ce854719b845dc37912548"/></dir><file name="Category.php" hash="e3d279a026d1613ecbd7d5a3b1b5f879"/><file name="Check.php" hash="8a48d77b591b6234f23a34d1cb02e2a3"/><file name="Comment.php" hash="e6ca88fe0a7ba12be87cc8b8ea8467ed"/><file name="News.php" hash="98c8bdfc76f61485437a9da60418395c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash="55a5ce77722a8c066348063d2bd7bf8a"/><file name="CommentController.php" hash="bec1545e94875f64582f298ef8de977c"/><file name="NewsController.php" hash="b33e1983da1d98f9d2220403e9fa5fde"/></dir><file name="IndexController.php" hash="a942095b635f345c7d91079d8cc92d75"/><file name="NewsitemController.php" hash="2ad107ffbcfff9f2655784f08195e457"/><file name="RssController.php" hash="53eeaf7b1f992ad4e018fa54cf08044a"/></dir><dir name="etc"><file name="config.xml" hash="4a3cff563130a38bd3dbd7a24a55f8ec"/><file name="system.xml" hash="fc91c1a9c57d8c37fef767e6e60300ca"/></dir><dir name="sql"><dir name="clnews_setup"><file name="mysql4-install-1.0.0.php" hash="59f4d1576540ee5d98b7030ac32d0b3a"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="clnews.xml" hash="c862118dff765ac146aaa5aaebf396da"/></dir><dir name="template"><dir name="clnews"><file name="latest.phtml" hash="c469069d2d68a260fa95adf4b2dc0c92"/><file name="list.phtml" hash="a676fdf8b7c4dfb777022b2694b14fc5"/><file name="menu.phtml" hash="ce181349e797b49232237ac74c36b047"/><file name="news_print.phtml" hash="2805e2d08a368e74bfdbb234b92950f0"/><file name="newsitem.phtml" hash="e81cc946ebad9a70e068fb4300af0e96"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="CommerceLab_News.xml" hash="8da22cde4606bb3f8a30d40c4dbda6ee"/></dir></dir></dir><dir name="js"><dir name="commercelab"><file name="noconflict.js" hash="8b266e71830972f1999c5af5638b5ff2"/></dir><dir name="jquery"><file name="jquery-1.4.4.js" hash="1e2ef16563c5939f247626c6147045aa"/><file name="jquery-1.7.1-min.js" hash="de56dbfca517764d9d056e82068f8d39"/></dir></dir><dir name="skin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="clnews"><dir name="images"><file name="i-tags.gif" hash="d8acce70b98a2c5827ba8bd6ee166d6d"/><file name="i_attached.gif" hash="4e277173b6372b1a90b0f19e0388ad54"/><file name="i_print.gif" hash="0aed138181495642e9ab29e55d194d40"/><file name="rss.gif" hash="d17678b5dab15949ed62bea2b602090f"/></dir><file name="style.css" hash="02684062443683d8310010a2b73d1c92"/></dir><file name="print.css" hash="45381611ef35e150daaff426b3f04020"/></dir><dir name="images"><dir name="clnews"><file name="ajax-loader.gif" hash="7b9776076d5fceef4993b55c9383dedd"/></dir></dir></dir></dir></dir></dir></target></contents>
44
+ <compatible/>
45
+ <dependencies/>
46
+ </package>
skin/frontend/default/default/css/clnews/images/i-tags.gif ADDED
Binary file
skin/frontend/default/default/css/clnews/images/i_attached.gif ADDED
Binary file
skin/frontend/default/default/css/clnews/images/i_print.gif ADDED
Binary file
skin/frontend/default/default/css/clnews/images/rss.gif ADDED
Binary file
skin/frontend/default/default/css/clnews/style.css ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .news-item {
2
+ margin:0 0 15px 0;
3
+ }
4
+
5
+ .news-item span.date {
6
+ font-size:90%;
7
+ }
8
+
9
+ .news-item-comment form {
10
+ margin:20px 0px 0px;
11
+ display:block;
12
+ clear:both;
13
+ }
14
+
15
+ .prev {
16
+ float:left;
17
+ margin:4px 12px 5px 0;
18
+ }
19
+
20
+ .date {
21
+ color:#999999;
22
+ font-size:11px;
23
+ }
24
+
25
+ .clearing {
26
+ clear:both;
27
+ font-size:1px;
28
+ height:1px;
29
+ line-height:1px;
30
+ }
31
+
32
+ .comment-item {
33
+ margin:10px 0 0 0;
34
+ }
35
+
36
+ .comment-item .username {
37
+ font-size:12px;
38
+ margin:0px;
39
+ color:#1E7EC8;
40
+ display:inline;
41
+ }
42
+
43
+ .block.news-categories {
44
+ border: 1px solid #C4C1BC;
45
+ margin: 0 0 15px;
46
+ }
47
+
48
+ .block.news-categories .block-title {
49
+ background: url("../images/bkg_block-title.gif") repeat-x scroll 0 0 transparent;
50
+ border-bottom: 1px solid #DDDDDD;
51
+ padding: 2px 9px;
52
+ }
53
+
54
+ .block.news-categories .menu-categories {
55
+ margin:0px;
56
+ padding: 5px 9px;
57
+ }
58
+
59
+ .block.news-categories .menu-categories h5, .menu-categories ul li{
60
+ font-size:11px;
61
+ margin:0px;
62
+ }
63
+
64
+ .block.news-categories .block-title strong {
65
+ color: #E26703;
66
+ display: block;
67
+ font: bold 12px/16px Arial,Helvetica,sans-serif;
68
+ min-height: 16px;
69
+ padding: 1px 0;
70
+ text-transform: uppercase;
71
+ }
72
+
73
+ .news {
74
+ text-align:justify;
75
+ }
76
+
77
+ h4 {
78
+ color:#e26703;
79
+ font-size:15px;
80
+ }
81
+ .news-item {
82
+ clear:both;
83
+ padding-bottom:20px;
84
+ }
85
+ .news_image {
86
+ float:left;
87
+ margin:3px 10px 5px 0px;
88
+ }
89
+ .news-item .description {
90
+ text-align:justify;
91
+ }
92
+ .news-item .description p {
93
+ display:inline;
94
+ margin:0px;
95
+ }
96
+ .news-item .comment {
97
+ float:right;
98
+ font-size:11px;
99
+ padding-top:5px;
100
+ }
101
+ .social {
102
+ padding-top:10px;
103
+ height:35px;
104
+ }
105
+ .social .google_button {
106
+ float:left;
107
+ width:80px;
108
+ overflow:hidden;
109
+ }
110
+ .social .fb-like {
111
+ float:left;
112
+ }
113
+
114
+ .news-item-comment {
115
+ clear:both;
116
+ padding-bottom:20px;
117
+ }
118
+ .news-item-comment p.required {
119
+ text-align:left;
120
+ }
121
+ .news .loadfile {
122
+ text-align:right;
123
+ }
124
+ .news .loadfile a {
125
+ background: url(images/i_attached.gif) 0px 0px no-repeat;
126
+ padding:1px 0 0 20px;
127
+ }
128
+ #postComment label {
129
+ float:left;
130
+ width:80px;
131
+ }
132
+ #postComment .input-box {
133
+ padding-bottom:9px;
134
+ }
135
+ #postComment input[type="text"] {
136
+ width:200px;
137
+ }
138
+ label .required {
139
+ color:red;
140
+ }
141
+ #postComment .validation-advice {
142
+ margin-left:80px;
143
+ }
144
+ #postComment .button-set {
145
+ padding-left:80px;
146
+ }
147
+
148
+ #comment_block .comment-item div {
149
+ padding-left:40px;
150
+ }
151
+
152
+ /*-- pager --*/
153
+ .news-item-comment .pager {
154
+ background:none;
155
+ margin-top:20px;
156
+ padding-top:10px;
157
+ text-align:left;
158
+ }
159
+ .news-item-comment .pager span {
160
+ cursor:pointer;
161
+ border:1px solid #dadfe0;
162
+ float:left;
163
+ height:19px;
164
+ width:20px;
165
+ text-align:center;
166
+ margin-right:6px;
167
+ line-height:19px;
168
+ }
169
+ .news-item-comment .pager span.current {
170
+ cursor:default;
171
+ background:#f6f6f6;
172
+ }
173
+ .news-item-comment .pager span:hover {
174
+ background:#f6f6f6;
175
+ }
176
+ .news-item-comment .pager #prev,
177
+ .news-item-comment .pager #next {
178
+ border:none !important;
179
+ background:none !important;
180
+ padding:0px !important;
181
+ margin:0px !important;
182
+ width:auto !important;
183
+ }
184
+ .news-item-comment .pager .prev,
185
+ .news-item-comment .pager .next {
186
+ width:auto;
187
+ padding:0 5px;
188
+ margin-top:0px;
189
+ }
190
+ /*-- /pager --*/
191
+ .print-btn {
192
+ float:right;
193
+ background: url(images/i_print.gif) 0px 0px no-repeat;
194
+ padding-left:20px;
195
+ }
196
+ #clloader {
197
+ position:absolute;
198
+ margin-left:333px
199
+ }
200
+ .tags {
201
+ background: url(images/i-tags.gif) 0px 1px no-repeat;
202
+ padding-left:20px;
203
+ }
204
+
skin/frontend/default/default/css/print.css ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package default_default
22
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ * { background:none !important; text-align:left !important; }
26
+ html { margin:0 !important; padding:0 !important; }
27
+ body { background:#fff !important; padding:0 !important; margin:10px !important; font:9pt Arial, Helvetica, sans-serif !important;}
28
+ a { color:#2976c9 !important; }
29
+ th,td { color:#2f2f2f !important; border-color:#ccc !important; }
30
+
31
+ .header-container,
32
+ .nav-container,
33
+ .footer-container,
34
+ .pager,
35
+ .toolbar,
36
+ .actions,
37
+ .buttons-set,
38
+ .print { display:none !important; }
39
+
40
+ .page-print .data-table .cart-tax-total { background-position:100% -54px; }
41
+ .page-print .data-table .cart-tax-info { display:block !important; }
42
+
skin/frontend/default/default/images/clnews/ajax-loader.gif ADDED
Binary file