
var clicks = 0;			// Set initial click value to 0
	
	$(document).ready(function(){
		$('#three-boxes a').contentSlide();			// Attach custom function to links under banner
		
		// Slideshow Contact Page Btns
		
		$("a.slide-btn").click(function(event){
			if(clicks == 0){
				clicks = 1;   
				$(".container").animate({ height: 'hide'}, 500, "easeOutExpo");
				$("#thumbSlider0").animate({opacity: 'hide'}, 500, "easeOutExpo");
				$('#last-btn').addClass("highlighted");
			 	$('#three-boxes').animate({ marginTop: '-=10px'}, 'fast');
			 	$(".top-border").animate({ marginLeft: '-=20px', width: '+=40px'}, 600, "easeOutExpo");
				$("#footer").animate({top: '1300px'}, 500, "easeOutExpo", function() {
					$("#contact-panel").animate({height: '+=900px'}, 200, "easeInExpo");
					$('#contact-panel').addClass("current");});
						}
					$("h1").click(function(event){
					if(clicks == 1){
    				 $('#three-boxes').animate({ marginTop: '+=10px'}, 'slow');
    				 $('.current').animate({height: '-=900px'}, 500, "easeInExpo", function() {
								$('.current').animate({height: '0px'}, 500, "easeInExpo", function(){
							//		panelContent.show();
								});
								$('.current').removeClass('current');
								$("#footer").animate({top: '663px'}, 500, "easeOutExpo");
				   				$('.container').animate({	 height: 'show'}, 500, "easeOutExpo");
				 	  		  $("#thumbSlider0").animate({opacity: 'show'}, 'slow');
			 					$(".top-border").animate({ marginLeft: '+=20px', width: '980px'}, 600, "easeOutExpo");
							});
					$('a').removeClass("highlighted");
					clicks = 0;                     // Set clicks back to zero...
    					 }
  					 });
  					 

  		 });
  		 
  		 // Internal Contact Page Btns
  		 $(".inside-contact").click(function(event){
  		 	$('.current').animate({height: '-=900px'}, 500, "easeInExpo", function() {
								$('.current').animate({height: '0px'}, 500, "easeInExpo", function(){
							//		panelContent.show();
								$('.current').removeClass('current');
								$('.highlighted').removeClass('highlighted');
								$("#contact-panel").animate({height: '+=900px'}, 200, "easeInExpo");
								$('#contact-panel').addClass("current");
								$('#last-btn').addClass("highlighted");
								});
							});
  		 });
	 });
	
	
	$.fn.contentSlide = function(){
		var topContainer = $('#three-boxes');
		var panelsContainer = $('#panels');
		
		$(this).click(function(event){				// Keeps the browser from doing default link commands like scroll to top of page
			var content = $(this).attr('class');	// Store which link had been clicked
			event.preventDefault();	
			var panelContent = $("." + content + ".ppanel");
				
			
			if(clicks == 0){						// If none of the links have been clicked yet...
			
				clicks = 1;                     // Set click value to 1
				
				$(".container").animate({ height: 'hide'}, 500, "easeOutExpo");
				$("#thumbSlider0").animate({opacity: 'hide'}, 500, "easeOutExpo");
				$(this).addClass("highlighted");
			 	topContainer.animate({ marginTop: '-=10px'}, 'fast');
			 	$(".top-border").animate({ marginLeft: '-=20px', width: '+=40px'}, 600, "easeOutExpo");
				$("#footer").animate({top: '1300px'}, 500, "easeOutExpo", function() {
					panelContent.animate({height: '+=900px'}, 200, "easeInExpo");
					panelContent.addClass("current");
				});
				
				$('h1').click(function() {
					if(clicks == 1){
			 		topContainer.animate({ marginTop: '+=10px'}, 'slow');
					$('.current', panelsContainer).animate({height: '-=900px'}, 500, "easeInExpo", function() {
						$('.current', panelsContainer).animate({height: '0px'}, 500, "easeInExpo", function(){
							panelContent.show();
						});
						$('.current', panelsContainer).removeClass('current');
						$("#footer").animate({top: '663px'}, 500, "easeOutExpo");
				   		$('.container').animate({	 height: 'show'}, 500, "easeOutExpo");
				 	    $("#thumbSlider0").animate({opacity: 'show'}, 'slow');
			 			$(".top-border").animate({ marginLeft: '+=20px', width: '980px'}, 600, "easeOutExpo");
					});
					$('a').removeClass("highlighted");
					clicks = 0;                     // Set clicks back to zero...
					}
				});
				
				
									
				
			} else {		
			
				if($(this).hasClass('highlighted')){
					// do nothing
				}
				
				else {
				
					$('.highlighted', topContainer).removeClass('highlighted');
					$(this).addClass("highlighted");
					$('.current', panelsContainer).animate({height: '-=900px'}, 200, "easeOutExpo", function() {
						$('#timer').animate({marginLeft: '-=500px'}, 200, function() {
								$('.current', panelsContainer).removeClass('current');
								panelContent.addClass("current");
								panelContent.animate({height: '+=900'}, 200, "easeInExpo");
							});
					});
				}
						
			}
		});
	};
