







///////////////////////////////////
//
// sequence.html

function hilightGenes( geneIDs ) {
	for(i in geneIDs) {
		elt = document.getElementById( geneIDs[i] );
		elt.style.border = "2px outset rgb(0,0,0)";
	}
}

function unHilightGenes( geneIDs ) {
	for(i in geneIDs) {
		elt = document.getElementById( geneIDs[i] );
		elt.style.border = "none";
	}
}

function hideAllSequence() {
	geneIDs = new Array("FpNCR", "oneA", "oneB","oneC","oneD","twoA","twoB","twoC","threeA","threeB","threeC","threeD","TpNCR", "Coding", "Genome");
	serotypes = new Array();
	ssOptions = document.getElementById("serotypeSelector").options;
	for(i in ssOptions) {
		if( ssOptions[i].text ) {
			serotypes.push( ssOptions[i].text );
		}
	}

	for(i in geneIDs) {
		for(j in serotypes) {
			if( j != "undefined" ) {
				seqID = serotypes[j] + geneIDs[i];
				seq = document.getElementById( seqID );
				if(seq) {
					seq.style.visibility = "hidden";
					seq.style.height = "0px";
					seq.style.position = "absolute";
					seq.style.top = "1000";
					seq.style.left = "1000";
					seq.style.margin = "0px 0px 0px 0px";
				}
			}
		}
	}
}


function selectGene( geneID ) {

	hideAllSequence();

	serotypes = new Array();
	seroSelector = document.getElementById("serotypeSelector");
	for(i in seroSelector.options) {
		if(seroSelector.options[i].selected) {
			serotypes.push( seroSelector.options[i].text );
		}
	}
	
	for(i in serotypes) {
		sequenceID = serotypes[i] + geneID;
		seq = document.getElementById( sequenceID );
		if( seq ) {
			seq.style.visibility = "visible";
			seq.style.height = "auto";
			seq.style.position = "static";
			seq.style.margin = "5px 20px 0px 20px";
		}
	}
}

function selectAllSerotypes() {
	check = document.getElementById("serotypeSelectAll");
	seroSelector = document.getElementById("serotypeSelector");
	for(i in seroSelector.options) {
		if(check.checked) {
			seroSelector.options[i].selected = 1;
		}
		else {
			seroSelector.options[i].selected = 0;
		}
	}
}


/////////////////////////////////////////
//
// phylogeny.html

function selectTree( geneID ) {
	myDiv = document.getElementById("treeDisplay")
	myDiv.innerHTML = "<div class='plink'><a href='images/phylogeny/" + geneID + ".ps'>download ps version</a></div><div class='ptree'><img src='images/phylogeny/" + geneID +  ".png'></div>"
}

////////////////////////////////////////////
//
// media.html

function fillMediaBin( html ) {
	bin = document.getElementById("mediaBin");
	bin.innerHTML = html;
}

function hilightMedia( id ) {
	elt = document.getElementById( id );
	elt.style.background="#CCCCFF";
}

function unHilightMedia( id ) {
	elt = document.getElementById( id );
	elt.style.background="#FFFFFF";
}

////////////////////////////////////////////////
//
// dNdS.html

function selectdnds( geneID ) {
	results = document.getElementById("results");
	results.innerHTML = createDNDSTable("A", geneID) + createDNDSTable("B", geneID) + createDNDSTable("Both", geneID );
}

function createDNDSTable( subgroup, gene ) {
	baseLink = "dnds/"+subgroup+"/"+gene;
	rstLink = baseLink + ".rst";
	alnLink = baseLink + ".aln";
	return "<div class='dndsTable'><div class='dndsHeader'>HRV - "+subgroup+"</div><div class='dndsFooter'><a href='"+rstLink+"'>PAML .rst file</a> | <a href='"+alnLink+"'>Clustal .aln file used</a></div></div>";
}

