//--------------------------------------------------------
//管理画面でのレコード修正
//--------------------------------------------------------
function maintenanceClick(id,mode){
	var form =document.forms["MAINFORM"];
	form.id.value=id;
	form.mode.value=mode;
	form.page.value="";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//スケジュールページで日付変更
//--------------------------------------------------------
function change_date(year,month,day){
	var form =document.forms["MAINFORM"];
	form.target_year.value=year;
	form.target_month.value=month;
	form.target_day.value=day;
	form.mode.value="";
	form.page.value="";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//キャスト詳細の表示
//--------------------------------------------------------
function deleteMaintenace(){
	if (! window.confirm('削除すると復元させることができません。\nよろしいですか？')){
		return false;
	}
	var form =document.forms["MAINFORM"];
	form.page.value="";
	form.mode.value="REMOVE";
	form.method="POST";
	form.submit();
}


//--------------------------------------------------------
//キャスト詳細の表示
//--------------------------------------------------------
function showCastDetail(cast_id,from_page,from_parts){
	var fName="index.php?action_store_castdetail=true&cast_id="+cast_id+"&from_page="+from_page+"&from_parts="+from_parts;
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=900,height=600";
	w=window.open(fName,"",sStr);
}

//--------------------------------------------------------
//キャストのスケジュール修正
//--------------------------------------------------------
function maintenanceMaster(mode){
	var form =document.forms["MAINFORM"];
	form.mode.value=mode;
	form.page.value="";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//キャストのスケジュール修正
//--------------------------------------------------------
function maintenanceCastSchedule(cast_id){
	var form =document.forms["MAINFORM"];
	form.cast_id.value=cast_id;
	form.mode.value="";
	form.page.value="admin_schedule_edit";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//キャストの修正
//--------------------------------------------------------
function maintenanceCast(id,mode){
	var form =document.forms["MAINFORM"];
	form.cast_id.value=id;
	form.mode.value=mode;
	form.page.value="";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//BBSの修正
//--------------------------------------------------------
function maintenanceBBS(id,mode){
	var form =document.forms["MAINFORM"];
	form.id.value=id;
	form.mode.value=mode;
	form.page.value="";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//ログアウト
//--------------------------------------------------------
function logout() {
	var form =document.forms["MAINFORM"];
	form.page.value="";
	form.mode.value="logout";
	form.method="POST";
	form.submit();
}


//--------------------------------------------------------
//店舗変更
//--------------------------------------------------------
function changeStore(store_id) {
	var form =document.forms["MAINFORM"];
	form.mode.value="change_store";
	form.store_id.value=store_id;
	form.page.value="admin_menu";
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//各画面でのページ移動
//--------------------------------------------------------
function changePage(page) {

	var form =document.forms["MAINFORM"];
	form.page.value=page;
	form.method="POST";
	form.submit();
}
//--------------------------------------------------------
//各画面でのページ移動(待ち合わせ辺)
//--------------------------------------------------------
function changePlace(page,place) {

	var form =document.forms["MAINFORM"];
	form.page.value=page;
	form.place.value=place;
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//リスト画面でのページ遷移（次ページ、前ページ）
//param
//　page_mode ： FIRST,PREV,NEXT,LAST,DIRECT
//　direct_page ： page_modeがDIRECTの時のpage数
//--------------------------------------------------------
function pageJump(page_mode,direct_page) {
	var form =document.forms["MAINFORM"];
	form.page_mode.value=page_mode;
	form.page.value='';
	form.direct_page.value=direct_page;
	form.method="POST";
	form.submit();
}

//--------------------------------------------------------
//登録・編集画面からの移動（確認メッセージ付き）
//--------------------------------------------------------
function changePageWithConfirm(page) {

	if (! window.confirm('現在入力中のデータは破棄されますが\nよろしいですか？')){
		return false;
	}

	var form =document.forms["MAINFORM"];
	form.page.value=page;
	form.method="POST";
	form.submit();
}


function maintenanceMenu(mode){
	var form =document.forms["MAINFORM"];
	form.mode.value=mode;
	form.page.value='';
	form.method="POST";
	form.submit();
}


function maintenanceClick(id,mode){
	var form =document.forms["MAINFORM"];
	form.id.value=id;
	form.mode.value=mode;
	form.method="POST";

	if (mode=="UPDATE"){
		if (! window.confirm('入力された内容でデータを更新します。\nよろしいですか？')){
			return false;
		}
	}
	else if (mode=="REMOVE"){
		if (! window.confirm('現在のデータを削除します。\nよろしいですか？')){
			return false;
		}
	}
	else if (mode=="INSERT"){
		if (! window.confirm('入力された内容でデータを新規登録します。\nよろしいですか？')){
			return false;
		}
	}
	form.submit();
}



function goAdminAddPage(){
	if (! window.confirm('現在入力中のデータは破棄されますが\nよろしいですか？')){
		return false;
	}
	var form =document.forms["MAINFORM"];
	form.mode.value="ADD";
	form.page.value="";
	form.method="POST";
	form.submit();
}


/*リセットボタン用 コンボ名*/
function resetCombobox(cmbn){
	var form =document.forms["MAINFORM"];
	form[cmbn].selectedIndex = 0;
}
/*リセットボタン用 テキスト名*/
function resetTextbox(txtn){
	var form =document.forms["MAINFORM"];
	form[txtn].value = "";
}

/* 20070711 ADD */
function change(){
 if(document.all){
 if (document.all("list01") != null) document.all("list01").style.display="none";
 if (document.all("list02") != null) document.all("list02").style.display="none";
 if (document.all("list03") != null) document.all("list03").style.display="none";
 if (document.all("list04") != null) document.all("list04").style.display="none";
 if (document.all("list05") != null) document.all("list05").style.display="none";
 if (document.all("list06") != null) document.all("list06").style.display="none";
 if (document.all("list07") != null) document.all("list07").style.display="none";
 if (document.all("list08") != null) document.all("list08").style.display="none";
 if (document.all("list09") != null) document.all("list09").style.display="none";
 if (document.all("list10") != null) document.all("list10").style.display="none";
 if (document.all("list11") != null) document.all("list11").style.display="none";
 make="document.all(listid).style";
 }
 else if(document.getElementById){
 if (document.getElementById("list01") != null) document.getElementById("list01").style.display="none";
 if (document.getElementById("list02") != null) document.getElementById("list02").style.display="none";
 if (document.getElementById("list03") != null) document.getElementById("list03").style.display="none";
 if (document.getElementById("list04") != null) document.getElementById("list04").style.display="none";
 if (document.getElementById("list05") != null) document.getElementById("list05").style.display="none";
 if (document.getElementById("list06") != null) document.getElementById("list06").style.display="none";
 if (document.getElementById("list07") != null) document.getElementById("list07").style.display="none";
 if (document.getElementById("list08") != null) document.getElementById("list08").style.display="none";
 if (document.getElementById("list09") != null) document.getElementById("list09").style.display="none";
 if (document.getElementById("list10") != null) document.getElementById("list10").style.display="none";
 if (document.getElementById("list11") != null) document.getElementById("list11").style.display="none";
 make="document.getElementById(listid).style";
 }
 else if(document.layers){
 if (document.layers["list01"] != null) document.layers["list01"].display=none;
 if (document.layers["list02"] != null) document.layers["list02"].display=none;
 if (document.layers["list03"] != null) document.layers["list03"].display=none;
 if (document.layers["list04"] != null) document.layers["list04"].display=none;
 if (document.layers["list05"] != null) document.layers["list05"].display=none;
 if (document.layers["list06"] != null) document.layers["list06"].display=none;
 if (document.layers["list07"] != null) document.layers["list07"].display=none;
 if (document.layers["list08"] != null) document.layers["list08"].display=none;
 if (document.layers["list09"] != null) document.layers["list09"].display=none;
 if (document.layers["list10"] != null) document.layers["list10"].display=none;
 if (document.layers["list11"] != null) document.layers["list11"].display=none;
 make="document.layers[listid]";
 }
}

 var crm="list01";
 imagename = new Array ('btn_side_store_','btn_side_news_','btn_side_schedule_','btn_side_cast_','btn_side_display_','btn_side_only_','btn_side_master_','btn_side_portal');;
 layername = new Array ('list01','list02','list03','list04','list05','list06','list07','list08','list09','list10','list11');;

function changemenu(listid){

 if ( crm !== listid){
 change();
 eval(make).display="block";
 crm=listid;
 }
 else{
 crm="make";
 change();
 }
/*
 for(i=0;i<7;i++) {
 if(document.all(layername[i]).style.display=="none")
 document.all.menu[i].src="./image/"+imagename[i] +"n.png";
 else
 document.all.menu[i].src="./image/"+imagename[i] +"o.png";
 }
*/
}
/*ADD END*/


/*ADD 20070712*/
//--------------------------------------------------------
//店舗ニュース詳細の表示
//--------------------------------------------------------
function showStoreNewsDetail(store_id){
	var fName="index.php?action_store_newsdetail=true&store_id="+store_id;
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=420,height=600";
	w=window.open(fName,"",sStr);
}/*ADD 20070712*/
//--------------------------------------------------------
//店舗ニュース詳細の表示
//--------------------------------------------------------
function showStoreNewsDetail2(store_id,news_id){
	var fName="http://gen-g.jp/bin-one/index.php?action_store_newsdetail=true&store_id="+store_id+"&news_id="+news_id+"#news"+news_id;
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=420,height=600";
	w=window.open(fName,"",sStr);
}
function showStoreNewsDetail4(store_id,news_id){
	var fName="http://gen-g.jp/puyo2/index.php?action_store_newsdetail=true&store_id="+store_id+"&news_id="+news_id+"#news"+news_id;
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=420,height=600";
	w=window.open(fName,"",sStr);
}
//--------------------------------------------------------
//ポータルニュース詳細の表示
//--------------------------------------------------------
function showPortalNewsDetail(){
	var fName="index.php?action_portal_newsdetail=true";
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=420,height=600";
	w=window.open(fName,"",sStr);
}

//--------------------------------------------------------
//ポータルイベント詳細の表示
//--------------------------------------------------------
function showPortalPop(store_dir,filename){
	var fName=store_dir+filename;
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=630,height=660";
	w=window.open(fName,"",sStr);
}

//--------------------------------------------------------
//ポータルイベント詳細の表示
//--------------------------------------------------------
function showPortalEventDetail(store_dir){
	var fName=store_dir+"index.php?action_portal_event=true";
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=397,height=500";
	w=window.open(fName,"",sStr);
}

//--------------------------------------------------------
//ポータルイベント詳細の表示
//--------------------------------------------------------
function showPortalEventDetail_st(){
	var fName="index.php?action_portal_event=true";
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=490,height=500";
	w=window.open(fName,"",sStr);
}
//--------------------------------------------------------
//店舗イベント詳細の表示
//--------------------------------------------------------
function showStoreEventDetail(store_dir){
	var fName=store_dir+"index.php?action_store_event=true";
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=397,height=500";
	w=window.open(fName,"",sStr);
}


//--------------------------------------------------------
//ポータルイベント詳細の表示
//--------------------------------------------------------
function showTopinfoPop(filename){
	var fName=filename;
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=630,height=660";
	w=window.open(fName,"",sStr);
}
//--------------------------------------------------------
//新着情報過去履歴の表示
//--------------------------------------------------------
function showAdminNewsDetail(store_id,news_type){
	if (news_type=='portal1'){
		var fName="index.php?action_admin_news_detail2portal1=true&store_id="+store_id;
	}
	if (news_type=='portal2'){
		var fName="index.php?action_admin_news_detail2portal2=true&store_id="+store_id;
	}
	if (news_type=='store1'){
		var fName="index.php?action_admin_news_detail2store1=true&store_id="+store_id;
	}
	if (news_type=='store2'){
		var fName="index.php?action_admin_news_detail2store2=true&store_id="+store_id;
	}
	
	
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=900,height=600";
	w=window.open(fName,"newsdetail",sStr);
}


//--------------------------------------------------------
//出勤表：次週へ適用
//--------------------------------------------------------

function copyNextSchedule(forcnt){
	var form =document.forms["MAINFORM"];
	
	for (i=0; i<forcnt; i++) {
	
		form.elements["next_week_start_time[]"][i].selectedIndex = form.elements["basic_start_time[]"][i].selectedIndex;
		form.elements["next_week_end_time[]"][i].selectedIndex = form.elements["basic_end_time[]"][i].selectedIndex;
	}
	
}

//--------------------------------------------------------
//クリックで画像切り替え
//--------------------------------------------------------
function changeImage(image_name,image_src,image_dir){
	
	var dispimage = new Image(); 
	dispimage.src = image_dir + image_src;

	document.images[image_name].src = dispimage.src;
}
 

//--------------------------------------------------------
//グラビア詳細の表示
//--------------------------------------------------------
function showGravureDetail(gravure_id,mode,store_dir){
	if (mode=="store"){
		var fName=store_dir+"index.php?action_store_gravuredetail=true&gravure_id="+gravure_id;
	} else {
		var fName=store_dir+"index.php?action_portal_gravuredetail=true&gravure_id="+gravure_id;
	}
	var sStr="scrollbars=yes,resizable=yes,status=yes,menubar=no,width=500,height=550";
	w=window.open(fName,"",sStr);
}

//--------------------------------------------------------
//Ｆｌａｓｈに反映ボタン押下
//--------------------------------------------------------
function flashClick(id,mode){
	if (! window.confirm('現在の情報をＦｌａｓｈに反映します。\nよろしいですか？')){
		return false;
	}
	var form =document.forms["MAINFORM"];
	form.cast_id.value=id;
	form.mode.value=mode;
	form.page.value="";
	form.method="POST";
	form.submit();
}

function showOpener(str1){
	window.opener.focus();
	window.opener.location.href = "index.php?action_store_"+str1+"=true";
}



function changeAlphaImage(id,cnt) {
	for (i=1;i <= cnt;i++){
		var obj = findElement(id+i);  
		if(obj.runtimeStyle){  
			var image = obj.src;   
			obj.src = "./image/spacer.gif";  
			obj.runtimeStyle.filter =   
			'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+ image + '", sizingmethod="image");';  
		}
	}
}
function findElement(n) {  
	return document.all ? document.all(n) : document.getElementById(n);  
}

//--------------------------------------------------------
//管理画面でのレコード修正
//--------------------------------------------------------
function maintenanceClick(id,mode){
	var form =document.forms["MAINFORM"];
	form.id.value=id;
	form.mode.value=mode;
	form.page.value="";
	form.method="POST";
	form.submit();
}
