function div_fader(){
	$('#home_image').fadeToggle('slow',function(){
		$('#home_image2').fadeToggle('slow',function(){
			var t2 = setTimeout("div_fader2()",4000);
		});
	});
}

function div_fader2(){
	$('#home_image2').fadeToggle('slow',function(){
		$('#home_image').fadeToggle('slow',function(){
			var t2 = setTimeout("div_fader()",4000);
		});
	});
}

$(document).ready(function() {

	// declare rounded corners
	$('.rounded_gray').corner();
	$('.rounded').corner();
	$('#content_inside_left').corner();
	$('#content_inside_full').corner();
	
	// replace <hr> with image based hr
	$('hr').replaceWith("<img height='1' width='590' src='images/hr_590.png' class='hr' alt=''>");
	
	// Image Hover Swap
	$('img.hover').hover(function(){
		orig_image = $(this).attr('src');
		new_image = orig_image.replace('.png', '_s.png');
		$(this).attr('src', new_image);
	},function() {
		orig_image = $(this).attr('src');
		new_image = orig_image.replace('_s.png', '.png');
		$(this).attr('src', new_image);
	});
	
	// Form input behavior
	
	$('.mailinglist input').focus(function() {
		$(this).css('backgroundColor', '#FFF');
	});
	$('.mailinglist input').blur(function() {
		$(this).css('backgroundColor', '#333');
	});
	
	// The bottom of the iframe on the home page for the google map gets corners in ie but not firefox. This hides the manual image for rounded
	// corners in IE but lets it through in FF/etc. Haven't tested chrome/opera/safari yet
	if($.browser.msie) {
		$('.ie_hide').hide();
	}
	
	// show page after content/cufon/corners has loaded
	//$('#wrapper').fadeOut;
	//$('#wrapper').css({'display': 'block'});
	//$('#wrapper').fadeIn(300);
	
	$(".imgover").hover(
		function()
		{
			this.src = this.src.replace(".jpg","_s.jpg");
		},
		function()
		{
			this.src = this.src.replace("_s.jpg",".jpg");
		}
	);
	
	// Window Blind behavior when clicking on small plus buttons (mostly home page, some inside)
	
	$('a .home_plus_icon').toggle(function() {
		var graybox = $(this).parent().parent();
		graybox.animate({'height': 20}, 600);
		return false;
	},function() {
		var graybox = $(this).parent().parent();
		if(graybox.hasClass('tall')) {
			graybox.animate({'height': 262}, 600);
		} else {
			graybox.animate({'height': 232}, 600);
		}
	});
	
	if($('#slideshow_image').length > 0) $('#slideshow_image').kSlideshow();
	
	jQuery("#twitter").getTwitter({
		userName: "destinyusa",
		numTweets: 1,
		loaderText: "Loading tweets...",
		slideIn: true,
		slideDuration: 750,
		showHeading: false,
		headingText: "Latest Tweets",
		showProfileLink: false,
		showTimestamp: true
	});
	
	$('#img_slider').cycle({
		fx: 'scrollLeft'
	});
	
	$('#gallery').galleria({
			width: 900,
			height: 675,
			showInfo: true
	});
	
	var t = setTimeout("div_fader()",8000);
	
	//Stuff for walking tour form
	//show guest form fields when checkbox is selected
	
	$('input#fbrp__52').click(function(){
		//alert('change');
		if($('div.guest').is(':hidden')){
			$('div.guest').show();
		}
		else{
			$('div.guest').hide();
		}

	});
	
});
