jQuery(function() {

	/**
	 * If we are using a side nav, then make the
	 * side nav and the content just as tall as each other
	 * Note that this has to be run once all of our page
	 * assets are loaded, so we need to bind this to
	 * a load event
	 */
	jQuery(window).load(function() {
		jQuery(".callout-container, .content-main").equalHeights();
		if (jQuery("#nav.sidenav").length > 0) {
			jQuery("#nav.sidenav, #content").equalHeights();
		}
	});

	/**
	 * Mimic the 'placeholder' attribute behavior in browsers
	 * that aren't trying hard enough.
	 *
	 * Uses Mathias Bynens's plugin, found on github:
	 * http://github.com/mathiasbynens/Placeholder-jQuery-Plugin
	 */
	jQuery("#search input[name='terms']").placeholder();

	if (jQuery('div.navi').length) {
		// Begin the slideshow.
		/*jQuery('div.navi').tabs('.slideshow > div', {
			effect:       'fade',
			fadeInSpeed:  800,
			fadeOutSpeed: 800,
			rotate:       true,
			current:      'active'
		}).slideshow({
			autoplay:     true,
			interval:     7500
		});*/
	}
	
	if (jQuery.fn.cycle != undefined && jQuery('.slideshow') != undefined) {
		jQuery.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) { 
			idx = currSlideIndex + 1;
		    jQuery(pager + ' div a').removeClass('active');
			jQuery(pager + ' div #' + idx).addClass('active'); 
		};
	
	
		jQuery('.slideshow').before('<div class="navi line">').cycle({
			fx: 'shuffle',
			speed: 'slow',
			timeout: 8000,
			pager: 'div.navi',
			activePagerClass: 'active',
			pagerAnchorBuilder: function(index, anchor){
				var idx = index + 1;
				return '<div><a id="' + idx + '" class="navi-button png-fix">' + idx + '</a></div>';
			}
		});
	}
	
	jQuery('div.navi div.active a').addClass('active');
	
	//jQuery('div.navi a').addClass("navi-button png-fix").attr('href','');

	/**
	 * Round corners on all callout buttons (Since IE isn't smart enough to)
	 */
	jQuery('.callout').corner("5px");
	jQuery('#search button').corner("3px");
});

