(function($) {

	//splash frames
	$('#next').click(function() {
		var current = $('#frames .active'),
			next = current.next().length ? current.next() : current.parent().children(':first');
			
		current.hide(function() {
			$(this).removeClass('active');
		});
		next.show().addClass('active');
	});
	
	$('#prev').click(function() {
		var current = $('#frames .active'),
			prev = current.prev().length ? current.prev() : current.parent().children(':last');
			
		current.hide(function() {
			$(this).removeClass('active');
		})
		prev.show().addClass('active');
	});
	
	function getPosition() {
		var arrowHeight = ($(window).height() - 23) / 2,
			logoHeight = ($(window).height() - 39) / 2,
	 		logoWidth = ($(window).width() - 362) / 2;
	
			$('#next, #prev').css('top', arrowHeight);
			$('body.home #logo').css({
				top:  logoHeight,
				left: logoWidth
			});
	}
	
	getPosition();
	
	$(window).resize(getPosition);
	
	// nav 
	$('#menu-main-nav li:last span').addClass('hide');
	
	$('#overlay').hover(function() {
			$(this).addClass('active');	
		}, function() {
			$(this).removeClass('active');
			setTimeout(function() { 
				$('#overlay:not(.active)').slideUp();
			}, 100);
		});

	$('#menu-item-199 a').mouseover(function() {
		$('#overlay:not(:animated)')
		  .addClass('active')
		  .slideDown();
	});
	
	$("table.gigpress-table").paginate({ limit: 8, content: 'tbody.vevent' });
	
	//lasts
	$('div.post:last', '#main-col').addClass('last');
	
	//radio prices
	function displayPrice() {
		$('span.price').each(function() {
			var price = $(this).prevAll('form').find(':radio:checked').attr('data-price');
			$(this).html(price);
		});
	}
	
	displayPrice();
	
	$('.bundle-radios form :radio').change(displayPrice);
	
	//product-title elipsis (FF)
	$('h4.product-title').textOverflow('...', true);
	
	//target blank nav
	$('#menu-main-nav li a[href^="http://twitter.com"]').attr('target', '_blank');
	$('#menu-main-nav li a[href^="http://facebook.com"]').attr('target', '_blank');
				
})(jQuery)
