$(document).ready(function(){
	
	Site.init();
	
});

var Site = {
	
	init:function(sliderSettings) {
		
		//HOMPAGE ANIMATION
		if($('#feature-work').length != 0) {
			Site.homeDrop();
			Site.homeHover();
		}
		
		//SERVICE ICONS HOVER
		if($('.service-icons li').length != 0) {
			Site.attachServiceTooltips();
		}
		
		if ($('.form-validate').length != 0) {
			$('.form-validate').validate();
		}
	},

	homeDrop:function() {    
		$('#feature-work').animate({
			top: '+=350',
			queue: false
		}, 4000, 'easeOutCubic');
	},
	
	/* Delicious cat milk makes me strong */ 
	homeHover:function() {
		if (!$.browser.msie || ($.browser.msie && !($.browser.version == '6.0' || $.browser.version == '7.0' || $.browser.version == '8.0'))) {
			$("#feature-cta > li").hoverIntent({
				sensitivity: 9,
				timeout: 100,
				over: function() {
					$('#isometric li:not(.group-'+this.getAttribute('group')+')').animate({'opacity':0.25},{'duration':150,'queue':false} );
					currentBlip = $('#'+this.getAttribute('proup')+'-blip');
					currentBlip.addClass('active');
					$('.blip').not(currentBlip).removeClass('blipanim');
				},  
				out: function() {
					$('#isometric li:not(.group-'+this.getAttribute('group')+')').animate({'opacity':1},{'duration':150,'queue':false} );
					currentBlip = $('#'+this.getAttribute('proup')+'-blip');
					currentBlip.removeClass('active');
					$('.blip').not(currentBlip).addClass('blipanim');
				}
			});
			
			$('#feature-cta li .back').fadeOut(0)
			$('#feature-cta li .back ').css({display:'none'});
			
			
			$('#feature-cta li > div').hoverIntent({
				sensitivity: 9,
				timeout: 100,
				over: function() {
					$(this).find('.front').fadeOut(0);
					$(this).find('.back').css({display:'block'});
					$(this).find('.back').animate({top: '-=20',opacity: 1}, 'fast');
				},
				out: function() {
					$(this).find('.back').animate({top: '+=20',opacity: 0}, 'fast');
					$(this).find('.front').fadeIn('slow');
					$(this).find('.back').css({opacity: 0});
				}

			});

		}
		
		if ($.browser.version == '6.0' || $.browser.version == '7.0' || $.browser.version == '8.0') {
			$('.blip').hide();
			$('.blipanim').hide();
			$('#feature-cta li .back ').css({display:'none'});
			
			
			$('#feature-cta li > div').hoverIntent({
				sensitivity: 9,
				timeout: 100,
				over: function() {
					$(this).find('.front').css({display:'none'});
					$(this).find('.back').css({display:'block'});
					$(this).find('.back').animate({top: '-=20'});
				},
				out: function() {
					$(this).find('.back').animate({top: '+=20'}, 'fast');
					$(this).find('.back').css({display:'none'});
					$(this).find('.front').css({display:'block'});
				}

			});
		}
			
					
	},
	
	
	attachServiceTooltips:function() {
		$('.service-icons li div').fadeOut(0)
		$('.service-icons li div').css({display:'none'});
		
		$('.service-icons li').hoverIntent({
			sensitivity: 7,
			timeout: 100,
			over: function() {
				$(this).children('div').css({display:'block',opacity: 0});
				$(this).children('div').animate({top: '-=20',opacity: 0.9});
				$(this).siblings().animate({opacity: 0.3},{duration: 50, queue: false});
			},
			out: function() {
				
				$(this).children('div').animate({top: '+=20',opacity: 0});
				$(this).children('div').css({opacity: 0}).hide();
				$(this).siblings().animate({opacity: 1},{duration: 50, queue: true});
			}
		});
		
	}
	

};

