$(document).ready(function() {
	jQuery.easing.def = "easeInOutQuart";
	
	var myDate = new Date();
	var day = "Sunday";
	switch(myDate.getDay()){
		case 0:
			day = "Sunday";
			break;
		case 1:
			day = "Monday";
			break;
		case 2:
			day = "Tuesday";
			break;
		case 3:
			day = "Wednesday";
			break;
		case 4:
			day = "Thursday";
			break;
		case 5:
			day = "Friday";
			break;
		case 6:
			day = "Saturday";
			break;
		default:
			day = "Sunday";
	}
	
	var monTh = "January";
	switch(myDate.getMonth()){
		case 0:
			monTh = "January";
			break;
		case 1:
			monTh = "February";
			break;
		case 2:
			monTh = "March";
			break;
		case 3:
			monTh = "April";
			break;
		case 4:
			monTh = "May";
			break;
		case 5:
			monTh = "June";
			break;
		case 6:
			monTh = "July";
			break;
		case 7:
			monTh = "August";
			break;
		case 8:
			monTh = "September";
			break;
		case 9:
			monTh = "October";
			break;
		case 10:
			monTh = "November";
			break;
		case 11:
			monTh = "December";
			break;
		default:
			monTh = "January";
	}
	
	var hours = myDate.getHours();
	var ampm = "AM";
	if (hours >= 12){
		hours = hours - 12;
		ampm = "PM";
	} else {
		ampm = "AM";
	}
	var minutes = myDate.getMinutes();
	if (minutes <= 9){
		minutes = "0" + minutes;
	}
	
	
	var displayDate = day + ' | ' + monTh + ' ' + myDate.getDate() + ', ' + myDate.getFullYear()  + ' | ' + hours + ":" + minutes + " " + ampm;
	$('#timedate').html(displayDate);

	var slideNum = 0;
	var strip = $("#feature #wrap");
	var total = ($("#feature #wrap").children().length);
	
	
	showFirst();
	window.setInterval(changeSlide, 4000);


	function changeSlide() {
		if(slideNum != -total + 1){
			slideNum -= 1;
		} else {
			slideNum = 0;
			$("#feature #wrap div .message").css({ left: -944, opacity: 0, easing: "swing" }, 0);
		}
		var n = -slideNum + 1;
		$(strip).animate({ left: slideNum * 944, easing: "swing" }, 1000);
		$("#feature #wrap div:nth-child(" + n + ") .message").animate({ left: -600, top: $("#feature #wrap div:nth-child(" + n + ") .message img").attr('class')}, 0);
		$("#feature #wrap div:nth-child(" + n + ") .message").delay(100).animate({ left: $("#feature #wrap div:nth-child(" + n + ") .message img").attr('id'), top: $("#feature #wrap div:nth-child(" + n + ") .message img").attr('class'), opacity: 1, easing: "swing" }, 1600);

	};
	
	function showFirst() {
		$("#feature #wrap div:nth-child(1) .message").animate({ left: -600, top: $("#feature #wrap div:nth-child(1) .message img").attr('class')}, 0);
		$("#feature #wrap div:nth-child(1) .message").delay(100).animate({ left: $("#feature #wrap div:nth-child(1) .message img").attr('id'), top: $("#feature #wrap div:nth-child(1) .message img").attr('class'), opacity: 1, easing: "swing" }, 1600);
	};
});

