
// 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: {
		
		
		
		
			cufon: function()
			{
			
				Cufon.replace('.bebas-neue', { fontFamily: 'Bebas Neue', hover: true, hoverables: { strong: true } });
				Cufon.replace('.bebas', { fontFamily: 'Bebas'});
			},
		
		
			slider: function()
			{
				$('ul.slides').coccaSlider({
					autoInterval: 10000,
					//autoInterval: 1000,
					fadeDuration: 1000
				});
			
			},


			
			slider: function()
			{
				$('ul.slides').coccaSlider({
					autoInterval: 10000,
					//autoInterval: 1000,
					fadeDuration: 1000
				});
			
			
			
			},

		
			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.portfolio").fancybox({
				    'transitionIn'	:	'elastic',
				    'transitionOut'	:	'elastic',
				    'speedIn'		:	600, 
				    'speedOut'		:	200, 
				    'overlayShow'	:	true
				});               
			},
			

		
		
			placeholder: function()
			{
				//var placeholder = $('input').attr('placeholder');
				
				$('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);






