/************************************************
	基本的なJavaScript

**************************************************/

/***********************************************************
	移動系

************************************************************/

/*********************************************************
	自分のまま移動する
	URL:	移動先
*********************************************************/
function selfAction(URL){ 
	self.location.href=URL;
}

/*********************************************************
	ひとつ上で移動する
	URL:	移動先
*********************************************************/
function parentAction(URL){ 
	parent.location.href=URL;
}

/***********************************************************
	削除確認

************************************************************/

/*********************************************************
	削除するときに確認ダイアログを出す
	URL1:	削除するソースのＵＲＬ
	URL2:	自分のＵＲＬ
*********************************************************/
function deleteEvent(URL){
	if(confirm("本当に削除してもいいですか？")){
		parent.location.href=URL;
	}else{
		return 0;
	}
}

/*********************************************************
	削除するときに確認ダイアログを出す（自分のまま）
	URL1:	削除するソースのＵＲＬ
	URL2:	自分のＵＲＬ
*********************************************************/
function deleteSelfEvent(URL){
	if(confirm("本当に削除してもいいですか？")){
		self.location.href=URL;
	}else{
		return 0;
	}
}

function deleteComment(url,message){
	if(message != ""){
		var afterMessage = "";
		messageArray = message.split("<br />");
		for(i = 0;i < messageArray.length;i++){
			if(i != 0){
				afterMessage += "\n";
			}
			afterMessage += messageArray[i];
		}
		if(confirm(afterMessage)){
			parent.location.href=url;
		}else{
			return 0;
		}
	}
}

/*********************************************************
	別ウィンドウを開く
	URL:	リンク先
*********************************************************/
function openWindow(URL){
	window.open(URL,"","scrollbars=1,resizable=1");
}

function openFullWindow(URL){
	var examinationWindow;
	myX = screen.width;
	myY = screen.height;
	myAgent = navigator.userAgent;
	if(myAgent.indexOf("Win") != -1){//Windows
		if(myAgent.indexOf("Firefox") != -1){//firefox
			myOption = "top=0,left=0,screenX=0,screenY=0,width="+myX+",height="+myY+",scrollbars=yes,resizable=no";
		}else if(myAgent.indexOf("Netscape") != -1){//Netscape
			myOption = "top=0,left=0,screenX=0,screenY=0,width="+myX+",height="+myY+",scrollbars=yes,resizable=no";
		}else{//それ以外
			myOption = "fullscreen=1,scrollbars=0";
		}
	}else{//Mac
		myOption = "top=0,left=0,screenX=0,screenY=0,width="+myX+",height="+myY+",scrollbars=yes,resizable=no";
	}
	examinationWindow = window.open(URL,"subWin",myOption);
	examinationWindow.focus();
}

/*********************************************************
	画像のサムネイルを表示する
	target:	画像ID
	objimg:	画像パス
*********************************************************/
function imageView(target,objimg){
	document.getElementById(target).src= objimg.value;
	document.getElementById(target).style.display="inline";
}

/*********************************************************
	ボタンを非表示にする
	Target:	ロックするＩＤ
	Count:	ループ回数
*********************************************************/
function lock(Target,Count){
	if(Count == "0"){
		document.getElementById(Target).disabled=true;
	}else{
		for(i = 0;i < Count;i++){
			document.getElementById(Target+i).disabled=true;
		}
	}
}

/********************************************************
	説明文表示パネル
*********************************************************/
function explainOpenAction(target,no,count){
	for(i = 1;i <= count;i++){
		if(document.getElementById(target+"_"+i) != null){
			document.getElementById(target+"_"+i).style.display = "none";
		}
	}
	if(document.getElementById(target+"_"+no) != null){
		document.getElementById(target+"_"+no).style.display = "block";
	}
}

function explainCloseAction(target){
	if(document.getElementById(target) != null){
		document.getElementById(target).style.display = "none";
	}
}
