var homebg = ["soul", "architects", "porch", "framer", "workers", "soul"];
var fader;
var current = 0;
function xfade(){
	var next = current + 1;
	if(next == homebg.length){
		next = 0;
	}
	fader.attr("class",homebg[next]);
	fader.fadeIn(1500, function(){
		$('body').removeClass(homebg[current]);
		current = next;
		$('body').addClass(homebg[current]);
		fader.hide();
		if(current != homebg.length-1){
			setTimeout("xfade()",10000);
		}
	});
}

$(document).ready(
	function() {

		// Open links with rel="external" in new window - like ye ole' target="_blank"
		$('a[rel="external"]').click(function() {window.open( $(this).attr('href') ); return false;});


		// Zebra-stripe data tables
		$(".nonforumcontent table tbody").each(function() {
			$(this).removeClass("odd even");
			$("tr:odd", this).addClass("odd");
			$("tr:even", this).addClass("even");
		});

		// Initialize Lightbox
		$(".lightbox").lightbox();


		// Textbox hint for Subscribe Form
		$('form#subscribe input.textbox').filter(function() {
			if ($(this).val() == ''){$(this).css({backgroundPosition:"right center"});}
		});
		$('form#subscribe input.textbox').focus(function() {$(this).css({backgroundPosition:"left center"});})
		.blur(function() {
		  if ($(this).val() == '') {$(this).css({backgroundPosition:"right center"});}
		});

		$("body.home").prepend('<div id="homefader1"></div>');
		fader = $("#homefader1");
		setTimeout("xfade()",10000);
	
		
		$(".homefader.soul").fadeOut('slow');

	}
);

