		
		(function ($) {
		
		//Link Bumping FUNCTION
		$.fn.LinkBump = function() {
			$(this).mouseup(function(){
				$(this).css({ 'margin-top' : '1px' });
			});
						
			$(this).mousedown(function(){
				$(this).css({ 'margin-top' : '1px' });
			});

			$(this).mouseout(function(){
				$(this).css({'margin-top' : '0px'});
			});
		};
		})(jQuery);
		
		$(document).ready(function()
		{
			$("#social-btn-section a").LinkBump();
			$("#social-btn-section2 a").LinkBump();
			
			
			$("input#register-submit").LinkBump();
			$("a#alpo-link").LinkBump();
			$("#cboxClose").LinkBump();
			
			//load color box for flash
			if($("#read-ebook").length){
				$("#read-ebook").colorbox(
					{
						transition: 'fade',
						initialWidth: 800,
						initialHeight: 600,
						speed: 1500,
						scrolling: false,
						onLoad:function(){ $("#cboxClose").hide();},
						onComplete:function(){  $("#cboxClose").show(); }
						
					}
				
				);
			}
			
			//load color box for flash - post page
			if($("#read-ebook-post").length){
				$("#read-ebook-post").colorbox(
					{
						transition: 'fade',
						initialWidth: 800,
						initialHeight: 600,
						speed: 1500,
						scrolling: false,
						onLoad:function(){ $("#cboxClose").hide();},
						onComplete:function(){  $("#cboxClose").show(); }
					}
				
				);
			}
			
			//image tilts
			
			$("#moreinfoimg").hover(
			  function () {
				$(this).css({'background-image' : 'url(images/img_book_hover.jpg)'});
			  }, 
			  function () {
				$(this).css({'background-image' : 'url(images/img_book.jpg)'});
			  }
			);
			
			//image tilts
			$(".whatis-hover").hover(
			  function () {
				$("#moreinfoimg").css({'background-image' : 'url(images/img_book_hover.jpg)'});
			  }, 
			  function () {
				$("#moreinfoimg").css({'background-image' : 'url(images/img_book.jpg)'});
			  }
			);

			//image tilts
			$("#whatis-desc").hover(
			  function () {
				$("#whatis-desc").css({'background-image' : 'url(images/img_cans_hover.jpg)'});
			  }, 
			  function () {
				$("#whatis-desc").css({'background-image' : 'url(images/img_cans.jpg)'});
			  }
			);

			
			//dialog rollover
			var options = {};
			$("a#taye-rollover").hover(
			  function () {
				$("#taye-bio").show();

			  }, 
			  function () {
				$("#taye-bio").hide();
			  }
			);
			
			//countdown
			var newYear = new Date(); 
			newYear = new Date(2010, 5 - 1, 19, 10); 
			$('#event-countdown').countdown({
				until: newYear,
				compact: true,
				layout: '<div class="image{d10}"></div><div class="image{d1}"></div>' + 
						'<div class="imageSep"></div>' + 
						'<div class="image{h10}"></div><div class="image{h1}"></div>' + 
						'<div class="imageSep"></div>' + 
						'<div class="image{m10}"></div><div class="image{m1}"></div>' + 
						'<div class="imageSep-last"></div>' + 
						'<div class="image{s10}"></div><div class="image{s1}"></div>'
			});
			
			//hide-show default input values
			$('input#register-input').click(
				function() {
					if (this.value == this.defaultValue) {
					this.value = '';
					}
			});
			$('input#register-input').blur(
				function() {
					if (this.value == '') {
					this.value = this.defaultValue;
					}
			});
			
			//watch archive display
			$('#watch-archive').click(
				function() {
					$('#post-overlay').hide();
					$('#read-ebook-post').hide();
					return false;
			});
			
			
			$('#middle-during form').submit(function() {
			  $('#event-countdown').countdown('destroy') // Remove countdown functionality 
			  $('#register').hide();
			  return false;
			});

			//fading notes - slideshow
			$('#rotating-note').cycle({ 
					timeout:  5000,
					pause: 1
			});
				
			function validate(email) {
			   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
			   if(reg.test(email) == false) {
			      alert('Invalid Email Address');
			      return false;
			   } else {
				  return true;
			   }
			}	
				
			// write hidden iframe
			var iframeSubmit = ($('#iframeSubmit').length) ? $('#iframeSubmit') : $('<iframe src="submit_frame.html" id="iframeSubmit"></iframe>').css({height:'0px',width:'0px'}).appendTo($('body'));
				
			$('#register-submit').click(function(e){
				e.preventDefault();
				if (validate($('#register-input').val())){
					var $link = iframeSubmit.contents().find('#registrationLink'),
						url = 'http://media.xfactorcom.com/medialink/201005Alpo/EMBED/analystregQS.asp?txtEmail=',
						userInput = $('#register-input').val();
					$link.attr('src',url+userInput);
					setTimeout(function(){window.location="thankyou.html";},300);
				}								
			});

			
		});


