var pause=0;
//var total=2;
var front=2;
 
 
 
$(document).ready(function(){
 $(".image").fadeTo(0,0);
 $("#img1").fadeTo(0,1);
 

     setInterval(function(){
  
    if(pause==0){
	
	
   $('.text_box').animate({right:-220},0);
    $('#text'+front).animate({right:80},'medium');
   $('#text'+front).animate({right:70},'fast');
   $('.tab').css("background-image","url(images/dark.png)");
    $('#tab'+front).css("background-image","url(images/light.png)");

	 $(".image").css("z-index","1");
	 $("#img"+front).css("z-index","2");
	  $("#img"+front).fadeTo("slow",1);
	  $(".image:not(#img"+front+")").fadeTo(1000,0);
	  $(".image").clearQueue();
	  
	  front++;
	  if(front>total){ front=1; }
	}
    }, 5000);

 
});

  function display(n){
     pause=1;
 
$('.text_box').animate({right:-220},0);
$('#text'+n).animate({right:80},'medium');
$('#text'+n).animate({right:70},'fast');
$('.tab').css("background-image","url(images/dark.png)");
$('#tab'+n).css("background-image","url(images/light.png)");

	 $(".image").css("z-index","1");
	 $("#img"+n).css("z-index","2");
	  $("#img"+n).fadeTo("slow",1);
	  $(".image:not(#img"+n+")").fadeTo(1000,0);
	  $(".image").clearQueue();
  }
