// Javascript

$(document).ready(function() {
	
	// Home Slideshow in main window area
	$(function() {
	   $('#feature ul').cycle({
			delay: -1000,
			timeout: 6000,
			speed: 2000,
			easing:"easeInOutQuad",
			pause: true
		});
	});
	
	// Fixes z-index problem for IE7&6
	$(function() {
		var zIndexNumber = 1000;
		$('div').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	});
	
	// Replace "to" in Calendar dates with " – "
	$('.ec3_to').contents().replaceWith('&nbsp;&ndash;&nbsp;');
	
	
	/*
	==============================================================
		Remove No-Script Styles
	==============================================================
	*/
	
	$('.no-script').removeClass('no-script');
	$('html').removeClass('js'); // Flash of content fix (when doc is ready, pull the .js class)
	
	
	/*
	==============================================================
		Toggle Slider
	==============================================================
	*/
	
	$('.slider').each(function(){
		
		// Kill empty DOM elements
		$(this).children(':empty:not(hr)').remove();
		
		// Add title class to first DOM element
		$(this).children(':first').addClass('slider-title');
		
		// Wrap all DOM elements except title
		$(this).children().not('.slider-title').wrapAll('<div class="slider-content"></div>');
	
	});
	
	$('.slider-content').each(function(){
		
		// Pull top/bottom margins off slider content to avoid animation jump
		$(this).children(':first').css('margin-top', '0');
		$(this).children(':last').css('margin-bottom', '0');
	
	});
	
	// Add +/- symbols
	$('.slider-title').append('<span class="plus">+</span><span class="minus">-</span>');
	
	// Slide toggle function
	$('.slider-title').click(function() {
		$(this).siblings('.slider-content').slideToggle();
		$(this).children('.plus, .minus').toggle();
	});
	
});
