// JavaScript Document

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function clearSearch()
{
	document.getElementById("ts_q").className = "superscript";
	document.getElementById("ts_q").value = "";
}

// Test for occurence of strings in location href to determine what tab to have 'up'
var pagenum = 0; //1;

var qstring = self.location.search.substring(1,self.location.search.length);
var teststr = new String(self.location);

var myRegExp = /automated_trading/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 2}

var myRegExp = /strategy_testing/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 1}

var myRegExp = /optionstation/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 3}

var myRegExp = /fees/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 4}

var myRegExp = /support/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 7}

var myRegExp = /tradingroom/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 5}

var myRegExp = /aboutts/;
var strcheck = teststr.search(myRegExp);
if (strcheck != -1){pagenum = 6}




// If a query string was passed, use that instead
if (qstring !="" && qstring<=9){pagenum = qstring}

	menu1_out = new Image(); menu1_out.src="/masthead/TopMast/1LineMast/Nav1_out.gif";
	menu2_out = new Image(); menu2_out.src="/masthead/TopMast/1LineMast/Nav2_out.gif";
	menu3_out = new Image(); menu3_out.src="/masthead/TopMast/1LineMast/Nav3_out.gif";
	menu4_out = new Image(); menu4_out.src="/masthead/TopMast/1LineMast/Nav4_out.gif";
	menu7_out = new Image(); menu7_out.src="/masthead/TopMast/1LineMast/Nav7_out.gif";
	menu6_out = new Image(); menu6_out.src="/masthead/TopMast/1LineMast/Nav6_out.gif";

	menu1_over = new Image(); menu1_over.src="/masthead/TopMast/1LineMast/Nav1_over.gif";
	menu2_over = new Image(); menu2_over.src="/masthead/TopMast/1LineMast/Nav2_over.gif";
	menu3_over = new Image(); menu3_over.src="/masthead/TopMast/1LineMast/Nav3_over.gif";
	menu4_over = new Image(); menu4_over.src="/masthead/TopMast/1LineMast/Nav4_over.gif";
	menu7_over = new Image(); menu7_over.src="/masthead/TopMast/1LineMast/Nav7_over.gif";
	menu6_over = new Image(); menu6_over.src="/masthead/TopMast/1LineMast/Nav6_over.gif";


	menu1_up = new Image(); menu1_up.src="/masthead/TopMast/1LineMast/Nav1_up.gif";
	menu2_up = new Image(); menu2_up.src="/masthead/TopMast/1LineMast/Nav2_up.gif";
	menu3_up = new Image(); menu3_up.src="/masthead/TopMast/1LineMast/Nav3_up.gif";
	menu4_up = new Image(); menu4_up.src="/masthead/TopMast/1LineMast/Nav4_up.gif";
	menu7_up = new Image(); menu7_up.src="/masthead/TopMast/1LineMast/Nav7_up.gif";
	menu6_up = new Image(); menu6_up.src="/masthead/TopMast/1LineMast/Nav6_up.gif";



// OVER
function imgOn(imgName)
	{
	// If this tab is not up
	if (("menu"+pagenum)!=imgName)
		{
		document[imgName].src = eval(imgName + "_over.src");
		}
	}
            
// OUT
function imgOut(imgName)
	{
	// If this tab is not up
	if (("menu"+pagenum)!=imgName)
		{
		document[imgName].src = eval(imgName + "_out.src");
		}
	}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

	function Exit_Menu_TSWORLD(sRefer)
	{
		if (sRefer == null)
		{
			sRefer = "";
		}
		var sLink;
		sLink = new String(sRefer);
		sLink = sLink.replace("&","$38");
		var w, h;
		w = 800;
		h = 200;
		var sw = screen.width/2 - w/2;
		var sh = screen.height/2 - h/2;
		if ( sLink.length > 0 )
		{
			sLink = "https://www.tradestation.com/support/exit_TS_TSWORLD.asp?Refer=" + sLink;
		}
		else
		{
			sLink = "https://www.tradestation.com/support/exit_TS_TSWORLD.asp";
		}
		newWin=window.open(sLink,"popwin","left="+sw.toString()+",top="+sh.toString()+",width="+w.toString()+",height="+h.toString()+",status=no,location=top,toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no");
		//newWin=window.open("exit_TSSupport.asp","popwin","left="+sw.toString()+",top="+sh.toString()+",width="+w.toString()+",height="+h.toString()+",status=no,location=top,toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no");
		newWin.focus();
	}

	function Exit_Menu_TSADDONS(sRefer)
	{
		if (sRefer == null)
		{
			sRefer = "";
		}
		var sLink;
		sLink = new String(sRefer);
		sLink = sLink.replace("&","$38");
		var w, h;
		w = 800;
		h = 200;
		var sw = screen.width/2 - w/2;
		var sh = screen.height/2 - h/2;
		if ( sLink.length > 0 )
		{
			sLink = "https://www.tradestation.com/support/exit_TS_TSADDONS.asp?Refer=" + sLink;
		}
		else
		{
			sLink = "https://www.tradestation.com/support/exit_TS_TSADDONS.asp";
		}
		newWin=window.open(sLink,"popwin","left="+sw.toString()+",top="+sh.toString()+",width="+w.toString()+",height="+h.toString()+",status=no,location=top,toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no");
		//newWin=window.open("exit_TSSupport.asp","popwin","left="+sw.toString()+",top="+sh.toString()+",width="+w.toString()+",height="+h.toString()+",status=no,location=top,toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no");
		newWin.focus();
	}

function mail() {
		
		var urlLink = window.location.href;
		window.open('http://www.tradestation.com/popups/mailto_pop_errors.asp?URL=' + urlLink,'mail','width=365,height=565,menubar=no,status=no,toolbar=no,location=no,scrollbars=auto, resizable=yes');

}

function requirements() {
	window.open("http://www.tradestation.com/system_requirements/system_spec_pop.shtm","requirements","width=440,height=630,menubar=no,status=no,toolbar=no,location=no,scrollbars=yes,resizable=yes") ;
}

function faq() {
		window.open("/myaccount_net/faq_eq.aspx","faq","width=630,height=500,menubar=yes,status=no,toolbar=yes,location=no,scrollbars=yes,resizable=yes") ;
	}