$(document).ready(function() {
	// set up tabbed panels
	$('ul.pricingTabs li').each( function(){
		$(this).click( function(){ showPanel($("ul.pricingTabs li").index(this)); } );
	});
	
	// activate gallery
	$('div.gallerySection ul.gallery').galleria();
	
	// coupon printing stuff
	$('.printLink').click( function(){ // print coupons only
		$('#wrapper').addClass("noPrint");
		$('body').prepend('<div id="couponPrintWrapper"></div>');
		$('#couponPrintWrapper').html($('.coupons').html());
		window.print();
		$('#couponPrintWrapper').remove();
		$('#wrapper').removeClass("noPrint");
	});
	equalize(); // make all coupons the same height
	
	// fancy zoom initiate
	setupZoom();
	
});	

function showPanel(index) { // show tabbed panel
	// hide all panels
	$('.panelContent').css({'display' : 'none'});
	$('.panelContent:eq('+index+')').css({'display' : 'block'});
	$('ul.pricingTabs li.active').removeClass("active");
	$('ul.pricingTabs li:eq('+index+')').addClass("active");
}

function equalize() {
	var tallest = 0;
	$('.coupon').each( function(){
		if ( $(this).height() > tallest )  tallest = $(this).height(); 
	}).height(tallest);
}

