﻿function UpdateUpcomingStoriesControl()
{
	if( document.getElementById("usc_content") == null )
		return;
		
	var current_page = 1 * document.getElementById("usc_current_page").value;
	var index = 1;
	var num_node = document.getElementById("usc_page_num_1");
	var page_node = document.getElementById("usc_page_content_1");
	while( num_node && page_node )
	{
		num_node.className = ( current_page == index ? "page_current" : "page_num" );
		page_node.style.display = ( current_page == index ? "block" : "none" );
		
		++index;
		num_node = document.getElementById("usc_page_num_" + index);
		page_node = document.getElementById("usc_page_content_" + index);
	} 
	
	if( index == 2 )
		document.getElementById("usc_page_num_container").style.display = "none";
}

function On_USC_PageClick( page )
{
	document.getElementById("usc_current_page").value = page;
	UpdateUpcomingStoriesControl();
}

function UpdateUpcomingStoriesContent( data )
{
	document.getElementById("usc_content").innerHTML = data;
	UpdateUpcomingStoriesControl();
}