////////////////////////////
//
// for sample.cgi 
//
// LastUpdate : 2008/02/29
//
////////////////////////////

//-----------------------------------------
// set cruise infomation from baloon
//-----------------------------------------
function setDataCruise(value) {
	document.myFORM.cruise_name.value = value + ' ' + document.myFORM.cruise_name.value;
}
function setDataStation(value) {
	document.myFORM.station.value = value + ' ' + document.myFORM.station.value;
}
function setDataShip(value) {
	document.myFORM.ship_name.value = value + ' ' + document.myFORM.ship_name.value;
}
function setDataSample(value) {
	document.myFORM.sample_series_name.value = value + ' ' + document.myFORM.sample_series_name.value;
}
function setDataNet(value) {
	document.myFORM.net_type.value = value + ' ' + document.myFORM.net_type.value;
}

function setDataGene(value) {
	document.myFORM.gene_name.value = value + ' ' + document.myFORM.gene_name.value;
}

//-----------------------------------------
// clear cruise info from clear button
//-----------------------------------------
function clearTextCruise(){
	document.myFORM.cruise_name.value = "";
}
function clearTextStation(){
	document.myFORM.station.value = "";
}
function clearTextShip(){
	document.myFORM.ship_name.value = "";
}
function clearTextSample(){
	document.myFORM.sample_series_name.value = "";
}
function clearTextNet(){
	document.myFORM.net_type.value = "";
}

function clearTextGene(){
	document.myFORM.gene_name.value = "";
}

/////////////////////////////////////////////////////


//-----------------------------------------
// show and hyde AdvancedSearch for sample form page
//-----------------------------------------
function hideAdvancedSearch(id) {
//alert("hide test");
	document.getElementById(id).style.display = "none";
	document.myFORM.BUTTON1.style.display = "block";
	document.myFORM.BUTTON2.style.display = "none";
}
function showAdvancedSearch(id) {
//alert("show test");
	document.getElementById(id).style.display = "block";
	document.myFORM.BUTTON1.style.display = "none";
	document.myFORM.BUTTON2.style.display = "block";
}

//-----------------------------------------
// open cruise_info.cgi
//-----------------------------------------
function key_window_open(num) {
	var url = 'cruise_info.cgi?key=' + num;
	var WinF01=window.open(url,'WinNameF01','toolbar=0,location=0,diretories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=450,height=500');
}

//-----------------------------------------
// paint selected checkbox
//-----------------------------------------
function ChgCol(i) {
	var col;
	if(document.getElementById(i).checked){
		col = "#ffcccc";
	} else {
		col = "#ffffff";
	}
	document.getElementById("tr_"+i).style.backgroundColor = col;
}


//-----------------------------------------
// paint selected radio button
//-----------------------------------------
function ChgCol_radio(id, on) {
		if(document.getElementById(id+"_1").checked){
			document.getElementById("td_"+id+"_0").style.backgroundColor = "#ffffff";
			document.getElementById("td_"+id+"_1").style.backgroundColor = "#ffcccc";
			document.getElementById("td_"+id+"_2").style.backgroundColor = "#ffffff";

		} else if(document.getElementById(id+"_2").checked){
			document.getElementById("td_"+id+"_0").style.backgroundColor = "#ffffff";
			document.getElementById("td_"+id+"_1").style.backgroundColor = "#ffffff";
			document.getElementById("td_"+id+"_2").style.backgroundColor = "#ffcccc";

		} else {
			document.getElementById("td_"+id+"_0").style.backgroundColor = "#ffcccc";
			document.getElementById("td_"+id+"_1").style.backgroundColor = "#ffffff";
			document.getElementById("td_"+id+"_2").style.backgroundColor = "#ffffff";
		}
}

//-----------------------------------------
// set default color
//-----------------------------------------
function setDefaultColor(){
	var col = "#ffcccc";
	document.getElementById("tr_year").style.backgroundColor = col;
	document.getElementById("tr_month").style.backgroundColor = col;
	document.getElementById("tr_hour").style.backgroundColor = col;
	document.getElementById("td_mouth_opening_0").style.backgroundColor = col;
	document.getElementById("td_mesh_size_0").style.backgroundColor = col;
	document.getElementById("td_min_depth_0").style.backgroundColor = col;
	document.getElementById("td_max_depth_0").style.backgroundColor = col;
}
//function setRadioColor(){
//	var col = "#ffcccc";
//	document.getElementById("td_mouth_opening_only").style.backgroundColor = col;
//	document.getElementById("td_mesh_size_only").style.backgroundColor = col;
//	document.getElementById("td_min_depth_only").style.backgroundColor = col;
//	document.getElementById("td_max_depth_only").style.backgroundColor = col;
//}

//-----------------------------------------
// reset selected color
//-----------------------------------------
function resetSelectedColor(){
	var col = "#ffffff";
	document.getElementById("tr_year").style.backgroundColor = col;
	document.getElementById("tr_month").style.backgroundColor = col;
	document.getElementById("tr_hour").style.backgroundColor = col;

	document.getElementById("td_mouth_opening_1").style.backgroundColor = col;
	document.getElementById("td_mouth_opening_2").style.backgroundColor = col;
	document.getElementById("td_mouth_opening_0").style.backgroundColor = col;
	document.getElementById("td_mesh_size_1").style.backgroundColor = col;
	document.getElementById("td_mesh_size_2").style.backgroundColor = col;
	document.getElementById("td_mesh_size_0").style.backgroundColor = col;
	document.getElementById("td_min_depth_1").style.backgroundColor = col;
	document.getElementById("td_min_depth_2").style.backgroundColor = col;
	document.getElementById("td_min_depth_0").style.backgroundColor = col;
	document.getElementById("td_max_depth_1").style.backgroundColor = col;
	document.getElementById("td_max_depth_2").style.backgroundColor = col;
	document.getElementById("td_max_depth_0").style.backgroundColor = col;
	document.getElementById("tr_ctd").style.backgroundColor = col;

	document.getElementById("tr_fixation0").style.backgroundColor = col;
	document.getElementById("tr_fixation1").style.backgroundColor = col;
	document.getElementById("tr_tow0").style.backgroundColor = col;
	document.getElementById("tr_tow1").style.backgroundColor = col;
	document.getElementById("tr_tow2").style.backgroundColor = col;
	document.getElementById("tr_tow3").style.backgroundColor = col;
	document.getElementById("tr_sort0").style.backgroundColor = col;
	document.getElementById("tr_sort1").style.backgroundColor = col;
}


