/*

	Theme Name:	 p2p_cms
	Theme URI:	 http://point2pointcentral.com
	Description: WP CMS style layout. Widget friendly.
	Tags:		 custom, CMS, three columns, fixed width
	Version:	 0.5
	Author:		 Dylan James Wagner
	Author URI:	 http://dylanjameswagner.com

	Designed for point2point as a CMS theme.

	// -------------------------------------------------------------- //
	// slideshow.js

*/

//$(document).ready(function(){

	function slideSwitch(switchSpeed) {
		var $active = $('#slideshow li.active');
	
		if ( $active.length == 0 ) $active = $('#slideshow li:last');
	
		// ordered selection
		var $next = $active.next('li').length ? $active.next('li') : $('#slideshow li:first');
	
		// random selection
	//	var $sibs = $active.siblings();
	//	var rndNum = Math.floor(Math.random() * $sibs.length );
	//	var $next = $($sibs[ rndNum ]);
	   
		$active.addClass('last-active');
	
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, switchSpeed, function() {
				$active.removeClass('active last-active');
			});
	}
	
	/*
	$(function() {
		setInterval("slideSwitch(1000)", 5000);
	});
	*/
	
	// pause when mouseover // does not work
	var playSlideshow = setInterval('slideSwitch(1000)', 4000);
	
	$('#slideshow').hover(function() {
		clearInterval(playSlideshow);
	},
	
	function() {
		playSlideshow;
	});

//});
