$(document).ready(function(){

	// slide show for portfolio
	$('#slideshow img').removeClass('hide');
	$('#slideshow').cycle({
	    fx:     'fade', 
	    speed:  'slow', 
	    next:   '#slideshow'
	 });
	
	// slide show for home
	$('#slideshow-home img').removeClass('hide');
	$('#slideshow-home').cycle({
	    fx:     'fade', 
	    speed:  'slow'
	 });
	
	// slide show for research
	$('#slideshow-research img').removeClass('hide');
	$('#slideshow-research').cycle({
	    fx:     'fade', 
	    speed:  'slow'
	 });
	
	// slide show for about
	$('#slideshow-about img').removeClass('hide');
	$('#slideshow-about').cycle({
	    fx:     'fade', 
	    speed:  'slow'
	 });
	
	//$('.single img').hide();
	pageController.init();
});

//window.onload = function(){
	//$('.single img').fadeIn('slow');
//}

var pageController = {
	// will store the url
	browserAddress : "",
	
	init: function(){
		// add url to browserAddress variable
		this.browserAddress = window.location.href;
		// and array with all the pages
		pages = ['/about/', '/who/', '/research/', '/strategic-partners/', '/reading/', '/students/', '/links/', '/apply/'];
		//loop through all the pages and see if we're on that page
		for(var i = 0; i < pages.length; i++){
			// sent the page string to another function
			this.seeIfItsActive(pages[i]);
		}
	},
	
	seeIfItsActive: function(stringToCompareToUrl){
		// if the url contains the page string
		if(this.browserAddress.indexOf(stringToCompareToUrl) != -1){
			// add active class to it
			$("#top li a[href*='"+stringToCompareToUrl+"']").addClass('active');
		}
	}
}




