var $j = jQuery.noConflict();

//$j(function () { $j("label").inFieldLabels(); });
$j(function () {
    $j('.product h2').equalHeights();
    $j('.product .container_content_inner').equalHeights();
});

$j(document).ready(function () {
    //feature list
    $j.featureList(
		$j("#tabs li a"),
		$j("#output li"), {
		    start_item: 0,
		    pause_on_hover: true,
		    transition_interval: 5000
		}
	);

  //BESTSELLER EN SPECIALS TOOLBAR 
  $j('.cms-aanbiedingen .shop_header .shop_header_left:first').text('10 artikel(en)');
  $j('.cms-meest-verkocht .shop_header .shop_header_left:first').text('10 artikel(en)');
  $j('.cms-aanbiedingen .toolbar-bottom .shop_header .shop_header_left:first').text('10 artikel(en)');
  $j('.cms-meest-verkocht .toolbar-bottom .shop_header .shop_header_left:first').text('10 artikel(en)');
  $j('.cms-meest-verkocht .shop_header .shop_header_right:not(:first)').text('');
  
  
  
    //hide the paging on the aanbieding en bestseller page
    $j('.cms-aanbiedingen .pages, .cms-meest-verkocht .pages').html('&nbsp;');

    //sorteer de namen van de merken
	  jQuery('ol.m-filter-item-list:not(.not-sorted) li').tsort();
                                  
    //menu, sub naar andere div onderbrengen - subnav
    var subNav = $j('#navigatie li.active ul li').detach();
    $j('#subnavigatie ul').append(subNav);

    //zet de prijs goed links boven
    //$j('.total-cart').html($j('.container-cart .subtotal .label').text() + ' <em>' + $j('.container-cart .subtotal .price').text() + '</em>');

    //remove the sales img when the product has not a special prive (detail page)
    if ($j('.product-detail .old-price').length == 0) {
        $j('.product-detail .sale').hide();
    }
    if ($j('.product-detail .advies-price').length > 0) {
        $j('.product-detail .sale').hide();
    }


    //remove the sales img when the product has not a special prive (overview page)
    $j('.category-products .product').each(function () {
        if ($j(this).find('.old-price').length == 0) {
            $j(this).find('.sale').hide();
        }
        //remove also when it is a advies price
        if ($j(this).find('.advies-price').length == 1) {
            $j(this).find('.sale').hide();
        }
    });

    //remove the sales img when the product has not a special prive (uppsell)
    $j('.box-up-sell .product').each(function () {
        if ($j(this).find('.old-price').length == 0) {
            $j(this).find('.sale').hide();
        }
        //remove also when it is a advies price
        if ($j(this).find('.advies-price').length == 1) {
            $j(this).find('.sale').hide();
        }
    });

     
    
    //remove the sales img when the product has not a special prive (cross-sell)
    $j('.box-cross-sell .product').each(function () {
        if ($j(this).find('.old-price').length == 0) {
            $j(this).find('.sale').hide();
        }
        //remove also when it is a advies price
        if ($j(this).find('.advies-price').length == 1) {
            $j(this).find('.sale').hide();
        }
    });
    //remove the sales img when the product has not a special prive (overview page)
    $j('.box-up-sell').each(function () {
        if ($j(this).find('.old-price').length == 0) {
            $j(this).find('.sale').hide();
        }
    });


    //vul divjes met een &nbsp;
    $j('.shop_header_left').each(function () {
        if ($j.trim($j(this).html()) == '') {
            $j(this).html('&nbsp;');
        }
    });


});
