$(document).ready(function(){
	$('#slides').cycle({
		fx: 'fade',
		cleartype: true,
		cleartypeNoBg: true,
		timeout: 5000,
		prev:'#prev',
		next: '#next',
		pager: '#pager'
	});
	$('#pager a').html('&nbsp;');
	$('input[type="text"], textarea').each(function() {
			var defval = this.value;
			$(this).focus(function() {
				if(this.value == defval) {
					this.value = '';
					$(this).css('color', '#000');
				}
			});
			$(this).blur(function() {
				if(this.value == '') {
					this.value = defval;
					$(this).css('color', '#999');
				}
			});
		});
	$(".tab_content").hide();
	$("ul.tabs li:first").addClass("active").show();
	$(".tab_content:first").show();
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active");
		$(this).addClass("active");
		$(".tab_content").hide();
		var activeTab = $(this).find("a").attr("href");
		$(activeTab).fadeIn();
		return false;
	});
	$(".tab_content #nexttab").click(function() {
		$(".tab_content").hide();
		var actb = $(this).attr("href");
		$("ul.tabs li.active").removeClass('active').next().addClass("active");
		$(actb).fadeIn();
		return false;
	});
	$('a[rel="prettyPhoto"]').prettyPhoto();
	$('#questions_slide .answer').not(':first').hide();
	$('#questions_slide .question').click(function() {
		if($(this).next('.answer').is(':visible')) {
			$(this).next('.answer').slideUp(300);
		} else {
			$(this).next('.answer').slideDown(300).siblings('.answer').slideUp(300);
		}
	});
	$('#check_boxes').addClass('background');
	$('#check_boxes .check_mark li').not(':first').hide();
	function questions_cycle() {
		$('#check_boxes .check_mark li:visible').fadeOut(300, function(){
			$(this).next('li').fadeIn(300);
			var thishtml = $(this).html();
			$(this).parent('ul').append('<li style="display:none">' + thishtml + '</li>');
			$(this).remove();
		});
	}
	setInterval(questions_cycle, 5000);
	$('#deb-email').html(function(){
		var e = "dcwaters";
		var d = "apogeebg";
		var a = "@";
		var c = ".com";
		var h = 'mailto:' + e + a + d + c;
		$(this).parent('a').attr('href', h);
		return e + a + d + c;
	});
	$('#steve-email').html(function(){
		var e = "spmiller";
		var d = "apogeebg";
		var a = "@";
		var c = ".com";
		var h = 'mailto:' + e + a + d + c;
		$(this).parent('a').attr('href', h);
		return e + a + d + c;
	});
});
