function showScreen(whichOne)
{
	var info = document.getElementById("info");
	var details = document.getElementById("details");
	var rules = document.getElementById("rules");
  var ftcom = document.getElementById("ftcom");

  var infoLI = document.getElementById("infoLI");
	var detailLI = document.getElementById("detailLI");
	var rulesLI = document.getElementById("rulesLI");
	var ftcomLI = document.getElementById("ftcomLI");

	if (whichOne =='rules')
	{
		info.style.display = "none";
		details.style.display = "none";
    ftcom.style.display = "none";
		rules.style.display = "block";
    infoLI.className = "";
    detailLI.className = "";
    ftcomLI.className = "";
    rulesLI.className = "currentPage";
	}
	else if(whichOne == 'detail')
	{
		info.style.display = "none";
		rules.style.display = "none";
		ftcom.style.display = "none";
		details.style.display = "block";
    infoLI.className = "";
    detailLI.className = "currentPage";
    rulesLI.className = "";
    ftcomLI.className = "";
	}
  else if(whichOne == 'ftcom')
	{
		info.style.display = "none";
		rules.style.display = "none";
		ftcom.style.display = "block";
		details.style.display = "none";
    infoLI.className = "";
    detailLI.className = "";
    rulesLI.className = "";
    ftcomLI.className = "currentPage";
	}
	else
	{
		details.style.display = "none";
		rules.style.display = "none";	
		ftcom.style.display = "none";	
		info.style.display = "block";
    infoLI.className = "currentPage";
    detailLI.className = "";
    rulesLI.className = "";
    ftcomLI.className = "";
	}
}
function trade(conID) {
	if (null != window.opener &&  !window.opener.closed) {
    if (window.opener.changeContract != null) {
      window.opener.changeContract(conID);
      window.opener.parent.focus();
    }
	}
  else {
    var url = "/aav2/trading/tradingHTML.jsp?selConID=" + conID;
    var tradingPage = window.open(url,'tradingPage');
    tradingPage.focus();
  }
	return false;
}

function showGraph(whichOne)
{

	var first = document.getElementById("first");
	var second = document.getElementById("second");
	var third = document.getElementById("third");

	var firstLink = document.getElementById("firstLink");
	var secondLink = document.getElementById("secondLink");
	var thirdLink = document.getElementById("thirdLink");

  var graph1LI = document.getElementById("graph1LI");
  var graph2LI = document.getElementById("graph2LI");
  var graph3LI = document.getElementById("graph3LI");

	if (whichOne == 'third')
	{
    if (graph1LI != null) graph1LI.className = "tabBorder";
    if (graph2LI != null) graph2LI.className = "tabBorder";
    if (graph3LI != null) graph3LI.className = "tabBorder graphSelected";

		if (first != null) first.style.display = "none";
		if (second != null) second.style.display = "none";		
		if (third != null) third.style.display = "block";

		if (firstLink != null) firstLink.style.display = "none";
		if (secondLink != null) secondLink.style.display = "none";		
		if (thirdLink != null) thirdLink.style.display = "block";
	}
	else if(whichOne == 'second')
	{
    if (graph1LI != null) graph1LI.className = "tabBorder";
    if (graph2LI != null) graph2LI.className = "tabBorder graphSelected";
    if (graph3LI != null) graph3LI.className = "tabBorder";

		if (first != null) first.style.display = "none";		
		if (second != null) second.style.display = "block";
    if (third != null) third.style.display = "none";

		if (firstLink != null) firstLink.style.display = "none";
    if (secondLink != null) secondLink.style.display = "block";
		if (thirdLink != null) thirdLink.style.display = "none";
	}
	else
	{
    if (graph1LI != null) graph1LI.className = "tabBorder graphSelected";
    if (graph2LI != null) graph2LI.className = "tabBorder";
    if (graph3LI != null) graph3LI.className = "tabBorder";

    if (first != null) first.style.display = "block";
		if (second != null) second.style.display = "none";
		if (third != null) third.style.display = "none";		
		
    if (firstLink != null) firstLink.style.display = "block";
		if (secondLink != null) secondLink.style.display = "none";
		if (thirdLink != null) thirdLink.style.display = "none";
	}
}

function contractDetail(conID)
{
	var date = new Date();
	var z = date.getTime();
	var win = '/aav2/trading/contractInfo.jsp?conDetailID='+conID+"&z="+z;
	window.location.href = win;
}
// Add an eventListener to browsers that can do it somehow.
// Originally by the amazing Scott Andrew.
function addEventLstnr(obj, evType, fn){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
  } else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
	return false;
  }
}
function addToPortfolio(pfID, conID)
{
	var url = "/aav2/portfolio/portfoliomanage.jsp?add=true&portfolio="+pfID+"&ContractID="+conID;
	var windowOptions = "width=700,height=400,top=100,left=100,resizable=yes,scrolling=auto,status=no";

	var portResults = window.open(url,'portResults',windowOptions);
	portResults.focus();
}

function showInfo(what) {
  var url = "/aav2/rulesAndFaqs.jsp?helpPage=fullGlossary#" + what;
  var glossaryWnd = window.open(url,'glossary');
  glossaryWnd.focus();
}
