// initialize the slideshow when the DOM is ready
$(document).ready(function() {
    $('.slideshow')
	.before('<div id="nav">')
	.cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		pager:  '#nav',
		speed: 500,
		timeout: 4000,
		pause: 1
	});
	$(".cover", this).stop().css({top:'262px'});
	
	// Fit height fix
	$(".fitheight").each(function(){
		if( $(this).is('.bottomhr') ) {
			// has to be 1px less because of the 1px bottom border
			$(this).height( $(this).parent().height() - 1);
		}else {
			$(this).height( $(this).parent().height());
		}
	});
	
	$("div.quote_body p:last-child").append('<img class="endquote" align="&quot;" src="/images/testimonials-quote-end.png" />');
	$("div.quote_body p:first-child").prepend('<img class="startquote" align="&quot;" src="/images/testimonials-quote-start.png" />');
	// any input focusing
	$("input[type=text]").focus(function(){
		$(this).addClass('focused', 100);
		});
	$("input[type=text]").blur(function(){
		$(this).removeClass('focused', 100);
		});
	// efects for search button on input focus
	$("#search_bar input[type=text]").focus(function(){
		$("#searchsubmit").addClass('focused', 100);
		});
	$("#search_bar input[type=text]").blur(function(){
		$("#searchsubmit").removeClass('focused', 100);
		});
	
	//Menu hover
	$('#header #navigation li').hoverIntent(function(){
		$(".underline:not(.active)",this).fadeIn(300);
	}, function() {
		$(".underline:not(.active)",this).fadeOut(300);
	});
	
	


	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Vertical Sliding
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	});
	//Horizontal Sliding
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	//Diagnal Sliding
	$('.boxgrid.thecombo').hover(function(){
		$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
	});
	//Partial Sliding (Only show some of background)
	$('.boxgrid.peek').hover(function(){
		$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	});
	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
	});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hoverIntent(function(){
		$(".cover", this).stop().animate({top:'180px',backgroundColor: '#FF3333'},{queue:false,duration:160});
		$(".background", this).fadeIn(160);
	}, function() {
		$(".cover", this).stop().animate({top:'262px',backgroundColor: '#999999'},{queue:false,duration:160});
		$(".background", this).fadeOut(160);
	});

});

Cufon.replace('h1,h2,.nice, .entry h3, #header #navigation a .link, .statement', { fontFamily: 'Attitude' });

//$(document).ready(function() {
// $('#slideshow').cycle({
//   cleartype: true,
//   timeout: 8000,
//   pause: true,
//   before: function() {
//     $('#slideshow span').css('display','none');
//   },
//   after: function() {
//     $('span', this).css({opacity: '0.8'}).slideDown();
//   }
// });
//});

