var mpsb = '#nav a';
var mpc  = '.mpc, #footer p';
var cplb = '#intro h2';
var cpll = '.cpll';
var fbth = '#intro div.slides p';

Cufon.replace(mpsb, { fontFamily: 'Myriadpro-Semibold', hover: true });
Cufon.replace(mpc,  { fontFamily: 'Myriadpro-Cond' });
Cufon.replace(cplb, { fontFamily: 'Copperplate-Gothic-Bold' });
Cufon.replace(cpll, { fontFamily: 'Copperplate-Gothic-Light' });
Cufon.replace(fbth, { fontFamily: 'FuturaBT-Heavy', textShadow: '#444 1px 1px'  });

$(function(){
	$('input.txt, textarea').inpchk();
	if ($.browser.webkit){
		$('textarea').css('resize', 'none');
	}
	$('#slideshow').slideshow({
		delay : 5000,
		fadeintime : 1200,
		fadeouttime : 1200
	});
});

(function($) {
	$.fn.slideshow = function(inp){
		if ($(this).length == 0){
			return $(this);
		}
		var par = {
			delay : 5000,
			fadeintime : 800,
			fadeouttime : 800
		};
		$.extend(par, inp);
		var loc = { count : 0};
		var $slides = $(this).find('div.slides').hide();
		$slides.eq(loc.count).fadeIn(par.fadeintime);
		setInterval(function(){
			$slides.eq(loc.count).fadeOut(par.fadeouttime);
			loc.count++;
			if (loc.count == $slides.length){
				loc.count = 0;
			}
			$slides.eq(loc.count).fadeIn(par.fadeintime);
		}, par.delay);
		return $(this);
	}
})(jQuery);

(function($) {
	$.fn.inpchk = function(){
		var focusfn = function(){
			var val = $(this).attr('value');
			var def = $(this).attr('defaultValue');
			if (val == def){
				$(this).attr('value', '');
			}
		};
		var blurfn = function(){
			var val = $(this).attr('value');
			var def = $(this).attr('defaultValue');
			if (val == ''){
				$(this).attr('value', def);
			}
		};
		$(this).bind({
			blur : blurfn,
			focus : focusfn
		});
		return $(this);
	}
})(jQuery);