// 
// 
// Base JavaScript
// Modified : 2006-06;
//
//

// ===============================================
//
// 発言者自動切換
//
// ===============================================

function VoiceSel(thisForm, vc){
	self.document.forms[0].VoiceClass.value = vc;
	myForm = self.document.forms[0];
	if( myForm.Voice[0] != thisForm) myForm.Voice[0].value = "";
	for(i = 0; i < myForm.Voice.length; i++){
		if( myForm.Voice[i] != thisForm ) myForm.Voice[i].selectedIndex = 0;
	}
}





// ===============================================
//
// 詳細検索　全条件 submit 処理
//
// ===============================================

function submitall(n){
	self.document.forms[n].submit();
}





// ===============================================
//
// 現在の検索条件
//
// ===============================================

function Condition(URL, ImgPath, Template, StartKikan, EndKikan, Cabinet, Classes, RecordName, VoiceName, Phrase){
	var Tag = '';
	KikanLinkTag = '<a href="' + URL + '?Template=' + Template + '&KikanSelect=Clear&QueryType=Modify" title="設定している検索条件をクリアします。">クリア';
	CabinetLinkTag = '<a href="' + URL + '?Template=' + Template + '&CabinetSelect=Clear&QueryType=Modify" title="設定している検索条件をクリアします。">クリア';
	ClassLinkTag = '<a href="' + URL + '?Template=' + Template + '&ClassSelect=Clear&QueryType=Modify" title="設定している検索条件をクリアします。">クリア';
	RecordNameLinkTag = '<a href="' + URL + '?Template=' + Template + '&RecordNameSelect=Clear&QueryType=Modify" title="設定している検索条件をクリアします。">クリア';
	VoiceLinkTag = '<a href="' + URL + '?Template=' + Template + '&VoiceSelect=Clear&QueryType=Modify" title="設定している検索条件をクリアします。">クリア';
	PhraseLinkTag = '<a href="' + URL + '?Template=' + Template + '&PhraseSelect=Clear&QueryType=Modify" title="設定している検索条件をクリアします。">クリア';

	if(Phrase != ''){
		Tag += '<table summary="現在の検索条件（ことば）">'
		Tag += '<tr><th scope="row"><span>ことば</span>' + PhraseLinkTag + '<\/a><\/th><\/tr>';
		Tag += '<tr><td>' + Phrase + '<\/td><\/tr><\/table>';
	}
	if(VoiceName != ''){
		Tag += '<table summary="現在の検索条件（発言者）">'
		Tag += '<tr><th scope="row"><span>発言者</span>' + VoiceLinkTag + '<\/a><\/th><\/tr>';
		Tag += '<tr><td>' + VoiceName + '<\/td><\/tr><\/table>';
	}
	if(Cabinet != ''){
		Tag += '<table summary="現在の検索条件（会議名）">'
		Tag += '<tr><th scope="row"><span>会議名</span>' + CabinetLinkTag + '<\/a><\/th><\/tr>';
		Tag += '<tr><td>' + Cabinet + '<\/td><\/tr><\/table>';
	}
	if(Classes != ''){
		Tag += '<table summary="現在の検索条件（分類）">'
		Tag += '<tr><th scope="row"><span>分類</span>' + ClassLinkTag + '<\/a><\/th><\/tr>';
		Tag += '<tr><td>' + Classes + '<\/td><\/tr><\/table>';
	}
	if(RecordName != ''){
		Tag += '<table summary="現在の検索条件"（文書名）>'
		Tag += '<tr><th scope="row"><span>文書名</span>' + RecordNameLinkTag + '<\/a><\/th><\/tr>';
		Tag += '<tr><td>' + RecordName + '<\/td><\/tr><\/table>';
	}
	if(StartKikan != '' || EndKikan != ''){
			Tag += '<table summary="現在の検索条件（期間）">'
			Tag += '<tr><th scope="row"><span>期間</span>' + KikanLinkTag + '<\/a><\/th><\/tr>';
			Tag += '<tr><td>' + StartKikan + "-"  + EndKikan + '<\/td><\/tr><\/table>';
	}

	if(Tag != ''){
		document.write(Tag);
	}
}





// ===============================================
//
// ジャンプメニュー
//
// ===============================================

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}





// ===============================================
//
//結果一覧表示形式プルダウン
//
// ===============================================

