var timeout=0;
var timedef = 1;
var ArrayTimer = new Array();
ArrayTimer[1]=0;
ArrayTimer[2]=0;
ArrayTimer[3]=0;
ArrayTimer[4]=0;
ArrayTimer[5]=0;
ArrayTimer[6]=0;
ArrayTimer[7]=0;


function _Buttons(index){  	 
		window.clearInterval(timeout);
		if (ArrayTimer[index] != 0) {
			window.clearTimeout(ArrayTimer[index]);
			ArrayTimer[index] = 0;
		}
		ArrayTimer[index] = window.setTimeout(function () {
			_Buttonsold(index);
		}, 10);     
}
function _Buttonsold(ind){
					
          for(var i=1;i<=7;i++){
            if(ind == i)
            {
                document.getElementById("R_IMG_" + i).style.display='block';
                document.getElementById("R_a" + i).className='rollOn';
            }
            else
            {
                document.getElementById("R_IMG_" + i).style.display = 'none';
                document.getElementById("R_a" + i).className = '';
            }
          }		
          if (ind ==7||timedef>7){
          	timedef=1;	
          }else{
          	timedef++;
          }          
}


function onloadPic(index) { 
	if (ArrayTimer[index] != 0) {
			window.clearTimeout(ArrayTimer[index]);
			ArrayTimer[index] = 0;
	}
	timeout = window.setInterval("paster();",5000);
}

function paster(){
	_Buttonsold(timedef);
}
function onloadPic1(index) {
	_Buttonsold(timedef);
	onloadPic(index);
}