$(document).ready(function(){
	// Slider 
	$('#slider').after('<div id="pager">').cycle({ 
	    fx:        'fade',
		speed: 	   400,
	    timeout:   6000,
	    pager:    '#pager'
	});
	
	// Form styles
	$('form#contact div.field input, form#contact div.text textarea').focus(function () {
		$(this).parent().addClass('focus');
    }).blur(function () {
		$(this).parent().removeClass('focus');
	});
	$('form#contact button').hover(
	  function () {
	    $(this).css("backgroundPosition", "bottom left");
	  },
	  function () {
	    $(this).css("backgroundPosition", "top left");
	  }
	);

	// Resolution fix
	scrSize();
	$(window).bind('resize', function() {
	    scrSize();
	});
	
	// $(window).bind('resize', docSize());	
	
	// PNG Fix for IE6 and below
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('#footer, #header, #main, #navigation, ul#links-nav li, .project-info, .project-info ul li, #pager a');
	}
});
// Text replacement
Cufon.replace('#main h2, #main h3, #main h4, h2.moto, h3.goals, #footer h2, ul.services, #main blockquote, form#contact label, a.launch, h1#four-o-four, span.launch');
Cufon.replace('span.passive', {
	textShadow: '1px 1px rgba(0, 0, 0, 0.5)'
});

Cufon.replace('.slide h2', {
	textShadow: '1px 1px rgba(0, 0, 0, 0.5)'
});

function scrSize(self){
	var scrw = $(window).width();
	var sitw = $('#warper').width();
	var minw = 912;

	if( scrw < sitw && scrw > minw ){
		var ofst = sitw - scrw;
		var ofst = ofst/2;

		$('html').css({
			'overflow-x': 'hidden',
			width: scrw
		});
		$('#warper').css({
			overflow: 'hidden',
			left: -ofst,
			right: -ofst
		});
	} else {
		$('html').css({
			overflow: 'none',
			width: 'auto'
		});
		$('#warper').css({
			overflow: 'none',
			left: 'auto',
			right: 'auto'
		});		
	}
}