function setOrderList(order){
	if( order == "asc")
		self.document.forms[0].Order.selectedIndex = 1;
	else
		self.document.forms[0].Order.selectedIndex = 0;
}





// ===============================================
//
// 検索結果一覧ページ番号処理
//
// ===============================================

function MoveListPage(ListPageNo, CurListPageNo, GotoPageSelect, DocumentType, Template){
	var Tag = '';
	if (Template == "" ) Template='List';
	if( ListPageNo == CurListPageNo ){
	//現在開いているページリンク
		Tag += '<strong>' + ListPageNo + '<\/strong>'
	}else{
	//他のページリンク
		Tag += '<a href="' + GotoPageSelect + '?Template='+Template+'&amp;QuerySelect=No&amp;List=now&amp;DocumentType=' + DocumentType + '">' + ListPageNo + '<\/a>';
	}
	if(Tag != '') document.write("&nbsp;" +Tag+ "&nbsp;");
}





// ===============================================
//
// ヘルプ
//
// ===============================================

function HelpWindow(url){
	OpenHelpWindow = window.open("","HelpWindow","toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,close=yes,width=642,height=500");
	OpenHelpWindow.location = url;
}





// ===============================================
//
// 文書内容閲覧定義
//
// ===============================================

var hyozureFlg  = 0;  // 表ズレ表示フラグ
var downloadFlg = 0;  // ダウンロード画面切り替えフラグ
var windowNo = 0;     // 別窓表示のWindow名
var targetName;       // Form ターゲットオブジェクト名
var connect;          // URLの入力値の接続文字 "?" か "&"
var preSpeakerNo = 0; // 前回ハイライトした発言者番号
var voiceCounter=0;   // 表示発言カウンタ
var maxCount=0;       // 全発言者件数
var voiceArray = new Array();





// ===============================================
//
// setConnect()
//
// URL の入力変数の結合文字
//
// ===============================================

function setConnect(n){
	if( n == 0 ){
		connect = '?';
	}else if(n == 1){
		connect = '&';
	}else{
		connect = '';
	}
}





// ===============================================
//
// TargetSet()
//
// Documentのターゲットオブジェクトのセット
//   Page：１画面表示の Page ターゲット名
//
//
// ===============================================

function TargetSet(){
	targetName = Page.document;
}





// ===============================================
//
// downloadList()
//
// 発言内容表示
//
// ===============================================

function downloadList(url, n){
	setConnect(n);
	if(downloadFlg == 0){
		dwnlist =  connect + 'Template=DocOneVoicelistDownload';
		downloadFlg = 1;
	}else{
		dwnlist =  connect + 'Template=DocOneVoicelist';
		downloadFlg = 0;
	}
	Voicelist.document.location.href = url + dwnlist;
}





// ===============================================
//
// Hyozure()
//
// 表ズレ表示
// Flg: 0=折り返す
//      1=折り返し無し
//
// ===============================================

function Hyozure(url, n){
	setConnect(n);
	TargetSet();
	
	if(hyozureFlg == 0){
		targetName.location.href= url + connect + 'Template=DocPage2';
		hyozureFlg = 1;
	}else if(hyozureFlg == 1){
		targetName.location.href = url + connect + 'Template=DocPage';
		hyozureFlg = 0;
	}
}





// ===============================================
//
// showDocumentVoice()
//
// 発言内容表示
//
// ===============================================

function showDocumentVoice(url, n){
	setConnect(n);
	TargetSet();
	if(hyozureFlg == 1){
		orikaeshi = connect + 'Template=DocPage2';
	}else{
		orikaeshi = connect + 'Template=DocPage';
	}
	targetName.location.href = url + orikaeshi;
}





// ===============================================
//
// moveSelDocumentVoice()
//
// 前発言/次発言の移動処理
//
// ===============================================

function moveSelDocumentVoice(max, addcount){
	TargetSet();
	voiceCounter += addcount;
	if( voiceCounter != 0 && voiceCounter <= max ) CurrentSpeakerListHighlight(voiceArray[voiceCounter-1]);
	if(0 >= voiceCounter){
		voiceCounter = 1;
	}else if(max < voiceCounter){
		voiceCounter = max;
	}
	if(max != 0){
		targetName.location.hash = "LinkNo" + voiceArray[voiceCounter - 1];
	}
}





// ===============================================
//
// moveDocumentVoice()
//
// 前発言/次発言の移動処理
//
// ===============================================

