﻿/////////////////////////////////////////////////////////////////////////////
// グローバル変数の定義

var g_urlCounterRelativeIndex = "./users/editordorf/counter/";


/////////////////////////////////////////////////////////////////////////////
// 初期化関連の関数

// この関数は起動時にページが作成された後に呼ばれるので削除しないでください。
// 起動時にページが作成された後に実行するスクリプトはこの関数内に記述してください。
function initUser()
{

}


/////////////////////////////////////////////////////////////////////////////
// 内容表示関連の関数

// この関数は表示モードの時、トピックやメモが選択されて表示された後に呼ばれるので削除しないでください。
// 表示モードの時、トピックやメモが選択表示された後に実行するスクリプトはこの関数内に記述してください。
function dispContentUser(nSelTopicIndex, nSelCardIndex)
{

	if (nSelTopicIndex == 1 && nSelCardIndex == 9)
	{
		// カウンター値を設定する。
                                getCounterLink(g_urlCounterRelativeIndex + 'WinTamatechoDemo', 'win_tamatecho_demo_count');
	}

               else if (nSelTopicIndex == 2 && nSelCardIndex == 7)
	{
		// カウンター値を設定する。
                                getCounterLink(g_urlCounterRelativeIndex + 'MacTamazoshiDemo', 'mac_tamazoshi_demo_count');
                                getCounterLink(g_urlCounterRelativeIndex + 'MacTamatechoDemo', 'mac_tamatecho_demo_count');
	}
                else if (nSelTopicIndex == 2 && nSelCardIndex == 8)
	{
		// カウンター値を設定する。
                                getCounterLink(g_urlCounterRelativeIndex + 'MacTamazoshiUpdate', 'mac_tamazoshi_update_count');
                                getCounterLink(g_urlCounterRelativeIndex + 'MacTamatechoUpdate', 'mac_tamatecho_update_count');
	}

}


/////////////////////////////////////////////////////////////////////////////
// 一般Ajax関連の関数

// 現在のファイルリンクカウンター値を返す。
function getCounterLink(strPath, id)
{
	// 処理を実行するための関数リファレンスを定義する。
	var funcRef = function(txt)
	{
		if (txt != "false")
		{
			var elem = document.getElementById(id);
			elem.innerHTML = txt;
		}
	}

	var strQuery = "path=" + strPath + "&" + "os_encoding=" + g_strOSEncoding;
	strQuery = uriEncode(strQuery);

	httpXmlRequest(g_urlPhpGetCounter, "POST", strQuery, false, false, funcRef, httpError);
}

// ファイルをリンク（バイナリーファイルの場合はダウンロード）させてカウンター値を返す。
function increaseCounterLink(strPath, strLinkPath, id)
{
	// 処理を実行するための関数リファレンスを定義する。
	var funcRef = function(txt)
	{
		if (txt != "false")
		{
			location.href= strLinkPath;

			var elem = document.getElementById(id);
			elem.innerHTML = txt;
		}
	}

	var strQuery = "path=" + strPath + "&" + "os_encoding=" + g_strOSEncoding + "&" + "init_count=1";
	strQuery = uriEncode(strQuery);

	httpXmlRequest(g_urlPhpIncreaseCounter, "POST", strQuery, false, false, funcRef, httpError);
}


/////////////////////////////////////////////////////////////////////////////
// 一般処理の関数

function openWinTamaShot1()
{
	var wo
	wo = window.open("", "", "toolbar=no, location=no, directories=no, width=600, height=480");
	wo.document.open();
	wo.document.write("<html><head><title>玉手帖2.0 画面ショット1</title></head><body><center><img src=./resource/WinTamaShot71.jpg></center></body></html>");
	wo.document.close();
}

function openWinTamaShot2()
{
	var wo
	wo = window.open("", "", "toolbar=no, location=no, directories=no, width=600, height=420");
	wo.document.open();
	wo.document.write("<html><head><title>玉手帖2.0 画面ショット2</title></head><body><center><img src=./resource/WinTamaShot73.jpg></center></body></html>");
	wo.document.close();
}

function openMacTechoShot()
{
	var wo
	wo = window.open("", "", "toolbar=no, location=no, directories=no, width=600, height=450");
	wo.document.open();
	wo.document.write("<html><head><title>玉手帖 画面ショット</title></head><body><center><img src=./resource/tamate1_big.jpg></center></body></html>");
	wo.document.close();
}

function openMacZoshiShot()
{
	var wo
	wo = window.open("", "", "toolbar=no, location=no, directories=no, width=600, height=450");
	wo.document.open();
	wo.document.write("<html><head><title>玉双紙 画面ショット</title></head><body><center><img src=./resource/tamazo1_big.jpg></center></body></html>");
	wo.document.close();
}

