function slideSwitch() {
    var $active = $('#cycle-imgs IMG.active');

    if ( $active.length == 0 ) $active = $('#cycle-imgs IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#cycle-imgs 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( "slideSwitch()", 5000 );
});



function miasto(miasto){

  	$('#'+miasto+' a').hover(
		function () {
			$('#localizations div').animate({opacity: "hide", bottom: "400"}, "fast");
			$('#localizations .'+miasto).animate({opacity: "show", bottom: "330"}, "fast");
		},
		function () {
		//	$('#localizations .'+miasto).animate({opacity: "hide", bottom: "10"}, "fast");
		}
	);
  }


$(function() {

	miasto("school1");
  	miasto("school2");
  	miasto("school3");
  	miasto("school4");
  	miasto("school5");
  	miasto("school6");
  	miasto("school7");
  	miasto("school8");	
  	miasto("school9");
  	miasto("school10");
  	miasto("school11");
  	miasto("school12");
  	miasto("school13");
  	miasto("school14");	
  	miasto("school15");	
  	miasto("school16");	
  
	
	
	
	
	
	
	
	

	$("#slideshow").css("overflow", "hidden");
	$("#slideshow").css("cursor", "pointer");
    $('#slideshow').cycle({
    	fx:       'fade',
        prev: '#prev',
		next: '#next',
		timeout: 0, 
		after:     function() {
            $('#caption').html(this.alt);
        }
    });
    
    /*
    $("#cycle-imgs").css("overflow", "hidden");
    $('#cycle-imgs').cycle({
    	
    	 fx:    'fade', 
    speed:  2500
        
    });
*/
    
    
    
    
    $('.accordionButton').click(function() {

		//REMOVE THE ON CLASS FROM ALL BUTTONS
		$('.accordionButton').removeClass('on');
		  
		//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
	 	$('.accordionContent').slideUp('normal');
   
		//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
		if($(this).next().is(':hidden') == true) {
			
			//ADD THE ON CLASS TO THE BUTTON
			$(this).addClass('on');
			  
			//OPEN THE SLIDE
			$(this).next().slideDown('normal');
		 } 
		  
	 });
	  
	
	/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
	$('.accordionButton').mouseover(function() {
		$(this).addClass('over');
		
	//ON MOUSEOUT REMOVE THE OVER CLASS
	}).mouseout(function() {
		$(this).removeClass('over');										
	});
	
	/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	
	/********************************************************************************************************************
	CLOSES ALL S ON PAGE LOAD
	********************************************************************************************************************/	
	$('.accordionContent').hide();
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$('.accordionButton2').click(function() {

		//REMOVE THE ON CLASS FROM ALL BUTTONS
		$('.accordionButton2').removeClass('on2');
		  
		//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
	 	$('.accordionContent2').slideUp('normal');
   
		//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
		if($(this).next().is(':hidden') == true) {
			
			//ADD THE ON CLASS TO THE BUTTON
			$(this).addClass('on2');
			  
			//OPEN THE SLIDE
			$(this).next().slideDown('normal');
		 } 
		  
	 });
	  
	
	/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
	$('.accordionButton2').mouseover(function() {
		$(this).addClass('over');
		
	//ON MOUSEOUT REMOVE THE OVER CLASS
	}).mouseout(function() {
		$(this).removeClass('over');										
	});
	
	/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	
	/********************************************************************************************************************
	CLOSES ALL S ON PAGE LOAD
	********************************************************************************************************************/	
	$('.accordionContent2').hide();
	
	
	
	
	
	
	
	
	if (document.maps.map.value=="true")
	{
		$(".mapBtn").colorbox();
	}	
	
	
	
    
});


