var $j = jQuery.noConflict();
$j(function () {

	//hide the divs containing the rollovers on the home page
	$j('#facebookRollover').hide();
	$j('#mainRollover').hide();
	$j('#expect').hide();
	$j('#team').hide();
	$j('#signs').hide();
	$j('#directions').hide();
	$j('#mobile').hide();
	
   //check for external links
   $j('a, area').filter(function () {
        return this.hostname && (this.hostname).split(":")[0] !== (location.hostname).split(":")[0] || $j(this).attr('rel') == 'external'
    }).not(':has(img, div, mailto)').addClass('external').end().click(function (e) {
        open(this.href);
        e.preventDefault()
    });
	
	//do the rollovers and fades
		$j(".bigImage").hover(
		  function () {
			$j('#mainRollover').stop(false, true).slideToggle();
		  },
		  function () {
			//$j('#mainRollover').hide();
		  }
		);
		
		$j("#mainRollover").hover(
		  function () {
			//$j('#mainRollover').show();
		  },
		  function () {
			$j('#mainRollover').stop(false, true).slideToggle();
		  }
		);
		
		$j(".fbImage").hover(
		  function () {
			$j('#facebookRollover').stop(false, true).slideToggle();
		  },
		  function () {
			//$j('#facebookRollover').hide();
		  }
		);
		
		$j("#facebookRollover").hover(
		  function () {
			//$j('#facebookRollover').show();
		  },
		  function () {
			$j('#facebookRollover').stop(false, true).slideToggle();
		  }
		);
		
		$j("img.expect").hover(
		  function () {
			$j('img.expect').hide();
			$j('#expect').fadeIn('slow', function() { });
		  },
		  function () {
			//$j('#expect').hide();
		  }
		);
		
		$j("#expect").hover(
		  function () {
			//$j('#expect').show();
		  },
		  function () {
			$j('img.expect').fadeIn('slow', function() { });
			$j('#expect').hide();
		  }
		);
	
		$j("img.team").hover(
		  function () {
			$j('img.team').hide();
			$j('#team').fadeIn('slow', function() { });
		  },
		  function () {
			//$j('#expect').hide();
		  }
		);
		
		$j("#team").hover(
		  function () {
			//$j('#team').show();
		  },
		  function () {
			$j('img.team').fadeIn('slow', function() { });
			$j('#team').hide();
		  }
		);
		
		$j("img.signs").hover(
		  function () {
			$j('img.signs').hide();
			$j('#signs').fadeIn('slow', function() { });
		  },
		  function () {
			//$j('#signs').hide();
		  }
		);
		
		$j("#signs").hover(
		  function () {
			//$j('#signs').show();
		  },
		  function () {
			$j('img.signs').fadeIn('slow', function() { });
			$j('#signs').hide();
		  }
		);
	
		$j("img.directions").hover(
		  function () {
			$j('img.directions').hide();
			$j('#directions').fadeIn('slow', function() { });
		  },
		  function () {
			//$j('#directions').hide();
		  }
		);
		
		$j("#directions").hover(
		  function () {
			//$j('#directions').show();
		  },
		  function () {
			$j('img.directions').show();
			$j('#directions').fadeOut('slow', function() { });
		  }
		);
		
		$j("img.mobile").hover(
		  function () {
			$j('img.mobile').hide();
			$j('#mobile').fadeIn('slow', function() { });
		  },
		  function () {
			//$j('#expect').hide();
		  }
		);
		
		$j("#mobile").hover(
		  function () {
			//$j('#expect').show();
		  },
		  function () {
			$j('img.mobile').fadeIn('slow', function() { });
			$j('#mobile').hide();
		  }
		);
	//do the rollovers and fades
	
	
	$j('form#phone').submit(
		function() {
			// do image switching.
			$j('#mobilePhone').css("background-image", "url(/wp-content/themes/erstjoe/images/mobile-thankyou.png)");
			$j('#mobilePhone-facebook').css("background-image", "url(/wp-content/themes/erstjoe/images/facebook-thankyou.png)");
			$j('form#phone').hide();
	});

	
});
