jQuery(document).ready(function($) {
	// input show/hide default value
	$('input.text').click(function() {
			if (this.value == this.defaultValue) {
				this.value = '';
			}
	});
	$('input.text').blur(function() {
			if (this.value == '') {
				this.value = this.defaultValue;
			}
	});
	// Home Link Hover
	$('#header a img').stop().hover(
		function () {
			$(this).attr('src', '/assets/images/chesterhouse-logo-hover.png');
		}, 
		function () {
			$(this).attr('src', '/assets/images/chesterhouse-logo.png');
		}
	);
	/*
	// Home Link Hover
	$('#header a img').hover(
		function () {
			$(this).parent().append($("<span class='return_home_page'>Return to the Home Page</span>"));
		}, 
		function () {
			$("span.return_home_page").remove();
		}
	);
	*/
	// JS Navigation
	/*
	$('#nav > div > ul > li ul').addClass('jsmenu');
	$('#nav > div > ul > li').mouseover(function() {
		$(this).stop().find('ul').slideDown('slow');
	});
	$('#nav > div > ul > li').mouseout(function() {
		$(this).stop().find('ul').delay(10000).slideUp('slow');
	});
	$('ul#menu-main-menu li').stop().hoverIntent({
      timeout: 500,
      over: function() { $(this).stop().addClass('active').find('ul').css({ display : 'block', visibility : 'visible'}); },
      out: function() { $(this).stop().removeClass('active').find('ul').css({ display : 'none', visibility : 'hidden'}); }
  });
	*/
	// Cufon fonts
	Cufon.replace('h1, h2, h3, #news_events h4');
	// Image modalization
	$("#posts a img").parent("a").addClass("shutter");
	$('#graphics').hide();
});
jQuery(window).load(function() {
	// Header Image rotator
	jQuery('#graphics').show();
	jQuery('#graphics').after('<div id="controls" class="controls">').cycle({
		fx : 'fade',
		speed:  2000, 
    timeout: 5000,
    pager:  '#controls',
		pause : 1,
		pauseOnPagerHover : 1
	});
	// Module Image rotator
	jQuery('#widget1').after('<div id="controls1" class="controls">').cycle({
		fx : 'fade',
		speed:  2000, 
    timeout: 7000,
    pager:  '#controls1',
		pause : 1,
		pauseOnPagerHover : 1
	});
	jQuery('#widget2').after('<div id="controls2" class="controls">').cycle({
		fx : 'fade',
		speed:  2000, 
    timeout: 6000,
    pager:  '#controls2',
		pause : 1,
		pauseOnPagerHover : 1
	});
	jQuery('#widget3').after('<div id="controls3" class="controls">').cycle({
		fx : 'fade',
		speed:  2000, 
    timeout: 5000,
    pager:  '#controls3',
		pause : 1,
		pauseOnPagerHover : 1
	});
	jQuery('#widget').after('<div id="controlss" class="controls">').cycle({
		fx : 'fade',
		speed:  2000, 
    timeout: 5000,
    pager:  '#controlss',
		pause : 1,
		pauseOnPagerHover : 1
	});
});
