$(document).ready(function(){

		$("a.youtube").YouTubePopup({ autoplay: 1, draggable: false, modal: true, clickOutsideClose: true, hd: 1 });

        var boxfadein1 = function() {
            $("#one-over").show().animate({
                marginLeft: '0', 
                marginBottom: '+=72',
                width: '880', 
                height: '360'
            }, 600, function() {
                // Animation complete.
            });
            $("#one-over-content").delay(1000).addClass("allan").fadeIn(500);
            $("#one-over").addClass("blueb");
        };
        
        var boxfadeout1 = function() {
			$('#one-over').animate({
			    marginLeft: '0', 
			    marginBottom: '0',
			    width: '280px', 
			    height: '180px'
			}, 600);
			$("#one-over-content").removeClass("allan").fadeOut("fast");
			$("#one-over").fadeOut();
			$("#one-over").removeClass("blueb");
		};
		
        var boxfadein2 = function() {
            $("#two-over").fadeIn().animate({
                marginLeft: '-300', 
                marginBottom: '72',
                width: '880px', 
                height: '360px'
            }, 600, function() {
                // Animation complete.
            });
            $("#two-over-content").delay(1000).addClass("christina").fadeIn(500);
			$("#two-over").addClass("greenb");
        };
        
        var boxfadeout2 = function() {
			$('#two-over').animate({
			    marginLeft: '0', 
			    marginBottom: '0',
			    width: '280px', 
			    height: '180px'
			}, 600);
			$("#two-over-content").removeClass("christina").fadeOut("fast");
			$("#two-over").fadeOut();
			$("#two-over").removeClass("greenb");
		};
		
        var boxfadein3 = function() {
            $("#three-over").fadeIn().animate({
				marginLeft: '-600', 
				marginBottom: '72',
				width: '880px', 
				height: '360px'
            }, 600, function() {
                // Animation complete.
            });
            $("#three-over-content").delay(1000).addClass("nancy").fadeIn(500);
			$("#three-over").addClass("tealb");
			$("#two-over").removeClass("greenb");
        };
                
        var boxfadeout3 = function() {
			$('#three-over').animate({
			    marginLeft: '0', 
			    marginBottom: '0',
			    width: '280px', 
			    height: '180px'
			}, 600);
			$("#three-over-content").removeClass("nancy").fadeOut("fast");
			$("#three-over").fadeOut();
			$("#three-over").removeClass("tealb");
		};
		
        var boxfadein5 = function() {
            $("#health-over").fadeIn().animate({
				marginLeft: '0', 
				marginBottom: '0',
				width: '810px', 
				height: '110px'
            }, 600, function() {
                // Animation complete.
            });
            $("#health-over-content").delay(500).fadeIn(500);
        };
        
        var boxfadeout5 = function() {
			$('#health-over').animate({
			    marginLeft: '-40px', 
			    marginBottom: '0',
			    width: '880px', 
			    height: '20px'
			}, 600);
			$("#health-over-content").fadeOut("fast");
			$("#health-over").fadeOut();
		};
		
            
        // Dismiss the box with a tap.
     
        $('#close1').click(function(e){
        	$("#one").click(boxfadeout1);
            e.preventDefault(); // Keep # from showing in address bar
        }); 
        
        $('#close2').click(function(e){
        	$("#two").click(boxfadeout2);
            e.preventDefault(); // Keep # from showing in address bar
        });        
        
        $('#close3').click(function(e){
        	$("#three").click(boxfadeout3);
            e.preventDefault(); // Keep # from showing in address bar
        });          
          
        // $('.close').hide(); // No need to display hide button.
         
         // If on a computer, use the hover function
                 
        $("#one").hoverIntent({ sensitivity: 1,	over: boxfadein1, timeout: 1000, out: boxfadeout1 });
        $("#two").hoverIntent({ sensitivity: 1,	over: boxfadein2, timeout: 1000, out: boxfadeout2 });
        $("#three").hoverIntent({ sensitivity: 1, over: boxfadein3, timeout: 1000, out: boxfadeout3 });
        $("#health-care").bind("click",boxfadein5);
        $("#health-care").bind("mouseleave",boxfadeout5);

});
