var pause=1;
//var total=2;
var front=2;
 
 
 
$(document).ready(function(){
 $(".text_box").fadeTo(0,0);
 $("#text1").fadeTo(0,1);
 
 

     setInterval(function(){
  
    if(pause==0){
	
	
   $('.image').animate({right:-170},0);
    $('#img'+front).animate({right:20},'medium');
   $('#img'+front).animate({right:10},'fast');
   $('.tab').css("background-image","url(images/dark_tab.png)");
    $('.tab').css("color","#DFE5E9");
    $('#tab'+front).css("background-image","url(images/light_tab.png)");
    $('#tab'+front).css("color","#617E91");
	
	
	 $(".text_box").css("z-index","1");
	 $("#text"+front).css("z-index","2");
	  $("#text"+front).fadeTo("slow",1);
	  $(".text_box:not(#text"+front+")").fadeTo(1000,0);
	  $(".text_box").clearQueue();
	  
	  front++;
	  if(front>total){ front=1; }
	}
    }, 10000);

 $("#slide").mousedown(function(){
 
 pause = 1;
 });
 
 
});

  function display(n){
     pause=1;
 
	$('.image').animate({right:-170},0);
	$('#img'+n).animate({right:20},'medium');
	$('#img'+n).animate({right:10},'fast');
	$('.tab').css("background-image","url(images/dark_tab.png)");
	$('.tab').css("color","#DFE5E9");
	$('#tab'+n).css("background-image","url(images/light_tab.png)");
	$('#tab'+n).css("color","#617E91");

	 $(".text_box").css("z-index","1");
	 $("#text"+n).css("z-index","2");
	  $("#text"+n).fadeTo("slow",1);
	  $(".text_box:not(#text"+n+")").fadeTo(1000,0);
	  $(".text_box").clearQueue();
  }
