// Show the caption related to the selected <li>
function imageCaptions(index) {
	$showThis = $('#imageCaptions li:eq(' + index + ')')

	$('#imageCaptions li:visible').hide();
	$showThis.show();
}

//
function changeZindex($this) {
	$this.siblings().css('z-index' , 1);
	$this.css('z-index' , 2);
}

$(document).ready(function() {
	$('#slider').innerfade({
		speed: 'slow',
		timeout: 4000,
		type: 'sequence',
		containerheight: '349px'
	}).css('position','absolute');

	// format phone fields
	$('input[name*="phone"]').mask("(999) 999-9999");

	$('#imageCaptions li').hide();

	$('#imageRollovers a').mouseover(function() {
		imageCaptions($(this).parents('li').index());
	}).click(function(e) { e.preventDefault(); });

	$('#pdfs div').mouseover(function() {
		changeZindex($(this));
	});

	$('.supMailerSection').find('.mailerItemContainer:even').css('clear','both');
	$('.ie7 .supMailerSection, .ie8 .supMailerSection').find('.mailerItemContainer:odd').after('<div class="clear">&nbsp;</div>')
	$('.ie7 #results .text, .ie8 #results .text').css('backgroundColor','white');
	$('.ie7 .dropdown').hover(function() {
		$(this).find('ul').css('left','0px');
	},function() {
		$(this).find('ul').css('left','-9999px');
	});

	$('#bubblemanGallery').innerfade({
		speed: 800,
		timeout: 4500,
		type: 'sequence',
		containerheight: '480px'
	});

	$('a.fancy').fancybox();
	$('#bubblemanGallery a').fancybox();
	$('a[rel=lightbox]').fancybox();

	/* html5form */
// commented out by brandon
//	$('form').html5form();

//	$('form').validationEngine();
});

