function change(inType, openid) {
	var list = document.getElementById(openid);
	var list_I = document.getElementById(openid + "I");
	if (list.style.display == "none") {
		list.style.display = "block";
		list_I.src = "../Image/ominus.png";
		list_I.alt = "close";
	} else {
		list.style.display = "none";
		list_I.src = "../Image/plus.png";
		list_I.alt = "open";
	}
}

function changeList(inType, openid) {
	var list;
	if (inType == "Toxin" || inType == "SpecToxinID" || inType == "Channel" || inType == "SpecChannelID")
		list = document
				.getElementById(openid.substr(openid, openid.length - 1));
	else
		list = document
				.getElementById(openid.substr(openid, openid.length - 2));
	var list_I = document.getElementById(openid);
	if (list.style.display == "none") {
		list.style.display = "block";
		list_I.src = "../Image/ominus.png";
		list_I.alt = "close";
	} else {
		list.style.display = "none";
		list_I.src = "../Image/plus.png";
		list_I.alt = "open";
	}
}

function getSpecList(inType, openid, getobj) {
	var get_S = document.getElementById("Selected")

	if (get_S != null) {
		get_S.id = "";
		get_S.style.color = "#993300";
	}
	getobj.id = "Selected";
	getobj.style.color = "#009900";

	var mainFrame = parent.document.getElementById("mainFrame");
	if (inType == "Toxin")
		mainFrame.src = "Species_3.jsp?Type=Toxin&Filter=SP_Toxin&QS="
			+ openid + "&Page=0&Search=No";
	if (inType == "Channel")
		mainFrame.src = "Species_3.jsp?Type=Channel&Filter=SP_Channel&QS="
				+ openid + "&Page=0&Search=No";
	//alert(mainFrame.src);
	if (inType == "SpecToxinID")
		mainFrame.src = "Species_3.jsp?Type=SpecToxinID&Filter=SpecIDAndToxinID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "SpecChannelID")
		mainFrame.src = "Species_3.jsp?Type=SpecChannelID&Filter=SpecIDAndChannelID&QS="
			+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Mechanism")
		mainFrame.src = "Mechanism_3.jsp?Type=Ontolege_Mechanism&Filter=Ontolege_Mechanism_ID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Symptom")
		mainFrame.src = "Symptom_3.jsp?Type=Ontolege_Symptom&Filter=Ontolege_Symptom_ID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Target")
		mainFrame.src = "Target_3.jsp?Type=Ontolege_Target&Filter=Ontolege_Target_ID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Molecule")
		mainFrame.src = "Molecule_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Molecule_ID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Mechanism_ToxinID")
		mainFrame.src = "Mechanism_3.jsp?Type=Mechanism&Filter=Ontolege_Mechanism_ToxinID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Symptom_ToxinID")
		mainFrame.src = "Symptom_3.jsp?Type=Symptom&Filter=Ontolege_Symptom_ToxinID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Target_ToxinID")
		mainFrame.src = "Target_3.jsp?Type=Target&Filter=Ontolege_Target_ToxinID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Molecule_ToxinID")
		mainFrame.src = "Molecule_3.jsp?Type=Molecule&Filter=Ontolege_Molecule_ToxinID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontologe_Access")
		mainFrame.src = "FunctionToOntology_3.jsp?Type=Ontologe_Access&Filter=Ontologe_Access&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Channel_Molecule")
		mainFrame.src = "Molecule_3.jsp?Type=Channel_Molecule&Filter=Channel_Molecule_ID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Homology_ChannelID")
		mainFrame.src = "Molecule_3.jsp?Type=Ontolege_Homology&Filter=Ontolege_Homology_ChannelID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Channel_Physiological")
		mainFrame.src = "Physiological_3.jsp?Type=Channel_Physiological&Filter=Channel_Physiological_ID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Ontolege_Physiological_ChannelID")
		mainFrame.src = "Physiological_3.jsp?Type=Ontolege_Physiological&Filter=Ontolege_Physiological_ChannelID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Channel_Distribution")
		mainFrame.src = "Distribution_3.jsp?Type=Channel_Distribution&Filter=Channel_Distribution_ID&QS="
				+ openid + "&Page=0&Search=No";
	//if (inType == "Channel_Distribution_ChannelID")//Ontolege_Physiological_ChannelID
	if (inType == "Ontolege_Distribution_ChannelID")
		mainFrame.src = "Distribution_3.jsp?Type=Ontolege_Distribution&Filter=Ontolege_Distribution_ChannelID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Channel_Pathophysiology")
		mainFrame.src = "Pathophysiology_3.jsp?Type=Channel_Pathophysiology&Filter=Channel_Pathophysiology_ID&QS="
				+ openid + "&Page=0&Search=No";
	//if (inType == "Channel_Pathophysiology_ChannelID")
	if (inType == "Ontolege_Pathophysiology_ChannelID")
		mainFrame.src = "Pathophysiology_3.jsp?Type=Ontolege_Pathophysiology&Filter=Ontolege_Pathophysiology_ChannelID&QS="
				+ openid + "&Page=0&Search=No";
	if (inType == "Toxin_Interaction")
	{
		mainFrame.src = "Main.jsp?Type=Toxin_Interaction&Filter=Toxin_Interaction&QS="
			+ openid + "&Page=0&Search=No";
	}
	if (inType == "Channel_Interaction")
	{
		mainFrame.src = "Main.jsp?Type=Channel_Interaction&Filter=Channel_Interaction&QS="
			+ openid + "&Page=0&Search=No";
	}
}

