$(document).ready(function() {
	//$(document).pngFix();

	// Main Navigation	
	$('#nav li').hover(function() {
		$('ul', this).fadeIn('fast');
		$(this).addClass('over');
	}, function() {
		$('ul', this).fadeOut('fast');
		$(this).removeClass('over');
	});
	
	$('.submitBtns input').hover(function(){
		$(this).css('background-position','0 -21px');
	}, function() {
		$(this).css('background-position','0 0');
	});
	
	$('textarea').blur().text('Please enter a description of the problem.');
	$('textarea').focus().text('');
	
	if($('#heroImgs').is(':visible') == true) {
		$('#heroImgs').cycle({ 
		    fx:    'fade', 
		    timeout:  7000,
			speed: 2000,
			random:  1
		});
	}
});

$(function tracker() {
	$('a.tracker').click(function() {
		$("#gaCode").attr("src","contact-tracker.html");
	});
});

// Tab Switcher
$(function tabSwitcher() {
	tabList = arrayBuilder();
	//$('#tabContainer div').hide();
	$('#'+tabList[0]).show();
	
	$('ul#tabs a').click(function () {
		var tabNum = $(this).attr('rel');
		
		if (tabNum == 2) {
			$('ul#tabs').addClass('two');	
		}
		else {
			$('ul#tabs').removeClass('two');
		}
		$('#tabContainer div').hide();
		$('#'+tabList[tabNum-1]).fadeIn();
		return false;
	});
});

function arrayBuilder() {
	var arr = jQuery.makeArray(document.getElementById("tabContainer").getElementsByTagName("div"));
	arrList = new Array();
	
	jQuery.each(arr, function() {
		arrList.push(this.id);
	});
	
	return arrList;
}

$(function () {
	$('#provider a').click(function() {
		$('.merchantInfo').hide();
		$('#provider a, #merchant a').removeClass('on');
		$(this).addClass('on');
		$('#merchant').show();
		$('#merchBox').scrollTo(0);
		return false;
	});
	$('#merchant a').click(function() {
		var mercID = $(this).attr('href');
		$('.merchantInfo').hide();
		$('#merchant a').removeClass('on');
		$(this).addClass('on');
		$(mercID).show();
		return false;
	});
});

