
function slideSwitch() {
    var $active = $('#slideshow DIV.active');
 
    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');
  
  

    $active.addClass('last-active');
   $next.css({opacity: 0.0})
              .addClass('active')
        .animate({opacity: 1.0}, 200, function() {
            $active.removeClass('active last-active');
			var listItem = $('div.active');
			var currentActive = ($(listItem).index()) + 1;
			$('#current_img').html(currentActive);        
        });
}


function slideSwitchPrev() {
    var $active = $('#slideshow DIV.active');
 
    if ( $active.length == 0 ) $active = $('#slideshow DIV:first');
    var $next =  $active.prev().length ? $active.prev()
        : $('#slideshow DIV:last');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
      
        .addClass('active')
        .animate({opacity: 1.0}, 200, function() {
            $active.removeClass('active last-active');
			var listItem = $('div.active');
			var currentActive = ($(listItem).index()) + 1;
			$('#current_img').html(currentActive);        
        });
}






$(document).ready(function(){


var totalSlides = $("#slideshow").children().length;
$('#total_img').html(totalSlides);




var playSlideshow =  setInterval( "slideSwitch()", 4000 );


	$("#play_pause").live("click", function() {
	
	
	if($(this).hasClass('play')){
		$(this).removeClass('play').addClass('pause');
		clearInterval(playSlideshow);
		$(this).html('Play');
	}
	else{
		slideSwitch();
		$(this).removeClass('pause').addClass('play');
		$(this).html('Pause');
    	playSlideshow =  setInterval( "slideSwitch()", 4000 );
	}
	
	  });
  


	$("#next").live("click", function() {
		clearInterval(playSlideshow);
		$('#play_pause').html('Play').removeClass('play').addClass('pause');
		slideSwitch();
  });

	$("#previous").live("click", function() {
		clearInterval(playSlideshow);
		$('#play_pause').html('Play').removeClass('play').addClass('pause');
		slideSwitchPrev();
  });


/*         e.preventDefault(); */
		
		
		
		/*
if((this).hasClass('e_active')){
		$(this).removeClass('e_active').next('.e_text').hide().
		}
		else{
		$(this).addClass('e_active').next('.e_text').show().
		}
*/








  }); /* end doc.ready */








$(document).ready(function(){

	$(".e_title").live("click", function() {
		if($(this).hasClass('e_active')){
			$(this).removeClass('e_active').next('.e_text').hide(400);
		}
		else{
			$('div.e_active').removeClass('e_active').next('.e_text').hide(400);
			$(this).addClass('e_active').next('.e_text').show(400);
		}
  });
}); /* end doc.ready */




function blockError(){return true;}
window.onerror=blockError;
