
// 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()
			{
				if ($('#coda-slider').length > 0)
				{
					$('#coda-slider').codaSlider({
						autoSlide: true,
						autoSlideInterval: 7000,
						autoSlideStopWhenClicked: false,
           				dynamicArrows: true,
           				firstPanelToLoad: 1,
           				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()
			{
					$('.submit_newsletter').submit(function(event)
					{
						event.preventDefault();
			
			    		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);






