//Master Javascript file
//version:   1.0
//author:   Bryan Lademann
//email:     hi@bryanlademann.com
//website:   http://www.bryanlademann.com

/*============================*/

// calls jQuery from Google server
google.load("jquery", "1");
//google.load("jqueryui", "1");


// creates tabbed content areas
// -------------------------------
var TabContent = {};// creates an object container
TabContent.setup = function()
{
	
	var tabs = jQuery('#tabs-nav li a'), // gathers all the navigation links
	    shell = jQuery('#tabs-content'), // assigns variable to the containing element
	    images = jQuery(shell).children(); // gathers all the images 
	
	
	// onClick event behavior
	jQuery(tabs).click(function() {	
		
		var proj = jQuery(this).attr('href'); //gathers link destination
		
		jQuery('#tabs-nav li a').removeClass('active');//removes 'you are here' indicator
		jQuery(this).addClass('active');//adds 'you are here' indicator
	  jQuery(images).fadeOut(100) // when clicked previous images fade from view
		jQuery(proj).fadeIn(600); // then the new image slowly appears in 800 milliseconds
		return false; // prevents the visual dissonance when a browser jumps to an anchor link
	});
};


     

// Image carousel
var Carousel = {};
Carousel.setup = function() {

  /*
    var current = $('#carousel .show'); 
    var next = current.next().length ? current.next() : current.parent().children(':first');
    
    current.fadeOut(300).removeClass('show');
    next.fadeIn(800).addClass('show'); 
    
    setTimeout(Carousel.setup, 5000);
    */
    
    
	var container = jQuery('#carousel'); // assigns variable to the containing element
	var frame = jQuery(container).children(); // gathers all the images
	
	container.css("overflow", "hidden"); // removes scroll option for users with javascript enabled
	
	container.cycle({
		fx: 'fade', 
		speed: 2000,
		timeout: 6000
	});

  
    
}


//alert('works');

//when finished loading, runs main functions
google.setOnLoadCallback(function(){
	
	
		
	TabContent.setup();  
	Carousel.setup();
	
	 
  	
	
});
