
// Automatically calls all functions in CHZ.init
jQuery(document).ready(function() {
	WILBUR.global();
});

// Module pattern:
// http://yuiblog.com/blog/2007/06/12/module-pattern
var WILBUR = (function($) {
	return {
		// Start It
		global: function() {
			for (var i in WILBUR.init) {
				WILBUR.init[i]();
			}
		},



		init: {


			placeholder: function()
			{
				var placeholder = $('#enews').attr('placeholder');
				$('#enews').val(placeholder);
				
				$('#enews').focus(function(){
					$('#enews').val('');
				})
			
			},


			image_scroller: function() 
			{
				$('#scroller').innerfade({
							animationtype: 'fade',
							speed: 2000,
							timeout: 10000,
							/*type: 'random',*/
							containerheight: '530px'
						});
			
			},
			
			
			swap: function()
			{
				$(".swap").mouseover(function() {
					var rel = $(this).attr('rel');
					$('img#'+rel).show();
  				}).mouseout(function(){
					var rel = $(this).attr('rel');
					$('img#'+rel).hide();
  				});
			
			
			}




		},
		
		
		subscribe: function()
		{
				var email = $('#enews').val();
				
				$.post(
					"/ajax/subscribe", 
					{ email: email },
					
				   	function(data){
				   	  $('.news').fadeOut('Slow', function(){
				   	  		$('#news-response').html('<p>Thanks For Subscribing</p>');
				   	  		$('#news-response').fadeIn('Slow');
				   	  });
				   	}
				);		
   
   		}
		
		
		
	};
// Pass in jQuery ref.
})(jQuery, this);






