// 【共通検索機能：東大】アプリケーションルートパス
var CS_URL_APP_ROOT_TOKYO = "http://clioz39.hi.u-tokyo.ac.jp/ships/ZClient/W34/";


//-----------------------------------------------
// 検索を実行する
//
//	f：フォームオブジェクト
//-----------------------------------------------
function doSearch(f) {

	f.submit();
}

//-----------------------------------------------
// ウィンドウを閉じる
//-----------------------------------------------
function windowClose() {

	if(!confirm("ウィンドウを閉じます。\nよろしいですか？")) {
		return false;
	}

	(window.open('', '_self').opener = window).close();
}

//-----------------------------------------------
// ポップアップウィンドウを開く
//
//	url 　：表示URL
//	target：新ウィンドウ名
//-----------------------------------------------
function openNewPopUp(url, target){

	window.open(url, target);
}

//-----------------------------------------------
//文字詳細画面へ遷移する
//
//	title 　：検索文字
//	mgno　　：管理番号
//	count 　：件目
//	countAll：総件数
//-----------------------------------------------
function goDetail(title, mgno, count, countAll){

	var	url;

	url	=	CS_URL_APP_ROOT_TOKYO + "z_detail.php?title=" + title;
	url	+=	"&mgno=" + mgno;
	url	+=	"&count=" + count;
	url	+=	"&countAll=" + countAll;

	location.href	=	url;
}


//-----------------------------------------------
// 文字一覧画面のページングを行う
//
//	title　　　　：検索文字
//	resourcetype ：代表表示フラグ
//	firstPosition：取得開始位置
//	dataLimit　　：取得件数上限
//-----------------------------------------------
function goListAll(title, resourceType, firstPosition, dataLimit){

	var	url;

	url	=	CS_URL_APP_ROOT_TOKYO + "z_list.php?title=" + title;
	url	+=	"&resourcetype=" + resourceType;
	url	+=	"&firstPosition=" + firstPosition;
	url	+=	"&dataLimit=" + dataLimit;

	location.href	=	url;

}

//-----------------------------------------------
//文字詳細画面へ遷移する（ページング：先頭）
//
//	title：検索文字
//	count：件目（現在の件目）
//-----------------------------------------------
function goDetailTop(title, count){

	if(1 == count){
		// 現在件目が1件目の場合、エラーメッセージを表示
		alert("先頭件です。");
		return false;
	}

	// ページング処理呼び出し
	goDetailPaging(title, 1)
}


//-----------------------------------------------
//文字詳細画面へ遷移する（ページング：前件）
//
//	title：検索文字
//	count：件目（現在の件目）
//-----------------------------------------------
function goDetailForward(title, count){

	if(1 == count){
		// 現在件目が1件目の場合、エラーメッセージを表示
		alert("前件はありません。");
		return false;
	}

	// ページング処理呼び出し
	goDetailPaging(title, count - 1)
}


//-----------------------------------------------
//文字詳細画面へ遷移する（ページング：次件）
//
//	title 　：検索文字
//	count 　：件目（現在の件目）
//	countAll：総件数
//-----------------------------------------------
function goDetailNext(title, count, countAll){

	if(count >= countAll){
		// 現在件目が最後の場合、エラーメッセージを表示
		alert("次件はありません。");
		return false;
	}

	// ページング処理呼び出し
	goDetailPaging(title, count + 1)
}


//-----------------------------------------------
//文字詳細画面へ遷移する（ページング：最終）
//
//	title：検索文字
//	count 　：件目（現在の件目）
//	countAll：総件数
//-----------------------------------------------
function goDetailLast(title, count, countAll){

	if(count >= countAll){
		// 現在件目が最後の場合、エラーメッセージを表示
		alert("最終件です。");
		return false;
	}

	// ページング処理呼び出し
	goDetailPaging(title, "")
}


//-----------------------------------------------
//文字詳細画面へ遷移する（ページング）
//
//	title：検索文字
//	count：件目
//-----------------------------------------------
function goDetailPaging(title, count){

	var	url;

	url	=	CS_URL_APP_ROOT_TOKYO + "z_detailPaging.php?title=" + title;
	if("" != count){
		url	+=	"&count=" + count;
	}

	location.href	=	url;
}



