	
	// custom functions
	$func_banner = function($w){
		$currentBanner = $w;
		$newMargin = -($windowWidth * ($currentBanner-1));
		
		if($currentBanner>$totalBanners-$psLength){
			if($oldBanner>$totalBanners-$psLength){
				$bannerSpeed = 0;
			} else {
				$bannerSpeed = $speed;
			}
		} else {
			$bannerSpeed = $speed;
		}
		
		if($currentBanner>$('#thumbs').children().length){
			// product shot
			$('.thumb-li').removeClass('activeMedia');
			$('#ps-'+$currentBanner+'-link').addClass('activeMedia').siblings().removeClass('activeMedia');
		} else {
			// thumbnail or video
			$('.ps-li').removeClass('activeMedia');
			$('#thumb-'+$currentBanner+'-link').addClass('activeMedia').siblings().removeClass('activeMedia');
		}
		$('#banner-container').stop().animate({marginLeft:$newMargin}, $bannerSpeed, function(){
			if($currentBanner==1 && $flashOn){
				//$('#banner-wrapper').animate({height:'521px'});
				//$('#breadcrumbs').animate({top:'560px'});
			}		
		});
		if($currentBanner!=1){
			//$('#banner-wrapper').animate({height:'375px'});
			//$('#breadcrumbs').animate({top:'414px'});
		}
		
		$oldBanner = $currentBanner;
		
		$func_bannerNav();
	}
	$func_bannerNav = function(){
		if($currentBanner == 1)            { $('.prev-banner').fadeOut(); } else { $('.prev-banner').fadeTo(0, .2).fadeIn(500); }
		if($currentBanner == $totalBanners){ $('.next-banner').fadeOut(); } else { $('.next-banner').fadeTo(0, .2).fadeIn(500); }
	}
	$func_updateCart = function(jo){
		// was #cart, changed for croscart
		$('#shopping-cart').html(jo.html).fadeIn('slow', function(){
			$('#adding-'+jo.id).parent().html('<a href="/cart/">Item successfully added! &raquo; VIEW SHOPPING CART<\/a>');
		});
	}
	
	
	
	
	
	
	// events
	$('.next-banner').mouseover(function(){
		$(this).fadeTo(200, .9);
	}).mouseout(function(){
		$(this).fadeTo(200, .2);
	}).click(function(){ if($currentBanner < $totalBanners){ $currentBanner++; $func_banner($currentBanner); } });	
	$('.prev-banner').mouseover(function(){
		$(this).fadeTo(200, .9);
	}).mouseout(function(){
		$(this).fadeTo(200, .2);
	}).click(function(){ if($currentBanner>1){ $currentBanner--; $func_banner($currentBanner); } });
	
	
	// handle thumbnail and product shot clicks (moves the banner container accordingly)
	$('#thumbs li').click(function(){
		$w = $(this).attr('id').split('-');
		$func_banner($w[1]);
	});
	$('#product-shots li').click(function(){
		$w = $(this).attr('id').split('-');
		$func_banner($w[1]);
	});
	
	$(window).resize(function(){
		$windowHeight = $(window).height();
		$windowWidth  = $(window).width();
		
		$('#banner-container li').css({width: $windowWidth +'px'});
		
	});
	
	$(document).ready(function(){
		
		$windowHeight = $(window).height();
		$windowWidth  = $(window).width();
		$thumbLength  = $('#thumbs').children().length;
		$psLength     = $('#product-shots').children().length;
		$speed        = 300;
		$bannerSpeed  = 300;
		
		
		// banner variables
		$currentBanner = 1;
		$oldBanner = 1;
		$totalBanners = $thumbLength + $psLength;
		
		// initial banner sizing for variable width browser windows
		$('#banner-container li').css({width:$windowWidth});
		
		$('.prev-banner').fadeTo(200, 0);
		$('.next-banner').fadeTo(0, .2);
		
		
	
		
		
	});

