var utils = 
{
	check_location : function()
	{
		var address = window.location.toString().slice(7); // get rid of the "http://"
		var currentLoc = address.slice(address.indexOf("/",0)+1); // search for the address after the ".com/"

		switch (currentLoc)
		{
			case 'index.php':
			case '':
				slideshow.start();
				break;
			default:
				break;
		}
		
	}
}

var slideshow = 
{
	slides : $('#slides'),
	options : { fx: 'scrollHorz', speed: 'normal', timeout: 0, next: '#next', prev: '#prev' },

	start : function()
	{
		slideshow.create_menu();
		slideshow.slides.cycle(slideshow.options);
	},

	create_menu : function()
	{
		$('#msthd').append("<ul id='ss-menu'></ul>");
		$('#ss-menu')
			.append("<li><a href='#' title='previous slide' id='prev'>Previous Slide</a></li>")
			.append("<li><a href='#' title='next slide' id='next'>Next Slide</a></li>");
						
		$('#prev').click(function(e){
			e.preventDefault();
			slideshow.slides.cycle('pause');
		});
	
		$('#next').click(function(e){
			e.preventDefault();
			slideshow.slides.cycle('resume');
		});
	}
}

utils.check_location();
