$jQ(document).ready(function() {
// Cufon fonts
Cufon.replace('.checkout-cart-index .page-title h1, .invitations-table thead th, .page-head, .page-head-alt h3, .review-customer-view .author, .checkout-cart-index .sp-empry-title, .my-account-body .page-title h1,  .my-account .page-title-extra, .customer-account-logoutsuccess h1, .customer-account-forgotpassword  .page-title h1, .my-account-body .my-account-cufon, .customer-account-create .page-title h1, .customer-account-login .page-title h1, .choose-game-box h2.title, .checkout-onepage-success h1', {fontFamily: 'Helvetica Neue LT Std',color: '-linear-gradient(#ffffff, #cccaca)'});
Cufon.replace('#my-orders-table .cufon-me, .review-customer-index .col-main .product-name a, .my-account-body .info-box .box-content,  .customer-account-forgotpassword h2.legend, .customer-account-create .reg-title, .account-login  h2.legend, .general-nav a.first-level-link', {fontFamily: 'Helvetica Neue LT Std'});
Cufon.replace('#shopping-cart-totals-table .total-th th, #shopping-cart-totals-table .last-total-cell, #shopping-cart-totals-table .first-total-cell, .catalog-category-view .products-grid .range-fix .price-range, .catalogsearch-result-index .products-grid .range-fix .price-range, .catalog-category-view .products-grid .price, .catalogsearch-result-index .products-grid .price, .catalog-category-view .rpoducts-grid .price-label, .catalogsearch-result-index .price-label', {fontFamily: 'Helvetica Neue LT Std'});
Cufon.replace('.catalog-product-compare-index .page-title h1, #wishlist-table .product-name a, .catalog-category-view .filter-item .title h4, .catalogsearch-result-index .filter-item .title h4, .footer-nav a', {fontFamily: 'Helvetica Neue LT Std', hover: true});
Cufon.replace('.top-cart .block-content .item .btn-remove em, .pager .limiter label, .products-grid .product-name a, body:not(.catalog-product-view) .link-compare', {fontFamily: 'Helvetica Neue LT Std', hover: true, hoverables: {a:true}});
Cufon.replace('.sidebar .block-account li a, .choose-game-box > ul > li > a', {fontFamily: 'Helvetica Neue LT Std bold', hover: true});
Cufon.replace('.checkout-cart-index #shopping-cart-table  h2.product-name a', {fontFamily: 'Helvetica Neue LT Std bold', hover: true});
Cufon.replace('.grey-box .four-column h2.title, .visual-home p', {fontFamily: 'Helvetica Neue LT Std bold-italic'});
Cufon.replace('.category-list .title-category strong, .grey-box .four-column h2.title', {fontFamily: 'Helvetica black italic'});
Cufon.replace('.sidebar .block-account li strong, .header .top-compare .block-title .extra-number, .top-cart .block-title .extra-number, .my-rewards dl dt strong', {fontFamily: 'Helvetica Neue LT Std bold', hover: true});
Cufon.replace('.header .top-compare .block-title .extra-cuf', {fontFamily: 'Helvetica Neue LT Std bold', hover: true});
Cufon.replace('.top-cart #cartHeader .extra-cuf', {fontFamily: 'Helvetica Neue LT Std bold', hover: true, hoverables: {strong:true}});
Cufon.replace('.grey-box .category-list .extra-txt strong', {fontFamily: 'Helvetica Neue LT Std bold', hover:true});
Cufon.replace('.header .checkout-link, .header .my-account-link', {fontFamily: 'Helvetica Neue LT Std bold', hover: true});
Cufon.replace('.catalog-category-view .filter-title h3,.catalogsearch-result-index .filter-title h3,.catalog-category-view  .category-title h1,.catalogsearch-result-index  .page-title h1, .catalog-category-view  .category-title h2', {fontFamily: 'Helvetica black italic'});
//Cufon.replace('.top-compare .block-content .item .product-name a', {fontFamily: 'Helvetica Neue LT Std', hover: true});
/* Product Details page */
Cufon.replace('.product-view .product-name h1, .checkout-cart-index h2:not(.product-name), #shopping-cart-table thead th, .rma-title h1, .quick-checkout h1, .checkout-multishipping-login h1, .checkout-multishipping-register h1', {fontFamily: 'Helvetica Neue LT Std bold',color: '-linear-gradient(#ffffff, #cac8c8)', textShadow: 'rgba(0, 0, 0, 0.5) 0 3px'});
Cufon.replace('.groped-product-type thead th, .cart .crosssell .item .price-box .price, .cart .crosssell .item .price-box .price-label, .cart-table .price, .product-view .price-box .price, #options-container .product-options .price', {fontFamily: 'Helvetica Neue LT Std bold',color: '-linear-gradient(#cac8c8, #ffffff)'});
Cufon.replace('.product-view .product-shop .price-box .price', {fontFamily: 'Helvetica Neue LT Std bold'});
Cufon.replace('.main .price-range', {fontFamily: 'Helvetica Neue LT Std bold'});
Cufon.replace('.product-view .box-collateral .box-title h2', {fontFamily: 'Helvetica black italic'});


    //need for filters bg 
    $jQ('body.checkout-multishipping-success div.main').addClass('shadow');
    $jQ('body.checkout-onepage-success div.main').addClass('shadow');
    $jQ('body.catalogsearch-result-index div.main').addClass('shadow');
    $jQ('body.catalog-category-view div.main').addClass('shadow');
    $jQ('body.checkout-multishipping-success div.col-main').addClass('rgba');
    $jQ('body.checkout-onepage-success div.col-main').addClass('rgba');
    $jQ('body.catalogsearch-result-index div.main-holder').addClass('rgba');
    $jQ('body.catalog-category-view div.main-holder').addClass('rgba');
    
    // drop down main nav
    $jQ('ul.general-nav  > li').each( function(){
        $jQ(this).mouseenter( function() {
            var HeightDropCategory = $jQ(this).find('div.first-level').height();
            var HeightDropCategory2 = $jQ(this).find('div.nav-container').height();
            if(HeightDropCategory < HeightDropCategory2 ){HeightDropCategory = HeightDropCategory2;}
            var TempLevel1 = HeightDropCategory - 143;
            var TempLevel2 = HeightDropCategory - 56;
            $jQ(this).find('div.first-level ul.first-level-ul').height(TempLevel1);
            $jQ(this).find('div.nav-container > ul').height(TempLevel2);
        }).mouseleave(function(){
                $jQ(this).find('div.first-level ul.first-level-ul').css({'height': 'auto'});
                $jQ(this).find('div.nav-container  > ul').css({'height': 'auto'});
            });
     });
    // dropDown for 'Choose your game'
    $jQ('div.choose-game-box > ul >  li').each( function(){
        var TithLiHeight = 0;
        $jQ(this).mouseenter( function() {
            var HeightDropCategory = $jQ(this).find('div.sub-level').height();
            var HeightDropCategory2 = $jQ(this).find('div.sub-level .sub-second').height();
            //console.log('HeightDropCategory', HeightDropCategory);
            //console.log('HeightDropCategory2', HeightDropCategory2);
            if(HeightDropCategory < HeightDropCategory2 ){HeightDropCategory = HeightDropCategory2;}
            var TempLevel1 = HeightDropCategory - 27 + "px";
            TithLiHeight = HeightDropCategory;
            $jQ(this).find('div.sub-level .holder-box').height(TempLevel1);
            $jQ(this).find('div.sub-level .sub-second > ul').height(HeightDropCategory).css('border-radius', '0 5px 5px 0');
        }).mouseleave(function(){
                $jQ(this).find('div.sub-level .holder-box').css({'height': 'auto'}.css('border-radius', ''));
                $jQ(this).find('div.sub-level .sub-second > ul').css({'height': 'auto'}).css('border-radius', '');
                $jQ(this).find('.sub-third > ul').css({'height': 'auto'}).css('border-radius', '');
            });
        var MyLi =$jQ(this);
        $jQ(this).find('div.sub-second > ul > li').each( function(){
             var MyLi2 =$jQ(this);
            $jQ(this).mouseenter( function() {
                var HeightDropCategory3 = TithLiHeight;
                var HeightDropCategory = $jQ(this).find('div.sub-third').height();
                if(HeightDropCategory > HeightDropCategory3 ){HeightDropCategory3 = HeightDropCategory;}
                var TempLevel1 = HeightDropCategory3 - 27 + "px";
                var TempLevel25 = HeightDropCategory3 - 16 + "px"; // 16 it is padding-top on ul
                $jQ(MyLi).find('div.sub-level .holder-box').height(TempLevel1);
                $jQ(MyLi).find('div.sub-level .sub-second > ul').height(HeightDropCategory3);
                $jQ(this).find('.sub-third > ul').height(HeightDropCategory3).css('border-radius', '0 5px 5px 0');
                $jQ('.sub-third').css('border-radius', '0 5px 5px 0');
                var LinkArrow = $jQ(this).find("> a");
                var BgArrow = $jQ(this).find("> a .arrow");
                var HeightArrow = HeightDropCategory3 + 15 + "px";
                var position = LinkArrow.position();
                var LinkArrowTop = 1356  - position.top;
                var LinkArrowTop2 =0;
                if ( $jQ.browser.msie ){ 
                    LinkArrowTop2 = position.top + 9;
                    if(jQuery.browser.msie){
                        LinkArrowTop2 = LinkArrowTop2 - 9;
                    }
                    if(LinkArrowTop2 < 0){LinkArrowTop2 = LinkArrowTop2+ "px"}else{
                    LinkArrowTop2 = "-" + LinkArrowTop2 + "px";}
                }else{LinkArrowTop2 = "-" + position.top + "px";}
                LinkArrowTop = " 0 -" + LinkArrowTop + "px";
                $jQ(BgArrow).css({'height':HeightArrow, 'background-position' : LinkArrowTop, 'top': LinkArrowTop2 });
                 if ( $jQ.browser.msie ){ $jQ(BgArrow).css({'visibility' : 'visible' });}
            }).mouseleave(function(){
                if ( $jQ.browser.msie ){
                    var BgArrow = $jQ(this).find("> a .arrow");
                    $jQ(BgArrow).css({'visibility' : 'hidden'});
                }
                var TempLevel3 = TithLiHeight - 27 + "px";
                $jQ(MyLi).find('div.sub-level .holder-box').css({'height': TempLevel3}).css('border-radius', '');
                $jQ(MyLi).find('div.sub-level .sub-second > ul').css({'height': TithLiHeight}).css('border-radius', '');
                $jQ(this).find('.sub-third > ul').css({'height': 'auto'}).css('border-radius', '');
                $jQ('.sub-third').css('border-radius', '');
             //  $jQ(this).find('div.sub-level .holder-box').css({'height': 'auto'});
             //  $jQ(this).find('div.sub-level .sub-second > ul').css({'height': 'auto'});
            });
         }); 
        
    });
    
    jQuery.fn.eQMenu = function() {
      var maxHeight = this.map(function(i,e) {
        return jQuery(e).height();
      }).get();
      
      return this.height( Math.max.apply(this, maxHeight) );
    };

    jQuery('#nav li').live({
        mouseenter: function(){
            var allParents = jQuery(this).find('ul:first > li').parentsUntil('.general-nav', 'ul');
            allParents.eQMenu().css('border-radius', '');
            jQuery(this).find('ul:first').css('border-radius', '0 5px 5px 0');
        },

        mouseleave: function(){
            var allParents = jQuery(this).find('ul:first > li').parentsUntil('.general-nav', 'ul');
            allParents.css('height', 'auto').css('border-radius', '');
        }
    });
   
   // fade effect for logos
   
   $jQ('div.footer div.logo-box a.footer-logo').hover(
        function(){
            $jQ('div.footer a.nfl img.normal').animate({'opacity': 0});
            $jQ('div.footer a.nfl img.blur').css({'display': 'block'});
            $jQ('div.footer a.nfl img.blur').animate({'opacity': 1});

        },function() {
            $jQ('div.footer a.nfl img.blur').animate({'opacity': 0});
            $jQ('div.footer a.nfl img.normal').animate({'opacity': 1});
            $jQ('div.footer a.nfl img.blur').css({'display': 'none'});
            }
   )
   $jQ('div.footer div.logo-box a.nfl').hover(
        function(){
            $jQ('div.footer a.footer-logo img.normal').animate({'opacity': 0});
            $jQ('div.footer a.footer-logo img.blur').css({'display': 'block'});
            $jQ('div.footer a.footer-logo img.blur').animate({'opacity': 1});

        },function() {
            $jQ('div.footer a.footer-logo img.blur').animate({'opacity': 0});
            $jQ('div.footer a.footer-logo img.normal').animate({'opacity': 1});
            $jQ('div.footer a.footer-logo img.blur').css({'display': 'none'});
            }
   )
   $jQ('div.header div.logo-box a.logo').hover(
        function(){
            $jQ('div.header a.nfl img.normal').animate({'opacity': 0});
            $jQ('div.header a.nfl img.blur').css({'display': 'block'});
            $jQ('div.header a.nfl img.blur').animate({'opacity': 1});

        },function() {
            $jQ('div.header a.nfl img.blur').animate({'opacity': 0});
            $jQ('div.header a.nfl img.normal').animate({'opacity': 1});
            $jQ('div.header a.nfl img.blur').css({'display': 'none'});
            }
   )
   $jQ('div.header div.logo-box a.nfl').hover(
        function(){
            $jQ('div.header a.logo img.normal').animate({'opacity': 0});
            $jQ('div.header a.logo img.blur').css({'display': 'block'});
            $jQ('div.header a.logo img.blur').animate({'opacity': 1});

        },function() {
            $jQ('div.header a.logo img.blur').animate({'opacity': 0});
            $jQ('div.header a.logo img.normal').animate({'opacity': 1});
            $jQ('div.header a.logo img.blur').css({'display': 'none'});
            }
   )
   // one height for cat egory list
   $jQ('div.grey-box ul.category-list > li ul > li').each( function(){
        var CategoryVis = $jQ(this).find('a').height();
        var CategoryImg = $jQ(this).find('.visual img').height();
        var CategoryTitle =$jQ(this).find('strong.extra-txt').height(); 
        if (CategoryVis > CategoryImg){
            $jQ(this).find('.visual').css({'height': CategoryVis, 'display' : 'table' });
            $jQ(this).find('.visual span').css({'display' : 'table-cell', 'vertical-align': 'middle'  });
        }
        if( CategoryVis > CategoryTitle){
            $jQ(this).find('strong.extra-txt').css({'height': CategoryVis, 'display' : 'table' });
            $jQ(this).find('strong.extra-txt strong').css({'display' : 'table-cell', 'vertical-align': 'middle'  });
        }
   });
	/* multishipping selects */
	
   /* header compare & shopping cart dropdown */ 
   $jQ('#topCompareContent div.scrollable').each(function(){
        var compareTemp = $jQ('#compare-items').height();
        var compareLi11 =  $jQ('#compare-items li:eq(0)').innerHeight() +1; 
        var compareLi21 =  $jQ('#compare-items li:eq(1)').innerHeight() +1;
        var compareLi31 =  $jQ('#compare-items li:eq(2)').innerHeight() +1;
        var compareLiGeneral2 =  compareLi11 + compareLi21 + compareLi31;
        if (compareTemp < compareLiGeneral2) {
            $jQ('#topCompareContent div.scrollable').css({
                'height' : compareTemp
            });
            
        }else{
            $jQ('#topCompareContent div.scrollable').css({
                'height' : compareLiGeneral2
            });
            
        }
        if ($jQ('#compare-items li').size() < 4){
            $jQ('#topCompareContent div.scroll-holder').css({'padding' : 0 });
            $jQ('#topCompareContent div.vscroll-bar').css({'display' : 'none' });
        }
    }); 
   $jQ('#topCartContent div.scrollable').each(function(){
        var compareTempFix27 = $jQ('#mini-cart').height();
        var compareLi1 =  $jQ('#mini-cart li:eq(0)').innerHeight() +1; 
        var compareLi2 =  $jQ('#mini-cart li:eq(1)').innerHeight() +1;
        var compareLi3 =  $jQ('#mini-cart li:eq(2)').innerHeight() +1;
        var compareLiGeneral =  compareLi1 + compareLi2 + compareLi3;
        if (compareTempFix27 < compareLiGeneral) {
            $jQ('#topCartContent div.scrollable').css({
                'height' : compareTempFix27
            });
            
        }else{
            $jQ('#topCartContent div.scrollable').css({
                'height' : compareLiGeneral
            });
            
        }
        if ($jQ('#mini-cart li').size() < 4){
            $jQ('#topCartContent div.scroll-holder').css({'padding' : 0 });
            $jQ('#topCartContent .vscroll-bar').css({'display' : 'none' });
        }
    });
    /* my account */
    $jQ('.my-account-sidebar, .my-account.rgba').each(function (){
        $jQ(this).parent().addClass('shadow shadow-my-account')
    });

    var attributeSize = $jQ('.product-view .product-shop .dropdown.attribute').size();
	if(attributeSize < 2)
	$jQ('.product-view .product-shop #product-options-wrapper').addClass('some-option');
	$jQ('.product-view .product-shop #product-options-wrapper .hidden-select:last').addClass('last');
    
    /* shopping-cart */
    $jQ('#shopping-cart-totals-table tr').each(function (){
        $jQ(this).find('td:first').addClass('first-total-cell');
        $jQ(this).find('td:last').addClass('last-total-cell');
     });
     $jQ('#shopping-cart-totals-table th').each(function (){
        $jQ(this).parent().addClass('total-th');

        });
		
	$jQ('.ratings .rating-links a').live('click',function(){
		if($jQ('#box-reviews-list .jspPane').height() == $jQ('#box-reviews-list .jspContainer').height()) {
			$jQ('.ie9 #box-reviews-list .jspVerticalBar').addClass('no-display-i');
		}
	});
   
    var MESSAGES = $jQ('.messages');
    if(MESSAGES.length > 0) {
        MESSAGES.find('li[class]').append('<a class="close" onclick="$(this).up(\'[class$=-msg]\').hide();" href="javascript:">Close</a>');
    }
});

