$(document).ready(function(){
	//find a largePocket image and add the pocket to it.
	if ($('.largePocket').length > 0) {
		$('.largePocket').attr('style', 'margin-top: 12px;');
		$('.largePocket').parent().prepend('<img src="/media/layout/big-image-pocket.png" alt="" class="largePocketOverlay" />');
	}
	//find a mediumPocket image and add the pocket to it.
	if ($('.mediumPocket').length > 0) {
		$('.mediumPocket').attr('style', 'margin-top: 7px;');
		$('.mediumPocket').before('<img src="/media/layout/medium-image-pocket.png" alt="" class="mediumPocketOverlay" />');
	}
	//remove the text in the search box on focus
	if ($('#siteSearch').length > 0) {
		$('#siteSearch').focus(function() {
			$(this).val('');
		});
		$('#siteSearch').blur(function() {
			if ($(this).val().length == 0) $(this).val('search site...');
		});
	}
	//take care of the photo slideshow
	if ($('#main-photos').length > 0) {
		$('#mainPhoto1').hide();
		$('#mainPhoto2').hide();
		$('#mainPhoto3').hide();
		$('#mainPhoto4').hide();
		$('#mainPhoto5').hide();
		$('#main-photos').cycle({ 
			fx:     'scrollHorz', 
			speedIn:  1000,
			speedOut: 800,
			timeout: 8000, 
			slideExpr: ':not(.largePocketOverlay)',
			pause: 1,
			after: function() {
				var thisID = $(this).attr('id').split('mainPhoto')[1];
				if (thisID == 0) 
					prevID = 5;
				else
					prevID = (thisID - 1);
				$('#mainThumb' + (prevID)).removeClass('selected');
				$('#mainThumb' + thisID).addClass('selected');
			}
		});
	}
	
	//take care of rel="fancybox" links
	$('a[rel=fancybox]').fancybox();
});