


		


		
		
		
	
	
	
		
		
	


			$(function() {

		swfver = deconcept.SWFObjectUtil.getPlayerVersion()['major'];

		$("table[id^='sortable'] tr:odd, .sortable tr:odd").addClass('odd');
		$("table[id^='sortable'] tr:even, .sortable tr:even").addClass('even');

		$('ul#slideshow').animatedinnerfade({
			speed: 1000,
			timeout: 6000,
			type: 'sequence',
			containerheight: '719px',
			containerwidth: '480px',
			animationSpeed: 5000,
			animationtype: 'fade',
			bgFrame: 'none',
			controlBox: 'none',
			displayTitle: 'none'
		});

		$('body').append('<div style="display:none;"><div id="fancyinfo"></div><a class="fancyboxinfo" href="#fancyinfo"></a></div>');
		
		fancyPopupSetup = function() {
			$('a.fancybox').click(function(event) { 
				event.preventDefault();
				
				try { _gaq.push(['_trackPageview', $(this).attr('href') ]); } catch(e) {}

				$.fn.fancybox.showLoading();
				$('#fancyinfo').load($(this).attr('href')+ '?ajax=yes #contentBody', {}, function(data) { 
					$(".fancy_loading").hide(); 
					$('#fancyinfo').html('<div id="productpop">'+ $('#fancyinfo').html() + '</div>'); 
					$('.fancyboxinfo').trigger('click'); 
					
				} ); 
				
			});
		}
		fancyPopupSetup();
		
		oSRC = "";
		$(".blowup").hover(
			
			function(){
				if (oSRC != $(this).attr("src")) {
					oWidth = $(this).width();
					oHeight = $(this).height();
					mpx = 1.1;
					oSRC = $(this).attr("src");
				}
				
				$(this).stop().animate({
						//take the original width/height X multipler and tag on the 'px'
						width: (oWidth * mpx) +'px',
						height: (oHeight * mpx) +'px'
						//space the animation out over 1 sec (deals in milliseconds)
				},1000);
			},
			//this is just like a mouseOut effect to take the img back to the original size
			function(){
				if (typeof oWidth != 'undefined')
					$(this).stop().animate({
							width: oWidth +'px',
							height: oHeight +'px'
					},1000);
			}
		);

		popReload = function (event) { 
				$(".fancy_loading").hide(); 
				if (swfver) MagicMagnify.start(true);
				if (typeof FB != 'undefined') FB.XFBML.parse();				
		};

		$('#productpop a.fancybox').live("click", function(event) { 
			event.preventDefault();
			try { _gaq.push(['_trackPageview', $(this).attr('href') ]); } catch(e) {}
			$.fn.fancybox.showLoading();
			$('#productpop').load($(this).attr('href')+ '?ajax=yes #contentBody', {}, popReload );	
			return false;													
		});

		$("a.fancyboxinfo").fancybox({
			'hideOnContentClick'	: false,
			'frameWidth'			: 700,
			'frameHeight'			: Math.min($(window).height()-100, 560),
			'overlayShow'			: true,
			'zoomSpeedIn'			: 600,
			'zoomSpeedOut'			: 500,
			'easingIn'				: 'easeOutBack',
			'easingOut'				: 'easeInBack',
			'centerOnScroll'		: false,
			'callbackOnShow'		: function() {
										popReload(); 
									}
			
		}); 

		jQuery.fn.outerHTML = function() {
			return $('<div>').append( this.eq(0).clone() ).html();
		};

		$('#menu1 > ul > li').hover(
			function () { 

				if (!$(this).find('ul').length) { $('#contentBody').trigger('mouseover'); return; } 
				
				$("#slidemenu").height( $("#contentRight").outerHeight() );
				
				$("#slidemenu").html( $(this).find('ul').outerHTML() );	

				
				$("#slidemenu").stop(true).animate({left:$("#slidemenu").outerWidth()*-1}, { duration: 500, queue: false, 
					complete: function(){ 
						$("#slidemenu").animate({left:'0px'}, { duration: 300, queue: false });
					} 
				});
			}

		);

		$('#header, #contentBody').hover(
			function () { 
				$("#slidemenu").stop(true).animate({left:$("#slidemenu").outerWidth()*-1}, { duration: 500, queue: false	} );
			}
		);
		

		$("a.cvvpop").addClass("iframe").fancybox({
			'hideOnContentClick'	: false,
			'frameWidth'			: 570,
			'frameHeight'			: Math.min($(window).height()-100, 320),
			'width'					: 570,
			'height'				: Math.min($(window).height()-100, 320),
			'overlayShow'			: false,
			'zoomSpeedIn'			: 600,
			'zoomSpeedOut'			: 500,
			'easingIn'				: 'easeOutBack',
			'easingOut'				: 'easeInBack'
		}); 

		$("#tieShape").live("change", function() {

			if ($("#tieShape option:selected").val().indexOf("Henry") != -1 || $("#tieShape option:selected").val().indexOf("Banded") != -1) {
				if ($('#tieSize')[0].options.length == 3) $("#tieSize").append($("<option></option>").val('Youth - (fits 11.5" - 13.5")').html('Youth - (fits 11.5" - 13.5")')); 
			}
			else 
				if ($('#tieSize')[0].options.length == 4) $('#tieSize')[0].options.length = 3;
		});

		if($.browser.msie) {
			$("#tieShape").live("click", function() {
				$(this).change();
			});
		}
		
		affiliatePopup = function(id) {
			$("body").append('<a href="/index.cfm/p/products/id/'+ id +'" id="affiliatepop" class="fancybox"></a>');
			fancyPopupSetup();
			$("#affiliatepop").trigger("click");
		}
		
		$("img").pngfix();
	});	


	

	