function subNavDecoration(){
	jQuery('.general-nav .sub-nav').prepend('<div class="arrow"></div>');
	jQuery('.general-nav .sub-nav').prepend('<div class="top"></div>');
	jQuery('.general-nav .sub-nav').children('ul').wrap('<div class="middle"></div>');
	jQuery('.general-nav .sub-nav').append('<div class="bottom"></div>');
}


Riddell = {
        gridDecorated : function(){
            var productHeightMax = new Array;
            var productPriceHeightMax = new Array;
            var size =  $jQ('.products-grid').size();
            for(i = 0; i < size; i++){
                productHeightMax[i] = 0;
                productPriceHeightMax[i] = 0;
                $jQ('.product-name','.products-grid:eq(' + i + ')').each(function(){
                    var productHeight = $jQ(this).height();
                    if(productHeightMax[i] < productHeight){
                        productHeightMax[i] = productHeight;
                    }
                });
                $jQ('.product-name','.products-grid:eq(' + i + ')').height(productHeightMax[i]);
                $jQ('.price-box','.products-grid:eq(' + i + ')').each(function(){
                    var productPriceHeight = $jQ(this).height();
                    if(productPriceHeightMax[i] < productPriceHeight){
                         productPriceHeightMax[i] = productPriceHeight;
                    }
                });
                $jQ('.price-box','.products-grid:eq(' + i + ')').height(productPriceHeightMax[i]);
            }
            $jQ('.products-grid-holder:last').css({'padding-bottom': '15px'})
            //$jQ('.products-grid:has(.rating-box) .price-box').css('padding-bottom','16px');
            //$jQ('.products-grid li:has(.rating-box) .price-box').css('padding-bottom','0');
        },
		
		menuDropDown : function(){
			jQuery('.general-nav li:has(.sub-nav)').hover(
				function(){
					jQuery(this).children('.sub-nav').css('visibility','visible').css('height','auto');
				},
				function(){
					jQuery(this).children('.sub-nav').css('visibility','hidden').css('height',0);
			})
		},
		
		fixOrderProduct : function(){
			$jQ('#checkout-review-table .item-options').each(function(){
				var optionsHeight = $jQ(this).height();
				$jQ(this).prev('.product-name').css('padding-bottom',optionsHeight);
			});
		}
}

