/* UIをコントロールする */

/* フェードインの時間 */
var fadeTime = 300;

/* 更新履歴のカウンタ */
var historyCounter = 5;

/* 更新履歴を更新する間隔 */
var refreshTime = 12000;

/* 画面の初期化 */
function InitScreen()
{
	/* 更新履歴の更新 */
	RefreshHistory();
	
	/* URL引数の解析 */
	var option = location.href.split('#')[1];
	
	/* 引数を解析してページ遷移 */
	switch (option)
	{
		case '!top':
			OpenTop();
			break;
			
		case '!about':
			OpenAbout();
			break;
			
		case '!graphic':
			OpenGraphic();
			break;
			
		case '!template':
			OpenTemplate();
			break;
			
		case '!software':
			OpenSoftware();
			break;
			
		case '!link':
			OpenLink();
			break;
			
		case '!qMimy_win7':
			OpenSoftware();
			OpenQMimyWin7();
			break;
			
		case '!qMimy':
			OpenSoftware();
			OpenQMimy();
			break;
			
		case '!parakeet':
			OpenSoftware();
			OpenParakeet();
			break;
			
		default:
			break;
	}
	
	/* 更新履歴用のタイマーをセット */
	historyTimer = setInterval('RefreshHistory()', refreshTime);
}

/* 表示の遷移 */
function OpenTop()
{
	HideAllSection();
	$('#top').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode**';
}

function OpenAbout()
{
	HideAllSection();
	$('#about').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::About**';
}

function OpenGraphic()
{
	HideAllSection();
	$('#graphic').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::Graphic**';
}

function OpenTemplate()
{
	HideAllSection();
	$('#ppTemplate').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::Office Template**';
}

function OpenSoftware()
{
	HideAllSection();
	$('#software').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::Software**';
}

function OpenLink()
{
	HideAllSection();
	$('#link').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::Link**';
}

/* ソフトウェア欄の画面遷移 */
function OpenQMimyWin7()
{
	HideAllSoftware();
	$('#qMimy_win7').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::Software::qMimy Tumblr Viewer for Windows7**';
}

function OpenQMimy()
{
	HideAllSoftware();
	$('#qMimy').fadeIn(fadeTime);	
	document.title = '**Ex.QuelLENcode::Software::qMimy Tumblr Viewer**';
}

function OpenParakeet()
{
	HideAllSoftware();
	$('#parakeet').fadeIn(fadeTime);
	document.title = '**Ex.QuelLENcode::Software::Parakeet Podcast Downloader**';
}

/* 全てのセクションを隠す */
function HideAllSection()
{
	$('#top').hide();
	$('#about').hide();
	$('#graphic').hide();
	$('#ppTemplate').hide();
	$('#software').hide();
	$('#link').hide();
}

/* 更新履歴を隠す */
function HideAllHistory()
{
	$('#history1').hide();
	$('#history2').hide();
	$('#history3').hide();
	$('#history4').hide();
	$('#history5').hide();
	$('#history6').hide();
}

/* ソフトウェア欄を隠す */
function HideAllSoftware()
{
	$('#qMimy_win7').hide();
	$('#qMimy').hide();
	$('#parakeet').hide();
}

/* 更新履歴の更新 */
function RefreshHistory()
{
	HideAllHistory();
	switch(historyCounter)
	{
		case 0:
			/* show()はIE hack */
			$('#history2').fadeIn('fast');
			historyCounter++;
			break;
			
		case 1:
			$('#history3').fadeIn('fast');
			historyCounter++;
			break;
			
		case 2:
			$('#history4').fadeIn('fast');
			historyCounter++;
			break;
			
		case 3:
			$('#history5').fadeIn('fast');
			historyCounter++;
			break;
			
		case 4:
			$('#history6').fadeIn('fast');
			historyCounter++;
			break;
			
		case 5:
			$('#history1').fadeIn('fast');
			historyCounter = 0;
			break;
			
		default:
			$('#history1').fadeIn('fast');
			historyCounter = 0;
			break;
	}
	
	/* 更新履歴用のタイマーをセット */
	//clearTimeout(historyTimer);
	//historyTimer = setTimeout('RefreshHistory()', refreshTime);
}


