// JavaScript Document

$(document).ready(function() {
						
	$('#header').corner("bottom 15px");	
	$('#content').corner("15px");
	$('#fancybox-outer').corner("15px").parent().css('padding', '4px').corner("round 20px");
	
/* SLIDESHOW */
$('#slideshow').cycle('fade')


/* FAQ Slide Script */
$('.faq li a, .faq p a').click(function () { 
	$(this).parent().next(".hide").slideToggle();
});

/* FANCY */
	
	$("a.sideContact, a.contact").fancybox({
		'type' : 'iframe',
		'overlayShow'	:	true,
		'hideOnContentClick' : true ,
		'width'			: 820,
		'height'		: 550,
		'autoScale'     	: false,
		'overlayOpacity' : 0.8,
		'centerOnScroll' : true,		
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'easingIn' : 'easeOutBack',
		'easingOut' : 'easeInBack'

	});
	
	$(".register a").fancybox({
		'type' : 'iframe',
		'overlayShow'	:	true,
		'hideOnContentClick' : false,
		'autoScale'     	: false,
		'overlayOpacity' : 0.8,
		'width'			: 820,
		'height'		: 600,
		'centerOnScroll' : true,		
		'transitionIn' : 'elastic',
		'transitionOut' : 'fade',
		'easingIn' : 'easeOutBack'

	});

/* CONTACT FORM */
$("#contact input[type='text'], #register input[type='text']").focus(function () { 
												 
	$(this).animate({ 
		width: "300px",
		height: "30px",
		fontSize: '18px',
		lineHeight: "30px"
	}, 1000, "easeOutBounce");
	
	$(this).css({
	'border-color' : '#6cf'
				});
												 
}).blur(function () { 

	$(this).animate({ 
		width: "200px",
		height: "18px",
		fontSize: '14px',
		lineHeight: "18px"
	}, 1000, "easeOutBounce");

	$(this).css({
	'border-color' : '#999'
	});

});

$("#contact textarea, #register textarea").focus(function () { 
												 
	$(this).animate({ 
		width: "300px",
		height: "100px",
		fontSize: '18px'
	}, 1000, "easeOutBounce");
	$(this).css({
	'border-color' : '#6cf'
				});
												 
}).blur(function () { 

	$(this).animate({ 
		width: "200px",
		height: "30px",
		fontSize: '14px'
	}, 1000, "easeOutBounce");
	$(this).css({
	'border-color' : '#999'
	});

});

/* FORM SUBMIT */
//Contact
$('#contact').submit(function(){

	 var action = $(this).attr('action');

		 $.post(action, {
				 name: $('#name').val(),
				 email: $('#email').val(),
				 phone: $('#phone').val(),
				 message: $('#message').val()
		 	},

			 function(data){
			 //$('#cForm').fadeIn(1000);
			 //$('.response').fadeOut(500,function(){$(this).remove()});
			 var newdatas = data.split("|||||");
			 if(newdatas.length <= 1) {
			 	newdatas[1] = data;
				}
			 $('.response').remove()
			 $('#contact').before('<div class="response">'+newdatas[1]+'</div>');
			 $('.response').hide()
			 $('.response').fadeIn()
				 if(newdatas[0]=='true') {
					 $('#contact').fadeOut();
					 $('.response').remove()
					 $('.response').hide()
					 $('.response').fadeIn()
					 $('#contact').before('<div class="response">'+newdatas[1]+'</div>');
				 }

			 }
	 );

 return false;

 });

//Register
$('#register').submit(function(){

	 var action = $(this).attr('action');

		 $.post(action, {
				 name: $('#name').val(),
				 email: $('#email').val(),
				 address: $('#address').val(),
				 city: $('#city').val(),
				 state: $('#state').val(),
				 zip: $('#zip').val(),
				 phone: $('#phone').val(),
				 quantity: $('#quantity').val(), 
				 time: $('#time').val(),
				 date: $('#date').val(), 
				 show: $('#show').val()
		 	},

			 function(data){
			 //$('#cForm').fadeIn(1000);
			 //$('.response').fadeOut(500,function(){$(this).remove()});
			 var newdatas = data.split("|||||");
			 if(newdatas.length <= 1) {
			 	newdatas[1] = data;
				}
			 $('.response').remove()
			 $('#register').before('<div class="response">'+newdatas[1]+'</div>');
			 $('.response').hide()
			 $('.response').fadeIn()
				 if(newdatas[0]=='true') {
					 $('#register').slideUp();
					 $('.response').remove()
					 $('.response').hide()
					 $('.response').fadeIn()
					 $('#register').before('<div class="response">'+newdatas[1]+'</div>');
				 }

			 }
	 );

 return false;

 });



$("#all").click(function () { 
	$("#allShows .show").css("display", "block");  
	$("a.page_link, a.next_link, a.previous_link").css("color", "#e2e2e2");
});

$("a.page_link, a.next_link, a.previous_link").click( function() {
	$(".page_navigation a").css("color", "#1A77BE");
});






});
