
jQuery(document).ready(function() {
	/* Fix for IE */
    	if (jQuery.browser.msie && jQuery.browser.version >= 9) {
		 jQuery.support.noCloneEvent = true;
		}
	/* End fix for IE */
	/* Load scripts */
		if (jQuery('.product-image img').length) {
				jQuery(".products-grid .product-image img, .products-list .product-image img, .more-views li a img, .cart .crosssell .product-image img, .block-related .product .product-image img, #carousel .products-list-slider .product-image img").insetBorder({
					speed          : 400,           // 1000 = 1 second, default 250
					borderColor    : "#F3F3F3",    // Default white (#ffffff)
					inset          : 8,             // Border width, default 10px
					borderType     : "solid",        // Border type, e.g. dashed
					outerClass     : "ibe_outer",    // Class name of outer wrap
					innerClass     : "ibe_inner"     // Class name of inner border
				  });
			}
		if(jQuery('.lightbox').length) {
				jQuery(".lightbox").fancybox({
						'opacity'		: true,
						'overlayShow'	: true,
						'transitionIn'	: 'elastic',
						'transitionOut'	: 'elastic'
					});
			}
		
		if (jQuery('#carousel-2').length) {
				jQuery("#carousel-2").jCarouselLite({
					btnNext: ".next",
					btnPrev: ".prev",
					visible: 4
				});
			}
		
		if (jQuery('ul#myRoundabout').length) {
				jQuery('ul#myRoundabout').roundabout({
						btnNext: '#next',
         				btnPrev: '#previous'
					});
			}
			
			
		
	/* End load scripts*/
	
	/* Sidebar tabs */
	
	/**/
	
	var tabsContent = jQuery('.tab_container .block');
	var i = 1;
	var y = 1;
	tabsContent.each (function(){
			jQuery(this).attr('id', 'tab'+i).addClass('tab_content');
			var tabsTitle = jQuery(this).find('div.block-title strong');
			
			jQuery(tabsTitle).appendTo('ul.tabs');
			i++;
		})
	var tabsTitle = jQuery('ul.tabs strong');
	tabsTitle.each(function(){
			jQuery(this).wrap('<li><a href="#tab'+y+'"></a></li>')
			y++;
		})
	/**/
	
	//When page loads...
	jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:first").show(); //Show first tab content

	//On Click Event
	jQuery("ul.tabs li").click(function() {

		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content").hide(); //Hide all tab content

		var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	/* End sidebar tabs */
	
	/* Product view tabs */
	
	//When page loads...
	jQuery(".tab_content-2").hide(); //Hide all content
	jQuery("ul.tabs-2 li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content-2:first").show(); //Show first tab content

	//On Click Event
	jQuery("ul.tabs-2 li").click(function() {

		jQuery("ul.tabs-2 li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content-2").hide(); //Hide all tab content

		var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	/* End product view tabs */
	
	/* Hover */
	jQuery('.top-cart').hover(function(){
			jQuery(this).find('.block-title a').addClass('active');
			jQuery('#topCartContent').stop().fadeTo(500, 1).addClass('active');
		}, function(){
				jQuery(this).find('.block-title a').removeClass('active');
				jQuery('#topCartContent').fadeTo(400, 0).removeClass('active');
			})
	/* Hover */
	

	/*  */
	jQuery('.cart .totals table td:first-child').addClass('totals-title')
	jQuery ('.block-height').equalHeightColumns();
	/*  */
});
