﻿
	var UC_NEWS_index = 0;
	var UC_NEWS_listIndex = 0;
	var UC_NEWS_listSize = 5;
	var UC_NEWS_enableTimer = true;
	var UC_NEWS_arrImage = new Array();
	var UC_NEWS_arrTitle = new Array();
	var UC_NEWS_arrBrief = new Array();
	var UC_NEWS_arrDate = new Array();
	var UC_NEWS_arrUrl= new Array();

	function UC_NEWS_showContent(iItem)
	{
		UC_NEWS_index = iItem;
		var Pic = document.getElementById("UC_NEWS_ctrlPic");
		Pic.src = UC_NEWS_arrImage[iItem];
		var ctrlTitle = document.getElementById('UC_NEWS_ctrlTitle');
		ctrlTitle.innerHTML	= UC_NEWS_arrTitle[iItem];
		var ctrlBrief = document.getElementById('UC_NEWS_ctrlBrief');
		ctrlBrief.innerHTML	= UC_NEWS_arrBrief[iItem];
		var ctrlDate = document.getElementById('UC_NEWS_ctrlDate');
		ctrlDate.innerHTML = UC_NEWS_arrDate[iItem];	 
		var ctrlUrl = document.getElementById('UC_NEWS_ctrlUrl');
		ctrlUrl.href = UC_NEWS_arrUrl[iItem];
		ctrlUrl = document.getElementById('UC_NEWS_ctrlUrl2');
		ctrlUrl.href = UC_NEWS_arrUrl[iItem];
				
		var lnk = null;
		for (i=0; i<UC_NEWS_arrTitle.length; i++)
		{
			var lnk = document.getElementById('UC_NEWS_ctrlTD' + i);
			lnk.style.backgroundColor = '';
			lnk = document.getElementById('UC_NEWS_ctrlLink' + i);
			lnk.style.width = '65';
			lnk.style.height = '42';
		}
		lnk = document.getElementById('UC_NEWS_ctrlTD' + iItem);
		lnk.style.backgroundColor = '#000000';
		lnk = document.getElementById('UC_NEWS_ctrlLink' + iItem);
		lnk.style.width = '55';
		lnk.style.height = '36';
	}

	function UC_NEWS_nextItem()
	{
		UC_NEWS_index = UC_NEWS_index + 1;
		if (UC_NEWS_index > (UC_NEWS_arrTitle.length - 1))
			UC_NEWS_index = 0;
		
		UC_NEWS_showContent(UC_NEWS_index);
	}
	function UC_NEWS_prevItem()
	{
		UC_NEWS_index = UC_NEWS_index - 1;
		if (UC_NEWS_index < 0)
			UC_NEWS_index = UC_NEWS_arrTitle.length - 1;
		
		UC_NEWS_showContent(UC_NEWS_index);
	}
	function UC_NEWS_viewItem()
	{
		if (UC_NEWS_enableTimer)
		{
			UC_NEWS_index = UC_NEWS_index + 1;
			if (UC_NEWS_index > (UC_NEWS_arrTitle.length - 1))
				UC_NEWS_index = 0;
			
			UC_NEWS_showContent(UC_NEWS_index);
			setTimeout("UC_NEWS_viewItem()", 20 * 500);
		}
	}
	function UC_NEWS_toggleTimer()
	{
		var ctrlPause = document.getElementById("UC_NEWS_ctrlPause");
		
		if (UC_NEWS_enableTimer)
			UC_NEWS_enableTimer = false;
		else
			UC_NEWS_enableTimer = true;	
		if (UC_NEWS_enableTimer)
		{
			setTimeout("UC_NEWS_viewItem()", 20 * 500);
			ctrlPause.src = ctrlPause.src = ctrlPause.src.replace('On.gif', '.gif');
		}
		else
			ctrlPause.src = ctrlPause.src.replace('.gif', 'On.gif');
	}
	
	/*
	function UC_NEWS_showLegend()
	{
		var content = "<table cellspacing=10><tr>";
		var i=0;
		
		for (i=(UC_NEWS_listIndex * UC_NEWS_listSize); i < ((UC_NEWS_listIndex * UC_NEWS_listSize) + UC_NEWS_listSize); i++)
		{
			if (i <= (UC_NEWS_arrImage.length - 1))
				content += "<td><a href='javascript:UC_NEWS_showContent(" + i + ");' style='color:#ffffff;'><img src='" + UC_NEWS_arrImage[i] + "' width='100' height='60' border='1' alt='' style='border-color:#aaaaaa;'></a></td>";
		}
		content += "</tr></table>";
		
		window.UC_NEWS_ctrlLegend.innerHTML	= content;
	}
	function UC_NEWS_nextList()
	{
		UC_NEWS_listIndex = UC_NEWS_listIndex + 1;
		if ((UC_NEWS_listIndex * UC_NEWS_listSize) > (UC_NEWS_arrImage.length - 1))
			UC_NEWS_listIndex = 0;
		
		UC_NEWS_showLegend();
	}
	function UC_NEWS_prevList()
	{
		UC_NEWS_listIndex = UC_NEWS_listIndex - 1;
		if (UC_NEWS_listIndex < 0)
		{
			UC_NEWS_listIndex = (UC_NEWS_arrImage.length - (UC_NEWS_arrImage.length % UC_NEWS_listSize))/UC_NEWS_listSize;
			if (0 == (UC_NEWS_arrImage.length % UC_NEWS_listSize))
				UC_NEWS_listIndex = UC_NEWS_listIndex - 1;
		}
		UC_NEWS_showLegend();
	}
	*/
	
