errors = 0
jQuery(document).ready(function(){ 
	jQuery(".selectQuantity").click(function() {
		jQuery("#quantity").attr('value',1);
		jQuery(".quantitySelector").animate({ opacity: 1,height:45 }, 1000, "");
		
	});
	
	jQuery("#quantity").keyup(function() {
		if(isNaN(this.value) ||  this.value <= 0) {
			errors = 1;	
			jQuery('.errorQuantity').css('display',"block")
		} else {
			
			if(this.value > 1) {
				jQuery('#quantityLabel').html("tickets");
			} else {
				jQuery('#quantityLabel').html("ticket");
			}
			
			if(this.value==2) {
				document.paypalForm.amount.value=125
			} else {
				document.paypalForm.amount.value=150
			}
			
			errors=0;
			jQuery('.errorQuantity').css('display',"none")
		}
	});
	
	
	activePicture = "pic1";
	
	jQuery('.thumb img').hover(
		function(){
			jQuery("#"+this.id).animate({ opacity: 1 }, 500,"")
		}
		,
		function(){
			
			if(this.id!=activePicture) {
				jQuery("#"+this.id).animate({ opacity: 0.4 }, 500,"")
			}	
		}
		);
	
	jQuery('.thumb img').click(
		function() {
			jQuery('.thumb img').removeClass('imgActive');
//			jQuery('.thumb img').animate({ opacity: 0.4 }, 500,"")
			
			jQuery('#'+this.id).addClass('imgActive');
			jQuery('.thumb img').css('opacity',"0.4");
			jQuery('#'+this.id).css('opacity',"1");
			activePicture = this.id
			
			jQuery("#mainPicture").animate({opacity:0},800,
				function() {
					var newSrc = jQuery('#'+activePicture).attr('src').split('/')
					var newPic = newSrc[newSrc.length - 1];
//					
					
					jQuery('#mainPicture').removeAttr('src');
					jQuery('#mainPicture').attr('src',"images/gallery/normal/"+newPic);
					
					jQuery("#mainPicture").animate({opacity:1},500,"")
					
				}
			)
		}
	)
	
});


function addToPaypalCart(item,amount) {
	document.paypalForm.item_name.value = item
	document.paypalForm.amount.value = amount
	document.paypalForm.submit()
}