
var CurStep = 1;
var AnimTimer;
preloadImages("/images/step2_crn.jpg", "/images/step3_crn.jpg");

function NextStep(){
	CurStep++;
	if( CurStep>3 ) CurStep = 1;
	SetStep( CurStep );
}

function SetStep( n ){
	var obj = document.getElementById('layout');
	if( obj ){
		obj.className = "step" + n;
	}
	CurStep = n;
}

function ShowStep( n ){
	StopAnim();
	SetStep( n );
}

function StartAnim(){
	AnimTimer = setInterval( "NextStep()", 3000 );
}
function StopAnim(){
	clearInterval( AnimTimer );
}

// Кеширование картинок
function preloadImages() {
 var d=document;
 if(d.images) {
    if(!d.pr) d.pr = new Array();
    var i, j=d.pr.length, a=preloadImages.arguments;
    for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!=0){
        d.pr[j]=new Image;
        d.pr[j++].src=a[i];
      }
  }
}


