function startSlides(container, file, slideSelector){	
	$(function(){
		
		//$("head").load(file + " style");
		$.get(file, "html", function(data){			 
			
			//load the <style>s
			var styles = $("<div></div>").append(data).find("style"); 
			$("head").append(styles);
			
			//load the individual slides
			$(container).empty();
			$(container).addClass('slideshow');
			var slides = $("<div/>").append($(data)).find(slideSelector); 
			$(container).append(slides);
			var maxHeight = 0;
			$(container).children().each(function(i){
				//maxHeight = $(this).height();
				if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
			});
			$(container).css("height", ($(container).children(":first").height() + 30) + "px");
			$(container).children().each(function(i){
				$(this).css("border-bottom", "solid white " + (maxHeight - $(this).height()) + "px"); 
			})
			//$(container).children().css("border-bottom", "solid white " + (maxHeight - $(this).height()) + "px"); 
			$(container).children(":not(:first)").hide(); //hide all but the first slides
			$(container).children(":first").addClass('active'); //set the first slide as .active
			
			if( $(container).children().length > 1 ) {
				setInterval ( function(){slideSwitch(container, 500)}, 8000 );
			}
		});
		

	});
}

function slideSwitch(container, switchSpeed) {
	var $active = $(container + ' .active');
	if ( $active.length == 0 ) $active = $(container + ' :first');

	var $next =  $active.next().length ? $active.next()
	   : $(container + ' :first');
	
	$active.addClass('last-active');
	$next.addClass('active');
	
	/*$(container).animate({ 
        height: ($next.height() + 30) + "px"
      }, 500 );
*/
	$next.fadeIn(switchSpeed, function(){
	  $active.hide();
	  $active.removeClass('active last-active');
	});
	$(container).css("height", ($next.height() + 30) + "px");

}
	