﻿$(document).ready(function(){
	// Video Play Button
	$('.videos li').fader({
    	time: 300,
		selectors: ".play"
	});
	
	$('.videos').fader({
		selectors: ".play",
		fadein: 1,
		fadeout: 0
	});
	
	$('.date.format').each(function(){	
		var month = parseInt($(this).text()) - 1; // Subtracting one from the month because array is base 0
		var months = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec');
		
		if ($(this).hasClass('comments')) {
			var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
		}
		
		if(month + 1 >= 10) {
			var day = parseInt($(this).text().substring(3));
			if(day > 9) {
				var year = parseInt($(this).text().substring(6));
			} else {
				var year = parseInt($(this).text().substring(5));
			}
		} else {
			var day = parseInt($(this).text().substring(2));
			if(day > 9) {
				var year = parseInt($(this).text().substring(5));
			} else {
				var year = parseInt($(this).text().substring(4));
			}
		}
		
		$(this).text("");
		
		if ($(this).hasClass('comments')) {
			$(this).append('<span class="month">' + months[month] + '</span> <span class="day">' + day + '</span>' + ', ' + year + ':'); 
		}
		else {
			$(this).append('<span class="month">' + months[month] + '</span> <span class="day">' + day + '</span>'); 
		}
	});
});

//Tooltip
$(window).load(function () {
	$(".photos li").each(function(){
		$(this).hover(function(){
			$(this).find(".toolTip").css("display", "block");
		}, function() {
			$(this).find(".toolTip").css("display", "none");
		});
	});
	
	// Fixes if hovered over the info div
	$(".photos li .toolTip").mouseover(function () {
			$(this).css("display", "none");													  
	});
});

function popitupmailing(url) {
	Shadowbox.open(
	{
		"title": "Sign&ndash;up for Burnham&rsquo;s Newsletter",
		"content": url,
		"width": 453, "height": 565,
		"reloadOnClose": false, "player": "iframe",
		"options": { "modal": false }
	}
	);
	return false;
}

