// JavaScript Document



(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)


$(function () {  
     jQuery.preLoadImages( 
     			  "/images/site/nav-item-home.png",
     			  "/images/site/nav-item-about.png",
     			  "/images/site/nav-item-happy.png",
     			  "/images/site/nav-item-use.png",
     			  "/images/site/nav-item-contact.png",   			  
                          "/images/site/about-bg.png", 
                          "/images/site/about-bg-over.jpg", 
                          "/images/site/happy-bg.png",
						  "/images/site/happy-bg_new.png",
                          "/images/site/happy-bg-over.jpg",
                          "/images/site/use-bg.png",
                          "/images/site/use-bg-over.jpg",
						  "/images/site/whatsnew-bg.png",
                          "/images/site/whatsnew-bg-over.gif",
                          "/images/site/contact-bg.png",
                          "/images/site/contact-bg-over.gif",
                          "/images/site/continue.png",
                          "/images/site/continue-over.png",
						  "/images/site/continue-over.jpg",
                          "/images/site/keys.png",
                          "/images/site/orange-arrow.jpg",
                          "/images/site/more-testimonials.png",
                          "/images/site/more-testimonials-over.png",
                          "/images/site/more.png",
                          "/images/site/more-over.png",
                          "(/images/site/post-it-note1.png",
                          "(/images/site/post-it-note2.png",
                          "(/images/site/post-it-note3.png",
                          "(/images/site/post-it-note4.png",
                          "(/images/site/post-it-note5.png",
                          "(/images/site/post-it-note6.png",
                          "/images/site/paper1.png",
                          "/images/site/paper2.png",
                          "/images/site/paper3.png",
                          "/images/site/paper4.png",
                          "/images/site/paper5.png");
     $(window).scroll(function () {  
         if ($(this).scrollTop() != 0) {  
             $('#toTop').fadeIn();  
         } else {  
             $('#toTop').fadeOut();  
         }  
     });  
     $('#toTop').click(function () {  
         $('body,html').animate({  
             scrollTop: 0  
         },  
         800);  
     });
       
     $("#tile-about a").css('opacity', 0.0);
     $("#tile-about a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 
     
     $("#tile-use a").css('opacity', 0.0);
     $("#tile-use a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 

     $("#tile-happy a").css('opacity', 0.0);
     $("#tile-happy a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     );
	 
     $("#tile-happy-new a").css('opacity', 0.0);
     $("#tile-happy-new a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     );
	 
	 $("#tile-whatsnew a").css('opacity', 0.0);
     $("#tile-whatsnew a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 

     $("#tile-contact a").css('opacity', 0.0);
     $("#tile-contact a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 

     $("#keys a").css('opacity', 0.0);
     $("#keys a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("fast", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 

     $("#paper1 a").css('opacity', 0.0);
     $("#paper1 a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("slow", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 

     $("#paper2 a").css('opacity', 0.0);
     $("#paper2 a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("slow", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 
     
     $("#paper3 a").css('opacity', 0.0);
     $("#paper3 a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("slow", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 
     
     $("#paper4 a").css('opacity', 0.0);
     $("#paper4 a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("slow", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     ); 
     
     $("#paper5 a").css('opacity', 0.0);
     $("#paper5 a").hover(
                function(){
                	$(this).stop();
		        $(this).fadeTo("slow", 1.0);
		},
                function(){
                	$(this).stop();
			$(this).fadeTo("slow", 0.0);		
		}
     );                             		
});  




