$(document).ready(function(){
 	
	/*------------------- Galeries ------------------------------------------------------------------------*/
	//----------- Main Slideshow
	
	$('#slideshow').cycle({ 
		fx:     'fade', 
		speed:   1500, 
		timeout: 6000, 
		cleartype:  1
	 });
	
	function onBefore(curr,next,opts) { 
		$(this).find('p').hide();
	}
	
	function onAfter(curr,next,opts) { 
		$(this).find('p').fadeIn();
	}
	
	$('#pause').click(function() { $('#slideshow').cycle('pause'); return false; });
    $('#play').click(function() { $('#slideshow').cycle('resume'); return false; });

	/*-------Paypal form----------------------------------------------------------------------------------*/
	
	( $('form#paypal').length ) ? countForm() : '';
	$("select[name='data']").change( function() {
		countForm();	
	});

	
	/*--------------------------------65--------------------------------------------------------*/
	/*-----------------------------------------------------------------------------------------*/
	$.easing.custom = function (x, t, b, c, d) { 
		var s = 1.70158;  
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 
	}
	$.easing.easeOutExpo = function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	};
	$.easing.easeOutBounce = function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	};

	/*-------------------------------------------------*/
	
}); //Close document.ready

$(window).bind("load", function() {							
    //-----------  Preload images for 
	
	$('.loading').each(function () {
		$(this).hide();
	});
	$('#specialOffer, #tabs').fadeIn('slow');
	$('#slideshowWrapper').fadeIn('slow');

});

function countForm() {
	data = $("select[name='data']").val();
	data = data.split('|');
	
	quantity = parseFloat(data[0]);
	shipping = parseFloat(data[1]);
	amount = parseFloat( $("input[name='amount']").val() );
	
	var item_total = amount * quantity;
	var total = item_total + shipping;
	
	$("input[name='quantity']").val(quantity);		
	$("input[name='shipping']").val(shipping);
	
	$('#status span.item').text(item_total.toFixed(2));
	$('#status span.postage').text(shipping.toFixed(2));
	$('#status span.total').text(total.toFixed(2));
}

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}





