﻿var CurrentCurrency = 1;


function start_currencies_roll(immediately){
	
	div = $('CrrRoller');
	$('CrrPauseImg').style.display="none";
	$('crr_link_more').style.display = "none";
	if(immediately){
		 //roll_currencies();
		if(!div.RollInterval) div.RollInterval = setInterval('roll_currencies()', 2500);
	}else{
		if(!div.RollInterval) div.RollInterval = setInterval('roll_currencies()', 2500);
	}
}
function stop_currencies_roll(){
	var div = $('CrrRoller');
	$('CrrPauseImg').style.display="block";
	$('crr_link_more').style.display = "block";
	clearInterval(div.RollInterval);
	div.RollInterval = false;
}

function roll_currencies(){
	var div = document.getElementById('CrrRoller');
	var cr_rollout = CurrentCurrency;
	var crr_count = div.getAttribute('Count')*1;
	if(CurrentCurrency == crr_count) CurrentCurrency = 0;
	var cr_rollin = CurrentCurrency + 1;
	
	transPosition('crrdiv'+cr_rollout, '!','!', '!','-30',1000);
	transPosition('crrdiv'+cr_rollin, '!','!', '40','10', 500);
	CurrentCurrency++;
}
function roll_currencies_back(){
	var div = document.getElementById('CrrRoller');
	var cr_backout = CurrentCurrency;
	var crr_count = div.getAttribute('Count')*1;
	
	if(CurrentCurrency == 1) CurrentCurrency = crr_count+1;
	var cr_backin = CurrentCurrency - 1;
	
	transPosition('crrdiv'+cr_backin, '!','!', '-30','10',500);
	transPosition('crrdiv'+cr_backout, '!','!', '!','40', 1000);
	CurrentCurrency--;
}
//======================================

start_currencies_roll(false);