function moveDocumentVoice(max, addcount){
	TargetSet();
	voiceCounter += addcount;
	if( voiceCounter != 0 && voiceCounter <= max ) CurrentSpeakerListHighlight(voiceCounter);
	if(0 >= voiceCounter){
		voiceCounter = 1;
	}else if(max <= voiceCounter){
		voiceCounter = max;
	}
	targetName.location.hash = "LinkNo" + voiceCounter;
}


// #############################################################
//
// setSpeakerDocument()
//
// moveSelectDocument() + CurrentSpeakerListHighlight() の同時処理
//
//
function setSpeakerDocument(voiceno,type)
{
        moveSelectDocument(voiceno,type);
        CurrentSpeakerListHighlight(voiceno);
}


// ===============================================
//
// moveSelectDocument()
//
// 発言リストからの発言内容移動
//
// ===============================================

function moveSelectDocument(VoiceNo,type){
	TargetSet();
	if(type == 'All'){
		voiceCounter = VoiceNo;
	}else if(type == 'Sel'){
		for(i=0;i < maxCount; i++){
			if( voiceArray[i] == VoiceNo ){
				voiceCounter = i+1;
			}
		}
	}
	targetName.location.hash = "LinkNo" + VoiceNo;
}





// ===============================================
//
// CurrentSpeakerListHighlight()
//
// 文書詳細画面の発言者リスト
// 発言者リストの現在表示中の発言者をハイライトする
// (渡された発言番号の箇所をハイライトする)
//
// ===============================================

var CurVoiceNo;
function CurrentSpeakerListHighlight(curSpeakerNo)
{
	CurVoiceNo = curSpeakerNo;
	// 発言リストも移動する ( true / false )
	listMove    = false;

	// ハイライト色の設定
	TxtColor    = "";  // 規定値(text)
	BGColor     = "";  // 規定値(background)
	curTxtColor = "#333333";  // 選択色(text)
	curBGColor  = "#ffcc66";  // 選択色(background)

	// 選択された箇所の色を元に戻す
	preIDName = 'SpeakerNo' + preSpeakerNo;
	if( Voicelist.document.getElementById(preIDName) ){
		Voicelist.document.getElementById(preIDName).style.color = TxtColor;
		Voicelist.document.getElementById(preIDName).style.background = BGColor;
		Voicelist.document.getElementById(preIDName).style.backgroundColor = "";
	}

	// 現在表示の発言者をハイライト
	if( preSpeakerNo == 0 ) preSpeakerNo = 1;
	curIDName = 'SpeakerNo' + curSpeakerNo;
	if( Voicelist.document.getElementById(curIDName) ){
		Voicelist.document.getElementById(curIDName).style.color = curTxtColor;
		Voicelist.document.getElementById(curIDName).style.background = curBGColor;
	}

	// 現在選択されている発言番号を保存
	preSpeakerNo = curSpeakerNo;

	// 選択発言へリストの移動
	if( listMove ){
		if(Voicelist.location != '#'+curIDName )
			Voicelist.location.hash = '#'+curIDName;
	}
}





// ===============================================
//
// ハイライト箇所をセットする
//
// ===============================================

function setSpeakerHighlight(no) {
	if(!CurVoiceNo) CurVoiceNo=no;
	CurrentSpeakerListHighlight(CurVoiceNo);
}





// ===============================================
//
// setFontSize()
//
// 文書詳細内容のフォントサイズ変更
//
// ===============================================

var MinSize = 40;
var MaxSize = 200;
var Size    = 100;
var fontSize = Size + "%";

function setFontSize(add) {
	TargetSet()
	Size += add;
	if( Size < MinSize )
		Size = MinSize;
	else if( Size > MaxSize )
		Size = MaxSize;

	fontSize = Size + "%";
	targetName.body.style.fontSize = fontSize;
}





// ===============================================
//
// 印刷画面
//
// ===============================================

function PrintWindow(url){
	OpenPrintWindow = window.open("","PrintWindow","toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,close=yes,width=700,height=500");
	OpenPrintWindow.location = url;
}





// ===============================================
//
// 別窓表示
//
// ===============================================

function OtherWindow(url){
	OpenOtherWindow = window.open("","OtherWindow","toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,close=yes,width=700,height=500");
	OpenOtherWindow.location = url;
}

