// JavaScript Document

/***全般***/
function logout(path){
	res = confirm('ログアウトしますか？');
	if(res==true){
		var url = path + 'index.php?lgo=out';
		location.href=url;
		//var li = location.href = '/~naoki/spms/index.php?lgo=out';

	}
}

/***スケジュール***/

function delscd(recid){
	var res = confirm('この予定を削除しますか？');
	if(res == true){
		location.href='index.php?mode=delete&recid='+ recid;
	}
}

function inputcheckScd(){
	if(document.forms[0].Staff_ID.selectedIndex == 0){
		alert('予約者が選択されていません。');
		return false;
	}
	if(document.forms[0].Title.value == ""){
		alert('件名が入力されていません。');
		return false;
	}
}


/***ユーザー設定***/

function chengepass(path){
	var popwin,w,h
	w = 500;
	h = 400;
	url = path+'userdata.php';
	popwin=window.open(url,"subwin","width=" + w + ",height=" + h + ",menubar=no,toolbar=no,location=yes,scrollbars=yes,status=yes,resizable=yes,fullscreen=no");
	popwin.focus();
}

/***企業マスタ***/

function inputcheckCom(){
	if(document.com.C_Name.value == ""){
		alert('企業名が入力されていません。');
		return false;
	}
}

function delcom(recid){
	res = confirm('この企業データを削除しますか?');
	if(res == true){
		location.href= 'index.php?mode=com_del&recid='+recid;
	}
}

/***スタッフマスタ***/

function inputcheckStaff(mode){
	if(document.staff.Login_ID.value == ""){
		alert('ログインIDが入力されていません。');
		return false;
	}
	/*
	if(document.staff.Staff_ID.value == ""){
		alert('スタッフIDが入力されていません。');
		return false;
	}
	*/
	if(document.staff.Staff_Name.value == ""){
		alert('スタッフ名が入力されていません。');
		return false;
	}
	if(document.staff.Staff_Name_Kana.value == ""){
		alert('スタッフ名カナが入力されていません。');
		return false;
	}
	if(document.staff.Dept_ID.selectedIndex == 0){
		alert('部署が選択されていません。');
		return false;
	}
	if(document.staff.Auth_ID.selectedIndex == 0){
		alert('権限が選択されていません。');
		return false;
	}
}

function passclear(){
	var res = confirm('このスタッフのパスワードを消去しますか？');
	if(res == true){
		document.staff.PassWord.disabled = false;
		alert('パスワードは「編集実行」後消去されます。');
	}
	
}

function delstaff(recid){
	res = confirm('このスタッフデータを削除しますか?');
	if(res == true){
		location.href= 'index.php?mode=staff_del&recid='+recid;
	}
}

/***部門マスタ***/

function inputcheckDept(mode){
	/*
	if(document.dept.Dept_ID.value == ""){
		alert('部門IDが入力されていません。');
		return false;
	}*/
	if(document.dept.Dept_Name.value == ""){
		alert('部門名が入力されていません。');
		return false;
	}
}

function deldept(recid){
	res = confirm('この部門データを削除しますか?');
	if(res == true){
		location.href= 'index.php?mode=dept_del&recid='+recid;
	}
}


/***設備マスタ***/

function inputcheckSrv(mode){
	/*
	if(document.srv.S_ID.value == ""){
		alert('設備IDが入力されていません。');
		return false;
	}*/
	if(document.srv.Service_Name.value == ""){
		alert('設備名が入力されていません。');
		return false;
	}
}

function delsrv(recid){
	res = confirm('この設備データを削除しますか?');
	if(res == true){
		location.href= 'index.php?mode=srv_del&recid='+recid;
	}
}



















/***問題点指摘***/

function comedit(recid,row){
	var popwin,w,h,recid,row,name;
	w = 600;
	h = 350;
	window.name = 'detail';
	url = 'prb_comupdate.php?&recid='+ recid + '&row='+ row;
	popwin=window.open(url,"subwin","width=" + w + ",height=" + h + ",menubar=no,toolbar=no,location=yes,scrollbars=yes,status=yes,resizable=yes,fullscreen=no");
	popwin.focus();
}

function comupdate(){
	var ck = inputcheckPrbCom();
	if(ck!=false){
		document.forms[0].submit();
		self.close();
	}
}

function datadelete(recid,name,db){
	var res = confirm('このデータを削除しますか？');
	if(res == true){
		location.href= name+'?mode=delete&recid='+ recid + '&db=' + db;
	}
}

function comdelete(recid,comrecid){
	var res = confirm('このデータを削除しますか？');
	if(res == true){
		window.opener.location.href= 'prb_detail.php?mode=delete&recid='+ recid + '&comrecid=' + comrecid;
		self.close();
	}
}

function inputcheckPrbCom(){
	if(document.prbcom.elements['Prb_Comment::Tantou'].value == ""){
		alert('担当者名が入力されていません。');
		return false;
	}
	if(document.prbcom.elements['Prb_Comment::Comment'].value == ""){
		alert('コメントが入力されていません。');
		return false;
	}
}

