$(document).ready(function() {
	
	// Unnescarry code to swap thumbnails when there was two thumbs per row (ex: Ikea).
	// Since we don't have any of those anymore, this code is useless.
	// To everyone who isn't me, enjoy!
	var $placeholderimg		= $("#ikea .placeholder").attr('src');
	
	var $ikeabobsbiglamp	= "images/commercials/thumb-ikea_bnl.jpg";
	var $ikealamps			= "images/commercials/thumb-ikea_lamps.jpg";
	
	
	$("#ikea #ikeabob").hover(function() {
		$("#ikea .placeholder").attr('src', $ikeabobsbiglamp)
	}, function() {
		$("#ikea .placeholder").attr('src', $placeholderimg)
	});
	
	$("#ikea #ikealamp").hover(function() {
		$("#ikea .placeholder").attr('src', $ikealamps)
	}, function() {
		$("#ikea .placeholder").attr('src', $placeholderimg)
	});
	
	
	
	
	/*
	Fancy Box and Mobile Safari detection
	- "Vimeo - URL of mobile version?" - http://vimeo.com/forums/topic:22207
	*/


	var deviceAgent = navigator.userAgent.toLowerCase();
	var agentID = deviceAgent.match(/(iphone|ipod|ipad|BlackBerry)/);

	if (agentID) {
		$(".entry a").click(function() {return true;}); // If Mobile Safari (iPhone, iPod, iPad)

	} else {

		// http://groups.google.com/group/fancybox/browse_thread/thread/e5067d93a3893d28/4406cb29520be48e?lnk=raot
		// http://fancybox.net/vimeo
		$(".entry a, a.fancybox").click(function() {
			$.fancybox({
				'transitionIn'	:	'fade',
				'transitionOut'	:	'fade',
				'speedIn'		:	400, 
				'speedOut'		:	100,
				'padding'       : 5, 

				'easingIn':'easeOutCubic',
				'easingOut':'easeInCubic',

				'opacity'		: 	true,

				'overlayShow'	:	true,
				'overlayOpacity'	:0.7,
				'overlayColor'	:'black',

				'titlePosition':'outside',

				'title'                 : this.title,
				//'title'                 : '\"static here\"', 
				'width'                 : 640, 
				'height'                : 424, 
				'href'					: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1') + '&amp;fullscreen=1',
				'type'                  : 'swf',
				'swf'					: {'wmode' : 'transparent', 'allowfullscreen' : 'true'}
			}); 
		return false; 
		});
	}
	
	
	
	
	
	
	
});

