jQuery(document).ready(function($){
	
	function setFieldBehaviour(obj, val) {
		if (!val) val = obj.val();
		if (obj.val() == '') obj.val(val);
		obj.focus(function(){
			$(this).removeClass('valid');
			$(this).removeClass('error');
			if ($(this).val() == val) $(this).val('');
		}).blur(function(){
			if ($(this).val() == '') {
				$(this).val(val);
				$(this).removeClass('prefilled');
			}
		});
		obj.parents('form').submit(function(){
			if (obj.val() == val) obj.val('');
		});
	}
	setFieldBehaviour($('input#s'), $('input#searchsubmit').val());

	$('#slideshow').cycle({ 
		cleartypeNoBg: true,
		slideExpr: '.slide',
		prev: '#slideshow a#prev',
		next: '#slideshow a#next',
		timeout: '8000'
	});
	
	$('#slideshow .arrow').click(function(){
		$('#slideshow').cycle('pause');
	});
	
	
});
