jQuery(document).ready(function() {
	/* Fix for IE */
    	if (jQuery.browser.msie && jQuery.browser.version >= 9) {
		 jQuery.support.noCloneEvent = true;
		}
	/* End fix for IE */
	
	/* Top Cart */
	jQuery('.top-cart .block-title').click(function(){
		jQuery(this).toggleClass('active');
		jQuery('#topCartContent').slideToggle(500).toggleClass('active');
	})
	/* Top Cart */
	
	/* Product Page Tabs */
	jQuery ('.catalog-product-view #tabs li a').click (function () {
		jQuery("ul#tabs li a").removeClass("active");
		jQuery(this).addClass("active")
		jQuery(".box-collateral").hide();

		var activeTab = jQuery(this).attr("href");
		jQuery(activeTab).fadeIn();
		return false;
		})
	/* Product Page Tabs */
	
	
	/* Hover Image on product list */
	if(jQuery('.hover-image').length) {
		jQuery ('.col-main li.item').hover(function(){
			jQuery(this).find('span.hover-image').stop(true, true).fadeIn(500)
		}, function(){
			jQuery(this).find('span.hover-image').stop(true, true).fadeOut(500)
		})
	}
	/* Hover Image on product list */
	
	/* Lightbox */
	if(jQuery('.lightbox').length) {
		jQuery(".lightbox").fancybox({
				'opacity'		: true,
				'overlayShow'	: true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});
	}
	/* Lightbox */
	
	/* Pimg */
	if(jQuery('.pimg').length) {
		pimg();
	}
	/* Pimg */
	
	
	/* Menu */
	if(jQuery('#superfish-menu ul#nav').length) {
	  jQuery("#superfish-menu ul#nav").superfish({
		  autoArrows: false,
		  dropShadows: false,
		  animation:   {opacity:'show',height:'show'}
	  });
	  jQuery('#superfish-menu ul#nav li li a').prepend('<span class="menu-arr"></span >');
	}
	
	if(jQuery('#menu-wide ul#nav').length) {
	  jQuery ('#menu-wide #nav li.level-top.parent').hover (function(){
		      jQuery(this).addClass("hover").find('ul:first').stop(true, true).fadeIn (500)
		  }, function (){
			   jQuery(this).removeClass("hover").find('ul:first').stop(true, true).fadeOut (500)
			  })
	}
	/* Menu */
	
	/* My cart page accordion */
	if(jQuery('#accordion').length) {
		  //ACCORDION BUTTON ACTION	
		jQuery('dt.accordion_toggle').click(function() {
			jQuery('dd.accordion_content').slideUp('normal');	
			jQuery(this).next().slideDown('normal');
		});
	 
		//HIDE THE DIVS ON PAGE LOAD	
		jQuery("dd.accordion_content").hide();
	}
	/* My cart page accordion */
	
	/* Grid Small Dark */
	if(jQuery('.grid-small').length) {
	  jQuery ('.grid-small li.item').hover (function(){
		  var blockHeight = jQuery(this).find('a.product-image').css('height')
		  jQuery(this).addClass("hover").find('.grid-info').css('height', blockHeight).stop(true, true).fadeTo (500, 0.7)
	  }, function (){
		   jQuery(this).removeClass("hover").find('.grid-info').stop(true, true).fadeOut (500)
		  })
	}
	/* Grid Small Dark */
	
	/* Grid Small Light */
	if(jQuery('.grid-small-second').length) {
	  jQuery ('.grid-small-second li.item').hover (function(){
		  var blockHeight = jQuery(this).find('.grid-info').css('height')
		  jQuery(this).addClass("hover").find('.grid-info').css('opacity', 0.8).stop(true, true).animate ({bottom:15}, 500)
	  }, function (){
		   jQuery(this).removeClass("hover").find('.grid-info').stop(true, true).animate ({bottom:-200}, 500)
		  })
	}
	/* Grid Small Light */
	
	/* Sidebar decoration */
	if(jQuery('.sidebar').length) {
		jQuery('.sidebar .block').each(function(index){
			if (index % 2 !== 0) jQuery(this).addClass('even')
		});
	}
	/* Sidebar decoration */
	
	/* Homepage content carousel */
	if(jQuery('.products-grid li.item').length) {
		var productWidth = jQuery('.cms-home .col-main .products-grid li.item  a.product-image img').css('width')
		var productHeight = jQuery('.cms-home .col-main .products-grid li.item a.product-image img').css('height')
		jQuery('.cms-home .col-main .products-grid li.item .product-shop').css({'width': productWidth, 'height': productHeight })
		
		jQuery('.cms-home .col-main .carousel-control').css({'height': productHeight })
		
		
		jQuery ('.cms-home .col-main .products-grid li.item').hover (function(){
		  jQuery(this).find('.product-shop').stop(true, true).fadeTo('slow', 0.95)
	  }, function (){
		   jQuery(this).find('.product-shop').stop(true, true).fadeTo ('slow', 0).css('display', 'none')
		  })
	}
	/* Homepage content carousel */
	
	if(jQuery('#nav_vert').length) {
		jQuery('#nav_vert li').prepend('<div class="icon"></div>');
	}
	
	if(jQuery('#cs-navigation-coin-slider a').length) {
		jQuery('#cs-navigation-coin-slider a').prepend('<span class="shdow"></span ><span class="bg-coin-button"></span >');
	}
	
	jQuery('.header .links li').each(function(index){
		jQuery(this).addClass('item-' + (index+1));
	});
	
	
		
});
