function initScroll(){
	swapStyles();
}

function scrollUp(){
	if(window.hot.pos==0) return false;
	if(window.hot.loading==1) return false;
	window.hot.pos--;
	scrollList(71);
}

function scrollDown(){
	if(window.hot.pos>=(window.hot.all.length-1)) return false;
	if(window.hot.loading==1) return false;
	var nextID=parseInt(window.hot.all[window.hot.pos+window.hot.items]);

	if(!document.getElementById('zz_hot_item_'+nextID)){
		var query="";
		for(var i=window.hot.pos+window.hot.items; (i<window.hot.all.length) && (i<(window.hot.pos+window.hot.items+20)); i++) {
			query+="&ids[]="+window.hot.all[i];
		}
		if(query!="") {
			window.hot.loading=1;
			AjaxQuery("ajax_user.php?sel=get_hot"+query, window.hot.stack_div, loadStack);
		}
	}
	else {
		window.hot.pos++;
		scrollList(-71);
	}
}

function scrollList(offset){
	var screenDiv=document.getElementById(window.hot.screen_div);
	
	var curTop=parseInt(screenDiv.style.top);
	screenDiv.style.top=(curTop+offset)+"px";
	swapStyles();
}

function loadStack(){
	var screenDiv=document.getElementById(window.hot.screen_div);
	var stackDiv=document.getElementById(window.hot.stack_div);
	
	screenDiv.innerHTML+=stackDiv.innerHTML;
	stackDiv.innerHTML='';
	window.hot.pos++;
	window.hot.loading=0;
	scrollList(-71);
}

function swapStyles() {
	var firstID=window.hot.all[window.hot.pos];
	var lastID=window.hot.all[window.hot.pos+window.hot.items-1];
	var itemID=0;
	var objDiv=false;
	
	for(var i=0; i<window.hot.all.length; i++){
		itemID=window.hot.all[i];
		if(document.getElementById('zz_hot_item_'+itemID)){
			document.getElementById('icon_'+itemID).className='icon2';
			document.getElementById('listr_'+itemID).className='listr2';			
		}
	}
	
	document.getElementById('icon_'+firstID).className='icon2_first';
	document.getElementById('listr_'+firstID).className='listr2_first';
	document.getElementById('icon_'+lastID).className='icon2_last';
	document.getElementById('listr_'+lastID).className='listr2_last';
}
