$(document).ready(function() {

	//PSEUDO FIXES
	
	$('.subnav li:first-child').addClass('first');
	$('.people:nth-child(odd)').addClass('odd');
	$('.work-with li:nth-child(3n)').addClass('third');
	//PSEUDO FIXES


//----------


	//LINKS
	$('a').each(function() {
		if ($(this).attr('rel') == '_blank') {
			$(this).attr('target','_blank');
		}
	});
	//LINKS


//----------


	//TEXT SIZE
	$('.text-resize a').click(function() {
		$.cookie('text-size',null);
		$.cookie(
			'text-size', 
			$(this).attr('class'), {
				expires: 7, 
				path: '/'
			}
		);
		resize_text($(this).attr('class'));
		return false;
	});
	resize_on_load();
	//TEXT SIZE
	
	
//----------
	
	
	//SEARCH
	$('.search .text').focus(function() {
		if ($(this).val() == "Search site") {
			$(this).val("");
		}
	}).blur(function() {
		if ($(this).val() == "") {
			$(this).val("Search site");
		}
	});	
	//SEARCH
	
	
//----------
	
	
	//SLIDER
	$('.slider div ul li a').hoverIntent(function() {
		var target = $(this).attr('rel');
		var header = $('.slider-content .' +  target + ' .header').html();
		var content = $('.slider-content .' + target + ' .content').html();
		var image = $('.slider-content .' +   target + ' .image').html();
		
		$('.slider h1').fadeOut('fast', function() {
			$(this).html(header).removeClass().addClass(target + ' replace').fadeIn('fast');
		});
		$('.slider p').fadeOut('fast', function() {
			$(this).html(content).fadeIn('fast');
		});
		$('.slider .image').fadeOut('fast', function() {
			$(this).attr('src', image).fadeIn('fast');
		});
//		return false;
	}, function() {});
	//SLIDER
	
	
//----------


	//PRELOADER
	$('.slider-content .image').each(function() {
		preloader(
			$(this).html()
		);
	});
	//PRELOADER
});


//FUNCTIONS
	var count = 0;
	function preloader(src) {
		window['image' + count] = new Image();
		window['image' + count].src = src;
		count = count + 1;
	}
	
	//Changing the text size of the whole page
	function resize_text(size) {
		if (size == 'regular') {
			$('#content, #footer').css('font-size','1em');
		} else if (size == 'large') {
			$('#content, #footer').css('font-size','1.1em');
			$('.slider ul li a, .slider ul li').css({'line-height': '18px', 'font-size': '18px'});
		} else if (size == 'extra') {
			$('#content, #footer').css('font-size','1.2em');
			$('.slider ul li a, .slider ul li').css({'line-height': '18px', 'font-size': '18px'});
		}
	}
	
	function resize_on_load() {
		var cookie = $.cookie('text-size');
		
		if (typeof(cookie) != "undefined") {
			resize_text(cookie);
		}
	}
//FUNCTIONS
