$(document).ready(function(){

	// Functions to start
	contentSlider();
	//footer();
	arrowsLeft();
	arrowsRight();
	/*facebooktt();
	twittertt();
	flickrtt();
	youtubett();
	diggtt();
	stumbleupontt();
	reddittt();
	delicioustt();*/

	/* -------------------------- Footer -------------------------- START */
	
	function footer() {
		
		//$('#socialMedia').css({opacity: '0.15'})
		//$('#socialMedia').fadeTo('100', 0.15, function() {
		// Animation complete.
	     //});
		
		$('#socialMedia').css({opacity: '0.15'})
		$('#fanNav').css({opacity: '0.15'})
		$('#staticBox').css({opacity: '0.15'})
		$('#footer img').css({opacity: '0.15'})
		$('#footer p').css({opacity: '0.15'})
		/*$('#footer .tt').css({visibility: 'hidden'})*/
		
		$('#hover_area_footer').bind('mouseover.mySlideDown', function() {

				$('#hover_area_footer').unbind('mouseover.mySlideDown');
				$('#socialMedia').animate({opacity: '0.9', queue: false}, 600, 'easeOutQuint');
				$('#fanNav').animate({opacity: '0.9', queue: false}, 600, 'easeOutQuint');
				$('#staticBox').animate({opacity: '0.9', queue: false}, 600, 'easeOutQuint');
				$('#footer img').animate({opacity: '0.9', queue: false}, 600, 'easeOutQuint');
				$('#footer p').animate({opacity: '0.9', queue: false}, 600, 'easeOutQuint');
				
				$('#hover_area_footer').bind('mouseleave.myUp', function() {
					$('#hover_area_footer').unbind('mouseleave.myUp');
					$('#socialMedia').animate({opacity: '0.15', queue: false}, 600, 'easeOutQuint');
					$('#fanNav').animate({opacity: '0.15', queue: false}, 600, 'easeOutQuint');
					$('#footer img').animate({opacity: '0.15', queue: false}, 600, 'easeOutQuint');
					$('#footer p').animate({opacity: '0.15', queue: false}, 600, 'easeOutQuint');
					$('#staticBox').animate({opacity: '0.15', queue: false}, 600, 'easeOutQuint', function() {footer();});
				});
		});
	}
	
	/* -------------------------- Footer -------------------------- END */
	
	/* -------------------------- Arrows -------------------------- START */
	
	function arrowsLeft() {
		
		$('.coda-nav-left').css({opacity: '0.5'})
		
		$('.coda-nav-left').bind('mouseover', function() {

				$('.coda-nav-left').unbind('mouseover');
				$('.coda-nav-left , .coda-nav-right').animate({opacity: '1', queue: false}, 600, 'easeOutQuint');
				
				$('.coda-nav-left').bind('mouseleave', function() {
					$('.coda-nav-left').unbind('mouseleave');
					$('.coda-nav-left , .coda-nav-right').animate({opacity: '0.5', queue: false}, 600, 'easeOutQuint', function() {arrowsLeft();});
				});
		});
	}
	function arrowsRight() {
			
			$('.coda-nav-right').css({opacity: '0.5'})
			
			$('.coda-nav-right').bind('mouseover', function() {
	
					$('.coda-nav-right').unbind('mouseover');
					$('.coda-nav-right , .coda-nav-left').animate({opacity: '1', queue: false}, 600, 'easeOutQuint');
					
					$('.coda-nav-right').bind('mouseleave', function() {
						$('.coda-nav-right').unbind('mouseleave');
						$('.coda-nav-right , .coda-nav-left').animate({opacity: '0.5', queue: false}, 600, 'easeOutQuint', function() {arrowsRight();});
					});
			});
	}
	
	/* -------------------------- Arrows -------------------------- END */
	
	/* -------------------------- Feature -------------------------- START */
		
	/* -------------------------- Feature -------------------------- END */
	
	/* -------------------------- Social Media Footer Tooltip I had to make a separate function for each one because I suck -------------------------- START */
	
	//$('#foo').slideUp(300).delay(800).fadeIn(400);
	
	function facebooktt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#facebooktt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 150})
		$('#facebook , #facebooktt').mouseover(function() {
			//if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			/*if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#facebooktt').css({display: 'block', opacity: '1'}), function() {beingShown = false; shown = true};
			}*/
			$('#facebooktt').fadeIn(400).css('display', block);
		})
		
		$('#facebook , #facebooktt').mouseout(function() {
			//if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			/*hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				facebooktt()
			}, hideDelay)*/
			$('#facebooktt').delay(800).fadeOut(400);
		});
	}
	function twittertt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#twittertt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 230})
		$('#twitter , #twittertt').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#twittertt').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				twittertt()
			}, hideDelay)
		});
	}
	function flickrtt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#flickrtt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 300})
		$('#flickr , #flickrtt').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#flickrtt').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				flickrtt()
			}, hideDelay)
		});
	}
	function youtubett() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#youtubett').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 360})
		$('#youtube , #youtubett').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#youtubett').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				youtubett()
			}, hideDelay)
		});
	}
	function diggtt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#diggtt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 440})
		$('#digg , #diggtt').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#diggtt').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				diggtt()
			}, hideDelay)
		});
	}
	function stumbleupontt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#stumbleupontt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 490})
		$('#stumbleupon , #stumbleupontt').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#stumbleupontt').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				stumbleupontt()
			}, hideDelay)
		});
	}
	function reddittt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#reddittt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 550})
		$('#reddit , #reddittt').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#reddittt').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				reddittt()
			}, hideDelay)
		});
	}
	function delicioustt() {
		var hideDelay = 200;		// option
		var hideDelayTimer = null;
		var time = 150;			// option
		var beingShown = false;		// tracker
		var shown = false;			// tracker
		$('#delicioustt').css({display: 'none', opacity: '0', position: 'fixed', bottom: 135, left: 625})
		$('#delicious , #delicioustt').mouseover(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// stops the hide event if we move from the trigger to the tooltip element
			if (beingShown || shown) {return;} else { 
				beingShown = true;
				$('#delicioustt').css({display: 'block', opacity: '1' }), function() {beingShown = false; shown = true};
			}
		}).mouseout(function() {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);									// reset the timer if we get fired again - avoids double animations
			hideDelayTimer = setTimeout(function () {										// store the timer so that it can be cleared in the mouseover if required
				hideDelayTimer = null;
				delicioustt()
			}, hideDelay)
		});
	}
	
	/* -------------------------- Social Media Footer Tooltip -------------------------- END */
	
	/* -------------------------- Content Slider keyboard activation. See jquery.coda-slider-1.0.js for plugin details -------------------------- START */
	
	function contentSlider() {
		
		$(document).keydown(function(e){
			if (e.which == 37) { 
				$('#left-key').click();
			} 
			else if(e.which == 39) { 
				$('#right-key').click();
			}
		});
	}
	
	/* -------------------------- Content Slider keyboard activation. See jquery.coda-slider-1.0.js for plugin details -------------------------- END */

  
});
