$(document).ready(function() {
	
	//
	// Dropdown parent hover maintain
	// -------------------------------------------------------------------------
	
	$('#menu li ul').hover(
		function() {
			$(this).parent().addClass('subhover');
		},
		function() {
			$(this).parent().removeClass('subhover');
		}
	);
	
	$('#menu ul ul li a').removeAttr('title');
	
	$('#menu ul li').hover(
		function() {
			$(this).children('ul').show();
		},
		function() {
			$(this).children('ul').hide();
		}
	);
	
	
	//
	// Feature Navigation Behavior
	// -------------------------------------------------------------------------
	
	/*
	$('.press a').css({
		'background-image' : 'url(wp-content/themes/sheworks/images/btn_press_over.jpg)',
		'opacity' : '0'
	});
	$('.membership a').css({
		'background-image' : 'url(wp-content/themes/sheworks/images/btn_membership_over.jpg)',
		'opacity' : '0'
	});
	$('.events a').css({
		'background-image' : 'url(wp-content/themes/sheworks/images/btn_events_over.jpg)',
		'opacity' : '0'
	});
	
	$('.feature-nav li').hover(function () {
		$(this).children("a").stop().animate({
			'opacity' : 1
		},'normal');
	}, function () {
		$(this).children("a").stop().animate({
			'opacity' : 0
		},'normal');
	});
	*/
	
	
	//
	// Feature Navigation Behavior BUG NOT WORKING
	// -------------------------------------------------------------------------
	
	$('.feature-nav li a').hover(function(){
		$(this).animate({
			'background-color' : '#eaeaea'
		},'normal');
	},function(){
		$(this).animate({
			'background-color' : '#f6f6f6'
		},'normal');
	});
	
	
	//
	// Fancybox
	// -------------------------------------------------------------------------
	
	//sidebar widget images
	$(".ngg-widget a").fancybox({ 
		'zoomSpeedIn': 0, 
		'zoomSpeedOut': 0, 
		'overlayShow': true, 
		'hideOnContentClick': true,
		'overlayOpacity': .7
	});
	
	$(".ngg-gallery-thumbnail a").fancybox({ 
		'zoomSpeedIn': 0, 
		'zoomSpeedOut': 0, 
		'overlayShow': true, 
		'hideOnContentClick': true,
		'overlayOpacity': .7
	});
	
	
	//
	// Join Tabbed Form
	// -------------------------------------------------------------------------
	
	// .personalbtn
	// #wpcf7-f2-p158-o1
	
	// .corporatebtn
	// #wpcf7-f3-p158-o2
	
	if( $("#corp-post").length > 0 ){
		// Show Corporate form 
		$('#wpcf7-f2-p158-o1').hide();
		//$('#wpcf7-f3-p158-o2').show();
		$(".corporatebtn").addClass("current-tab");
	} else{
		// Show Personal
		$('#wpcf7-f3-p158-o2').hide();
		//$('#wpcf7-f2-p158-o1').show();
		$(".personalbtn").addClass("current-tab");
	}

	// ??? handle showing corporate onsubmit of corporate form here...
	
	$(".personalbtn").click( function (e){
		e.preventDefault();
		$(this).addClass("current-tab");
		$(".corporatebtn").removeClass("current-tab");
		$("#wpcf7-f3-p158-o2").hide();
		$("#wpcf7-f2-p158-o1").show();
	});
	
	$(".corporatebtn").click( function (e) {
		e.preventDefault();
		$(this).addClass("current-tab");
		$(".personalbtn").removeClass("current-tab");
		$("#wpcf7-f2-p158-o1").hide();
		$("#wpcf7-f3-p158-o2").show();
	});
	
});