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

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



		init: {
		
			datepicker: function() 
			{
			   $(".datepicker").datepicker();
			},
		
			
			
			
			
			
			
			gallery: function()
			{
    			$('#gallery_slider').jcarousel({
    				buttonNextHTML: ' <div class="jcarousel-next"></div>',
     				buttonPrevHTML: ' <div class="jcarousel-prev"></div>',
     				visible: 8
   			
    			});
			},		
			
		
			slider: function()
			{
				if ($('#coda-slider-5').length > 0)
				{
					$('#coda-slider-5').codaSlider({
						autoSlide: true,
						autoSlideInterval: 7000,
						autoSlideStopWhenClicked: false,
           				dynamicArrows: false,
           				dynamicTabs: false					
					});
				}
			},
		
			
							
			lightbox: function()
			{		
				$("a.gallery").fancybox({
				    'transitionIn'	:	'elastic',
				    'transitionOut'	:	'elastic',
				    'speedIn'		:	600, 
				    'speedOut'		:	200, 
				    'overlayShow'	:	true
				});               
			},
			
		
			scroller: function()
			{
				$('#scroller').innerfade({
					animationtype: 'fade',
					speed: 1000,
					timeout: 4500,
					type: 'sequence',
					containerheight: '381px'
					// containerheight: '410px'

				});
			
			}
		
		
		
		
/*
			placeholder: function()
			{
				
				$('input').each(function(){
					if ($(this).attr('id') !== 'send') 
					{
						var placeholder = $(this).attr('placeholder');
						$(this).val(placeholder);		
					}			
				})
				
				
				
				$('input').focus(function(){
					if ($(this).attr('id') !== 'send') 
					{
						$(this).val('');
					}
				})
				
				$('input').blur(function(){
					if ($(this).attr('id') !== 'send') 
					{
				
						var placeholder = $(this).attr('placeholder');
						if ($(this).val() === '')
						{
							$(this).val(placeholder);
						}
					}
				});
			}
			
*/
			
			
			
			
			
			
		},
		
		subscribe: function()
		{
		    	var email = $('#newsletter').val();
		    	
		    	$.post(
		    		"/ajax/subscribe", 
		    		{ email: email },
		    		
		    	   	function(data){
		    	   	  $('form#newsletter-form').fadeOut('Slow', function(){
		    	   	  		$('#newsletter-response').html('<p>' + data + '</p>');
		    	   	  		$('#newsletter-response').fadeIn('Slow');
		    	   	  });
		    	   	}
		    	);		
   		}
		
		
		
		
	};
// Pass in jQuery ref.
})(jQuery, this);






