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

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



		init: {
		
		
			
			lightbox: function()
			{		
				$("ul.gallery a").fancybox({
				    'transitionIn'	:	'elastic',
				    'transitionOut'	:	'elastic',
				    'speedIn'		:	600, 
				    'speedOut'		:	200, 
				    'overlayShow'	:	true
				});               
			},
		
		
			home: function()
			{
				$('div.triptik a').hover(function(){
					
					var el = $(this).parent('div.slider');
					$(el).addClass('current');
					$('div.triptik').children().not('div.current').addClass('background');
					
					
					$(el).removeClass('background');
					
					$(el).css('z-index', '1000');
					$('div.background').css('z-index', '0');
					
					
					// Get id of element
					var id = $(el).attr('id');
					
					
					
							// Set individual positioning values
							switch(id) {
								case('sale') :									
									var left = -30;
									var top = 35;
									
									break;
								
								case('feature') :								
									var left = 0;
									var top = 35;

									break;
								
								case('lease') : 
									var left = -93;
									var top = 35;
								
									break;
							
								default : 
									// Nothing. imposter. 
								
							
							}
							
							
				
					
					
					/* MAKE CURRENT BIGGER */
							$(el).stop().animate({
								width: '427px',
								height: '263px',
								marginTop: '0',
								marginLeft: left + 'px'
							}, 500);
							
							
							$('div.current img.main').stop().animate({
								width: '342px',
								height: '221px',
								marginLeft: '41px'
							}, 500);
							
							
							
							
							$('div.current img.container').stop().animate({
								width: '427px',
								height: '263px'
							}, 500);
							
							
							$('div.current img.title').stop().animate({
								width: '380px',
								height: '55px',
								marginLeft: '22px'
							}, 500);
					
					
					/* MAKE OTHER ONES SMALLER */
					
					$('div.background').each(function(i){
						
							// Get id of element
							var id = $(this).attr('id');
						
						
						
							// Set individual positioning values
							switch(id) {
								case('sale') :									
									var left = 0;
									var top = 35;
									
									break;
								
								case('feature') :								
									var left = 23;
									var top = 35;

									break;
								
								case('lease') : 
									var left = 0;
									var top = 35;
								
									break;
							
								default : 
									// Nothing. imposter. 
								
							
							}
							
							
						
						
							$(this).stop().animate({
								width: '317px',
								height: '198px',
								marginTop: top + 'px',
								marginLeft: left + 'px'
							}, 500);
							
							
							$('div.background img.main').stop().animate({
								width: '252px',
								height: '162px',
								marginLeft: '31px'
							}, 500);
														
							$('div.background img.container').stop().animate({
								width: '317px',
								height: '198px'
							}, 500);
							
							
							$('div.background img.title').stop().animate({
								width: '284px',
								height: '48px',
								marginLeft: '16px'
							}, 500);
					
					});
					
					
					
					
					
					
					
					
					
					
				}, function(){
				
					var el = $(this).parent('div.slider');
					$(el).removeClass('current');
				});
			
			
			}
		
		
		}
		
		
	};
// Pass in jQuery ref.
})(jQuery, this);






