// JavaScript Document

//set count for headers
var typecount = 1;
var type;
//var $setblurb = $('.active');

function slideSwitch() {
	
	//document.getElementById("slide_caption").innerHTML = type;
	//document.getElementById("slide_caption").innerHTML = $('.active').css("border","13px solid red");
	//$('.active').css("border","13px solid red");
	
    $active = $('#slideshow IMG.active');
	
	
	//$setblurb = $('.last-active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
	

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
     //var rndNum = Math.floor(Math.random() * $sibs.length );
     //var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
		
		document.getElementById("slide_caption").innerHTML = $next.attr("title");
		

		
	
	
}
$(function() {
	document.getElementById("slide_caption").innerHTML = $('#slideshow IMG.active').attr("title");
    setInterval( "slideSwitch()", 7000 );
	//document.getElementById("slide_caption").innerHTML = $active.attr("title");
});

//slideshow
function slideSwitch2() {
	
	
    var $active = $('#slide2 IMG.active');

    if ( $active.length == 0 ) $active = $('#slide2 IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slide2 IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
     //var rndNum = Math.floor(Math.random() * $sibs.length );
     //var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
	
	
	
}
$(function() {
    setInterval( "slideSwitch2()", 6000 );
});






