$().ready(function(){
	
	// Home Page slide show
	// Append controls and initialize Cycle plugin
	$("#home-slider")
		.after('<a id="slide-next" />')
		.after('<a id="slide-prev" />')
		.before('<div id="slide-nav" />')
		.cycle({ 
			timeout: 8000,
			pager:  '#slide-nav', 
			next: '#slide-next',
			prev: '#slide-prev'
		});
	
	// Stop when a slide is clicked	
	$('#slide-nav a, #slide-next, #slide-prev').click(function(){
		$("#home-slider").cycle('stop');
	});
		
	// Redirects for select "jump" lists
	$("select.jumplist").change(function(){
		if($(this).val() != '') {
			window.location = $(this).val();
		}
	});
	
	// Video overlays
	$(".video-link").fancybox();
	
	$(".video-slider").cycle({
		fx:'scrollHorz', 
		timeout:0,
		next: '.video-next',
		prev: '.video-prev'
	});
	
	
	// Open external links in a new window
	$("a[href^=http]").each(function() {
		if(this.href.indexOf(location.hostname.replace(/www./gi, "")) == -1) {
			$(this).click(function() { window.open(this.href, "_blank"); return false; });
		}
	});
	
	// Form field titles as prompts
	// Display prompts as values using Labelify plugin 
	$('input[type="text"]').labelify();
	
});
