var d = document;

var img11 = d.getElementById('img11');
var img12 = d.getElementById('img12');
var img21 = d.getElementById('img21');
var img22 = d.getElementById('img22');
var img31 = d.getElementById('img31');
var img32 = d.getElementById('img32');

var counter1=0;
var counter2=0;
var counter3=0;
var op1=0;
var op2=0;
var op3=0;

//setInterval("init()",3000);
function init(){
changeBox3();
//var t1 = setTimeout("changeBox3()",200);
//var t2 = setTimeout("changeBox2()",400);
//var t3 = setTimeout("changeBox1()",600);
//runSequence([        changeBox3(),        changeBox2(),        changeBox1()], this, 200);
setTimeout("init()",6000);
}
//img12.onload=fade1();
function changeBox1(){
 
		if(counter1<box1.length){
		 img12.src = box1[counter1];
		 fade1();
		 counter1++;
		}else{
		 counter1=0;
		}
		
}

function fade1(){ 
	if(op1<1){
    op1 += 0.1;
		img12.style.opacity = op1;
    img12.style.filter = 'alpha(opacity = ' + (op1*100) + ')';

    setTimeout("fade1()", 80);
  }else{
	      img11.src=img12.src;
				img12.style.opacity = op1 = 0;
				img12.style.filter = "alpha(opacity=0)";
	  		
	}
}

function changeBox2(){
		if(counter2<box2.length){
		 img22.src = box2[counter2];
		 fade2();
		 counter2++;
		 
		}else{
		 counter2=0;
		}
		setTimeout("changeBox1()",300);
}


function fade2(){ 
	if(op2<1){
    op2 += 0.1;
		
    img22.style.opacity = op2;
    img22.style.filter = 'alpha(opacity = ' + (op2*100) + ')';
		
    setTimeout("fade2()", 80);
		
  }else{
				img21.src=img22.src;
				img22.style.opacity = op2 = 0;
				img22.style.filter = "alpha(opacity=0)";
    		
	}
}

function changeBox3(){
		if(counter3<box3.length){
		 img32.src = box3[counter3];
		 fade3();
		 counter3++;
		 
		}else{
		 counter3=0;
		
		}
		setTimeout("changeBox2()",300);
}

function fade3(){ 
	if(op3<1){
    op3 += 0.1;
		img32.style.opacity = op3;
    img32.style.filter = 'alpha(opacity = ' + (op3*100) + ')';
		
   	
    setTimeout("fade3()", 80);
  }else{
	      img31.src=img32.src;
				img32.style.opacity = op3 = 0;
				img32.style.filter = "alpha(opacity=0)";
	
   		
	}
}

init();

function showMe(el){
  d.getElementById(el).style.display = "block";
}
function hideMe(el){
  d.getElementById(el).style.display = "none";
}
