var checkobj

//<!-- submit押ｋ"逐迷-->
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

//<!-- ハイライト表ｦ -->
var highlightcolor="lightyellow"  
  
var ns6=document.getElementById&&!document.all   
var previous=''  
var eventobj   
  
var intended=/INPUT|TEXTAREA|OPTION/   
  
function checkel(which){   
  if (which.style&&intended.test(which.tagName)){   
    if (ns6&&eventobj.nodeType==3)   
      eventobj=eventobj.parentNode.parentNode
    return true  
  }   
  else  
    return false  
}   
  
function highlight(e){   
  eventobj=ns6? e.target : event.srcElement   
  if (previous!=''){   
    if (checkel(previous))   
      previous.style.backgroundColor=''  
    previous=eventobj   
    if (checkel(eventobj) && eventobj.disabled==false && eventobj.type.toLowerCase()!="submit")
      eventobj.style.backgroundColor=highlightcolor
  }   
  else{   
    if (checkel(eventobj) && eventobj.disabled==false && eventobj.type.toLowerCase()!="submit")
      eventobj.style.backgroundColor=highlightcolor
    previous=eventobj   
  }   
}   

//メンバー登録のドロップダウンリストを取得する
function GetRegDlList( mode , year , target_nm , sel_id ){
	var univ_id = $('university').value;
	var univ_in_kbn = $('univ_in_kbn').value;
	var dprtmnt_id = '';
	if(mode=='subject'){
		dprtmnt_id = $('dprtmnt_id').value;
	}
	var bind_target = $(target_nm);		
	var url='/'+year+'/func/GetRegDlList.php?univ_id='+univ_id+'&univ_in_kbn='+univ_in_kbn+'&dprtmnt='+dprtmnt_id+'&mode='+mode+'&sel_id='+sel_id+'&year='+year;
	new Ajax.Updater({success:bind_target},
				url, {
				method: "get",
				requestHeaders:['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
				evalScripts:false,
				onFailure:function(httpObj){
					bind_target.innerHTML = '<span style="color:red">エラーで読み込めませんでした</span>';
				},
				onSuccess:function(httpObj){

				}
			}
		);
}

//メンバー登録のドロップダウンリストを取得する
function GetRegDlList_for_onload(  year , target_nm_dpt , target_nm_sub , dprtmnt_id , subject_id ){
	var univ_id = $('university').value;
	var univ_in_kbn = $('univ_in_kbn').value;

	var url='';
	var bind_target = '';
	var mode ='';
	//学部
	if(univ_id != '' && univ_in_kbn != ''){
		mode = 'dprtmnt';
		bind_target = $(target_nm_dpt);		
		var url='/'+year+'/func/GetRegDlList.php?univ_id='+univ_id+'&univ_in_kbn='+univ_in_kbn+'&mode='+mode+'&sel_id='+dprtmnt_id+'&year='+year;
		new Ajax.Updater({success:bind_target},
					url, {
					method: "get",
					requestHeaders:['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
					evalScripts:false,
					onFailure:function(httpObj){
						bind_target.innerHTML = '<span style="color:red">error</span>';
					},
					onSuccess:function(httpObj){
					}
				}
			);
	}
	
	//学科
	if(univ_id != '' && univ_in_kbn != '' && dprtmnt_id != ''){
		mode = 'subject';
		bind_target = $(target_nm_sub);		
		url='/'+year+'/func/GetRegDlList.php?univ_id='+univ_id+'&univ_in_kbn='+univ_in_kbn+'&dprtmnt='+dprtmnt_id+'&mode='+mode+'&sel_id='+subject_id+'&year='+year;
		new Ajax.Updater({success:bind_target},
					url, {
					method: "get",
					requestHeaders:['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
					evalScripts:false,
					onFailure:function(httpObj){
						bind_target.innerHTML = '<span style="color:red">error</span>';
					},
					onSuccess:function(httpObj){
					}
				}
			);
	}

}

//メンバー登録のドロップダウンリストを取得する
function GetTxtField( mode , year ,  target_nm , id , txt_val , dpt_clear , sub_clear){

	var bind_target = $(target_nm);	
	var url='/'+year+'/func/GetTxtField.php?id='+id+'&mode='+mode+'&txt_val='+txt_val;
	new Ajax.Updater({success:bind_target},
				url, {
				method: "get",
				requestHeaders:['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
				evalScripts:false,
				onFailure:function(httpObj){
					bind_target.innerHTML = '<span style="color:red">エラーで読み込めませんでした</span>';
				},
				onSuccess:function(httpObj){

				}
			}
		);

	if(dpt_clear == "1"){
		var url_1='/'+year+'/func/GetTxtField.php?id=00&mode=dprtmnt';
		var bind_target = $('dpt_txt');	
		new Ajax.Updater({success:bind_target},
					url_1, {
					method: "get",
					requestHeaders:['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
					evalScripts:false,
					onFailure:function(httpObj){
						bind_target.innerHTML = '<span style="color:red">エラーで読み込めませんでした</span>';
					},
					onSuccess:function(httpObj){
	
					}
				}
			);
	}
	if(sub_clear == "1"){
		var url_2='/'+year+'/func/GetTxtField.php?id=00&mode=subject';
		var bind_target = $('sub_txt');	
		new Ajax.Updater({success:bind_target},
					url_2, {
					method: "get",
					requestHeaders:['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
					evalScripts:false,
					onFailure:function(httpObj){
						bind_target.innerHTML = '<span style="color:red">エラーで読み込めませんでした</span>';
					},
					onSuccess:function(httpObj){
	
					}
				}
			);
	}
	
}

function disp(url){window.open(url, "window_name", "width=370,height=320,scrollbars=1,resizable=0,location=0,directories=0");}
