Netstarter_Imageswitcher - Version 0.1.0

Version Notes

0.1.0 stable release

Download this release

Release Info

Developer Netstarter
Extension Netstarter_Imageswitcher
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (20) hide show
  1. app/code/community/Netstarter/Imageswitcher/Block/Catalog/Product/View/Type/Configurable.php +201 -0
  2. app/code/community/Netstarter/Imageswitcher/Helper/Data.php +65 -0
  3. app/code/community/Netstarter/Imageswitcher/Model/System/Config/Source/Product/Attributes.php +36 -0
  4. app/code/community/Netstarter/Imageswitcher/controllers/AjaxController.php +115 -0
  5. app/code/community/Netstarter/Imageswitcher/etc/adminhtml.xml +22 -0
  6. app/code/community/Netstarter/Imageswitcher/etc/config.xml +48 -0
  7. app/code/community/Netstarter/Imageswitcher/etc/system.xml +140 -0
  8. app/design/frontend/base/default/layout/imageswitcher.xml +105 -0
  9. app/design/frontend/base/default/template/netstarter/imageswitcher/catalog/product/list.phtml +166 -0
  10. app/design/frontend/base/default/template/netstarter/imageswitcher/catalog/product/view/media.phtml +84 -0
  11. app/design/frontend/base/default/template/netstarter/imageswitcher/product/view/type/options/configurable.phtml +67 -0
  12. app/design/frontend/base/default/template/netstarter/imageswitcher/product/view/type/options/configurable_list.phtml +32 -0
  13. app/etc/modules/Netstarter_Imageswitcher.xml +9 -0
  14. package.xml +38 -0
  15. skin/frontend/base/default/css/netstarter/imageswitcher/imageswitcher.css +29 -0
  16. skin/frontend/base/default/js/netstarter/imageswitcher/imageswitcher.js +339 -0
  17. skin/frontend/base/default/js/netstarter/imageswitcher/isconfigurable.js +365 -0
  18. skin/frontend/base/default/js/netstarter/imageswitcher/listconfigurable.js +284 -0
  19. skin/frontend/base/default/js/netstarter/jqzoom/jquery-1.3.1.min.js +21 -0
  20. skin/frontend/base/default/js/netstarter/jqzoom/jquery.jqzoom1.0.1.js +1141 -0