function inputcheckPrb(){
	if(document.prb.HasseiDate.value == ""){
		alert('発生日が入力されていません。');
		return false;
	}
	/*
	if(document.prb.HasseiKubun.selectedIndex == 0){
		alert('発生区分が選択されていません。');
		return false;
	}
	if(document.prb.HasseiGamen.selectedIndex == 0){
		alert('発生画面が選択されていません。');
		return false;
	}
	if(document.prb.UnyouKubun.selectedIndex == 0){
		alert('運用区分が選択されていません。');
		return false;
	}
	*/
	if(document.prb.Category.selectedIndex == 0){
		alert('分類が選択されていません。');
		return false;
	}
	if(document.prb.Priority.selectedIndex == 0){
		alert('優先度が選択されていません。');
		return false;
	}
	if(document.prb.Tantou.value == ""){
		alert('担当が入力されていません。');
		return false;
	}
	if(document.prb.HasseiGamenDetail.value == ""){
		alert('発生画面名が入力されていません。');
		return false;
	}
	if(document.prb.Title.value == ""){
		alert('タイトルが入力されていません。');
		return false;
	}
	if(document.prb.MainStatus.selectedIndex == 0){
		alert('ステータスが選択されていません。');
		return false;
	}
}

function tmpselect(fname,cname,no,tname){
	document.forms[fname].elements[cname][no].checked = true;
	if(no==0){
		document.forms[fname].elements[tname].disabled = true;
	}else if(no==1){
		document.forms[fname].elements[tname].disabled = false;
	}
	
}

/***Q&A***/

function inputcheckQA(){
	if(document.qa.Category.selectedIndex == 0){
		alert('分類が選択されていません。');
		return false;
	}
	if(document.qa.Q_Tantou.value == ""){
		alert('質問者が入力されていません。');
		return false;
	}
	if(document.qa.Title.value == ""){
		alert('タイトルが入力されていません。');
		return false;
	}
	if(document.qa.Question.value == ""){
		alert('質問・要望が入力されていません。');
		return false;
	}
	if(document.qa.MainStatus.selectedIndex == 0){
		alert('ステータスが選択されていません。');
		return false;
	}
}

function inputcheckQACom(){
	if(document.qacom.elements['QA_Comment::Category'].selectedIndex == 0){
		alert('分類が選択されていません。');
		return false;
	}
	if(document.qacom.elements['QA_Comment::Tantou'].value == ""){
		alert('担当者名が入力されていません。');
		return false;
	}
	if(document.qacom.elements['QA_Comment::Comment'].value == ""){
		alert('コメントが入力されていません。');
		return false;
	}
	if(document.qacom.MainStatus.selectedIndex == 0){
		alert('ステータスが選択されていません。');
		return false;
	}
}

function comqaedit(recid,row){
	var popwin,w,h,recid,row,name;
	w = 650;
	h = 350;
	window.name = 'detail';
	url = 'qa_comupdate.php?&recid='+ recid + '&row='+ row;
	popwin=window.open(url,"subwin","width=" + w + ",height=" + h + ",menubar=no,toolbar=no,location=yes,scrollbars=yes,status=yes,resizable=yes,fullscreen=no");
	popwin.focus();
}

function comqaupdate(){
	var ck = inputcheckQACom();
	if(ck!=false){
		document.forms[0].submit();
		self.close();
	}
}

function comqadelete(recid,comrecid){
	var res = confirm('このデータを削除しますか？');
	if(res == true){
		window.opener.location.href= 'qa_detail.php?mode=delete&recid='+ recid + '&comrecid=' + comrecid;
		self.close();
	}
}

/***バージョン管理***/

function inputcheckVrs(){
	if(document.vrs.ReleaseVersion.value == ""){
		alert('リリースバージョンが入力されていません。');
		return false;
	}
	if(document.vrs.Tantou.value == ""){
		alert('担当者が入力されていません。');
		return false;
	}
	if(document.vrs.Title.value == ""){
		alert('件名が入力されていません。');
		return false;
	}
	if(document.vrs.ReleaseContents.value == ""){
		alert('リリース内容が入力されていません。');
		return false;
	}
	if(document.vrs.MainStatus.selectedIndex == 0){
		alert('ステータスが選択されていません。');
		return false;
	}
}

function comvrsedit(recid,row){
	var popwin,w,h,recid,row,name;
	w = 600;
	h = 350;
	window.name = 'detail';
	url = 'vrs_comupdate.php?&recid='+ recid + '&row='+ row;
	popwin=window.open(url,"subwin","width=" + w + ",height=" + h + ",menubar=no,toolbar=no,location=yes,scrollbars=yes,status=yes,resizable=yes,fullscreen=no");
	popwin.focus();
}

function inputcheckVrsCom(){
	if(document.vrscom.elements['Vrs_Comment::Tantou'].value == ""){
		alert('担当者名が入力されていません。');
		return false;
	}
	if(document.vrscom.elements['Vrs_Comment::Comment'].value == ""){
		alert('コメントが入力されていません。');
		return false;
	}
}

function comvrsupdate(){
	var ck = inputcheckVrsCom();
	if(ck!=false){
		document.forms[0].submit();
		self.close();
	}
}

function comvrsdelete(recid,comrecid){
	var res = confirm('このデータを削除しますか？');
	if(res == true){
		window.opener.location.href= 'vrs_detail.php?mode=delete&recid='+ recid + '&comrecid=' + comrecid;
		self.close();
	}
}

