$(document).ready(function() {

	// search form click and click out
	$('.default-value').each(function() {
		var default_value = this.value;
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
	
	// modal pop-over window
	var triggers = $(".modalInput").overlay({
		mask: {
			color: '#ddd',
			loadSpeed: 400,
			opacity: 0.95
		},
		closeOnClick: false,
		onLoad: function(event) {
			$('#the_login_window #username').focus();
		}
	});
	
	// modal event info for calendar
	$('.event a').cluetip({ 
		cluetipClass: 'jtip', 
		arrows: true, 
		dropShadow: false, 
		local: true, 
		hideLocal: true, 
		clickThrough: true, 
		sticky: true, 
		closePosition: 'title', 
		closeText: '<img src="http://catadoptionteam.org/images/site/icons/16x16_X.png" alt="close" />', 
		cursor: 'pointer', 
		cluezIndex: 9999
	});
	
	// collapse and expand frequently asked questions
	
		$("dd").hide();
		$("dt").click(function(){$(this).next().toggle();});

	// image hovers - by Steve Wooster
    	$('.imgover').each(function () {		
		var src = $(this).attr('src');
		var fileType = src.substring(src.lastIndexOf('.'), src.length);
		var hoverSrc = src.replace(fileType, '_o'+fileType);

		var originalImage = new Image();
		var hoverImage    = new Image();
		originalImage.src = this.src;
		hoverImage.src    = hoverSrc;
		
		function rollIn() {
			this.src = hoverImage.src;
		}
		function rollOut() {
			this.src = originalImage.src;
		}
		$(this).hover( rollIn, rollOut );
    	});

	// smooth fading slide show settings
	$('#home_banner_slide_show, #home_content_slide_show') 
	.cycle({ 
		fx: 'fade', 
		timeout: 6000,
		speed: 2000,
		pause: true
	});

	// call superfish() for the containing ul element
        $('ul.sf-menu').superfish(); 

}); 
 