app/code/community/Netstarter/Imageswitcher/Block/Catalog/Product/View/Type/Configurable.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netstarter.com.au
4
+ *
5
+ * PHP Version 5
6
+ *
7
+ * @category Netstarter
8
+ * @package Netstarter_Imageswitcher
9
+ * @author Netstarter.com.au
10
+ * @copyright 2013 netstarter.com.au
11
+ * @license http://www.netstarter.com.au/license.txt
12
+ * @link N/A
13
+ *
14
+ */
15
+
16
+ /**
17
+ * Magento default configurable product type class extended here
18
+ *
19
+ */
20
+ class Netstarter_Imageswitcher_Block_Catalog_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable {
21
+
22
+ /**
23
+ * Added imagePath to the JSON object
24
+ *
25
+ * @return string
26
+ */
27
+
28
+ public function getJsonConfig()
29
+ {
30
+ $attributes = array();
31
+ $options = array();
32
+ $store = $this->getCurrentStore();
33
+ $taxHelper = Mage::helper('tax');
34
+ $currentProduct = $this->getProduct();
35
+ $preconfiguredFlag = $currentProduct->hasPreconfiguredValues();
36
+ if ($preconfiguredFlag) {
37
+ $preconfiguredValues = $currentProduct->getPreconfiguredValues();
38
+ $defaultValues = array();
39
+ }
40
+
41
+ foreach ($this->getAllowProducts() as $product) {
42
+ $productId = $product->getId();
43
+
44
+ foreach ($this->getAllowAttributes() as $attribute) {
45
+ $productAttribute = $attribute->getProductAttribute();
46
+ $productAttributeId = $productAttribute->getId();
47
+ $attributeValue = $product->getData($productAttribute->getAttributeCode());
48
+ if (!isset($options[$productAttributeId])) {
49
+ $options[$productAttributeId] = array();
50
+ }
51
+
52
+ if (!isset($options[$productAttributeId][$attributeValue])) {
53
+ $options[$productAttributeId][$attributeValue] = array();
54
+ }
55
+ $options[$productAttributeId][$attributeValue][] = $productId;
56
+ }
57
+ }
58
+
59
+ $this->_resPrices = array(
60
+ $this->_preparePrice($currentProduct->getFinalPrice())
61
+ );
62
+
63
+ foreach ($this->getAllowAttributes() as $attribute) {
64
+ $productAttribute = $attribute->getProductAttribute();
65
+ $attributeId = $productAttribute->getId();
66
+ $info = array(
67
+ 'id' => $productAttribute->getId(),
68
+ 'code' => $productAttribute->getAttributeCode(),
69
+ 'label' => $attribute->getLabel(),
70
+ 'options' => array()
71
+ );
72
+
73
+ $optionPrices = array();
74
+ $prices = $attribute->getPrices();
75
+ if (is_array($prices)) {
76
+ foreach ($prices as $value) {
77
+ if(!$this->_validateAttributeValue($attributeId, $value, $options)) {
78
+ continue;
79
+ }
80
+ $currentProduct->setConfigurablePrice(
81
+ $this->_preparePrice($value['pricing_value'], $value['is_percent'])
82
+ );
83
+ $currentProduct->setParentId(true);
84
+ Mage::dispatchEvent(
85
+ 'catalog_product_type_configurable_price',
86
+ array('product' => $currentProduct)
87
+ );
88
+ $configurablePrice = $currentProduct->getConfigurablePrice();
89
+
90
+ if (isset($options[$attributeId][$value['value_index']])) {
91
+ $productsIndex = $options[$attributeId][$value['value_index']];
92
+ } else {
93
+ $productsIndex = array();
94
+ }
95
+
96
+ $info['options'][] = array(
97
+ 'id' => $value['value_index'],
98
+ 'label' => $value['label'],
99
+ 'price' => $configurablePrice,
100
+ 'oldPrice' => $this->_prepareOldPrice($value['pricing_value'], $value['is_percent']),
101
+ //Netstarter Imageswitcher functionality. image path added
102
+ 'imagePath' => $this->getOptionImageLocation($value['label']),
103
+ 'products' => $productsIndex,
104
+ );
105
+ $optionPrices[] = $configurablePrice;
106
+ }
107
+ }
108
+ /**
109
+ * Prepare formated values for options choose
110
+ */
111
+ foreach ($optionPrices as $optionPrice) {
112
+ foreach ($optionPrices as $additional) {
113
+ $this->_preparePrice(abs($additional-$optionPrice));
114
+ }
115
+ }
116
+ if($this->_validateAttributeInfo($info)) {
117
+ $attributes[$attributeId] = $info;
118
+ }
119
+
120
+ // Add attribute default value (if set)
121
+ if ($preconfiguredFlag) {
122
+ $configValue = $preconfiguredValues->getData('super_attribute/' . $attributeId);
123
+ if ($configValue) {
124
+ $defaultValues[$attributeId] = $configValue;
125
+ }
126
+ }
127
+ }
128
+
129
+ $taxCalculation = Mage::getSingleton('tax/calculation');
130
+ if (!$taxCalculation->getCustomer() && Mage::registry('current_customer')) {
131
+ $taxCalculation->setCustomer(Mage::registry('current_customer'));
132
+ }
133
+
134
+ $_request = $taxCalculation->getRateRequest(false, false, false);
135
+ $_request->setProductClassId($currentProduct->getTaxClassId());
136
+ $defaultTax = $taxCalculation->getRate($_request);
137
+
138
+ $_request = $taxCalculation->getRateRequest();
139
+ $_request->setProductClassId($currentProduct->getTaxClassId());
140
+ $currentTax = $taxCalculation->getRate($_request);
141
+
142
+ $taxConfig = array(
143
+ 'includeTax' => $taxHelper->priceIncludesTax(),
144
+ 'showIncludeTax' => $taxHelper->displayPriceIncludingTax(),
145
+ 'showBothPrices' => $taxHelper->displayBothPrices(),
146
+ 'defaultTax' => $defaultTax,
147
+ 'currentTax' => $currentTax,
148
+ 'inclTaxTitle' => Mage::helper('catalog')->__('Incl. Tax')
149
+ );
150
+
151
+ $storeId = $this->helper('core')->getStoreid();
152
+
153
+ $config = array(
154
+ 'attributes' => $attributes,
155
+ 'template' => str_replace('%s', '#{price}', $store->getCurrentCurrency()->getOutputFormat()),
156
+ 'basePrice' => $this->_registerJsPrice($this->_convertPrice($currentProduct->getFinalPrice())),
157
+ 'oldPrice' => $this->_registerJsPrice($this->_convertPrice($currentProduct->getPrice())),
158
+ 'productId' => $currentProduct->getId(),
159
+ 'chooseText' => Mage::helper('catalog')->__('Choose an Option...'),
160
+ 'taxConfig' => $taxConfig,
161
+ ////Netstarter Imageswitcher functionality. Combine attribute parametters added
162
+ 'combineAttr' => Mage::getStoreConfig('imageswitcher/settings/combine_attribute',$storeId),
163
+ 'primaryAttr' => Mage::getStoreConfig('imageswitcher/settings/primary_attribute',$storeId),
164
+ 'secondaryAttr' => Mage::getStoreConfig('imageswitcher/settings/secondary_attribute',$storeId),
165
+ 'imgLocation' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).Mage::getStoreConfig('imageswitcher/settings/image_location',$storeId),
166
+ 'imgFileFormat' => Mage::getStoreConfig('imageswitcher/settings/image_file_format',$storeId)
167
+ );
168
+
169
+ if ($preconfiguredFlag && !empty($defaultValues)) {
170
+ $config['defaultValues'] = $defaultValues;
171
+ }
172
+
173
+ $config = array_merge($config, $this->_getAdditionalConfig());
174
+
175
+ return Mage::helper('core')->jsonEncode($config);
176
+ }
177
+
178
+ /**
179
+ * Get image location
180
+ * @param $label
181
+ * @return string
182
+ */
183
+ private function getOptionImageLocation($label){
184
+
185
+ $storeId = $this->helper('core')->getStoreid();
186
+ $imageLocation = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).Mage::getStoreConfig('imageswitcher/settings/image_location',$storeId);
187
+ $imageFileFormat = Mage::getStoreConfig('imageswitcher/settings/image_file_format',$storeId);
188
+ return $imageLocation.'/'.$label.$imageFileFormat;
189
+ }
190
+
191
+ /**
192
+ * Check for attribute type
193
+ * @param $attributeCode
194
+ * @return bool
195
+ */
196
+
197
+ public function isAttributePrimaryOrSecondary($attributeCode){
198
+ $imageSwitcherAttributes=Mage::helper('imageswitcher')->getPrimaryAndSecondaryAttribute();
199
+ return in_array($attributeCode,$imageSwitcherAttributes);
200
+ }
201
+ }
app/code/community/Netstarter/Imageswitcher/Helper/Data.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netstarter.com.au
4
+ *
5
+ * PHP Version 5
6
+ *
7
+ * @category Netstarter
8
+ * @package Netstarter_Imageswitcher
9
+ * @author Netstarter.com.au
10
+ * @copyright 2013 netstarter.com.au
11
+ * @license http://www.netstarter.com.au/license.txt
12
+ * @link N/A
13
+ *
14
+ */
15
+ class Netstarter_Imageswitcher_Helper_Data extends Mage_Core_Helper_Abstract {
16
+
17
+ /**
18
+ * Get image switcher functionality availability from system configurations
19
+ * @return boolean
20
+ */
21
+ public function isEnableForListingPages(){
22
+ $storeId = Mage::helper('core')->getStoreid();
23
+ return Mage::getStoreConfig('imageswitcher/display_options/listing_pages',$storeId);
24
+ }
25
+
26
+ /**
27
+ * Get image switcher addto cart functionality availability from system configurations
28
+ * @return boolean
29
+ */
30
+ public function isAddToCartFromListingPages(){
31
+ $storeId = Mage::helper('core')->getStoreid();
32
+ return Mage::getStoreConfig('imageswitcher/display_options/addtocart_listing_pages',$storeId);
33
+ }
34
+
35
+ /**
36
+ * Get image switcher functionality availability for product detail page from system configurations
37
+ * @return boolean
38
+ */
39
+ public function isEnableForProductDetailPage(){
40
+ $storeId = Mage::helper('core')->getStoreid();
41
+ return Mage::getStoreConfig('imageswitcher/display_options/product_detail_page',$storeId);
42
+ }
43
+
44
+ /**
45
+ * Check for attribute combined from system configurations
46
+ * @return boolean
47
+ */
48
+ public function isAttributesCombined(){
49
+ $storeId = Mage::helper('core')->getStoreid();
50
+ return Mage::getStoreConfig('imageswitcher/settings/combine_attribute',$storeId);
51
+ }
52
+
53
+ /**
54
+ * Get image switcher attributes array
55
+ * @return array
56
+ */
57
+ public function getPrimaryAndSecondaryAttribute(){
58
+ $storeId = Mage::helper('core')->getStoreid();
59
+ $imageSwitcherAttributes = array();
60
+ $imageSwitcherAttributes[] = Mage::getStoreConfig('imageswitcher/settings/primary_attribute',$storeId);
61
+ $imageSwitcherAttributes[] = Mage::getStoreConfig('imageswitcher/settings/secondary_attribute',$storeId);
62
+ return $imageSwitcherAttributes;
63
+ }
64
+ }
65
+ ?>
app/code/community/Netstarter/Imageswitcher/Model/System/Config/Source/Product/Attributes.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netstarter.com.au.
4
+ * PHP Version 5
5
+ * @category Netstarter
6
+ * @package Imageswitcher
7
+ * @author Netstarter.com.au
8
+ * @license http://www.netstarter.com.au/license.txt
9
+ * Model class to get product attributes with frontend input type 'select' for admin configurations.
10
+ */
11
+
12
+ class Netstarter_Imageswitcher_Model_System_Config_Source_Product_Attributes
13
+ {
14
+ //Return option array with product attribute label
15
+ public function toOptionArray(){
16
+ $options = array();
17
+ $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
18
+ $attributes = Mage::getModel('eav/entity_attribute')->getCollection()
19
+ ->addFilter('entity_type_id', $entityTypeId)
20
+ ->addFilter('frontend_input','select')
21
+ ->setOrder('attribute_code', 'ASC');
22
+ foreach ($attributes as $attribute){
23
+ $item['value'] = $attribute->getAttributeCode();
24
+ if ($attribute->getFrontendLabel()){
25
+ $item['label'] = $attribute->getFrontendLabel();
26
+ }
27
+ else{
28
+ $item['label'] = $attribute->getAttributeCode();
29
+ }
30
+ $options[] = $item;
31
+ }
32
+
33
+ return $options;
34
+ }
35
+ }
36
+ ?>
app/code/community/Netstarter/Imageswitcher/controllers/AjaxController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netstarter.com.au
4
+ *
5
+ * PHP Version 5
6
+ *
7
+ * @category Netstarter
8
+ * @package Netstarter_Imageswitcher
9
+ * @author Netstarter.com.au
10
+ * @copyright 2013 netstarter.com.au
11
+ * @license http://www.netstarter.com.au/license.txt
12
+ * @link N/A
13
+ *
14
+ */
15
+ /**
16
+ * Image switcher ajax controller class to get product images
17
+ */
18
+
19
+ class Netstarter_Imageswitcher_AjaxController extends Mage_Core_Controller_Front_Action {
20
+
21
+ //get product images for a product configurable attributes
22
+ public function getdetailimagesAction(){
23
+ $post = $this->getRequest()->getPost();
24
+ $productId = $post['productId'];
25
+ $attrId = $post['attrId'];
26
+ $optionId = $post['optionVal'];
27
+ $isCatView = $post['isCatView'];
28
+
29
+ if($post['twoAttr']=='true'){
30
+ $primaryAttrId= $post['primaryAttrId'];
31
+ }
32
+ if($post['twoAttr']=='true'){
33
+ $primaryOptionId = $post['primaryOptionId'];
34
+ }
35
+
36
+ if(!empty($productId)){
37
+ //Get product attribute configurable attributes.
38
+ $product=Mage::getModel('catalog/product')->load($productId);
39
+
40
+ $allowAttributes=$product->getTypeInstance(true)->getConfigurableAttributes($product);
41
+ foreach($allowAttributes as $attribute){
42
+ if($attribute->getProductAttribute()->getAttributeId()==$attrId){
43
+ $attributeCode=$attribute->getProductAttribute()->getAttributeCode();
44
+ $prices = $attribute->getPrices();
45
+ foreach ($prices as $optionPrice){
46
+ if($optionPrice['value_index']==$optionId){
47
+ $selctedProdPrice = $this->_preparePrice($optionPrice['pricing_value'],$optionPrice['is_percent'],$product->getFinalPrice());
48
+ }
49
+ }
50
+ break;
51
+ }
52
+ }
53
+ $formatedSelectedProductPrice = Mage::helper('core')->currency($selctedProdPrice, true, false);
54
+ $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
55
+ if($post['twoAttr']=='false'){
56
+ $col = $conf->getUsedProductCollection()
57
+ ->addAttributeToFilter($attributeCode, $optionId)
58
+ ->addAttributeToSelect('image')
59
+ ->addAttributeToSelect($attributeCode)
60
+ ->addFilterByRequiredOptions();
61
+ }else{
62
+ foreach($allowAttributes as $attribute){
63
+ if($attribute->getProductAttribute()->getAttributeId()==$primaryAttrId){
64
+ $primaryAttributeCode=$attribute->getProductAttribute()->getAttributeCode();
65
+ $prices = $attribute->getPrices();
66
+ foreach ($prices as $optionPrice){
67
+ if($optionPrice['value_index']==$optionId){
68
+ $selctedProdPrice = $this->_preparePrice($optionPrice['pricing_value'],$optionPrice['is_percent'],$product->getFinalPrice());
69
+ }
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ //Get product price
75
+ $formatedSelectedProductPrice = Mage::helper('core')->currency($selctedProdPrice, true, false);
76
+ $col = $conf->getUsedProductCollection()
77
+ ->addAttributeToFilter($attributeCode, $optionId)
78
+ ->addAttributeToFilter($primaryAttributeCode, $primaryOptionId)
79
+ ->addAttributeToSelect('image')
80
+ ->addAttributeToSelect($attributeCode)
81
+ ->addAttributeToSelect($primaryAttributeCode)
82
+ ->addFilterByRequiredOptions();
83
+ }
84
+ if($col->count()>0){
85
+ foreach($col as $colItem){
86
+ $simpleProduct = Mage::getModel('catalog/product')->load($colItem->getId());
87
+ if($isCatView){
88
+ $html= $simpleProduct->getImageUrl();
89
+ $productId = $simpleProduct->getEntityId();
90
+ }else{
91
+ $html=$this->getLayout()->createBlock('catalog/product_view_media')->setData('product', $simpleProduct)
92
+ ->setTemplate('catalog/product/view/media.phtml')
93
+ ->toHtml();
94
+ }
95
+ }
96
+ }else{
97
+ $html = '';
98
+ }
99
+ $result = array('success'=>'true','html'=>$html,'priceval'=>$formatedSelectedProductPrice, 'productId' => $productId);
100
+ }else{
101
+ $result = array('success'=>'false');
102
+ }
103
+ $this->getResponse()->setBody(json_encode($result));
104
+ }
105
+
106
+ protected function _preparePrice($price, $isPercent = false,$productFinalPrice)
107
+ {
108
+ if ($isPercent && !empty($price)) {
109
+ $price = $productFinalPrice * $price / 100;
110
+ }
111
+
112
+ return $productFinalPrice+$price;
113
+ }
114
+ }
115
+ ?>
app/code/community/Netstarter/Imageswitcher/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <imageswitcher>
12
+ <title>Netstarter Image Switcher</title>
13
+ </imageswitcher>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/community/Netstarter/Imageswitcher/etc/config.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Netstarter_Imageswitcher>
5
+ <version>0.2.0</version>
6
+ </Netstarter_Imageswitcher>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <imageswitcher>
11
+ <class>Netstarter_Imageswitcher_Helper</class>
12
+ </imageswitcher>
13
+ </helpers>
14
+ <models>
15
+ <imageswitcher>
16
+ <class>Netstarter_Imageswitcher_Model</class>
17
+ </imageswitcher>
18
+ </models>
19
+ <blocks>
20
+ <imageswitcher>
21
+ <class>Netstarter_Imageswitcher_Block</class>
22
+ </imageswitcher>
23
+ <catalog>
24
+ <rewrite>
25
+ <product_view_type_configurable>Netstarter_Imageswitcher_Block_Catalog_Product_View_Type_Configurable</product_view_type_configurable>
26
+ </rewrite>
27
+ </catalog>
28
+ </blocks>
29
+ </global>
30
+ <frontend>
31
+ <routers>
32
+ <imageswitcher>
33
+ <use>standard</use>
34
+ <args>
35
+ <module>Netstarter_Imageswitcher</module>
36
+ <frontName>imageswitcher</frontName>
37
+ </args>
38
+ </imageswitcher>
39
+ </routers>
40
+ <layout>
41
+ <updates>
42
+ <imageswitcher>
43
+ <file>imageswitcher.xml</file>
44
+ </imageswitcher>
45
+ </updates>
46
+ </layout>
47
+ </frontend>
48
+ </config>
app/code/community/Netstarter/Imageswitcher/etc/system.xml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <imageswitcher translate="label" module="imageswitcher">
5
+ <label>Netstarter Image Switcher</label>
6
+ <sort_order>300</sort_order>
7
+ </imageswitcher>
8
+ </tabs>
9
+ <sections>
10
+ <imageswitcher translate="label" module="imageswitcher">
11
+ <label>Configurations</label>
12
+ <tab>imageswitcher</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>10</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
+ <settings>
20
+ <label>Image Switcher 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
+ <primary_attribute translate="label">
28
+ <label>Primary Configuration Attribute</label>
29
+ <comment></comment>
30
+ <frontend_type>select</frontend_type>
31
+ <sort_order>20</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <can_be_empty>1</can_be_empty>
36
+ <source_model>imageswitcher/system_config_source_product_attributes</source_model>
37
+ </primary_attribute>
38
+ <secondary_attribute translate="label">
39
+ <label>Secondary Configuration Attribute</label>
40
+ <comment></comment>
41
+ <frontend_type>select</frontend_type>
42
+ <sort_order>30</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <can_be_empty>1</can_be_empty>
47
+ <source_model>imageswitcher/system_config_source_product_attributes</source_model>
48
+ </secondary_attribute>
49
+ <combine_attribute translate="label">
50
+ <label>Combine Attributes</label>
51
+ <comment></comment>
52
+ <frontend_type>select</frontend_type>
53
+ <sort_order>40</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ <can_be_empty>1</can_be_empty>
58
+ <source_model>adminhtml/system_config_source_yesno</source_model>
59
+ </combine_attribute>
60
+ <image_location translate="label">
61
+ <label>Configuration Attribute Image Location</label>
62
+ <comment>folder name of the </comment>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>50</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <can_be_empty>1</can_be_empty>
69
+ </image_location>
70
+ <image_file_format>
71
+ <label>Image File Format</label>
72
+ <comment>Eg: .jpg</comment>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>70</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <can_be_empty>1</can_be_empty>
79
+ </image_file_format>
80
+ </fields>
81
+ </settings>
82
+ <display_options>
83
+ <label>Image Switcher Display Options</label>
84
+ <frontend_type>text</frontend_type>
85
+ <sort_order>20</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <fields>
90
+ <listing_pages translate="label">
91
+ <label>Listing Pages</label>
92
+ <comment></comment>
93
+ <frontend_type>select</frontend_type>
94
+ <sort_order>20</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ <can_be_empty>1</can_be_empty>
99
+ <source_model>adminhtml/system_config_source_yesno</source_model>
100
+ </listing_pages>
101
+ <addtocart_listing_pages translate="label">
102
+ <label>Addto Cart From Listing Pages</label>
103
+ <comment></comment>
104
+ <frontend_type>select</frontend_type>
105
+ <sort_order>40</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ <can_be_empty>1</can_be_empty>
110
+ <source_model>adminhtml/system_config_source_yesno</source_model>
111
+ </addtocart_listing_pages>
112
+ <product_detail_page translate="label">
113
+ <label>Product Detail Page</label>
114
+ <comment></comment>
115
+ <frontend_type>select</frontend_type>
116
+ <sort_order>10</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <can_be_empty>1</can_be_empty>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ </product_detail_page>
123
+ <search_result_page translate="label">
124
+ <label>Search Result Page</label>
125
+ <comment></comment>
126
+ <frontend_type>select</frontend_type>
127
+ <sort_order>30</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ <can_be_empty>1</can_be_empty>
132
+ <source_model>adminhtml/system_config_source_yesno</source_model>
133
+ </search_result_page>
134
+ </fields>
135
+ </display_options>
136
+ </groups>
137
+ </imageswitcher>
138
+ </sections>
139
+
140
+ </config>
app/design/frontend/base/default/layout/imageswitcher.xml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <PRODUCT_TYPE_configurable translate="label" module="catalog">
5
+ <reference name="head">
6
+ <action method="addItem" ifconfig="imageswitcher/display_options/product_detail_page"><type>skin_js</type><name>js/netstarter/jqzoom/jquery-1.3.1.min.js</name></action>
7
+ <action method="addItem" ifconfig="imageswitcher/display_options/product_detail_page">
8
+ <type>skin_js</type><script>js/netstarter/imageswitcher/imageswitcher.js</script>
9
+ </action>
10
+ <action method="addItem" ifconfig="imageswitcher/display_options/product_detail_page">
11
+ <type>skin_css</type><script>css/netstarter/imageswitcher/imageswitcher.css</script>
12
+ </action>
13
+ </reference>
14
+ <reference name="product.info.options.configurable">
15
+ <action method="setTemplate" ifconfig="imageswitcher/display_options/product_detail_page">
16
+ <template>netstarter/imageswitcher/product/view/type/options/configurable.phtml</template>
17
+ </action>
18
+ </reference>
19
+ <reference name="product.info.media">
20
+ <action method="setTemplate" ifconfig="imageswitcher/display_options/product_detail_page">
21
+ <template>netstarter/imageswitcher/catalog/product/view/media.phtml</template>
22
+ </action>
23
+ </reference>
24
+ </PRODUCT_TYPE_configurable>
25
+
26
+ <catalog_category_default translate="label">
27
+ <reference name="head">
28
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages"><type>skin_js</type><name>js/netstarter/jqzoom/jquery-1.3.1.min.js</name></action>
29
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages">
30
+ <type>skin_js</type><script>js/netstarter/imageswitcher/listconfigurable.js</script>
31
+ </action>
32
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages">
33
+ <type>skin_js</type><script>js/netstarter/imageswitcher/imageswitcher.js</script>
34
+ </action>
35
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages">
36
+ <type>skin_css</type><script>css/netstarter/imageswitcher/imageswitcher.css</script>
37
+ </action>
38
+ </reference>
39
+ <reference name="product_list" ifconfig="imageswitcher/display_options/listing_pages">
40
+ <action method="setTemplate">
41
+ <template>netstarter/imageswitcher/catalog/product/list.phtml</template>
42
+ </action>
43
+ </reference>
44
+ </catalog_category_default>
45
+
46
+ <catalog_category_layered translate="label">
47
+ <reference name="head">
48
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages"><type>skin_js</type><name>js/netstarter/jqzoom/jquery-1.3.1.min.js</name></action>
49
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages">
50
+ <type>skin_js</type><script>js/netstarter/imageswitcher/listconfigurable.js</script>
51
+ </action>
52
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages">
53
+ <type>skin_js</type><script>js/netstarter/imageswitcher/imageswitcher.js</script>
54
+ </action>
55
+ <action method="addItem" ifconfig="imageswitcher/display_options/listing_pages">
56
+ <type>skin_css</type><script>css/netstarter/imageswitcher/imageswitcher.css</script>
57
+ </action>
58
+ </reference>
59
+ <reference name="product_list">
60
+ <action method="setTemplate" ifconfig="imageswitcher/display_options/listing_pages">
61
+ <template>netstarter/imageswitcher/catalog/product/list.phtml</template>
62
+ </action>
63
+ </reference>
64
+ </catalog_category_layered>
65
+
66
+ <catalogsearch_result_index translate="label">
67
+ <reference name="head">
68
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page"><type>skin_js</type><name>js/netstarter/jqzoom/jquery-1.3.1.min.js</name></action>
69
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page">
70
+ <type>skin_js</type><script>js/netstarter/imageswitcher/listconfigurable.js</script>
71
+ </action>
72
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page">
73
+ <type>skin_js</type><script>js/netstarter/imageswitcher/imageswitcher.js</script>
74
+ </action>
75
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page">
76
+ <type>skin_css</type><script>css/netstarter/imageswitcher/imageswitcher.css</script>
77
+ </action>
78
+ </reference>
79
+ <reference name="search_result_list">
80
+ <action method="setTemplate" ifconfig="imageswitcher/display_options/search_result_page">
81
+ <template>netstarter/imageswitcher/catalog/product/list.phtml</template>
82
+ </action>
83
+ </reference>
84
+ </catalogsearch_result_index>
85
+
86
+ <catalogsearch_advanced_result translate="label">
87
+ <reference name="head">
88
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page"><type>skin_js</type><name>js/netstarter/jqzoom/jquery-1.3.1.min.js</name></action>
89
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page">
90
+ <type>skin_js</type><script>js/netstarter/imageswitcher/listconfigurable.js</script>
91
+ </action>
92
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page">
93
+ <type>skin_js</type><script>js/netstarter/imageswitcher/imageswitcher.js</script>
94
+ </action>
95
+ <action method="addItem" ifconfig="imageswitcher/display_options/search_result_page">
96
+ <type>skin_css</type><script>css/netstarter/imageswitcher/imageswitcher.css</script>
97
+ </action>
98
+ </reference>
99
+ <reference name="search_result_list">
100
+ <action method="setTemplate" ifconfig="imageswitcher/display_options/search_result_page">
101
+ <template>netstarter/imageswitcher/catalog/product/list.phtml</template>
102
+ </action>
103
+ </reference>
104
+ </catalogsearch_advanced_result>
105
+ </layout>
app/design/frontend/base/default/template/netstarter/imageswitcher/catalog/product/list.phtml ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Product list template
30
+ *
31
+ * @see Mage_Catalog_Block_Product_List
32
+ */
33
+ ?>
34
+ <?php
35
+ $_productCollection=$this->getLoadedProductCollection();
36
+ $_helper = $this->helper('catalog/output');
37
+ ?>
38
+ <?php if(!$_productCollection->count()): ?>
39
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
40
+ <?php else: ?>
41
+ <div class="category-products">
42
+ <?php echo $this->getToolbarHtml() ?>
43
+ <?php // List mode ?>
44
+ <?php if($this->getMode()!='grid'): ?>
45
+ <?php $_iterator = 0; ?>
46
+ <ol class="products-list" id="products-list">
47
+ <?php foreach ($_productCollection as $_product): ?>
48
+ <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
49
+ <?php // Product Image ?>
50
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img class = "product-image-<?php echo $_product->getId();?>" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
51
+ <?php // Product description ?>
52
+ <div class="product-shop">
53
+ <div class="f-fix">
54
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
55
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
56
+ <?php if($_product->getRatingSummary()): ?>
57
+ <?php echo $this->getReviewsSummaryHtml($_product) ?>
58
+ <?php endif; ?>
59
+ <?php echo $this->getPriceHtml($_product, true) ?>
60
+ <!--Start Netstarter ImageSwitcher Module -->
61
+ <!--Image switcher on listing page-->
62
+ <?php if($_product->isSaleable()): ?>
63
+ <!--Start Netstarter ImageSwitcher Module -->
64
+ <!--Image switcher on listing page-->
65
+ <?php if ( $_product->getTypeId() == 'configurable'): ?>
66
+ <?php if(Mage::helper('imageswitcher')->isAddToCartFromListingPages()): ?>
67
+ <form action="<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>" method="post" id="product_addtocart_form" <?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
68
+ <?php endif; ?>
69
+ <?php if(Mage::helper('imageswitcher')->isEnableForListingPages()): ?>
70
+ <?php Mage::unregister('product') ?>
71
+ <?php Mage::register('product', $_product); ?>
72
+ <?php echo $this->getLayout()->createBlock('catalog/product_view_type_configurable')->setData('product',$_product)->setTemplate('netstarter/imageswitcher/product/view/type/options/configurable_list.phtml')->toHtml();?>
73
+ <?php endif ?>
74
+ <?php endif;?>
75
+ <?php if ( $_product->getTypeId() == 'configurable' && Mage::helper('imageswitcher')->isAddToCartFromListingPages()): ?>
76
+ <button type="submit" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"> <span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
77
+ </form>
78
+ <!--End Netstarter ImageSwitcher Module-->
79
+ <?php else: ?>
80
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
81
+ <?php endif;?>
82
+ <?php else: ?>
83
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
84
+ <?php endif; ?>
85
+ <div class="desc std">
86
+ <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
87
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
88
+ </div>
89
+ <ul class="add-to-links">
90
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
91
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
92
+ <?php endif; ?>
93
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
94
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
95
+ <?php endif; ?>
96
+ </ul>
97
+ </div>
98
+ </div>
99
+ </li>
100
+ <?php endforeach; ?>
101
+ </ol>
102
+ <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
103
+
104
+ <?php else: ?>
105
+
106
+ <?php // Grid Mode ?>
107
+
108
+ <?php $_collectionSize = $_productCollection->count() ?>
109
+ <?php $_columnCount = $this->getColumnCount(); ?>
110
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
111
+ <?php if ($i++%$_columnCount==0): ?>
112
+ <ul class="products-grid">
113
+ <?php endif ?>
114
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
115
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img class = "product-image-<?php echo $_product->getId();?>" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
116
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
117
+ <?php if($_product->getRatingSummary()): ?>
118
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
119
+ <?php endif; ?>
120
+ <?php echo $this->getPriceHtml($_product, true) ?>
121
+ <div class="actions">
122
+ <?php if($_product->isSaleable()): ?>
123
+ <!--Start Netstarter ImageSwitcher Module -->
124
+ <!--Image switcher on listing page-->
125
+ <?php if ( $_product->getTypeId() == 'configurable'): ?>
126
+ <?php if(Mage::helper('imageswitcher')->isAddToCartFromListingPages()): ?>
127
+ <form action="<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>" method="post" id="product_addtocart_form" <?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
128
+ <?php endif; ?>
129
+ <?php if(Mage::helper('imageswitcher')->isEnableForListingPages()): ?>
130
+ <?php Mage::unregister('product') ?>
131
+ <?php Mage::register('product', $_product); ?>
132
+ <?php echo $this->getLayout()->createBlock('catalog/product_view_type_configurable')->setData('product',$_product)->setTemplate('netstarter/imageswitcher/product/view/type/options/configurable_list.phtml')->toHtml();?>
133
+ <?php endif ?>
134
+ <?php endif;?>
135
+ <?php if ( $_product->getTypeId() == 'configurable' && Mage::helper('imageswitcher')->isAddToCartFromListingPages()): ?>
136
+ <button type="submit" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"> <span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
137
+ </form>
138
+ <?php else: ?>
139
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
140
+ <?php endif;?>
141
+ <!--End Netstarter ImageSwitcher Module-->
142
+ <?php else: ?>
143
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
144
+ <?php endif; ?>
145
+ <ul class="add-to-links">
146
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
147
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
148
+ <?php endif; ?>
149
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
150
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
151
+ <?php endif; ?>
152
+ </ul>
153
+ </div>
154
+ </li>
155
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
156
+ </ul>
157
+ <?php endif ?>
158
+ <?php endforeach ?>
159
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
160
+ <?php endif; ?>
161
+
162
+ <div class="toolbar-bottom">
163
+ <?php echo $this->getToolbarHtml() ?>
164
+ </div>
165
+ </div>
166
+ <?php endif; ?>
app/design/frontend/base/default/template/netstarter/imageswitcher/catalog/product/view/media.phtml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product media data template
29
+ *
30
+ * @see Mage_Catalog_Block_Product_View_Media
31
+ */
32
+ ?>
33
+ <?php
34
+ $productId=$this->getRequest()->getParam('prod_id');
35
+ if(isset($productId)){
36
+ $_product = Mage::getModel('catalog/product')->load($productId);
37
+ $this->setProduct($_product);
38
+ }else{
39
+ $_product = $this->getProduct();
40
+ }
41
+ $_helper = $this->helper('catalog/output');
42
+ ?>
43
+ <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
44
+ <p class="product-image product-image-zoom">
45
+ <?php
46
+ $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
47
+ echo $_helper->productAttribute($_product, $_img, 'image');
48
+ ?>
49
+ </p>
50
+ <p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
51
+ <div class="zoom">
52
+ <img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
53
+ <div id="track">
54
+ <div id="handle"></div>
55
+ </div>
56
+ <img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
57
+ </div>
58
+ <script type="text/javascript">
59
+ //<![CDATA[
60
+ Event.observe(window, 'load', function() {
61
+ product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
62
+ });
63
+ //]]>
64
+ </script>
65
+ <?php else: ?>
66
+ <p class="product-image">
67
+ <?php
68
+ $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
69
+ echo $_helper->productAttribute($_product, $_img, 'image');
70
+ ?>
71
+ </p>
72
+ <?php endif; ?>
73
+ <?php if (count($this->getGalleryImages()) > 0): ?>
74
+ <div class="more-views">
75
+ <h2><?php echo $this->__('More Views') ?></h2>
76
+ <ul>
77
+ <?php foreach ($this->getGalleryImages() as $_image): ?>
78
+ <li>
79
+ <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" /></a>
80
+ </li>
81
+ <?php endforeach; ?>
82
+ </ul>
83
+ </div>
84
+ <?php endif; ?>
app/design/frontend/base/default/template/netstarter/imageswitcher/product/view/type/options/configurable.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_product = $this->getProduct();
30
+ $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
31
+ $_iswitchName = "colorSwitcherPanels";
32
+ $storeId = $this->helper('core')->getStoreid();
33
+ $isCombineAttr=Mage::getStoreConfig('imageswitcher/settings/combine_attribute',$storeId);
34
+ $primaryAttr=Mage::getStoreConfig('imageswitcher/settings/primary_attribute',$storeId);
35
+ $primaryAttribute = $_product->getResource()->getAttribute($primaryAttr);
36
+ $secondaryAttr=Mage::getStoreConfig('imageswitcher/settings/secondary_attribute',$storeId);
37
+ $secondaryAttribute = $_product->getResource()->getAttribute($secondaryAttr);
38
+ $isLabel=false;
39
+ ?>
40
+ <?php if ($_product->isSaleable() && count($_attributes)):?>
41
+ <dl class="switcherWraper" data-id=<?php echo $_product->getId()?>>
42
+ <?php foreach($_attributes as $_attribute): ?>
43
+ <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
44
+ <?php if(!$this->isAttributePrimaryOrSecondary($_attribute->getProductAttribute()->getAttributeCode())):{?>
45
+ <label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label>
46
+ <?php } endif;?>
47
+ <div class="input-box">
48
+ <?php if($this->isAttributePrimaryOrSecondary($_attribute->getProductAttribute()->getAttributeCode())):?>
49
+ <input type="hidden" class="super_attribute"
50
+ name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]"/>
51
+ <ul class="<?php echo $_iswitchName ?>">
52
+ </ul>
53
+ <?php else : ?>
54
+ <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
55
+ <option><?php echo $this->__('Choose an Option...') ?></option>
56
+ </select>
57
+ <?php endif;?>
58
+ </div>
59
+ </dd>
60
+ <?php if($_iswitchName == "colorSwitcherPanels") $_iswitchName = "colorSwitcherSubPanels" ?>
61
+ <?php endforeach; ?>
62
+ </dl>
63
+ <script type="text/javascript">
64
+ var spJason_<?php echo $_product->getId()?> =<?php echo $this->getJsonConfig() ?>;
65
+ var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
66
+ </script>
67
+ <?php endif; ?>
app/design/frontend/base/default/template/netstarter/imageswitcher/product/view/type/options/configurable_list.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_product = $this->getProduct();
3
+ $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
4
+ $_iswitchName = "colorSwitcherPanels";
5
+ $storeId = $this->helper('core')->getStoreid();
6
+ $isCombineAttr=Mage::getStoreConfig('imageswitcher/settings/combine_attribute',$storeId);
7
+ $primaryAttr=Mage::getStoreConfig('imageswitcher/settings/primary_attribute',$storeId);
8
+ $primaryAttribute = $_product->getResource()->getAttribute($primaryAttr);
9
+ $secondaryAttr=Mage::getStoreConfig('imageswitcher/settings/secondary_attribute',$storeId);
10
+ $secondaryAttribute = $_product->getResource()->getAttribute($secondaryAttr);
11
+ ?>
12
+ <?php if ($_product->isSaleable() && count($_attributes)):?>
13
+ <dl class="switcherWraper" data-id=<?php echo $_product->getId()?>
14
+ <?php foreach($_attributes as $_attribute): ?>
15
+ <?php if($this->isAttributePrimaryOrSecondary($_attribute->getProductAttribute()->getAttributeCode())):?>
16
+ <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
17
+ <div class="input-box">
18
+ <input type="hidden" class="super_attribute"
19
+ name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]"/>
20
+ <ul class="<?php echo $_iswitchName ?>">
21
+ </ul>
22
+ </div>
23
+ </dd>
24
+ <?php if($_iswitchName == "colorSwitcherPanels") $_iswitchName = "colorSwitcherSubPanels" ?>
25
+ <?php endif;?>
26
+ <?php endforeach; ?>
27
+ </dl>
28
+ <script type="text/javascript">
29
+ var spConfig_<?php echo $_product->getId()?> = new ListConfig_Product.Config(<?php echo $this->getJsonConfig() ?>);
30
+ var spJason_<?php echo $_product->getId()?> =<?php echo $this->getJsonConfig() ?>;
31
+ </script>
32
+ <?php endif;?>
app/etc/modules/Netstarter_Imageswitcher.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Netstarter_Imageswitcher>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Netstarter_Imageswitcher>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Netstarter_Imageswitcher</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Image switcher allows you to easily present products in Magento that come in a variety of images depending on multiple configurable attributes such as Color and Material.</summary>
10
+ <description>Image switcher let you change the product images based on different selections for configurable attributes in the product catalog. &#xD;
11
+ &#xD;
12
+ &#xB7; Support up to two configurable attributes (e.g. Color and Material) and is able to work as independent sections or a combined selection in the front end. This can be configured in backed at store level.&#xD;
13
+ &#xD;
14
+ &#xB7; Admin interface will have the facility to define what configurable attributes are to be used for image switching&#xD;
15
+ &#xD;
16
+ &#xB7; Admin interface will have the ability to define a folder location to pick the respective images to be displayed in frontend based on the attribute configuration&#xD;
17
+ &#xD;
18
+ &#xB7; Listing pages&#xD;
19
+ &#xD;
20
+ o Users are able to see what colors and/or materials [these two parameters are configurable] a product is available in&#xD;
21
+ &#xD;
22
+ o By selecting the color and /or material users are able to view a picture of the product&#xD;
23
+ &#xD;
24
+ o Ability of adding configurable products to cart from listing pages &#xD;
25
+ &#xD;
26
+ &#xB7; Product pages&#xD;
27
+ &#xD;
28
+ o Upon selecting a color and / or material multiple images are refreshed&#xD;
29
+ &#xD;
30
+ o AJAX reloading for better usability</description>
31
+ <notes>0.1.0 stable release</notes>
32
+ <authors><author><name>Netstarter</name><user>cshotland</user><email>cshotland@netstarter.com.au</email></author></authors>
33
+ <date>2013-11-07</date>
34
+ <time>08:45:45</time>
35
+ <contents><target name="magecommunity"><dir name="Netstarter"><dir name="Imageswitcher"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="View"><dir name="Type"><file name="Configurable.php" hash="e6cbca4922ed9915dc7404c467ec5965"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="6a530a304b2a0bf29a92dc04460eed83"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Product"><file name="Attributes.php" hash="379b1258383ee986c9d743dfe8948ad3"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="2d5d859f4a9031efd2eebdb7789d4c7c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="cd8fdf4add9da3ae93bf09f275f333e6"/><file name="config.xml" hash="2ba408ec1f86200c448f008597aa7756"/><file name="system.xml" hash="14c15b3c6e6d06d22088216b7c7c4be8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Netstarter_Imageswitcher.xml" hash="7ac53d54e901aff46a90764d80b19dad"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="imageswitcher.xml" hash="f349475c65ca9ed8edeb8e84f2856fdf"/></dir><dir name="template"><dir name="netstarter"><dir name="imageswitcher"><dir name="catalog"><dir name="product"><file name="list.phtml" hash="9b565db184edeec9abc2849b4f69381b"/><dir name="view"><file name="media.phtml" hash="3ad256bd72bab1a4f38fa07becb03d7c"/></dir></dir></dir><dir name="product"><dir name="view"><dir name="type"><dir name="options"><file name="configurable.phtml" hash="b654fc6fb07f9d6780af21ca19a809ee"/><file name="configurable_list.phtml" hash="5f513696bccac58cf4c304bc20c8dfc4"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="netstarter"><dir name="imageswitcher"><file name="imageswitcher.css" hash="503f970938015615f8379290ef12caba"/></dir></dir></dir><dir name="js"><dir name="netstarter"><dir name="imageswitcher"><file name="imageswitcher.js" hash="2537191a69a888bbaef659bed0589fff"/><file name="isconfigurable.js" hash="f1640305659c0f03d51527da03b92062"/><file name="listconfigurable.js" hash="bbb916ae21f48b8b9cdf39d897e067cf"/></dir><dir name="jqzoom"><file name="jquery-1.3.1.min.js" hash="2789531e44cf13662d371050222010ff"/><file name="jquery.jqzoom1.0.1.js" hash="0ab1594c3941c5db3386ff68ada5dac6"/></dir></dir></dir></dir></dir></dir></target></contents>
36
+ <compatible/>
37
+ <dependencies><required><php><min>5.1.0</min><max>6.1.0</max></php></required></dependencies>
38
+ </package>
skin/frontend/base/default/css/netstarter/imageswitcher/imageswitcher.css ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dl.switcherWraper { float:left; width:100%}
2
+
3
+ ul.colorSwitcherPanels li
4
+ {
5
+ width: 28px;
6
+ padding: 4px 4px 4px;
7
+ float: left;
8
+
9
+ }
10
+
11
+ .switcherWraper dd { border:none; clear: both; width:100%}
12
+
13
+ ul.colorSwitcherPanels
14
+ {
15
+ width : 100% ;
16
+ }
17
+
18
+ ul.colorSwitcherSubPanels li
19
+ {
20
+ width: 28px;
21
+ padding: 4px 4px 4px;
22
+ float: left;
23
+
24
+ }
25
+
26
+ ul.colorSwitcherSubPanels
27
+ {
28
+ width : 100% ;
29
+ }
skin/frontend/base/default/js/netstarter/imageswitcher/imageswitcher.js ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Netstarter.com.au
3
+ *
4
+ * PHP Version 5
5
+ *
6
+ * @category Netstarter
7
+ * @package Netstarter_Imageswitcher
8
+ * @author Netstarter.com.au
9
+ * @copyright 2013 netstarter.com.au
10
+ * @license http://www.netstarter.com.au/license.txt
11
+ * @link N/A
12
+ *
13
+ */
14
+
15
+
16
+ jQuery(function () {
17
+ jQuery('.switcherWraper').each(function () {
18
+
19
+ jQuery(this).imageSwitcher();
20
+
21
+ });
22
+
23
+ });
24
+
25
+
26
+ var isCatView = 0;
27
+
28
+ (function ($, undefined) {
29
+
30
+ jQuery.fn.imageSwitcher = function (options) {
31
+ var set = $.extend({
32
+ errormsg1: "Please select an option", //set the error message for the first option
33
+ errormsg2: "Please select an option", //set the error message for the second option
34
+ errormsgCombine: "Please select as option", //set the error message for the combine option
35
+ errormsgPos:"bottom" // top or bottom (where error message appear)
36
+ }, options);
37
+
38
+ var cdiv = this;
39
+
40
+ if (!cdiv.length) return;
41
+
42
+ var cid = cdiv.attr('data-id');
43
+
44
+ var cjson = eval("spJason_" + cid);
45
+
46
+
47
+ var firstWrap = cdiv.find('.colorSwitcherPanels');
48
+ var secondWrap = cdiv.find('.colorSwitcherSubPanels');
49
+
50
+ var submitEvent;
51
+ var productSelected = false;
52
+
53
+ var index = [];
54
+ var coloreSet;
55
+ var otherSet;
56
+
57
+ var firstSet;
58
+ var secondSet;
59
+
60
+ var secondSetArray = [];
61
+
62
+ var safirst = cdiv.find('.super_attribute').eq(0);
63
+ var sasecond = cdiv.find('.super_attribute').eq(1);
64
+
65
+ var combineproduct = false;
66
+
67
+
68
+ if(jQuery('.category-view').length || jQuery('.results-view').length || jQuery('.category-products').length) isCatView = 1;
69
+
70
+
71
+ if (cjson.combineAttr == 1) combineproduct = true;
72
+ if (!cdiv.find('.colorSwitcherSubPanels').length) combineproduct = false; //check combine product or not
73
+
74
+ for (var x in cjson.attributes) {
75
+ index.push(x);
76
+ }
77
+
78
+ if (index.length) {
79
+ coloreSet = cjson.attributes[index[0]];
80
+ safirst.val("");
81
+ }
82
+
83
+ if (index.length >= 2) {
84
+ for( var j=0;j < index.length; j++){
85
+ if(cjson.attributes[index[j]].code == cjson.secondaryAttr)
86
+ {
87
+ otherSet = cjson.attributes[index[j]];break;
88
+ }
89
+ }
90
+ }
91
+
92
+ //When combine attribute is disable
93
+ if (!combineproduct) {
94
+
95
+ firstWrap.parent().prepend('<label class="required"><em>*</em>'+ coloreSet.label+'</label>');
96
+
97
+ for (var i = 0; i < coloreSet.options.length; i++) {
98
+ firstWrap.append('<li><img product_id="'+cjson.productId+'" title="' + coloreSet.options[i].label + '" optionid="' + coloreSet.options[i].id + '" attribute_id="' + coloreSet.id + '" src = "' + coloreSet.options[i].imagePath + '" width="30" height="30"/></li>');
99
+ }
100
+
101
+
102
+ firstWrap.find('li').click(function () {
103
+
104
+ cdiv.find('.switchError').remove();
105
+
106
+ if (index.length >= 2) {
107
+ productSelected = false;
108
+ sasecond.val("");
109
+ }
110
+ else {
111
+ productSelected = true;
112
+ }
113
+
114
+ cdiv.find('.switchSelect').removeClass('switchSelect');
115
+ jQuery(this).addClass('switchSelect');
116
+
117
+ var cset = jQuery(this).prevAll().length;
118
+ firstSet = coloreSet.options[cset];
119
+ secondSetArray = [];
120
+
121
+ safirst.val(firstSet.id);
122
+ //Load single attribute image
123
+ loadImages(jQuery(this).find('img').attr("optionid"), jQuery(this).find('img').attr("product_id"), jQuery(this).find('img').attr("attribute_id"),isCatView);
124
+
125
+ if (index.length >= 2) { // check for the other set
126
+
127
+
128
+ for (var k = 0; k < firstSet.products.length; k++) {
129
+
130
+ var cid = (firstSet.products[k]);
131
+
132
+ for (var s = 0; s < otherSet.options.length; s++) {
133
+ for (var p = 0; p < otherSet.options[s].products.length; p++) {
134
+ if (otherSet.options[s].products[p] == cid) {
135
+ secondSetArray.push(otherSet.options[s]);
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ secondWrap.html('');
142
+ secondWrap.parent().find('label').remove();
143
+ secondWrap.parent().prepend('<label class="required"><em>*</em>'+ otherSet.label+'</label>');
144
+ for (var n = 0; n < secondSetArray.length; n++) {
145
+ secondWrap.append('<li><img product_id="'+cjson.productId+'" title="' + secondSetArray[n].label + '" optionid="' + secondSetArray[n].id + '" attribute_id ="' + otherSet.id + '" src = "' + secondSetArray[n].imagePath + '" width="30" height="30"/></li>')
146
+ }
147
+
148
+ //second level product click
149
+ secondWrap.find('li').click(function () {
150
+
151
+
152
+ secondWrap.find('.switchSelect').removeClass('switchSelect')
153
+ jQuery(this).addClass('switchSelect');
154
+ productSelected = true;
155
+
156
+ var cset = jQuery(this).prevAll().length;
157
+ secondSet = secondSetArray[cset];
158
+
159
+ cdiv.find('.regular-price .price').html(parseInt(cjson.basePrice) + parseInt(secondSet.price));
160
+ sasecond.val(secondSet.id);
161
+
162
+ cdiv.find('.switchError').remove();
163
+
164
+ var selectedPrimaryAttributId = firstWrap.find('.switchSelect img').attr("attribute_id");
165
+ var selectedPrimaryOtionId = firstWrap.find('.switchSelect img').attr("optionid");
166
+
167
+ var clickedImage = jQuery(this).find('img');
168
+
169
+ clickedImage.attr("primary_attribute_id", selectedPrimaryAttributId);
170
+ clickedImage.attr("primary_optionid", selectedPrimaryOtionId);
171
+ //Load image for two attributes
172
+ loadSecondaryImages(clickedImage.attr("optionid"), jQuery(this).find('img').attr("product_id"), clickedImage.attr("attribute_id"), selectedPrimaryAttributId, selectedPrimaryOtionId,isCatView);
173
+ });
174
+ }
175
+
176
+
177
+ });
178
+ }
179
+
180
+
181
+ else {
182
+ firstWrap.addClass('combineProductHide');
183
+ cdiv.find('.last .input-box').prepend('<label class="required"><em>*</em>'+ coloreSet.label +" / " +otherSet.label +'</label>');
184
+
185
+ for (var p = 0; p < coloreSet.options.length; p++) {
186
+ var ppr = coloreSet.options[p];
187
+ for (var k = 0; k < coloreSet.options[p].products.length; k++) {
188
+ for (var pp = 0; pp < otherSet.options.length; pp++) {
189
+
190
+ var cpr = otherSet.options[pp];
191
+ for (var kk = 0; kk < otherSet.options[pp].products.length; kk++) {
192
+
193
+
194
+ if (otherSet.options[pp].products[kk] == coloreSet.options[p].products[k]) {
195
+ secondWrap.append('<li><img product_id="'+cjson.productId+'" src = "' + cjson.imgLocation + "/" + ppr.label + "_" + cpr.label + cjson.imgFileFormat
196
+ + '" title="' + cpr.label
197
+ + '" secondary_optionid="' + cpr.id
198
+ + '" secondary_attribute_id ="' + otherSet.id
199
+ + '" primary_optionid="' + ppr.id
200
+ + '" primary_attribute_id="' + coloreSet.id
201
+ + '" width="30" height="30"/></li>')
202
+ }
203
+
204
+ }
205
+ }
206
+
207
+ }
208
+ }
209
+
210
+
211
+ secondWrap.find('li img').click(function () {
212
+
213
+ safirst.val(jQuery(this).attr('primary_optionid'));
214
+ sasecond.val(jQuery(this).attr('secondary_optionid'));
215
+
216
+ cdiv.find('.switchError').remove();
217
+
218
+ jQuery(this).addClass('switchSelect');
219
+ productSelected = true;
220
+
221
+ var selectedPrimaryAttributId = jQuery(this).attr('primary_attribute_id');
222
+ var selectedPrimaryOptionId = jQuery(this).attr('primary_optionid');
223
+ var selectedSecondaryAttributId = jQuery(this).attr('secondary_attribute_id');
224
+ var selectedSecondaryOptionId = jQuery(this).attr('secondary_optionid');
225
+
226
+ loadSecondaryImages(selectedSecondaryOptionId, jQuery(this).attr("product_id"), selectedSecondaryAttributId, selectedPrimaryAttributId, selectedPrimaryOptionId,isCatView);
227
+
228
+ })
229
+
230
+ }
231
+
232
+ var thisbtn = cdiv.parent().find('.btn-cart');
233
+ if(thisbtn.length == 0) thisbtn = cdiv.parent().parent().find('.btn-cart');
234
+ var submitEvent = thisbtn.attr('onclick')
235
+ thisbtn.attr('onclick', '').unbind('click');
236
+
237
+
238
+ thisbtn.click(function (event) {
239
+
240
+
241
+ cdiv.find('.switchError').remove();
242
+
243
+
244
+ if (productSelected) {
245
+ thisbtn.attr('onclick', submitEvent);
246
+
247
+ }
248
+ else {
249
+
250
+ event.preventDefault();
251
+
252
+
253
+ if (combineproduct) {
254
+ if (!secondWrap.find('.switchSelect').length) {
255
+ if(set.errormsgPos == "top")secondWrap.before('<div class="switchError">'+set.errormsgCombine+'</div>');
256
+ else secondWrap.after('<div class="switchError">'+set.errormsgCombine+'</div>');
257
+ }
258
+ }
259
+ else {
260
+ if (!firstWrap.find('.switchSelect').length) {
261
+ if(set.errormsgPos == "top")firstWrap.before('<div class="switchError">'+set.errormsg1+'</div>');
262
+ else firstWrap.after('<div class="switchError">'+set.errormsg1+'</div>');
263
+ }
264
+ else {
265
+ if (!secondWrap.find('.switchSelect').length) {
266
+ if(set.errormsgPos == "top") secondWrap.before('<div class="switchError">'+set.errormsg2+'</div>');
267
+ else secondWrap.after('<div class="switchError">'+set.errormsg2+'</div>');
268
+ }
269
+ }
270
+ }
271
+
272
+
273
+ }
274
+
275
+ });
276
+
277
+
278
+ };
279
+
280
+ })(jQuery);
281
+
282
+ function loadImages(optionid, productId, attrId,isCatView) {
283
+ //get images of the product
284
+ jQuery.ajax({
285
+ 'url': '/imageswitcher/ajax/getdetailimages/',
286
+ 'type': 'post',
287
+ 'dataType': 'json',
288
+ 'data': 'productId=' + productId + '&optionVal=' + optionid + '&attrId=' + attrId + '&twoAttr=' + 'false' + '&isCatView=' + isCatView,
289
+ 'success': function (data) {
290
+ if (data.success == 'true') {
291
+ if(isCatView==0){
292
+ jQuery('.product-img-box').html(data.html);
293
+ jQuery('.super-attribute-select').val(optionid);
294
+ jQuery('.price').html(data.priceval);
295
+ }else{
296
+ var clickedItem = jQuery('.product-image-'+productId);
297
+ clickedItem.attr('src',data.html);
298
+ var detailViewLink = clickedItem.parent(0);
299
+ var detailViewUrl = detailViewLink.attr('href');
300
+ var url = detailViewUrl.split('?')[0]+'?prod_id='+data.productId;
301
+ detailViewLink.attr('href', url);
302
+ detailViewLink.parent(0).find('.product-name').find('a').attr('href', url);
303
+ jQuery('.super-attribute-select').val(optionid);
304
+ jQuery('#product-price-'+productId).find('price').html(data.priceval);
305
+ }
306
+ }
307
+ }
308
+ });
309
+ }
310
+
311
+ function loadSecondaryImages(optionid, productId, attrId, primaryAttrId, primaryOptionId,isCatView) {
312
+ //get images of the product
313
+ jQuery.ajax({
314
+ 'url': '/imageswitcher/ajax/getdetailimages/',
315
+ 'type': 'post',
316
+ 'dataType': 'json',
317
+ 'data': 'productId=' + productId + '&optionVal=' + optionid + '&attrId=' + attrId + '&twoAttr=' + 'true' + '&primaryAttrId=' + primaryAttrId + '&primaryOptionId=' + primaryOptionId+ '&isCatView=' + isCatView,
318
+ 'success': function (data) {
319
+ if (data.success == 'true') {
320
+ if(isCatView==0){
321
+ jQuery('.product-img-box').html(data.html);
322
+ jQuery('.super-attribute-select').val(optionid);
323
+ jQuery('.price').html(data.priceval);
324
+ }else{
325
+ var clickedItem = jQuery('.product-image-'+productId);
326
+ clickedItem.attr('src',data.html);
327
+ var detailViewLink = clickedItem.parent(0);
328
+ var detailViewUrl = detailViewLink.attr('href');
329
+ var url = detailViewUrl.split('?')[0]+'?prod_id='+data.productId;
330
+ detailViewLink.attr('href', url);
331
+ detailViewLink.parent(0).find('.product-name').find('a').attr('href', url);
332
+ jQuery('.super-attribute-select').val(optionid);
333
+ jQuery('#product-price-'+productId).find('.price').html(data.priceval);
334
+ }
335
+ }
336
+ }
337
+ });
338
+ }
339
+
skin/frontend/base/default/js/netstarter/imageswitcher/isconfigurable.js ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Created with JetBrains PhpStorm.
3
+ * User: duleep
4
+ * Date: 8/14/13
5
+ * Time: 12:05 PM
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+ /**
9
+ * Magento Enterprise Edition
10
+ *
11
+ * NOTICE OF LICENSE
12
+ *
13
+ * This source file is subject to the Magento Enterprise Edition License
14
+ * that is bundled with this package in the file LICENSE_EE.txt.
15
+ * It is also available through the world-wide-web at this URL:
16
+ * http://www.magentocommerce.com/license/enterprise-edition
17
+ * If you did not receive a copy of the license and are unable to
18
+ * obtain it through the world-wide-web, please send an email
19
+ * to license@magentocommerce.com so we can send you a copy immediately.
20
+ *
21
+ * DISCLAIMER
22
+ *
23
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
24
+ * versions in the future. If you wish to customize Magento for your
25
+ * needs please refer to http://www.magentocommerce.com for more information.
26
+ *
27
+ * @category Varien
28
+ * @package js
29
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
30
+ * @license http://www.magentocommerce.com/license/enterprise-edition
31
+ */
32
+ if (typeof Product == 'undefined') {
33
+ var Product = {};
34
+ }
35
+
36
+ /**************************** CONFIGURABLE PRODUCT **************************/
37
+ Product.IsConfig = Class.create();
38
+ Product.IsConfig.prototype = {
39
+ initialize: function(config){
40
+ this.config = config;
41
+ this.taxConfig = this.config.taxConfig;
42
+ if (config.containerId) {
43
+ this.settings = $$('#' + config.containerId + ' ' + '.super-attribute-select');
44
+ } else {
45
+ this.settings = $$('.super-attribute-select');
46
+ }
47
+ this.state = new Hash();
48
+ this.priceTemplate = new Template(this.config.template);
49
+ this.prices = config.prices;
50
+
51
+ // Set default values from config
52
+ if (config.defaultValues) {
53
+ this.values = config.defaultValues;
54
+ }
55
+
56
+ // Overwrite defaults by url
57
+ var separatorIndex = window.location.href.indexOf('#');
58
+ if (separatorIndex != -1) {
59
+ var paramsStr = window.location.href.substr(separatorIndex+1);
60
+ var urlValues = paramsStr.toQueryParams();
61
+ if (!this.values) {
62
+ this.values = {};
63
+ }
64
+ for (var i in urlValues) {
65
+ this.values[i] = urlValues[i];
66
+ }
67
+ }
68
+
69
+ // Overwrite defaults by inputs values if needed
70
+ if (config.inputsInitialized) {
71
+ this.values = {};
72
+ this.settings.each(function(element) {
73
+ if (element.value) {
74
+ var attributeId = element.id.replace(/[a-z]*/, '');
75
+ this.values[attributeId] = element.value;
76
+ }
77
+ }.bind(this));
78
+ }
79
+
80
+ // Put events to check select reloads
81
+ this.settings.each(function(element){
82
+ Event.observe(element, 'change', this.configure.bind(this))
83
+ }.bind(this));
84
+
85
+ // fill state
86
+ this.settings.each(function(element){
87
+ var attributeId = element.id.replace(/[a-z]*/, '');
88
+ if(attributeId && this.config.attributes[attributeId]) {
89
+ element.config = this.config.attributes[attributeId];
90
+ element.attributeId = attributeId;
91
+ this.state[attributeId] = false;
92
+ }
93
+ }.bind(this))
94
+
95
+ // Init settings dropdown
96
+ var childSettings = [];
97
+ for(var i=this.settings.length-1;i>=0;i--){
98
+ var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
99
+ var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
100
+ if (i == 0){
101
+ this.fillSelect(this.settings[i])
102
+ } else {
103
+ this.settings[i].disabled = true;
104
+ }
105
+ $(this.settings[i]).childSettings = childSettings.clone();
106
+ $(this.settings[i]).prevSetting = prevSetting;
107
+ $(this.settings[i]).nextSetting = nextSetting;
108
+ childSettings.push(this.settings[i]);
109
+ }
110
+
111
+ // Set values to inputs
112
+ this.configureForValues();
113
+ document.observe("dom:loaded", this.configureForValues.bind(this));
114
+ },
115
+
116
+ configureForValues: function () {
117
+ if (this.values) {
118
+ this.settings.each(function(element){
119
+ var attributeId = element.attributeId;
120
+ element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId];
121
+ this.configureElement(element);
122
+ }.bind(this));
123
+ }
124
+ },
125
+
126
+ configure: function(event){
127
+ var element = Event.element(event);
128
+ this.configureElement(element);
129
+ },
130
+
131
+ configureElement : function(element) {
132
+ this.reloadOptionLabels(element);
133
+ if(element.value){
134
+ this.state[element.config.id] = element.value;
135
+ if(element.nextSetting){
136
+ element.nextSetting.disabled = false;
137
+ this.fillSelect(element.nextSetting);
138
+ this.resetChildren(element.nextSetting);
139
+ }
140
+ }
141
+ else {
142
+ this.resetChildren(element);
143
+ }
144
+ this.reloadPrice();
145
+ },
146
+
147
+ reloadOptionLabels: function(element){
148
+ var selectedPrice;
149
+ if(element.options[element.selectedIndex].config && !this.config.stablePrices){
150
+ selectedPrice = parseFloat(element.options[element.selectedIndex].config.price)
151
+ }
152
+ else{
153
+ selectedPrice = 0;
154
+ }
155
+ for(var i=0;i<element.options.length;i++){
156
+ if(element.options[i].config){
157
+ element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice);
158
+ }
159
+ }
160
+ },
161
+
162
+ resetChildren : function(element){
163
+ if(element.childSettings) {
164
+ for(var i=0;i<element.childSettings.length;i++){
165
+ element.childSettings[i].selectedIndex = 0;
166
+ element.childSettings[i].disabled = true;
167
+ if(element.config){
168
+ this.state[element.config.id] = false;
169
+ }
170
+ }
171
+ }
172
+ },
173
+
174
+ fillSelect: function(element){
175
+ var attributeId = element.id.replace(/[a-z]*/, '');
176
+ var options = this.getAttributeOptions(attributeId);
177
+ this.clearSelect(element);
178
+ element.options[0] = new Option('', '');
179
+ element.options[0].innerHTML = this.config.chooseText;
180
+
181
+ var prevConfig = false;
182
+ if(element.prevSetting){
183
+ prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
184
+ }
185
+
186
+ if(options) {
187
+ var index = 1;
188
+ for(var i=0;i<options.length;i++){
189
+ var allowedProducts = [];
190
+ if(prevConfig) {
191
+ for(var j=0;j<options[i].products.length;j++){
192
+ if(prevConfig.config.allowedProducts
193
+ && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
194
+ allowedProducts.push(options[i].products[j]);
195
+ }
196
+ }
197
+ } else {
198
+ allowedProducts = options[i].products.clone();
199
+ }
200
+
201
+ if(allowedProducts.size()>0){
202
+ options[i].allowedProducts = allowedProducts;
203
+ element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id);
204
+ if (typeof options[i].price != 'undefined') {
205
+ element.options[index].setAttribute('price', options[i].price);
206
+ }
207
+ element.options[index].config = options[i];
208
+ index++;
209
+ }
210
+ }
211
+ }
212
+ },
213
+
214
+ getOptionLabel: function(option, price){
215
+ var price = parseFloat(price);
216
+ if (this.taxConfig.includeTax) {
217
+ var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax;
218
+ var excl = price - tax;
219
+ var incl = excl*(1+(this.taxConfig.currentTax/100));
220
+ } else {
221
+ var tax = price * (this.taxConfig.currentTax / 100);
222
+ var excl = price;
223
+ var incl = excl + tax;
224
+ }
225
+
226
+ if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) {
227
+ price = incl;
228
+ } else {
229
+ price = excl;
230
+ }
231
+
232
+ var str = option.label;
233
+ if(price){
234
+ if (this.taxConfig.showBothPrices) {
235
+ str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')';
236
+ } else {
237
+ str+= ' ' + this.formatPrice(price, true);
238
+ }
239
+ }
240
+ return str;
241
+ },
242
+
243
+ formatPrice: function(price, showSign){
244
+ var str = '';
245
+ price = parseFloat(price);
246
+ if(showSign){
247
+ if(price<0){
248
+ str+= '-';
249
+ price = -price;
250
+ }
251
+ else{
252
+ str+= '+';
253
+ }
254
+ }
255
+
256
+ var roundedPrice = (Math.round(price*100)/100).toString();
257
+
258
+ if (this.prices && this.prices[roundedPrice]) {
259
+ str+= this.prices[roundedPrice];
260
+ }
261
+ else {
262
+ str+= this.priceTemplate.evaluate({price:price.toFixed(2)});
263
+ }
264
+ return str;
265
+ },
266
+
267
+ clearSelect: function(element){
268
+ for(var i=element.options.length-1;i>=0;i--){
269
+ element.remove(i);
270
+ }
271
+ },
272
+
273
+ getAttributeOptions: function(attributeId){
274
+ if(this.config.attributes[attributeId]){
275
+ return this.config.attributes[attributeId].options;
276
+ }
277
+ },
278
+
279
+ reloadPrice: function(){
280
+ if (this.config.disablePriceReload) {
281
+ return;
282
+ }
283
+ var price = 0;
284
+ var oldPrice = 0;
285
+ for(var i=this.settings.length-1;i>=0;i--){
286
+ var selected = this.settings[i].options[this.settings[i].selectedIndex];
287
+ if(selected.config){
288
+ price += parseFloat(selected.config.price);
289
+ oldPrice += parseFloat(selected.config.oldPrice);
290
+ }
291
+ }
292
+
293
+ optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
294
+ optionsPrice.reload();
295
+
296
+ return price;
297
+
298
+ if($('product-price-'+this.config.productId)){
299
+ $('product-price-'+this.config.productId).innerHTML = price;
300
+ }
301
+ this.reloadOldPrice();
302
+ },
303
+
304
+ reloadOldPrice: function(){
305
+ if (this.config.disablePriceReload) {
306
+ return;
307
+ }
308
+ if ($('old-price-'+this.config.productId)) {
309
+
310
+ var price = parseFloat(this.config.oldPrice);
311
+ for(var i=this.settings.length-1;i>=0;i--){
312
+ var selected = this.settings[i].options[this.settings[i].selectedIndex];
313
+ if(selected.config){
314
+ price+= parseFloat(selected.config.price);
315
+ }
316
+ }
317
+ if (price < 0)
318
+ price = 0;
319
+ price = this.formatPrice(price);
320
+
321
+ if($('old-price-'+this.config.productId)){
322
+ $('old-price-'+this.config.productId).innerHTML = price;
323
+ }
324
+
325
+ }
326
+ }
327
+ }
328
+
329
+ jQuery(function () {
330
+ jQuery('.swatch-img').live('click',function () {
331
+ var colorSelected = jQuery(this).attr('title');
332
+ var productId = jQuery('[name=product]').val();
333
+ var colorId = jQuery(this).attr('color_id');
334
+ var configProdVal = JSON.parse(jQuery("#jsonVal").val());
335
+ var attributeId = jQuery(this).attr('id').replace(/[a-z]*/, '');
336
+ /*var colorId = '';
337
+ var color = '';
338
+ jQuery(this).parent().parent().children('select').each(function () {
339
+ jQuery(this).children("option").each(function () {
340
+ if (colorSelected == jQuery(this).html()) {
341
+ colorId = jQuery(this).val();
342
+ color = jQuery(this).html();
343
+ }
344
+ });
345
+ });*/
346
+
347
+ //get images of the product
348
+ jQuery.ajax({
349
+ 'url': '/imageswitcher/ajax/getdetailimages/',
350
+ 'type': 'post',
351
+ 'dataType':'json',
352
+ 'data': 'productId=' + productId + '&colorVal=' + colorId +'&attrId=' + attributeId,
353
+ 'success': function (data) {
354
+ if (data.success=='true') {
355
+ jQuery('.product-img-box').html(data.html);
356
+ //alert(configProdVal.attributes[92].options[0].label);
357
+ //for(i=0;i==configProdVal.attributes[92].options.length)
358
+ jQuery('.super-attribute-select').val(colorId);
359
+ //jQuery('.super-attribute-select').trigger('change');
360
+ jQuery('.price').html(data.priceval);
361
+ }
362
+ }
363
+ });
364
+ });
365
+ });
skin/frontend/base/default/js/netstarter/imageswitcher/listconfigurable.js ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Created with JetBrains PhpStorm.
3
+ * User: duleep
4
+ * Date: 9/10/13
5
+ * Time: 9:33 AM
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+ if(typeof ListConfig_Product =='undefined') {
9
+ var ListConfig_Product = {};
10
+ }
11
+
12
+ /**************************** CONFIGURABLE PRODUCT **************************/
13
+ ListConfig_Product.Config = Class.create();
14
+ ListConfig_Product.Config.prototype = {
15
+ initialize: function(config){
16
+ this.config = config;
17
+ this.taxConfig = this.config.taxConfig;
18
+ var settingsClassToSelect = '.super-attribute-select_'+this.config.productId;
19
+ this.settings = $$(settingsClassToSelect);
20
+ this.state = new Hash();
21
+ this.priceTemplate = new Template(this.config.template);
22
+ this.prices = config.prices;
23
+
24
+ this.settings.each(function(element){
25
+ Event.observe(element, 'change', this.configure.bind(this))
26
+ }.bind(this));
27
+
28
+ // fill state
29
+ this.settings.each(function(element){
30
+ var attributeId = element.id.replace(/[a-z]*/, '');
31
+ attributeId = attributeId.replace(/_.*/, '');
32
+ if(attributeId && this.config.attributes[attributeId]) {
33
+ element.config = this.config.attributes[attributeId];
34
+ element.attributeId = attributeId;
35
+ this.state[attributeId] = false;
36
+ }
37
+ }.bind(this))
38
+
39
+ // Init settings dropdown
40
+ var childSettings = [];
41
+ for(var i=this.settings.length-1;i>=0;i--){
42
+ var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
43
+ var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
44
+ if(i==0){
45
+ this.fillSelect(this.settings[i])
46
+ }
47
+ else {
48
+ this.settings[i].disabled=true;
49
+ }
50
+ $(this.settings[i]).childSettings = childSettings.clone();
51
+ $(this.settings[i]).prevSetting = prevSetting;
52
+ $(this.settings[i]).nextSetting = nextSetting;
53
+ childSettings.push(this.settings[i]);
54
+ }
55
+
56
+ // Set default values - from config and overwrite them by url values
57
+ if (config.defaultValues) {
58
+ this.values = config.defaultValues;
59
+ }
60
+
61
+ var separatorIndex = window.location.href.indexOf('#');
62
+ if (separatorIndex != -1) {
63
+ var paramsStr = window.location.href.substr(separatorIndex+1);
64
+ var urlValues = paramsStr.toQueryParams();
65
+ if (!this.values) {
66
+ this.values = {};
67
+ }
68
+ for (var i in urlValues) {
69
+ this.values[i] = urlValues[i];
70
+ }
71
+ }
72
+
73
+ this.configureForValues();
74
+ document.observe("dom:loaded", this.configureForValues.bind(this));
75
+ },
76
+
77
+ configureForValues: function () {
78
+ if (this.values) {
79
+ this.settings.each(function(element){
80
+ var attributeId = element.attributeId;
81
+ element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId];
82
+ this.configureElement(element);
83
+ }.bind(this));
84
+ }
85
+ },
86
+
87
+ configure: function(event){
88
+ var element = Event.element(event);
89
+ this.configureElement(element);
90
+ },
91
+
92
+ configureElement : function(element) {
93
+ this.reloadOptionLabels(element);
94
+ if(element.value){
95
+ this.state[element.config.id] = element.value;
96
+ if(element.nextSetting){
97
+ element.nextSetting.disabled = false;
98
+ this.fillSelect(element.nextSetting);
99
+ this.resetChildren(element.nextSetting);
100
+ }
101
+ }
102
+ else {
103
+ this.resetChildren(element);
104
+ }
105
+ //this.reloadPrice();
106
+ // Calculator.updatePrice();
107
+ },
108
+
109
+ reloadOptionLabels: function(element){
110
+ var selectedPrice;
111
+ //console.log(element.selectedIndex);
112
+ if(element.selectedIndex != -1 && element.options[element.selectedIndex].config){
113
+ selectedPrice = parseFloat(element.options[element.selectedIndex].config.price)
114
+ }
115
+ else{
116
+ selectedPrice = 0;
117
+ }
118
+ for(var i=0;i<element.options.length;i++){
119
+ if(element.options[i].config){
120
+ element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice);
121
+ }
122
+ }
123
+ },
124
+
125
+ resetChildren : function(element){
126
+ if(element.childSettings) {
127
+ for(var i=0;i<element.childSettings.length;i++){
128
+ element.childSettings[i].selectedIndex = 0;
129
+ element.childSettings[i].disabled = true;
130
+ if(element.config){
131
+ this.state[element.config.id] = false;
132
+ }
133
+ }
134
+ }
135
+ },
136
+
137
+ fillSelect: function(element){
138
+ var attributeId = element.id.replace(/[a-z]*/, '');
139
+ attributeId = attributeId.replace(/_.*/, '');
140
+ var options = this.getAttributeOptions(attributeId);
141
+ this.clearSelect(element);
142
+ element.options[0] = new Option(this.config.chooseText, '');
143
+
144
+ var prevConfig = false;
145
+ if(element.prevSetting){
146
+ prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
147
+ }
148
+ imagePathArray = [];
149
+ if(options) {
150
+ var index = 1;
151
+ for(var i=0;i<options.length;i++){
152
+ var allowedProducts = [];
153
+ if(prevConfig) {
154
+ for(var j=0;j<options[i].products.length;j++){
155
+ if(prevConfig.config.allowedProducts
156
+ && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
157
+ allowedProducts.push(options[i].products[j]);
158
+ }
159
+ }
160
+ } else {
161
+ allowedProducts = options[i].products.clone();
162
+ }
163
+
164
+ if(allowedProducts.size()>0){
165
+ options[i].allowedProducts = allowedProducts;
166
+ element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id);
167
+ //element.options[index].setAttribute('imagePath', options[i].imagePath);
168
+ //imagePathArray.push(options[i].imagePath);
169
+ element.options[index].config = options[i];
170
+ index++;
171
+ }
172
+ }
173
+ }
174
+ //this.loadOptionImages(imagePathArray,attributeId);
175
+ },
176
+
177
+ getOptionLabel: function(option, price){
178
+ var price = parseFloat(price);
179
+ if (this.taxConfig.includeTax) {
180
+ var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax;
181
+ var excl = price - tax;
182
+ var incl = excl*(1+(this.taxConfig.currentTax/100));
183
+ } else {
184
+ var tax = price * (this.taxConfig.currentTax / 100);
185
+ var excl = price;
186
+ var incl = excl + tax;
187
+ }
188
+
189
+ if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) {
190
+ price = incl;
191
+ } else {
192
+ price = excl;
193
+ }
194
+
195
+ var str = option.label;
196
+ if(price){
197
+ if (this.taxConfig.showBothPrices) {
198
+ str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')';
199
+ } else {
200
+ str+= ' ' + this.formatPrice(price, true);
201
+ }
202
+ }
203
+ return str;
204
+ },
205
+
206
+ formatPrice: function(price, showSign){
207
+ var str = '';
208
+ price = parseFloat(price);
209
+ if(showSign){
210
+ if(price<0){
211
+ str+= '-';
212
+ price = -price;
213
+ }
214
+ else{
215
+ str+= '+';
216
+ }
217
+ }
218
+
219
+ var roundedPrice = (Math.round(price*100)/100).toString();
220
+
221
+ if (this.prices && this.prices[roundedPrice]) {
222
+ str+= this.prices[roundedPrice];
223
+ }
224
+ else {
225
+ str+= this.priceTemplate.evaluate({price:price.toFixed(2)});
226
+ }
227
+ return str;
228
+ },
229
+
230
+ clearSelect: function(element){
231
+ for(var i=element.options.length-1;i>=0;i--){
232
+ element.remove(i);
233
+ }
234
+ },
235
+
236
+ getAttributeOptions: function(attributeId){
237
+ if(this.config.attributes[attributeId]){
238
+ return this.config.attributes[attributeId].options;
239
+ }
240
+ },
241
+
242
+ reloadPrice: function(){
243
+ var price = 0;
244
+ var oldPrice = 0;
245
+ for(var i=this.settings.length-1;i>=0;i--){
246
+ var selected = this.settings[i].options[this.settings[i].selectedIndex];
247
+ if(selected.config){
248
+ price += parseFloat(selected.config.price);
249
+ oldPrice += parseFloat(selected.config.oldPrice);
250
+ }
251
+ }
252
+
253
+ optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
254
+ optionsPrice.reload();
255
+
256
+ return price;
257
+
258
+ if($('product-price-'+this.config.productId)){
259
+ $('product-price-'+this.config.productId).innerHTML = price;
260
+ }
261
+ this.reloadOldPrice();
262
+ },
263
+
264
+ reloadOldPrice: function(){
265
+ if ($('old-price-'+this.config.productId)) {
266
+
267
+ var price = parseFloat(this.config.oldPrice);
268
+ for(var i=this.settings.length-1;i>=0;i--){
269
+ var selected = this.settings[i].options[this.settings[i].selectedIndex];
270
+ if(selected.config){
271
+ price+= parseFloat(selected.config.price);
272
+ }
273
+ }
274
+ if (price < 0)
275
+ price = 0;
276
+ price = this.formatPrice(price);
277
+
278
+ if($('old-price-'+this.config.productId)){
279
+ $('old-price-'+this.config.productId).innerHTML = price;
280
+ }
281
+
282
+ }
283
+ }
284
+ }
skin/frontend/base/default/js/netstarter/jqzoom/jquery-1.3.1.min.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery JavaScript Library v1.3.1
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright (c) 2009 John Resig
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://docs.jquery.com/License
8
+ *
9
+ * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
10
+ * Revision: 6158
11
+ */
12
+ (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.makeArray(E))},selector:"",jquery:"1.3.1",size:function(){return this.length},get:function(E){return E===g?o.makeArray(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,find:function(E){if(this.length===1&&!/,/.test(E)){var G=this.pushStack([],"find",E);G.length=0;o.find(E,this[0],G);return G}else{var F=o.map(this,function(H){return o.find(E,H)});return this.pushStack(/[^+>] [^+>]/.test(E)?o.unique(F):F,"find",E)}},clone:function(F){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.cloneNode(true),H=document.createElement("div");H.appendChild(I);return o.clean([H.innerHTML])[0]}else{return this.cloneNode(true)}});var G=E.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(F===true){this.find("*").andSelf().each(function(I){if(this.nodeType==3){return}var H=o.data(this,"events");for(var K in H){for(var J in H[K]){o.event.add(G[I],K,H[K][J],H[K][J].data)}}})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var F=o.expr.match.POS.test(E)?o(E):null;return this.map(function(){var G=this;while(G&&G.ownerDocument){if(F?F.index(G)>-1:o(G).is(E)){return G}G=G.parentNode}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML:null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(K,N,M){if(this[0]){var J=(this[0].ownerDocument||this[0]).createDocumentFragment(),G=o.clean(K,(this[0].ownerDocument||this[0]),J),I=J.firstChild,E=this.length>1?J.cloneNode(true):J;if(I){for(var H=0,F=this.length;H<F;H++){M.call(L(this[H],I),H>0?E.cloneNode(true):J)}}if(G){o.each(G,z)}}return this;function L(O,P){return N&&o.nodeName(O,"table")&&o.nodeName(P,"tr")?(O.getElementsByTagName("tbody")[0]||O.appendChild(O.ownerDocument.createElement("tbody"))):O}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){G=o.trim(G);if(G){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(G,E,I){if(E=="width"||E=="height"){var K,F={position:"absolute",visibility:"hidden",display:"block"},J=E=="width"?["Left","Right"]:["Top","Bottom"];function H(){K=E=="width"?G.offsetWidth:G.offsetHeight;var M=0,L=0;o.each(J,function(){M+=parseFloat(o.curCSS(G,"padding"+this,true))||0;L+=parseFloat(o.curCSS(G,"border"+this+"Width",true))||0});K-=Math.round(M+L)}if(o(G).is(":visible")){H()}else{o.swap(G,F,H)}return Math.max(0,K)}return o.curCSS(G,E,I)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,R){if(typeof R==="number"){R+=""}if(!R){return}if(typeof R==="string"){R=R.replace(/(<(\w+)[^>]*?)\/>/g,function(T,U,S){return S.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?T:U+"></"+S+">"});var O=o.trim(R).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+R+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var N=!O.indexOf("<table")&&O.indexOf("<tbody")<0?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&O.indexOf("<tbody")<0?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(R)){L.insertBefore(K.createTextNode(R.match(/^\s*/)[0]),L.firstChild)}R=o.makeArray(L.childNodes)}if(R.nodeType){G.push(R)}else{G=o.merge(G,R)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(){var G=arguments;return this.each(function(){for(var H=0,I=G.length;H<I;H++){o(G[H])[F](this)}})}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
13
+ /*
14
+ * Sizzle CSS Selector Engine - v0.9.3
15
+ * Copyright 2009, The Dojo Foundation
16
+ * Released under the MIT, BSD, and GPL Licenses.
17
+ * More information: http://sizzlejs.com/
18
+ */
19
+ (function(){var Q=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,K=0,G=Object.prototype.toString;var F=function(X,T,aa,ab){aa=aa||[];T=T||document;if(T.nodeType!==1&&T.nodeType!==9){return[]}if(!X||typeof X!=="string"){return aa}var Y=[],V,ae,ah,S,ac,U,W=true;Q.lastIndex=0;while((V=Q.exec(X))!==null){Y.push(V[1]);if(V[2]){U=RegExp.rightContext;break}}if(Y.length>1&&L.exec(X)){if(Y.length===2&&H.relative[Y[0]]){ae=I(Y[0]+Y[1],T)}else{ae=H.relative[Y[0]]?[T]:F(Y.shift(),T);while(Y.length){X=Y.shift();if(H.relative[X]){X+=Y.shift()}ae=I(X,ae)}}}else{var ad=ab?{expr:Y.pop(),set:E(ab)}:F.find(Y.pop(),Y.length===1&&T.parentNode?T.parentNode:T,P(T));ae=F.filter(ad.expr,ad.set);if(Y.length>0){ah=E(ae)}else{W=false}while(Y.length){var ag=Y.pop(),af=ag;if(!H.relative[ag]){ag=""}else{af=Y.pop()}if(af==null){af=T}H.relative[ag](ah,af,P(T))}}if(!ah){ah=ae}if(!ah){throw"Syntax error, unrecognized expression: "+(ag||X)}if(G.call(ah)==="[object Array]"){if(!W){aa.push.apply(aa,ah)}else{if(T.nodeType===1){for(var Z=0;ah[Z]!=null;Z++){if(ah[Z]&&(ah[Z]===true||ah[Z].nodeType===1&&J(T,ah[Z]))){aa.push(ae[Z])}}}else{for(var Z=0;ah[Z]!=null;Z++){if(ah[Z]&&ah[Z].nodeType===1){aa.push(ae[Z])}}}}}else{E(ah,aa)}if(U){F(U,T,aa,ab)}return aa};F.matches=function(S,T){return F(S,null,null,T)};F.find=function(Z,S,aa){var Y,W;if(!Z){return[]}for(var V=0,U=H.order.length;V<U;V++){var X=H.order[V],W;if((W=H.match[X].exec(Z))){var T=RegExp.leftContext;if(T.substr(T.length-1)!=="\\"){W[1]=(W[1]||"").replace(/\\/g,"");Y=H.find[X](W,S,aa);if(Y!=null){Z=Z.replace(H.match[X],"");break}}}}if(!Y){Y=S.getElementsByTagName("*")}return{set:Y,expr:Z}};F.filter=function(ab,aa,ae,V){var U=ab,ag=[],Y=aa,X,S;while(ab&&aa.length){for(var Z in H.filter){if((X=H.match[Z].exec(ab))!=null){var T=H.filter[Z],af,ad;S=false;if(Y==ag){ag=[]}if(H.preFilter[Z]){X=H.preFilter[Z](X,Y,ae,ag,V);if(!X){S=af=true}else{if(X===true){continue}}}if(X){for(var W=0;(ad=Y[W])!=null;W++){if(ad){af=T(ad,X,W,Y);var ac=V^!!af;if(ae&&af!=null){if(ac){S=true}else{Y[W]=false}}else{if(ac){ag.push(ad);S=true}}}}}if(af!==g){if(!ae){Y=ag}ab=ab.replace(H.match[Z],"");if(!S){return[]}break}}}ab=ab.replace(/\s*,\s*/,"");if(ab==U){if(S==null){throw"Syntax error, unrecognized expression: "+ab}else{break}}U=ab}return Y};var H=F.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|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(S){return S.getAttribute("href")}},relative:{"+":function(W,T){for(var U=0,S=W.length;U<S;U++){var V=W[U];if(V){var X=V.previousSibling;while(X&&X.nodeType!==1){X=X.previousSibling}W[U]=typeof T==="string"?X||false:X===T}}if(typeof T==="string"){F.filter(T,W,true)}},">":function(X,T,Y){if(typeof T==="string"&&!/\W/.test(T)){T=Y?T:T.toUpperCase();for(var U=0,S=X.length;U<S;U++){var W=X[U];if(W){var V=W.parentNode;X[U]=V.nodeName===T?V:false}}}else{for(var U=0,S=X.length;U<S;U++){var W=X[U];if(W){X[U]=typeof T==="string"?W.parentNode:W.parentNode===T}}if(typeof T==="string"){F.filter(T,X,true)}}},"":function(V,T,X){var U="done"+(K++),S=R;if(!T.match(/\W/)){var W=T=X?T:T.toUpperCase();S=O}S("parentNode",T,U,V,W,X)},"~":function(V,T,X){var U="done"+(K++),S=R;if(typeof T==="string"&&!T.match(/\W/)){var W=T=X?T:T.toUpperCase();S=O}S("previousSibling",T,U,V,W,X)}},find:{ID:function(T,U,V){if(typeof U.getElementById!=="undefined"&&!V){var S=U.getElementById(T[1]);return S?[S]:[]}},NAME:function(S,T,U){if(typeof T.getElementsByName!=="undefined"&&!U){return T.getElementsByName(S[1])}},TAG:function(S,T){return T.getElementsByTagName(S[1])}},preFilter:{CLASS:function(V,T,U,S,Y){V=" "+V[1].replace(/\\/g,"")+" ";var X;for(var W=0;(X=T[W])!=null;W++){if(X){if(Y^(" "+X.className+" ").indexOf(V)>=0){if(!U){S.push(X)}}else{if(U){T[W]=false}}}}return false},ID:function(S){return S[1].replace(/\\/g,"")},TAG:function(T,S){for(var U=0;S[U]===false;U++){}return S[U]&&P(S[U])?T[1]:T[1].toUpperCase()},CHILD:function(S){if(S[1]=="nth"){var T=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(S[2]=="even"&&"2n"||S[2]=="odd"&&"2n+1"||!/\D/.test(S[2])&&"0n+"+S[2]||S[2]);S[2]=(T[1]+(T[2]||1))-0;S[3]=T[3]-0}S[0]="done"+(K++);return S},ATTR:function(T){var S=T[1].replace(/\\/g,"");if(H.attrMap[S]){T[1]=H.attrMap[S]}if(T[2]==="~="){T[4]=" "+T[4]+" "}return T},PSEUDO:function(W,T,U,S,X){if(W[1]==="not"){if(W[3].match(Q).length>1){W[3]=F(W[3],null,null,T)}else{var V=F.filter(W[3],T,U,true^X);if(!U){S.push.apply(S,V)}return false}}else{if(H.match.POS.test(W[0])){return true}}return W},POS:function(S){S.unshift(true);return S}},filters:{enabled:function(S){return S.disabled===false&&S.type!=="hidden"},disabled:function(S){return S.disabled===true},checked:function(S){return S.checked===true},selected:function(S){S.parentNode.selectedIndex;return S.selected===true},parent:function(S){return !!S.firstChild},empty:function(S){return !S.firstChild},has:function(U,T,S){return !!F(S[3],U).length},header:function(S){return/h\d/i.test(S.nodeName)},text:function(S){return"text"===S.type},radio:function(S){return"radio"===S.type},checkbox:function(S){return"checkbox"===S.type},file:function(S){return"file"===S.type},password:function(S){return"password"===S.type},submit:function(S){return"submit"===S.type},image:function(S){return"image"===S.type},reset:function(S){return"reset"===S.type},button:function(S){return"button"===S.type||S.nodeName.toUpperCase()==="BUTTON"},input:function(S){return/input|select|textarea|button/i.test(S.nodeName)}},setFilters:{first:function(T,S){return S===0},last:function(U,T,S,V){return T===V.length-1},even:function(T,S){return S%2===0},odd:function(T,S){return S%2===1},lt:function(U,T,S){return T<S[3]-0},gt:function(U,T,S){return T>S[3]-0},nth:function(U,T,S){return S[3]-0==T},eq:function(U,T,S){return S[3]-0==T}},filter:{CHILD:function(S,V){var Y=V[1],Z=S.parentNode;var X=V[0];if(Z&&(!Z[X]||!S.nodeIndex)){var W=1;for(var T=Z.firstChild;T;T=T.nextSibling){if(T.nodeType==1){T.nodeIndex=W++}}Z[X]=W-1}if(Y=="first"){return S.nodeIndex==1}else{if(Y=="last"){return S.nodeIndex==Z[X]}else{if(Y=="only"){return Z[X]==1}else{if(Y=="nth"){var ab=false,U=V[2],aa=V[3];if(U==1&&aa==0){return true}if(U==0){if(S.nodeIndex==aa){ab=true}}else{if((S.nodeIndex-aa)%U==0&&(S.nodeIndex-aa)/U>=0){ab=true}}return ab}}}}},PSEUDO:function(Y,U,V,Z){var T=U[1],W=H.filters[T];if(W){return W(Y,V,U,Z)}else{if(T==="contains"){return(Y.textContent||Y.innerText||"").indexOf(U[3])>=0}else{if(T==="not"){var X=U[3];for(var V=0,S=X.length;V<S;V++){if(X[V]===Y){return false}}return true}}}},ID:function(T,S){return T.nodeType===1&&T.getAttribute("id")===S},TAG:function(T,S){return(S==="*"&&T.nodeType===1)||T.nodeName===S},CLASS:function(T,S){return S.test(T.className)},ATTR:function(W,U){var S=H.attrHandle[U[1]]?H.attrHandle[U[1]](W):W[U[1]]||W.getAttribute(U[1]),X=S+"",V=U[2],T=U[4];return S==null?V==="!=":V==="="?X===T:V==="*="?X.indexOf(T)>=0:V==="~="?(" "+X+" ").indexOf(T)>=0:!U[4]?S:V==="!="?X!=T:V==="^="?X.indexOf(T)===0:V==="$="?X.substr(X.length-T.length)===T:V==="|="?X===T||X.substr(0,T.length+1)===T+"-":false},POS:function(W,T,U,X){var S=T[2],V=H.setFilters[S];if(V){return V(W,U,T,X)}}}};var L=H.match.POS;for(var N in H.match){H.match[N]=RegExp(H.match[N].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(T,S){T=Array.prototype.slice.call(T);if(S){S.push.apply(S,T);return S}return T};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(M){E=function(W,V){var T=V||[];if(G.call(W)==="[object Array]"){Array.prototype.push.apply(T,W)}else{if(typeof W.length==="number"){for(var U=0,S=W.length;U<S;U++){T.push(W[U])}}else{for(var U=0;W[U];U++){T.push(W[U])}}}return T}}(function(){var T=document.createElement("form"),U="script"+(new Date).getTime();T.innerHTML="<input name='"+U+"'/>";var S=document.documentElement;S.insertBefore(T,S.firstChild);if(!!document.getElementById(U)){H.find.ID=function(W,X,Y){if(typeof X.getElementById!=="undefined"&&!Y){var V=X.getElementById(W[1]);return V?V.id===W[1]||typeof V.getAttributeNode!=="undefined"&&V.getAttributeNode("id").nodeValue===W[1]?[V]:g:[]}};H.filter.ID=function(X,V){var W=typeof X.getAttributeNode!=="undefined"&&X.getAttributeNode("id");return X.nodeType===1&&W&&W.nodeValue===V}}S.removeChild(T)})();(function(){var S=document.createElement("div");S.appendChild(document.createComment(""));if(S.getElementsByTagName("*").length>0){H.find.TAG=function(T,X){var W=X.getElementsByTagName(T[1]);if(T[1]==="*"){var V=[];for(var U=0;W[U];U++){if(W[U].nodeType===1){V.push(W[U])}}W=V}return W}}S.innerHTML="<a href='#'></a>";if(S.firstChild&&S.firstChild.getAttribute("href")!=="#"){H.attrHandle.href=function(T){return T.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var S=F,T=document.createElement("div");T.innerHTML="<p class='TEST'></p>";if(T.querySelectorAll&&T.querySelectorAll(".TEST").length===0){return}F=function(X,W,U,V){W=W||document;if(!V&&W.nodeType===9&&!P(W)){try{return E(W.querySelectorAll(X),U)}catch(Y){}}return S(X,W,U,V)};F.find=S.find;F.filter=S.filter;F.selectors=S.selectors;F.matches=S.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){H.order.splice(1,0,"CLASS");H.find.CLASS=function(S,T){return T.getElementsByClassName(S[1])}}function O(T,Z,Y,ac,aa,ab){for(var W=0,U=ac.length;W<U;W++){var S=ac[W];if(S){S=S[T];var X=false;while(S&&S.nodeType){var V=S[Y];if(V){X=ac[V];break}if(S.nodeType===1&&!ab){S[Y]=W}if(S.nodeName===Z){X=S;break}S=S[T]}ac[W]=X}}}function R(T,Y,X,ab,Z,aa){for(var V=0,U=ab.length;V<U;V++){var S=ab[V];if(S){S=S[T];var W=false;while(S&&S.nodeType){if(S[X]){W=ab[S[X]];break}if(S.nodeType===1){if(!aa){S[X]=V}if(typeof Y!=="string"){if(S===Y){W=true;break}}else{if(F.filter(Y,[S]).length>0){W=S;break}}}S=S[T]}ab[V]=W}}}var J=document.compareDocumentPosition?function(T,S){return T.compareDocumentPosition(S)&16}:function(T,S){return T!==S&&(T.contains?T.contains(S):true)};var P=function(S){return S.nodeType===9&&S.documentElement.nodeName!=="HTML"||!!S.ownerDocument&&P(S.ownerDocument)};var I=function(S,Z){var V=[],W="",X,U=Z.nodeType?[Z]:Z;while((X=H.match.PSEUDO.exec(S))){W+=X[0];S=S.replace(H.match.PSEUDO,"")}S=H.relative[S]?S+"*":S;for(var Y=0,T=U.length;Y<T;Y++){F(S,U[Y],V)}return F.filter(W,V)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(S){return"hidden"===S.type||o.css(S,"display")==="none"||o.css(S,"visibility")==="hidden"};F.selectors.filters.visible=function(S){return"hidden"!==S.type&&o.css(S,"display")!=="none"&&o.css(S,"visibility")!=="hidden"};F.selectors.filters.animated=function(S){return o.grep(o.timers,function(T){return S===T.elem}).length};o.multiFilter=function(U,S,T){if(T){U=":not("+U+")"}return F.matches(U,S)};o.dir=function(U,T){var S=[],V=U[T];while(V&&V!=document){if(V.nodeType==1){S.push(V)}V=V[T]}return S};o.nth=function(W,S,U,V){S=S||1;var T=0;for(;W;W=W[U]){if(W.nodeType==1&&++T==S){break}}return W};o.sibling=function(U,T){var S=[];for(;U;U=U.nextSibling){if(U.nodeType==1&&U!=T){S.push(U)}}return S};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){G=false}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&typeof l.frameElement==="undefined"){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width="1px";L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L)})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}this[H].style.display=o.data(this[H],"olddisplay",K)}}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)==1){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n)}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<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>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(H,F){var E=H?"Left":"Top",G=H?"Right":"Bottom";o.fn["inner"+F]=function(){return this[F.toLowerCase()]()+j(this,"padding"+E)+j(this,"padding"+G)};o.fn["outer"+F]=function(J){return this["inner"+F]()+j(this,"border"+E+"Width")+j(this,"border"+G+"Width")+(J?j(this,"margin"+E)+j(this,"margin"+G):0)};var I=F.toLowerCase();o.fn[I]=function(J){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+F]||document.body["client"+F]:this[0]==document?Math.max(document.documentElement["client"+F],document.body["scroll"+F],document.documentElement["scroll"+F],document.body["offset"+F],document.documentElement["offset"+F]):J===g?(this.length?o.css(this[0],I):null):this.css(I,typeof J==="string"?J:J+"px")}})})();
20
+
21
+ jQuery.noConflict();
skin/frontend/base/default/js/netstarter/jqzoom/jquery.jqzoom1.0.1.js ADDED
@@ -0,0 +1,1141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * JQZoom Evolution 1.0.1 - Javascript Image magnifier
3
+ *
4
+ * Copyright (c) Engineer Renzi Marco(www.mind-projects.it)
5
+ *
6
+ * $Date: 12-12-2008
7
+ *
8
+ * ChangeLog:
9
+ *
10
+ * $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me(renzi.mrc@gmail.com).
11
+ */
12
+ (function($)
13
+ {
14
+ $.fn.jqzoom = function(options)
15
+ {
16
+ var settings = {
17
+ zoomType: 'standard', //standard/reverse/innerzoom
18
+ zoomWidth: 200, //zoomed width default width
19
+ zoomHeight: 200, //zoomed div default width
20
+ xOffset: 10, //zoomed div default offset
21
+ yOffset: 0,
22
+ position: "right" ,//zoomed div default position,offset position is to the right of the image
23
+ lens:true, //zooming lens over the image,by default is 1;
24
+ lensReset : false,
25
+ imageOpacity: 0.2,
26
+ title : true,
27
+ alwaysOn: false,
28
+ showEffect: 'show',
29
+ hideEffect: 'hide',
30
+ fadeinSpeed: 'fast',
31
+ fadeoutSpeed: 'slow',
32
+ preloadImages :true,
33
+ showPreload: true,
34
+ preloadText : 'Loading zoom',
35
+ preloadPosition : 'center' //bycss
36
+ };
37
+
38
+ //extending options
39
+ options = options || {};
40
+ $.extend(settings, options);
41
+
42
+
43
+ return this.each(function()
44
+ {
45
+ var a = $(this);
46
+ var aTitle = a.attr('title'); //variabile per memorizzare il titolo href
47
+ $(a).removeAttr('title');
48
+ $(a).css('outline-style','none');
49
+
50
+
51
+ var img = $("img", this);
52
+ var imageTitle = img.attr('title');
53
+ img.removeAttr('title'); //variabile per memorizzare il titolo immagine
54
+
55
+
56
+ var smallimage = new Smallimage( img );
57
+ var smallimagedata = {};
58
+ //imageborder
59
+ var btop = 0;
60
+ var bleft = 0;
61
+
62
+ var loader = null; //variabile per memorizzare oggetto loader
63
+ loader = new Loader();
64
+
65
+ var ZoomTitle = (trim(aTitle).length > 0) ? aTitle :
66
+ (trim(imageTitle).length > 0) ? imageTitle : null; //setting zoomtitle
67
+ var ZoomTitleObj = new zoomTitle();
68
+
69
+ var largeimage = new Largeimage( a[0].href );
70
+
71
+ var lens = new Lens();
72
+ var lensdata = {};
73
+ //lensborder
74
+
75
+
76
+
77
+ var largeimageloaded = false;
78
+ var scale = {}; //rapporto tra immagine grande e piccola scale.x/scale.y
79
+ var stage = null; // quadrato che mostra l'immagine ingrandita
80
+ var running = false; // running = true quando si verifica l'evento che mostra lo zoom(adesso mouseover).
81
+ var mousepos = {};
82
+ var firstime = 0;
83
+ var preloadshow = false;
84
+ var isMouseDown = false;
85
+ var dragstatus = false
86
+ //loading smallimagedata
87
+ smallimage.loadimage();
88
+
89
+ //ritorna false al click dell href
90
+ $(this).click(function(){return false;});
91
+
92
+ //se settato alwaysOn attivo lo Zoom e lo mostro.
93
+
94
+ //attivo al mouseover
95
+ /* $(this).hover(function(e)
96
+ {
97
+ mousepos.x = e.pageX;
98
+ mousepos.y = e.pageY;
99
+ activate();
100
+ },function()
101
+ {
102
+ deactivate();
103
+ }); */
104
+
105
+ //activation on click
106
+ $(this).click(function(e)
107
+ {
108
+ if(!running) {
109
+ mousepos.x = e.pageX;
110
+ mousepos.y = e.pageY;
111
+ // adding class to container for manipulating styles
112
+ $(a).parent(0).addClass('zoom-activated');
113
+ activate();
114
+ }
115
+ });
116
+ //deactivation on mouseout
117
+ $(this).hover(function(e){},function()
118
+ {
119
+ $(a).parent(0).removeClass('zoom-activated');
120
+ deactivate();
121
+ });
122
+
123
+ //ALWAYS ON
124
+ if(settings.alwaysOn)
125
+ {
126
+ setTimeout(function(){activate();},150);
127
+ }
128
+
129
+
130
+ function activate()
131
+ {
132
+
133
+ if ( !running ) {
134
+
135
+ //finding border
136
+ smallimage.findborder();
137
+
138
+ running = true;
139
+
140
+ //rimuovo il titolo al mouseover
141
+ imageTitle = img.attr('title');
142
+ img.removeAttr('title');
143
+ aTitle = a.attr('title');
144
+ $(a).removeAttr('title');
145
+
146
+ //se non c� creo l'oggetto largeimage
147
+ if (!largeimage || $.browser.safari) {
148
+ largeimage = new Largeimage( a[0].href );
149
+ }
150
+
151
+ //se l'immagine grande non � stata caricata la carico
152
+ if(!largeimageloaded || $.browser.safari)
153
+ {
154
+ largeimage.loadimage();
155
+ }else
156
+ {
157
+ //after preload
158
+ if(settings.zoomType != 'innerzoom')
159
+ {
160
+ stage = new Stage();
161
+ stage.activate();
162
+ }
163
+ lens = new Lens;
164
+ lens.activate();
165
+ }
166
+
167
+ //hack per MAC
168
+ /* if($.browser.safari)
169
+ {
170
+ if(settings.zoomType != 'innerzoom') //se innerzoom non mostro la finestra dello zoom
171
+ {
172
+ stage = new Stage();
173
+ stage.activate();
174
+ }
175
+ if($('div.jqZoomPup').length <= 0)
176
+ {
177
+ lens = new Lens();
178
+ }
179
+ //if(settings.zoomType == 'innerzoom'){lens = new Lens()};
180
+ lens.activate();
181
+ (settings.alwaysOn) ? lens.center() : lens.setposition(null);
182
+ }
183
+ */
184
+ a[0].blur();
185
+ //alert($('div.jqZoomPup').length);
186
+ return false;
187
+ }
188
+
189
+
190
+
191
+
192
+ }
193
+
194
+ function deactivate()
195
+ {
196
+ if(settings.zoomType == 'reverse' && !settings.alwaysOn)
197
+ {
198
+ img.css({'opacity' : 1});
199
+ }
200
+
201
+ if(!settings.alwaysOn)
202
+ {
203
+ //resetting parameters
204
+ running = false;
205
+ largeimageloaded = false;
206
+ $(lens.node).unbind('mousemove');
207
+ lens.remove();
208
+ if($('div.jqZoomWindow').length >0)
209
+ {
210
+ stage.remove();
211
+ }
212
+ if($('div.jqZoomTitle').length > 0)
213
+ {
214
+ ZoomTitleObj.remove();
215
+ }
216
+ //resetting title
217
+ img.attr('title',imageTitle);
218
+ a.attr('title',aTitle);
219
+ $().unbind();
220
+
221
+ a.unbind('mousemove');
222
+ //resetto il parametro che mi dice che � la prima volta che mostor lo zoom
223
+ firstime = 0;
224
+ //remove ieiframe
225
+ if(jQuery('.zoom_ieframe').length > 0)
226
+ {
227
+ jQuery('.zoom_ieframe').remove();
228
+ }
229
+ }else
230
+ {
231
+ if(settings.lensReset)
232
+ {
233
+ switch(settings.zoomType)
234
+ {
235
+ case 'innerzoom':
236
+ largeimage.setcenter();
237
+ break;
238
+ default:
239
+ lens.center();
240
+ break;
241
+ }
242
+ }
243
+ }
244
+
245
+ //non so se serve da provare
246
+ if(settings.alwaysOn)
247
+ {
248
+ activate();
249
+ }
250
+ };
251
+
252
+
253
+
254
+
255
+
256
+ //smallimage
257
+ function Smallimage( image )
258
+ {
259
+ this.node = image[0];
260
+
261
+ this.loadimage = function() {
262
+ this.node.src = image[0].src;
263
+ };
264
+ this.findborder = function()
265
+ {
266
+ var bordertop = '';
267
+ bordertop = $(img).css('border-top-width');
268
+ btop = '';
269
+ var borderleft = '';
270
+ borderleft = $(img).css('border-left-width');
271
+ bleft = '';
272
+ /*if($.browser.msie)
273
+ {
274
+ var temp = bordertop.split(' ');
275
+
276
+ bordertop = temp[1];
277
+ var temp = borderleft.split(' ');
278
+ borderleft = temp[1];
279
+ }*/
280
+
281
+ if(bordertop)
282
+ {
283
+ for(i=0;i<3;i++)
284
+ {
285
+ var x = [];
286
+ x = bordertop.substr(i,1);
287
+
288
+ if(isNaN(x) == false)
289
+ {
290
+ btop = btop +''+ bordertop.substr(i,1);
291
+ }else
292
+ {
293
+ break;
294
+ }
295
+ }
296
+ }
297
+
298
+ if(borderleft)
299
+ {
300
+ for(i=0;i<3;i++)
301
+ {
302
+ if(!isNaN(borderleft.substr(i,1)))
303
+ {
304
+ bleft = bleft + borderleft.substr(i,1)
305
+ }else
306
+ {
307
+ break;
308
+ }
309
+ }
310
+ }
311
+ btop = (btop.length > 0) ? eval(btop) : 0;
312
+ bleft = (bleft.length > 0) ? eval(bleft) : 0;
313
+
314
+
315
+ }
316
+ this.node.onload = function()
317
+ {
318
+ //setto il cursor e la posizione dell'href
319
+
320
+
321
+ a.css({'cursor':'crosshair','display':'block'});
322
+
323
+ if(a.css('position')!= 'absolute' && a.parent().css('position'))
324
+ {
325
+ a.css({'cursor':'crosshair','position':'relative','display':'block'});
326
+ }
327
+ if(a.parent().css('position') != 'absolute')
328
+ {
329
+ a.parent().css('position','relative');
330
+ //a.css('position','relative');
331
+ }
332
+ else{
333
+ //a.css('position','relative');
334
+ }
335
+ if($.browser.safari || $.browser.opera)
336
+ {
337
+ $(img).css({position:'absolute',top:'0px',left:'0px'});
338
+ }
339
+ /*if(a.css('position')!= 'absolute' && a.parent().css('position'))
340
+ {
341
+ a.css({'cursor':'crosshair','position':'relative','display':'block'});
342
+ }
343
+ if(a.parent().css('position') != 'absolute')
344
+ {
345
+ alert('in');
346
+ a.parent().css('position','relative');
347
+ //a.css('position','relative');
348
+ }
349
+ else{
350
+ //a.css('position','relative');
351
+ }*/
352
+
353
+
354
+
355
+ /*
356
+ if(a.parent().css('position') != 'relative' && a.css('position') != 'absolute')
357
+ {
358
+ a.css({'cursor':'crosshair','position':'relative','display':'block'});
359
+ }*/
360
+
361
+ //al docuemnt ready viene caricato l'src quindi viene azionato l'onload e carico tutti i dati
362
+ smallimagedata.w = $( this ).width();
363
+ smallimagedata.h = $( this ).height();
364
+
365
+
366
+ //non viene fatta assegnazione alla variabile globale
367
+ smallimagedata.h = $( this ).height();
368
+ smallimagedata.pos = $( this ).offset();
369
+ smallimagedata.pos.l = $( this ).offset().left;
370
+ smallimagedata.pos.t = $( this ).offset().top;
371
+ smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l;
372
+ smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t;
373
+
374
+ //per sicurezza setto l'altezza e la width dell'href
375
+ a.height(smallimagedata.h);
376
+ a.width(smallimagedata.w);
377
+
378
+
379
+ //PRELOAD IMAGES
380
+ if(settings.preloadImages)
381
+ {
382
+ largeimage.loadimage();
383
+ }
384
+
385
+
386
+
387
+ };
388
+
389
+
390
+
391
+ return this;
392
+ };
393
+
394
+
395
+
396
+ //Lens
397
+ function Lens()
398
+ {
399
+
400
+
401
+ //creating element and adding class
402
+ this.node = document.createElement("div");
403
+ $(this.node).addClass('jqZoomPup');
404
+
405
+ this.node.onerror = function() {
406
+ $( lens.node ).remove();
407
+ lens = new Lens();
408
+ lens.activate() ;
409
+ };
410
+
411
+
412
+
413
+
414
+ //funzione privata per il caricamento dello zoom
415
+ this.loadlens = function()
416
+ {
417
+
418
+
419
+ switch(settings.zoomType)
420
+ {
421
+ case 'reverse':
422
+ this.image = new Image();
423
+ this.image.src = smallimage.node.src; // fires off async
424
+ this.node.appendChild( this.image );
425
+ //$( this.node ).css({'opacity' : 1});
426
+ break;
427
+ case 'innerzoom':
428
+
429
+ this.image = new Image();
430
+ this.image.src = largeimage.node.src; // fires off async
431
+ this.node.appendChild( this.image );
432
+ //$( this.node ).css({'opacity' : 1});
433
+ break
434
+ default:
435
+ break;
436
+ }
437
+
438
+
439
+
440
+ switch(settings.zoomType)
441
+ {
442
+ case 'innerzoom':
443
+ lensdata.w = smallimagedata.w;
444
+ lensdata.h = smallimagedata.h;
445
+ break;
446
+ default:
447
+ lensdata.w = (settings.zoomWidth)/scale.x;
448
+ lensdata.h = (settings.zoomHeight)/scale.y;
449
+ break;
450
+ }
451
+
452
+ $( this.node ).css({
453
+ width: lensdata.w + 'px',
454
+ height: lensdata.h + 'px',
455
+ position: 'absolute',
456
+ /*cursor: 'crosshair',*/
457
+ display: 'none',
458
+ //border: '1px solid blue'
459
+ borderWidth: 1+'px'
460
+ });
461
+ a.append(this.node);
462
+ }
463
+ return this;
464
+ };
465
+
466
+ Lens.prototype.activate = function()
467
+ {
468
+ //carico la lente
469
+ this.loadlens();
470
+
471
+ switch(settings.zoomType)
472
+ {
473
+ case 'reverse':
474
+ img.css({'opacity' : settings.imageOpacity});
475
+
476
+ (settings.alwaysOn) ? lens.center() : lens.setposition(null);
477
+ //lens.center();
478
+ //bindo ad a il mousemove della lente
479
+ a.bind( 'mousemove', function(e)
480
+ {
481
+ mousepos.x = e.pageX;
482
+ mousepos.y = e.pageY;
483
+ lens.setposition( e );
484
+ });
485
+ break;
486
+ case 'innerzoom':
487
+
488
+ // lens = new Lens();
489
+ // lens.activate();
490
+
491
+ $( this.node ).css({top : 0 ,left: 0});
492
+ if(settings.title)
493
+ {
494
+ ZoomTitleObj.loadtitle();
495
+ }
496
+
497
+ largeimage.setcenter();
498
+
499
+ a.bind( 'mousemove', function(e)
500
+ {
501
+ mousepos.x = e.pageX;
502
+ mousepos.y = e.pageY;
503
+ largeimage.setinner( e );
504
+
505
+ /*if(settings.zoomType == 'innerzoom' && running)
506
+ {
507
+ $(a).mousemove(function(){
508
+ if($('div.jqZoomPup').length <= 0)
509
+ {
510
+ lens = new Lens();
511
+ lens.activate();
512
+ }
513
+ });
514
+ }*/
515
+
516
+ /*if($('div.jqZoomPup').length <= 0)
517
+ {
518
+ lens = new Lens();
519
+ lens.activate();
520
+ }*/
521
+
522
+ });
523
+ break;
524
+ default:
525
+ /*$(document).mousemove(function(e){
526
+ if(isMouseDown && dragstatus != false){
527
+ lens.setposition( e );
528
+ }
529
+ });
530
+ lens.center()
531
+
532
+
533
+ dragstatus = 'on'
534
+ $(document).mouseup(function(e){
535
+ if(isMouseDown && dragstatus != false){
536
+ isMouseDown = false;
537
+ dragstatus = false;
538
+
539
+ }
540
+ });
541
+
542
+ $(this.node).mousedown(function(e){
543
+ $('div.jqZoomPup').css("cursor", "move");
544
+ $(this.node).css("position", "absolute");
545
+
546
+ // set z-index
547
+ $(this.node).css("z-index", parseInt( new Date().getTime()/1000 ));
548
+ if($.browser.safari)
549
+ {
550
+ $(a).css("cursor", "move");
551
+ }
552
+ isMouseDown = true;
553
+ dragstatus = 'on';
554
+ lens.setposition( e );
555
+ });
556
+ */
557
+
558
+
559
+ (settings.alwaysOn) ? lens.center() : lens.setposition(null);
560
+
561
+ //bindo ad a il mousemove della lente
562
+ $(a).bind( 'mousemove', function(e)
563
+ {
564
+
565
+ mousepos.x = e.pageX;
566
+ mousepos.y = e.pageY;
567
+ lens.setposition( e );
568
+ });
569
+
570
+ break;
571
+ }
572
+
573
+
574
+ return this;
575
+ };
576
+
577
+ Lens.prototype.setposition = function( e)
578
+ {
579
+
580
+
581
+ if(e)
582
+ {
583
+ mousepos.x = e.pageX;
584
+ mousepos.y = e.pageY;
585
+ }
586
+
587
+ if(firstime == 0)
588
+ {
589
+ var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
590
+ var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2 ;
591
+ //ADDED
592
+
593
+ $('div.jqZoomPup').show()
594
+ if(settings.lens)
595
+ {
596
+ this.node.style.visibility = 'visible';
597
+ }
598
+ else
599
+ {
600
+ this.node.style.visibility = 'hidden';
601
+ $('div.jqZoomPup').hide();
602
+ }
603
+ //ADDED
604
+ firstime = 1;
605
+
606
+ }else
607
+ {
608
+ var lensleft = mousepos.x - smallimagedata.pos.l - (lensdata.w)/2 ;
609
+ var lenstop = mousepos.y - smallimagedata.pos.t -(lensdata.h)/2 ;
610
+ }
611
+
612
+
613
+ //a sinistra
614
+ if(overleft())
615
+ {
616
+ lensleft = 0 + bleft;
617
+ }else
618
+ //a destra
619
+ if(overright())
620
+ {
621
+ if($.browser.msie)
622
+ {
623
+ lensleft = smallimagedata.w - lensdata.w + bleft + 1 ;
624
+ }else
625
+ {
626
+ lensleft = smallimagedata.w - lensdata.w + bleft - 1 ;
627
+ }
628
+
629
+
630
+ }
631
+
632
+ //in alto
633
+ if(overtop())
634
+ {
635
+ lenstop = 0 + btop ;
636
+ }else
637
+ //sotto
638
+ if(overbottom())
639
+ {
640
+
641
+ if($.browser.msie)
642
+ {
643
+ lenstop = smallimagedata.h - lensdata.h + btop + 1 ;
644
+ }else
645
+ {
646
+ lenstop = smallimagedata.h - lensdata.h - 1 + btop ;
647
+ }
648
+
649
+ }
650
+ lensleft = parseInt(lensleft);
651
+ lenstop = parseInt(lenstop);
652
+
653
+ //setto lo zoom ed un eventuale immagine al centro
654
+ $('div.jqZoomPup',a).css({top: lenstop,left: lensleft });
655
+
656
+ if(settings.zoomType == 'reverse')
657
+ {
658
+ $('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - bleft +1) });
659
+ }
660
+
661
+ this.node.style.left = lensleft + 'px';
662
+ this.node.style.top = lenstop + 'px';
663
+
664
+ //setto l'immagine grande
665
+ largeimage.setposition();
666
+
667
+ function overleft() {
668
+ return mousepos.x - (lensdata.w +2*1)/2 - bleft < smallimagedata.pos.l;
669
+ }
670
+
671
+ function overright() {
672
+
673
+ return mousepos.x + (lensdata.w + 2* 1)/2 > smallimagedata.pos.r + bleft ;
674
+ }
675
+
676
+ function overtop() {
677
+ return mousepos.y - (lensdata.h + 2* 1)/2 - btop < smallimagedata.pos.t;
678
+ }
679
+
680
+ function overbottom() {
681
+ return mousepos.y + (lensdata.h + 2* 1)/2 > smallimagedata.pos.b + btop;
682
+ }
683
+
684
+ return this;
685
+ };
686
+
687
+
688
+ //mostra la lente al centro dell'immagine
689
+ Lens.prototype.center = function()
690
+ {
691
+ $('div.jqZoomPup',a).css('display','none');
692
+ var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
693
+ var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2;
694
+ this.node.style.left = lensleft + 'px';
695
+ this.node.style.top = lenstop + 'px';
696
+ $('div.jqZoomPup',a).css({top: lenstop,left: lensleft });
697
+
698
+ if(settings.zoomType == 'reverse')
699
+ {
700
+ /*if($.browser.safari){
701
+ alert('safari');
702
+ alert(2*bleft);
703
+ $('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - 2*bleft) });
704
+ }else
705
+ {*/
706
+ $('div.jqZoomPup img',a).css({'position': 'absolute','top': -(lenstop - btop + 1) ,'left': -( lensleft - bleft +1) });
707
+ //}
708
+ }
709
+
710
+ largeimage.setposition();
711
+ if($.browser.msie)
712
+ {
713
+ $('div.jqZoomPup',a).show();
714
+ }else
715
+ {
716
+ setTimeout(function(){$('div.jqZoomPup').fadeIn('fast');},10);
717
+ }
718
+ };
719
+
720
+
721
+ //ritorna l'offset
722
+ Lens.prototype.getoffset = function() {
723
+ var o = {};
724
+ o.left = parseInt(this.node.style.left) ;
725
+ o.top = parseInt(this.node.style.top) ;
726
+ return o;
727
+ };
728
+
729
+ //rimuove la lente
730
+ Lens.prototype.remove = function()
731
+ {
732
+
733
+ if(settings.zoomType == 'innerzoom')
734
+ {
735
+ $('div.jqZoomPup',a).fadeOut('fast',function(){/*$('div.jqZoomPup img').remove();*/$(this).remove();});
736
+ }else
737
+ {
738
+ //$('div.jqZoomPup img').remove();
739
+ $('div.jqZoomPup',a).remove();
740
+ }
741
+ };
742
+
743
+ Lens.prototype.findborder = function()
744
+ {
745
+ var bordertop = '';
746
+ bordertop = $('div.jqZoomPup').css('borderTop');
747
+ //alert(bordertop);
748
+ lensbtop = '';
749
+ var borderleft = '';
750
+ borderleft = $('div.jqZoomPup').css('borderLeft');
751
+ lensbleft = '';
752
+ if($.browser.msie)
753
+ {
754
+ var temp = bordertop.split(' ');
755
+
756
+ bordertop = temp[1];
757
+ var temp = borderleft.split(' ');
758
+ borderleft = temp[1];
759
+ }
760
+
761
+ if(bordertop)
762
+ {
763
+ for(i=0;i<3;i++)
764
+ {
765
+ var x = [];
766
+ x = bordertop.substr(i,1);
767
+
768
+ if(isNaN(x) == false)
769
+ {
770
+ lensbtop = lensbtop +''+ bordertop.substr(i,1);
771
+ }else
772
+ {
773
+ break;
774
+ }
775
+ }
776
+ }
777
+
778
+ if(borderleft)
779
+ {
780
+ for(i=0;i<3;i++)
781
+ {
782
+ if(!isNaN(borderleft.substr(i,1)))
783
+ {
784
+ lensbleft = lensbleft + borderleft.substr(i,1)
785
+ }else
786
+ {
787
+ break;
788
+ }
789
+ }
790
+ }
791
+
792
+
793
+ lensbtop = (lensbtop.length > 0) ? eval(lensbtop) : 0;
794
+ lensbleft = (lensbleft.length > 0) ? eval(lensbleft) : 0;
795
+ }
796
+
797
+ //LARGEIMAGE
798
+ function Largeimage( url )
799
+ {
800
+ this.url = url;
801
+ this.node = new Image();
802
+
803
+ /*if(settings.preloadImages)
804
+ {
805
+ preload.push(new Image());
806
+ preload.slice(-1).src = url ;
807
+ }*/
808
+
809
+ this.loadimage = function()
810
+ {
811
+
812
+
813
+ if(!this.node)
814
+ this.node = new Image();
815
+
816
+ this.node.style.position = 'absolute';
817
+ this.node.style.display = 'none';
818
+ this.node.style.left = '-5000px';
819
+ this.node.style.top = '10px';
820
+ loader = new Loader();
821
+
822
+ if(settings.showPreload && !preloadshow)
823
+ {
824
+ loader.show();
825
+ preloadshow = true;
826
+ }
827
+
828
+ document.body.appendChild( this.node );
829
+ this.node.src = this.url; // fires off async
830
+ }
831
+
832
+ this.node.onload = function()
833
+ {
834
+ this.style.display = 'block';
835
+ var w = Math.round($(this).width());
836
+ var h = Math.round($(this).height());
837
+
838
+ this.style.display = 'none';
839
+
840
+ //setting scale
841
+ scale.x = (w / smallimagedata.w);
842
+ scale.y = (h / smallimagedata.h);
843
+
844
+
845
+
846
+
847
+
848
+ if($('div.preload').length > 0)
849
+ {
850
+ $('div.preload').remove();
851
+ }
852
+
853
+ largeimageloaded = true;
854
+
855
+ if(settings.zoomType != 'innerzoom' && running){
856
+ stage = new Stage();
857
+ stage.activate();
858
+ }
859
+
860
+ if(running)
861
+ {
862
+ //alert('in');
863
+ lens = new Lens();
864
+
865
+ lens.activate() ;
866
+
867
+ }
868
+ //la attivo
869
+
870
+ if($('div.preload').length > 0)
871
+ {
872
+ $('div.preload').remove();
873
+ }
874
+ }
875
+ return this;
876
+ }
877
+
878
+
879
+ Largeimage.prototype.setposition = function()
880
+ {
881
+ this.node.style.left = Math.ceil( - scale.x * parseInt(lens.getoffset().left) + bleft) + 'px';
882
+ this.node.style.top = Math.ceil( - scale.y * parseInt(lens.getoffset().top) +btop) + 'px';
883
+ };
884
+
885
+ //setto la posizione dell'immagine grande nel caso di innerzoom
886
+ Largeimage.prototype.setinner = function(e) {
887
+ this.node.style.left = Math.ceil( - scale.x * Math.abs(e.pageX - smallimagedata.pos.l)) + 'px';
888
+ this.node.style.top = Math.ceil( - scale.y * Math.abs(e.pageY - smallimagedata.pos.t)) + 'px';
889
+ $('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left });
890
+ };
891
+
892
+
893
+ Largeimage.prototype.setcenter = function() {
894
+ this.node.style.left = Math.ceil(- scale.x * Math.abs((smallimagedata.w)/2)) + 'px';
895
+ this.node.style.top = Math.ceil( - scale.y * Math.abs((smallimagedata.h)/2)) + 'px';
896
+
897
+
898
+ $('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left });
899
+ };
900
+
901
+
902
+ //STAGE
903
+ function Stage()
904
+ {
905
+
906
+ var leftpos = smallimagedata.pos.l;
907
+ var toppos = smallimagedata.pos.t;
908
+ //creating element and class
909
+ this.node = document.createElement("div");
910
+ $(this.node).addClass('jqZoomWindow');
911
+
912
+ $( this.node )
913
+ .css({
914
+ position: 'absolute',
915
+ width: Math.round(settings.zoomWidth) + 'px',
916
+ height: Math.round(settings.zoomHeight) + 'px',
917
+ display: 'none',
918
+ zIndex: 10000,
919
+ overflow: 'hidden'
920
+ });
921
+
922
+ //fa il positionamento
923
+ switch(settings.position)
924
+ {
925
+ case "right":
926
+
927
+ leftpos = (smallimagedata.pos.r + Math.abs(settings.xOffset) + settings.zoomWidth < screen.width)
928
+ ? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
929
+ : (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));
930
+
931
+ topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
932
+ toppos = (topwindow < screen.height && topwindow > 0)
933
+ ? smallimagedata.pos.t + settings.yOffset
934
+ : smallimagedata.pos.t;
935
+
936
+ break;
937
+ case "left":
938
+
939
+ leftpos = (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth > 0)
940
+ ? (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth)
941
+ : (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset));
942
+
943
+ topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
944
+ toppos = (topwindow < screen.height && topwindow > 0)
945
+ ? smallimagedata.pos.t + settings.yOffset
946
+ : smallimagedata.pos.t;
947
+
948
+ break;
949
+ case "top":
950
+
951
+ toppos = (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight > 0)
952
+ ? (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight)
953
+ : (smallimagedata.pos.t + smallimagedata.h + Math.abs(settings.yOffset));
954
+
955
+
956
+ leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
957
+ leftpos = (leftwindow < screen.width && leftwindow > 0)
958
+ ? smallimagedata.pos.l + settings.xOffset
959
+ : smallimagedata.pos.l;
960
+
961
+ break;
962
+ case "bottom":
963
+
964
+
965
+ toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < $('body').height())
966
+ ? (smallimagedata.pos.b + Math.abs(settings.yOffset))
967
+ : (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
968
+
969
+
970
+ leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
971
+ leftpos = (leftwindow < screen.width && leftwindow > 0)
972
+ ? smallimagedata.pos.l + settings.xOffset
973
+ : smallimagedata.pos.l;
974
+
975
+ break;
976
+ default:
977
+
978
+ leftpos = (smallimagedata.pos.l + smallimagedata.w + settings.xOffset + settings.zoomWidth < screen.width)
979
+ ? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
980
+ : (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));
981
+
982
+ toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height)
983
+ ? (smallimagedata.pos.b + Math.abs(settings.yOffset))
984
+ : (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
985
+
986
+ break;
987
+ }
988
+
989
+ this.node.style.left = leftpos + 'px';
990
+ this.node.style.top = toppos + 'px';
991
+ return this;
992
+ }
993
+
994
+
995
+ Stage.prototype.activate = function()
996
+ {
997
+
998
+ if ( !this.node.firstChild )
999
+ this.node.appendChild( largeimage.node );
1000
+
1001
+
1002
+ if(settings.title)
1003
+ {
1004
+ ZoomTitleObj.loadtitle();
1005
+ }
1006
+
1007
+
1008
+
1009
+ document.body.appendChild( this.node );
1010
+
1011
+
1012
+ switch(settings.showEffect)
1013
+ {
1014
+ case 'show':
1015
+ $(this.node).show();
1016
+ break;
1017
+ case 'fadein':
1018
+ $(this.node).fadeIn(settings.fadeinSpeed);
1019
+ break;
1020
+ default:
1021
+ $(this.node).show();
1022
+ break;
1023
+ }
1024
+
1025
+ $(this.node).show();
1026
+
1027
+ if ($.browser.msie && $.browser.version < 7) {
1028
+ this.ieframe = $('<iframe class="zoom_ieframe" frameborder="0" src="#"></iframe>')
1029
+ .css({ position: "absolute", left:this.node.style.left,top:this.node.style.top,zIndex: 99,width:settings.zoomWidth,height:settings.zoomHeight })
1030
+ .insertBefore(this.node);
1031
+ };
1032
+
1033
+
1034
+ largeimage.node.style.display = 'block';
1035
+ }
1036
+
1037
+ Stage.prototype.remove = function() {
1038
+ switch(settings.hideEffect)
1039
+ {
1040
+ case 'hide':
1041
+ $('.jqZoomWindow').remove();
1042
+ break;
1043
+ case 'fadeout':
1044
+ $('.jqZoomWindow').fadeOut(settings.fadeoutSpeed);
1045
+ break;
1046
+ default:
1047
+ $('.jqZoomWindow').remove();
1048
+ break;
1049
+ }
1050
+ }
1051
+
1052
+ function zoomTitle()
1053
+ {
1054
+
1055
+ this.node = jQuery('<div />')
1056
+ .addClass('jqZoomTitle')
1057
+ .html('' + ZoomTitle +'');
1058
+
1059
+ this.loadtitle = function()
1060
+ {
1061
+ if(settings.zoomType == 'innerzoom')
1062
+ {
1063
+ $(this.node)
1064
+ .css({position: 'absolute',
1065
+ top: smallimagedata.pos.b +3,
1066
+ left: (smallimagedata.pos.l+1),
1067
+ width:smallimagedata.w
1068
+ })
1069
+ .appendTo('body');
1070
+ }else
1071
+ {
1072
+ $(this.node).appendTo(stage.node);
1073
+ }
1074
+ };
1075
+ }
1076
+
1077
+ zoomTitle.prototype.remove = function() {
1078
+ $('.jqZoomTitle').remove();
1079
+ }
1080
+
1081
+
1082
+ function Loader()
1083
+ {
1084
+
1085
+ this.node = document.createElement("div");
1086
+ $(this.node).addClass('preload');
1087
+ $(this.node).html(settings.preloadText);//appendo il testo
1088
+
1089
+ $(this.node )
1090
+ .appendTo("body")
1091
+ .css('visibility','hidden');
1092
+
1093
+
1094
+
1095
+ this.show = function()
1096
+ {
1097
+ switch(settings.preloadPosition)
1098
+ {
1099
+ case 'center':
1100
+ loadertop = smallimagedata.pos.t + (smallimagedata.h - $(this.node ).height())/2;
1101
+ loaderleft = smallimagedata.pos.l + (smallimagedata.w - $(this.node ).width())/2;
1102
+ break;
1103
+ default:
1104
+ var loaderoffset = this.getoffset();
1105
+ loadertop = !isNaN(loaderoffset.top) ? smallimagedata.pos.t + loaderoffset.top : smallimagedata.pos.t + 0;
1106
+ loaderleft = !isNaN(loaderoffset.left) ? smallimagedata.pos.l + loaderoffset.left : smallimagedata.pos.l + 0;
1107
+ break;
1108
+ }
1109
+
1110
+ //setting position
1111
+ $(this.node).css({
1112
+ top: loadertop ,
1113
+ left: loaderleft ,
1114
+ position: 'absolute',
1115
+ visibility:'visible'
1116
+ });
1117
+ }
1118
+ return this;
1119
+ }
1120
+
1121
+ Loader.prototype.getoffset = function()
1122
+ {
1123
+ var o = null;
1124
+ o = $('div.preload').offset();
1125
+ return o;
1126
+ }
1127
+
1128
+ });
1129
+ }
1130
+ })(jQuery);
1131
+
1132
+ function trim(stringa)
1133
+ {
1134
+ while (stringa.substring(0,1) == ' '){
1135
+ stringa = stringa.substring(1, stringa.length);
1136
+ }
1137
+ while (stringa.substring(stringa.length-1, stringa.length) == ' '){
1138
+ stringa = stringa.substring(0,stringa.length-1);
1139
+ }
1140
+ return stringa;
1141
+ }