function newpage(p){
	window.document.form.searchagainflag.value="0";
	window.document.form.compareflag.value="0";
	window.document.form.target="";
	window.document.form.page.value=p;
	window.document.form.nextFirstNum.value=0;
	window.document.form.submit();
}

function sortchanged(){
	window.document.form.searchagainflag.value="0";
	window.document.form.compareflag.value="0";
	window.document.form.target="";
	window.document.form.nextFirstNum.value=1;
	window.document.form.page.value=1;
	window.document.form.submit();
}

function viewcountchanged(n){
	window.document.form.searchagainflag.value="0";
	window.document.form.compareflag.value="0";
	window.document.form.target="";
	window.document.form.nextFirstNum.value=n;
	window.document.form.page.value=0;
	window.document.form.submit();
}

function chk_hids(){
	if(window.document.form.hidcheckbox.length == undefined){
		if(window.document.form.hidcheckbox.checked){
			return true;
		}
		else{
			return false;
		}
	}
	for(id=0; id<window.document.form.hidcheckbox.length; id++){
		if(window.document.form.hidcheckbox[id].checked) {
			return true;
		}
	}
	return false;
}

function chk_arrays(){
	for(id=0; id<window.document.form.arraycheck.length; id++){
		if(window.document.form.arraycheck[id].checked) {
			return true;
		}
	}
	alert("Please check at least one of arrays.");
	return false;
}

function compare(){
	if(!chk_hids()){
	    alert("Please check at least one of cell records.");
		return;
	}
	if(!chk_arrays()){
		return;
	}
	var now = new Date();
	var uniqname = "at_" + now.getFullYear() + "_" +
		(now.getMonth() + 1) + "_" + now.getDate() + "_" + 
		now.getHours() + "_" + now.getMinutes() + "_" + 
		now.getSeconds();
	window.open("about:blank", uniqname, 
		"width=1000,height=650," +
		"resizable=yes,menubar=yes,scrollbars=yes");
	window.document.form.searchagainflag.value="0";
	window.document.form.compareflag.value="1";
	window.document.form.target=uniqname;
	window.document.form.submit();
}

function summary(){
	window.document.form.searchagainflag.value="0";
	window.document.form.compareflag.value="0";
	window.document.form.target="";
	window.document.form.submit();
}

function arrayChanged(){
	window.document.form.page.value="";
	window.document.form.nextFirstNum.value="";
	summary();
}

function chromSelected(c){
	window.document.form.chrom.value=c;
	window.document.form.gain.value="";
	window.document.form.page.value="";
	window.document.form.nextFirstNum.value="";
	summary();
}

function gainSelected(g, c){
	window.document.form.gain.value=g;
	window.document.form.chrom.value=c;
	window.document.form.page.value="";
	window.document.form.nextFirstNum.value="";
	summary();
}

function diagChanged(){
	window.document.form.fromresult.value="";
	window.document.form.diagnosis.value=window.document.form.diagnosisSelected.value;
	summary();
}

function resetSummary(){
	window.document.form.fromresult.value="";
	summary();
}

function check_ctl(f, flag){
	for(i = 0; i < f.elements.length; i++){
		var name = f.elements[i].name;
		if(f.elements[i].type == 'checkbox' && name.match('hidcheckbox')){
			f.elements[i].checked = flag;
		}
	}
}

function searchAgain(){
	window.document.form.searchagainflag.value="1";
	window.document.form.compareflag.value="0";
	window.document.form.target="";
	window.document.form.submit();
}