function Space_getSeq(inType, inQS, inPage) {
	if (inType == "Toxin")
		document.location = "Species_3.jsp?Type=" + inType + "&Filter=SP_Toxin&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Channel")
		document.location = "Species_3.jsp?Type=" + inType + "&Filter=SP_Channel&QS="
			+ inQS + "&Page=" + inPage + "&Search=Yes";
	//alert(document.location);
	if (inType == "SpecToxinID")
		document.location = "Species_3.jsp?Type=SpecToxinID&Filter=SpecIDAndToxinID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "SpecChannelID")
		document.location = "Species_3.jsp?Type=SpecChannelID&Filter=SpecIDAndChannelID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Mechanism_ID")
		document.location = "Mechanism_3.jsp?Type=Ontolege_Mechanism&Filter=Ontolege_Mechanism_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Symptom_ID")
		document.location = "Symptom_3.jsp?Type=Ontolege_Symptom&Filter=Ontolege_Symptom_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Target_ID")
		document.location = "Target_3.jsp?Type=Ontolege_Target&Filter=Ontolege_Target_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Molecule_ID")
		document.location = "Molecule_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Molecule_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Mechanism_ToxinID")
		document.location = "Mechanism_3.jsp?Type=Ontolege_Mechanism&Filter=Ontolege_Mechanism_ToxinID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Symptom_ToxinID")
		document.location = "Symptom_3.jsp?Type=Ontolege_Symptom&Filter=Ontolege_Symptom_ToxinID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Target_ToxinID")
		document.location = "Target_3.jsp?Type=Ontolege_Target&Filter=Ontolege_Target_ToxinID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Molecule_ToxinID")
		document.location = "Molecule_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Molecule_ToxinID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "SingleProtein") {
		// alert("hqyone");
		parent.document.location = "../Browse/SingleProtein.jsp?Type=" + inType
				+ "&Filter=ToxinID&QS=" + inQS + "&Page=" + inPage;
	}
	if (inType == "Ontologe_Access") {
		document.location = "FunctionToOntology_3.jsp?Type=Ontologe_Access&Filter=Ontologe_Access&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	}
	// Add 2008-11-12 HQZ
	if (inType == "Channel_Molecule_ID")
		document.location = "Molecule_3.jsp?Type=Channel_Molecule&Filter=Channel_Molecule_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	//Add 2008-11-13 HQZ
	if (inType == "Channel_Physiological_ID")
		document.location = "Physiological_3.jsp?Type=Channel_Physiological&Filter=Channel_Physiological_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Channel_Distribution_ID")
		document.location = "Distribution_3.jsp?Type=Channel_Distribution&Filter=Channel_Distribution_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Channel_Pathophysiology_ID")
		document.location = "Pathophysiology_3.jsp?Type=Channel_Pathophysiology&Filter=Channel_Pathophysiology_ID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	// Add 2009-1-6
	if (inType == "Ontolege_Homology_ChannelID")
		document.location = "Molecule_3.jsp?Type=Channel_Molecule&Filter=Ontolege_Homology_ChannelID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Physiological_ChannelID")
		document.location = "Physiological_3.jsp?Type=Channel_Physiological&Filter=Ontolege_Physiological_ChannelID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Distribution_ChannelID")
		document.location = "Distribution_3.jsp?Type=Channel_Distribution&Filter=Ontolege_Distribution_ChannelID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Ontolege_Pathophysiology_ChannelID")
		document.location = "Pathophysiology_3.jsp?Type=Channel_Pathophysiology&Filter=Ontolege_Pathophysiology_ChannelID&QS="
				+ inQS + "&Page=" + inPage + "&Search=Yes";
	if (inType == "Toxin_Interaction")
		document.location = "Main.jsp?Type=Toxin_Interaction&Filter=Toxin_Interaction&QS="
			+ inQS + "&Page=" + inPage +"&Search=Yes";
	if (inType == "Channel_Interaction")
	{
		document.location = "Main.jsp?Type=Channel_Interaction&Filter=Channel_Interaction&QS="
			+ inQS + "&Page=" + inPage + "&Search=Yes";
	}
	
}