jQuery(function(){
	subNavDecoration();
	jQuery('.ie .product-view .product-shop .product-collection').hover(
		function(){
				jQuery('.product-view .product-shop .rgba-f').removeClass('rgba').addClass('rgbaIE');
			},
		function(){
				jQuery('.product-view .product-shop .rgba-f').addClass('rgba').removeClass('rgbaIE');
	});
});

var cssFix = function(){
  var u = navigator.userAgent.toLowerCase(),
  addClass = function(el,val){
    if(!el.className) {
      el.className = val;
    } else {
      var newCl = el.className;
      newCl+=(" "+val);
      el.className = newCl;
    }
  },
  is = function(t){return (u.indexOf(t)!=-1)};
  addClass(document.getElementsByTagName('html')[0],[
    (!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)
      :is('firefox/2')?'gecko ff2'
      :is('firefox/3')?'gecko ff3'
      :is('gecko/')?'gecko'
      :is('opera/9')?'opera opera9':/opera (\d)/.test(u)?'opera opera'+RegExp.$1
      :is('konqueror')?'konqueror'
      :is('applewebkit/')?'webkit safari'
      :is('mozilla/')?'gecko':'',
    (is('x11')||is('linux'))?' linux'
      :is('mac')?' mac'
      :is('win')?' win':''
  ].join(" "));
}();

$jQ(document).load(function() {
	
})
