jQuery(document).ready(function() {
	jQuery('#banners').cycle({
		fx: 'fade',
		speed: 1000,
		timeout: 6000
	});

	jQuery('textarea.infieldLabel').each(function() {
		if($(this).text() == "") {
			$(this).text($(this).attr('title'));
		}

		$(this).focus(function() {
			if(($(this).text() == $(this).attr('title')) && $(this).text() != "") {
				$(this).text('');
			}
		});

		$(this).blur(function() {
			if($(this).text() == "") {
				$(this).text($(this).attr('title'));
			}
		});
	});

	jQuery('input.infieldLabel').each(function() {
		if($(this).val() == "") {
			$(this).val($(this).attr('title'));
		}

		$(this).focus(function() {
			if(($(this).val() == $(this).attr('title')) && $(this).val() != "") {
				$(this).val('');
			}
		});

		$(this).blur(function() {
			if($(this).val() == "") {
				$(this).val($(this).attr('title'));
			}
		});
	});
});

jQuery(window).load(function() {
	// ms to fade
	var homepageDuration = 3000;
	// ms after last image loads (window.load)
	var homepageTimeout = 1500;
	/*
	* home pages start with class white
	* fades to class black
	*/
	
	setTimeout(function() {
		// add the normal logo, and hide it
		jQuery('body.home .identity').addClass('white').after('<h1 class="identity black">').filter('.black').attr('opacity','0');
		// fade all images from class white to black
		jQuery('.white').animate( { opacity: 0 }, homepageDuration);
		jQuery('.black').animate( { opacity: 1 }, homepageDuration);
		jQuery('body.home').removeClass('home',homepageDuration);

		jQuery('body.home, body.home header nav a').animate(
			{ color: 'white' },
			homepageDuration
		);
	}, homepageTimeout);

});