function setIFrameSrc(inType) {
	var getSearch = document.location.search;
	var leftFrame = document.getElementById("leftFrame");
	var mainFrame = document.getElementById("mainFrame");

	if (inType == "Species") {
		getSearch = getSearch.substr(1, getSearch.length);
		var t = getSearch.split("&");
		if (t[0] == "Type=Toxin") {
			leftFrame.src = "Species_2.jsp?" + t[0] + "&QS=1.&Compress=Yes";
			mainFrame.src = "Species_3.jsp?" + t[0] + "&Filter=SP_Toxin&QS=1.&Page=0&Search=No";
		}
		if (t[0] == "Type=Channel") {
			leftFrame.src = "Species_2.jsp?" + t[0] + "&QS=1.&Compress=Yes";
			mainFrame.src = "Species_3.jsp?" + t[0] + "&Filter=SP_Channel&QS=1.&Page=0&Search=No";
		}
		if (t[1] == "Filter=SpecIDAndToxinID") {
			leftFrame.src = "Species_2.jsp?Type=SpecToxinID&" + t[2]
						+ "&Compress=Yes";
				mainFrame.src = "Species_3.jsp?" + getSearch + "&InitPage=Yes";
		}
		if (t[1] == "Filter=SpecIDAndChannelID") {
			leftFrame.src = "Species_2.jsp?Type=SpecChannelID&" + t[2]
						+ "&Compress=Yes";
				mainFrame.src = "Species_3.jsp?" + getSearch + "&InitPage=Yes";
		}
			
		/*if (getSearch.length < 1) {
			leftFrame.src = "Species_2.jsp?Type=Spec&QS=1.&Compress=Yes";
			mainFrame.src = "Species_3.jsp?Type=Spec&Filter=Spec_ID&QS=1.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=SpecIDAndToxinID") > 0) {
				leftFrame.src = "Species_2.jsp?Type=SpecIDAndToxinID&" + t[2]
						+ "&Compress=Yes";
				mainFrame.src = "Species_3.jsp?" + getSearch + "&InitPage=No";
			}
		}*/
	}
	if (inType == "Molecule") {
		if (getSearch.length < 1) {
			leftFrame.src = "Molecule_2.jsp?Type=Ontolege_Molecule&QS=1.1.&Compress=Yes";
			mainFrame.src = "Molecule_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Molecule_ID&QS=1.1.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Molecule_ToxinID") > 0) {
				leftFrame.src = "Molecule_2.jsp?Type=Ontolege_Molecule_ToxinID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Molecule_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Molecule_ToxinID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}

	if (inType == "Symptom") {
		if (getSearch.length < 1) {
			leftFrame.src = "Symptom_2.jsp?Type=Ontolege_Symptom&QS=1.4.&Compress=Yes";
			mainFrame.src = "Symptom_3.jsp?Type=Ontolege_Symptom&Filter=Ontolege_Symptom_ID&QS=1.4.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Symptom_ToxinID") > 0) {
				leftFrame.src = "Symptom_2.jsp?Type=Ontolege_Symptom_ToxinID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Symptom_3.jsp?Type=Ontolege_Symptom&Filter=Ontolege_Symptom_ToxinID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Target") {
		if (getSearch.length < 1) {
			leftFrame.src = "Target_2.jsp?Type=Ontolege_Target&QS=1.2.&Compress=Yes";
			mainFrame.src = "Target_3.jsp?Type=Ontolege_Target&Filter=Ontolege_Target_ID&QS=1.2.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Target_ToxinID") > 0) {
				leftFrame.src = "Target_2.jsp?Type=Ontolege_Target_ToxinID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Target_3.jsp?Type=Ontolege_Target&Filter=Ontolege_Target_ToxinID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Mechanism") {
		if (getSearch.length < 1) {
			leftFrame.src = "Mechanism_2.jsp?Type=Ontolege_Mechanism&QS=1.3.&Compress=Yes";
			mainFrame.src = "Mechanism_3.jsp?Type=Ontolege_Mechanism&Filter=Ontolege_Mechanism_ID&QS=1.3.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Mechanism_ToxinID") > 0) {
				leftFrame.src = "Mechanism_2.jsp?Type=Ontolege_Mechanism_ToxinID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Mechanism_3.jsp?Type=Ontolege_Mechanism&Filter=Ontolege_Mechanism_ToxinID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Ontologe_Access") {
		var t = getSearch.split("&");
		leftFrame.src = "FunctionToOntology_2.jsp?Type=Ontologe_Access&" + t[1] + "&"+ t[3]
				+ "&Compress=Yes";
	}

	if (inType == "Channel_Molecule") {
		if (getSearch.length < 1) {
			leftFrame.src = "Molecule_2.jsp?Type=Channel_Molecule&QS=2.6.&Compress=Yes";
			mainFrame.src = "Molecule_3.jsp?Type=Channel_Molecule&Filter=Channel_Molecule_ID&QS=2.6.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Homology_ChannelID") > 0) {
				leftFrame.src = "Molecule_2.jsp?Type=Ontolege_Homology_ChannelID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Molecule_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Homology_ChannelID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Channel_Physiological") {
		if (getSearch.length < 1) {
			leftFrame.src = "Physiological_2.jsp?Type=Channel_Physiological&QS=2.3.&Compress=Yes";
			mainFrame.src = "Physiological_3.jsp?Type=Channel_Physiological&Filter=Channel_Physiological_ID&QS=2.3.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Physiological_ChannelID") > 0) {
				leftFrame.src = "Physiological_2.jsp?Type=Ontolege_Physiological_ChannelID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Physiological_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Physiological_ChannelID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Channel_Distribution") {
		if (getSearch.length < 1) {
			leftFrame.src = "Distribution_2.jsp?Type=Channel_Distribution&QS=2.5.&Compress=Yes";
			mainFrame.src = "Distribution_3.jsp?Type=Channel_Distribution&Filter=Channel_Distribution_ID&QS=2.5.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Distribution_ChannelID") > 0) {
				leftFrame.src = "Distribution_2.jsp?Type=Ontolege_Distribution_ChannelID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Distribution_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Distribution_ChannelID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Channel_Pathophysiology") {
		if (getSearch.length < 1) {
			leftFrame.src = "Pathophysiology_2.jsp?Type=Channel_Pathophysiology&QS=2.4.&Compress=Yes";
			mainFrame.src = "Pathophysiology_3.jsp?Type=Channel_Pathophysiology&Filter=Channel_Pathophysiology_ID&QS=2.4.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Pathophysiology_ChannelID") > 0) {
				leftFrame.src = "Pathophysiology_2.jsp?Type=Ontolege_Pathophysiology_ChannelID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Pathophysiology_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Pathophysiology_ChannelID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Toxin_Interaction") {
		if (getSearch.length < 1) {
			leftFrame.src = "Tree.jsp?Type=Toxin_Interaction&QS=1.1.1.&Compress=Yes";
			mainFrame.src = "Main.jsp?Type=Toxin_Interaction&Filter=Toxin_Interaction&QS=1.1.1.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Pathophysiology_ChannelID") > 0) {
				leftFrame.src = "Pathophysiology_2.jsp?Type=Ontolege_Pathophysiology_ChannelID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Pathophysiology_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Pathophysiology_ChannelID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	if (inType == "Channel_Interaction") {
		if (getSearch.length < 1) {
			leftFrame.src = "Tree.jsp?Type=Channel_Interaction&QS=2.6.&Compress=Yes";
			mainFrame.src = "Main.jsp?Type=Channel_Interaction&Filter=Channel_Interaction&QS=2.6.&Page=0&Search=No";
		} else {
			getSearch = getSearch.substr(1, getSearch.length);
			var t = getSearch.split("&");
			if (t[1].indexOf("=Ontolege_Pathophysiology_ChannelID") > 0) {
				leftFrame.src = "Pathophysiology_2.jsp?Type=Ontolege_Pathophysiology_ChannelID&"
						+ t[2] + "&Compress=Yes";
				mainFrame.src = "Pathophysiology_3.jsp?Type=Ontolege_Molecule&Filter=Ontolege_Pathophysiology_ChannelID&"
						+ t[2] + "&Page=0&Search=No&InitPage=No";
			}
		}
	}
	
}

function S_Result_ShowAll(a) {
	for (i = 0; i < a; i++) {
		document.getElementById("TR_" + i).style.display = "";
	}
}

function S_Result_Filter(a) {

	for (i = 0; i < a; i++) {
		if (get_check = document.getElementById("checkbox_" + i).checked == false) {

			document.getElementById("TR_" + i).style.display = "none";
		}
	}
}
function S_Result_SelectAll(a) {
	for (i = 0; i < a; i++) {
		if (document.getElementById("TR_" + i).style.display != "none")
			document.getElementById("checkbox_" + i).checked = true;
		// document.getElementById("checkbox_"+i).checked =true;
	}
}
// if (document.getElementById("TR_"+i).style.display =="compact")
function myfrist(a) {
	// alert("first"+a);
	document.getElementById("NumberIndex").value = 1;
	// alert("first"+ 2);
	showEntries(a);
}

function myprevious(a) {

	var low = document.getElementById("NumberIndex").value;
	// alert("previous"+low);
	if (low > 1) {
		document.getElementById("NumberIndex").value = low - 1;
		showEntries(a);
	}
}

function mynext(a) {
	var over = document.getElementById("NumberIndex").value;
	// alert("next"+over);
	if (over * 100 < a) {
		document.getElementById("NumberIndex").value = Math.round(over) + 1;
		showEntries(a);
	}
}
function printrangle(begin, end) {
	document.getElementById("rangle").value = begin + "-" + end;
}

function mylast(a) {

	var cur = document.getElementById("NumberIndex").value = (Math
			.round((a - 1) / 100)) + 1;
	// alert("last"+cur);
	showEntries(a);
}

function showEntries(a) {
	// alert("show");
	var indexnum = document.getElementById("NumberIndex").value;
	var over = Math.min((indexnum) * 100, a);
	var low = Math.min((indexnum - 1) * 100, a);

	var curLow = Math.round(document.getElementById("Low").value);
	var curOver = Math.round(document.getElementById("Over").value);
	// alert("show "+low+"-"+over+"-"+curLow+"-"+curOver);
	if (over != curOver) {
		// alert("show "+low+"-"+over+"-"+curLow+"-"+curOver);
		for (k = low; k < over; k++) {
			document.getElementById("TR_" + k).style.display = "block";
		}
		for (i = curLow; i < curOver; i++) {
			document.getElementById("TR_" + i).style.display = "none";
		}
		document.getElementById("Low").value = low;
		document.getElementById("Over").value = over;
	}
	if (low == "undefined") {
		printrangle(1, 100);
	} else {
		printrangle(low + 1, over);
	}
}

function S_Result_Clear_Filter(a) {
	for (i = 0; i < a; i++) {
		document.getElementById("TR_" + i).style.display = "";
		// document.getElementById("checkbox_"+i).checked = false;
	}
}
// Envoke the "ExcelWriter" sevlet to create a excel file for downloading.
function excelout(a) {
	if (a == 0) {
		alert("No entry is selected! Please push \"get Sequences\" button firstly.");
		return;
	}
	var SelectStr = "";
	// var n=0;
	for (i = 0; i < a; i++) {
		if (document.getElementById("checkbox_" + i).checked == true)
			SelectStr = SelectStr + i + ",";
		// n++;
	}
	// alert(n);
	if (SelectStr == "") {
		alert("No entry is  selected!  All entries  will be downloaded.");
	}
	document.location = "../ExcelWriter?Filter=" + SelectStr;
}

// Envoke the "FastaWriter" sevlet to create a excel file for downloading.
function fastaout(a) {
	if (a == 0) {
		alert("No entry is selected! Please push \"get Sequences\" button firstly.");
		return;
	}
	var SelectStr = "";
	// var n=0;
	for (i = 0; i < a; i++) {
		if (document.getElementById("checkbox_" + i).checked == true)
			SelectStr = SelectStr + i + ",";
		// n++;
	}
	// alert(n);
	if (SelectStr == "") {
		alert("No entry is  selected!  All entries  will be downloaded.");
	}
	document.location = "../FastaWriter?Filter=" + SelectStr;
}

function fastaoutN()
{
	//if (a == 0) {
		//alert("No entry is selected! Please push \"get Sequences\" button firstly.");
		//return;
	//}
	//var SelectStr = "";
	// var n=0;
	//for (i = 0; i < a; i++) {
		//if (document.getElementById("checkbox_" + i).checked == true)
			//SelectStr = SelectStr + i + ",";
		// n++;
	//}
	// alert(n);
	//if (SelectStr == "") {
		//alert("No entry is  selected!  All entries  will be downloaded.");
	//}
	document.location = "../FastaWriterN";//Filter=" + SelectStr;
}
// Envoke the "ExcelWriter" sevlet to create a excel file for downloading.
function selectout(a) {
	var SelectStr = "";
	var nr_num = 0;
	for (i = 0; i < a; i++) {

		if (document.getElementById("checkbox_" + i).checked == true) {
			var curid = document.getElementById("SLink_" + i).title;
			curid = curid.replace("AT000", "X");
			if (SelectStr.toLowerCase().indexOf(curid.toLowerCase()) == -1) {
				SelectStr = SelectStr + curid + ",";
				// alert(curid+"");
				nr_num++;
				if (nr_num >= 300)
					break;
			}
		}
	}
	if (SelectStr == "") {
		alert("No entry is  selected!  All entries  will be downloaded.");
	} else {
		alert("There are " + nr_num + " non redundent toxin are selected!");
		document.location = "../SetAddress?Type=Sample_Search&Filter=ATIDs&QS="
				+ SelectStr;
	}
}

function getSelectNum(a) {
	var selnum = 0;
	for (i = 0; i < a; i++) {
		if (document.getElementById("checkbox_" + i).checked == true) {
			selnum++;
		}
	}
	return selnum;
}

function filterout(a) {
	var nameStr = document.getElementById("Name_TF").value; // Name_TF
	nameStr.replace(/[^\s,\s$]/gi, "");

	var speciesStr = document.getElementById("Speices_TF").value; // Speices_TF
	speciesStr.replace(/[^\s,\s$]/gi, "");
	var excute = false;
	if (a <= 0) {
		alert("No entry found!\nPlease push \"get Sequences\" button firstly.");
		return;
	} else if (a > 0 && a <= 1000) {
		excute = true;
	} else if (a > 1000 && a < 2000) {
		excute = confirm("The number of entries is great than 1000 \nThe javascript script will respond slowly.\n Are you sure to continue?");
	} else {
		alert("The entry list is too large (>=2000), the process is not permitted.")
		excute = false;
		return;
	}
	if (nameStr == "") {
		if (speciesStr == "") {
			alert("Please input keywords!");
			return;
		}
	}
	if (excute) {

		// var selnum=getSelectNum(a);
		// if(selnum==0)
		// {
		// alert("No entry are selected, all will selected automatically!");
		// S_Result_SelectAll(a);
		// }
		var hitnum = 0;
		for (i = 0; i < a; i++) {
			var name = document.getElementById("NameLink_" + i).title;
			var specise = document.getElementById("SpeciesLink_" + i).title;
			var namepass = 0;
			var specisepass = 0;
			// alert(specise);
			// if (document.getElementById("TR_"+i).style.display !="none")
			// {
			if (document.getElementById("Like_rb").checked == true) // like
			{

				if (nameStr != "") {
					if (name.toLowerCase().indexOf(nameStr.toLowerCase()) != -1) {
						namepass = 1;
					}
				} else {
					namepass = 1;
				}
				if (speciesStr != "") {
					if (specise.toLowerCase().indexOf(speciesStr.toLowerCase()) != -1) {
						specisepass = 1;
					}
				} else {
					specisepass = 1;
				}
			} else {
				if (nameStr != "") {
					if (name.toLowerCase() = nameStr.toLowerCase()) {
						namepass = 1;
					}
				} else {
					namepass = 1;
				}
				if (speciesStr != "") {
					if (specise.toLowerCase() = speciesStr.toLowerCase()) {
						specisepass = 1;
					}
				} else {
					specisepass = 1;
				}
			}
			if (namepass + specisepass == 2) {
				document.getElementById("checkbox_" + i).checked = true;
				document.getElementById("TR_" + i).style.display = "";
				hitnum++;
			} else {
				document.getElementById("checkbox_" + i).checked = false;
				document.getElementById("TR_" + i).style.display = "none";
			}
			// }
		}
		if (hitnum >= 100) {
			alert(hitnum
					+ " entrie(s) are filtered out, show the first 100 ones of them.");
		} else {
			alert(hitnum + " entrie(s) are filtered out.");
		}

	}
}

function ExpendTree(indirect) {
	var t = indirect.split(".");
	var a = t[0] + "." + t[1] + "." + t[2] + ".";

	for (i = 3; i < t.length - 2; i++) {
		a = a + t[i] + ".";
		var s = document.getElementById(a);
		s.style.display = "block";
	}

	var get_S = document.getElementById(indirect + "A")
	if (get_S != null) {
		get_S.id = "Selected";
		get_S.style.color = "#009900";
	}
	parent.document.getElementById("mainFrame").src = "FunctionToOntology_3.jsp?Type=Ontologe_Access&Filter=Ontologe_Access&QS="
			+ indirect + "&Page=0&Search=No";
	// else
	// parent.document.mainFrame.document.location =
	// "FunctionToOntology_3.jsp?Type=Ontologe_Access&Filter=Ontologe_Access&QS="+indirect+"&Page=0&Search=No"
	// ;
}