jQuery(window).load(function() {
	/* Fix for IE */
    	if (jQuery.browser.msie && jQuery.browser.version >= 9) {
		 jQuery.support.noCloneEvent = true;
		}
	/* End fix for IE */
	
	jQuery('.block:odd').addClass('odd')
	jQuery('.block:even').addClass('even')

	jQuery('button.button').hover(function() {
		jQuery(this).toggleClass('active')
	}, function () {
		jQuery(this).toggleClass('active')
	})
	
	/* Top Cart */
	jQuery('.top-cart .block-title').click(function(){
		jQuery(this).toggleClass('active');
		jQuery('#topCartContent').slideToggle(500).toggleClass('active')
	})
	/* Top Cart */
	
	jQuery('.header .links li a').prepend('<span class="top-links-arr"></span>');
	
	/* 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'},
		  delay: 50
	  });
	}
	
	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 */
	

	var colorValue = jQuery('a:hover').css('color')
	jQuery ('#nav li:not(.active)').hover (function(){
		Cufon.replace(jQuery (this).find('a.level-top'), {
		  hover: true,
		  color: colorValue
		});
		Cufon.now();
		})


	/* 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 */
	if(jQuery('.grid-small').length) {
		jQuery('.grid-small li.item').hover(function(){
			jQuery(this).css('z-index','9999').toggleClass('active') 
			jQuery('.grid-small li.item:not(.active)').stop(true, true).fadeTo(400, 0.5)
			jQuery(this).find('.product-grid-details').stop(true, true).fadeToggle(100)
		}, function() {
			jQuery(this).css('z-index','1').toggleClass('active')
			jQuery('.grid-small li.item').delay(200).fadeTo(400, 1)
			jQuery(this).find('.product-grid-details').fadeToggle(100)
		})
	}
	/* Grid Small */
	
	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));
	}); 

	jQuery('#accordion ul.level0, .block-account .block-content li a, .block-account .block-content li strong').before('<span class="icon"></span>'); 
	jQuery('#accordion ul.level0 li a').before('<span class="sub-icon"></span>');         
    jQuery('#accordion li.level0.nav-1').addClass('active');
               
    jQuery("#accordion li span.arrow").click(function(){
        if(false == jQuery(this).next('ul').is(':visible')) {
            jQuery('#accordion ul.level0').slideUp(300);
        }
        jQuery(this).next('.level0').slideToggle(300);
        
        if(jQuery(this).parent().hasClass('active')) {
            jQuery(this).parent().addClass('not-active');
        }
        
        jQuery('#accordion li.active').each(function() {
                jQuery(this).removeClass('active');
        });
        if(!jQuery(this).parent().hasClass('not-active')) {
            jQuery(this).parent().addClass('active');
        }
        jQuery('#accordion li.not-active').each(function() {
                jQuery(this).removeClass('not-active');
        });
    });
		
});
