function handleActionClick(newValue,systemid)
{var oldValue=lastActionValue;if(newValue==oldValue){return false;}
setCheckedValue(document.ticket.action,newValue);document.getElementById(newValue).className='actionradioON';document.getElementById(oldValue).className='actionradio';var TWHATnew=newValue.substring(newValue.length-2);var TWHATold=oldValue.substring(oldValue.length-2);var BSnew=String(newValue).substring(0,1);var BSold=String(oldValue).substring(0,1);if((TWHATnew=='TO')&&(TWHATold=='TC'))
{document.getElementById('toptarget').className='toptargetclassON';document.getElementById('bottomtarget').className='bottomtargetclassON';}
if((TWHATnew=='TC')&&(TWHATold=='TO'))
{document.getElementById('toptarget').className='toptargetclass';document.getElementById('bottomtarget').className='bottomtargetclass';}
if((BSnew!=BSold)&&(TWHATnew!='TC'))
{var eltop=document.getElementById('toptarget');var topx=findPosX(eltop);var topy=findPosY(eltop);var elbot=document.getElementById('bottomtarget');var bottomx=findPosX(elbot);var bottomy=findPosY(elbot);var mult=1;if(topy>bottomy){mult=-1;}
if(!document.all)
{new Effect.Move('toptarget',{x:0,y:100*mult,mode:'relative'});new Effect.Move('bottomtarget',{x:0,y:-100*mult,mode:'relative'});}}
lastActionValue=newValue;if(document.forms.ticket.quant.value.length==0)
{document.forms.ticket.quant.focus();}
else if(document.forms.ticket.symbol.value.length==0)
{document.forms.ticket.symbol.focus();}
return false;}
function handleOrderTypeClick(newValue,systemid)
{var oldValue=getCheckedValue(document.ticket.ordertype);if(newValue!='stop')
{document.getElementById('stopvalueholder').className='stopvalueholderclass';}
else if(newValue=='stop')
{document.getElementById('stopvalueholder').className='stopvalueholderclassON';document.forms.ticket.stopvalue.focus();}
if(newValue!='limit')
{document.getElementById('limitvalueholder').className='limitvalueholderclass';}
else if(newValue=='limit')
{document.getElementById('limitvalueholder').className='limitvalueholderclassON';document.forms.ticket.limitvalue.focus();}
if(newValue==oldValue){document.getElementById('market').className='ordertyperadio';document.getElementById('stop').className='ordertyperadio';document.getElementById('limit').className='ordertyperadio';document.getElementById(newValue).className='ordertyperadioON';return false;}
setCheckedValue(document.ticket.ordertype,newValue);document.getElementById(newValue).className='ordertyperadioON';document.getElementById(oldValue).className='ordertyperadio';return false;}
function handleTifClick(newValue,systemid)
{var R=Math.random();var url='orderentry.mpl?want=tif&session='+gsess+'&systemid='+systemid+'&tif='+newValue+'&R='+R;pendURL.push(url);if(newValue=='day')
{document.getElementById('day').className='btnBON';document.getElementById('gtc').className='btnB';}
else
{document.getElementById('day').className='btnB';document.getElementById('gtc').className='btnBON';}}
function togglebutton(e,otherID)
{e.className='btnGON';document.getElementById(otherID).className='btnG';}
function toggleExp(m)
{var i;for(i=1;i<6;i++)
{var on='';if(i==m)
{on='ON';}
document.getElementById('lookmo'+i).className='btnG'+on;}}
function handleInstruClick(newValue)
{if(newValue==lastInstru){return;}
if(newValue.length==0){return;}
if(newValue=='options')
{try
{$('optionLookup').setOpacity(.1);}
catch(err){}
document.getElementById('optionLookup').style.display='block';new Effect.Opacity('optionLookup',{duration:.7,from:.1,to:1});}
else if((lastInstru=='options')||(document.getElementById('optionLookup').style.display=='block'))
{new Effect.Opacity('optionLookup',{duration:.7,from:1,to:.1});setTimeout("document.getElementById('optionLookup').style.display='none';",100);}
document.getElementById(newValue).className='btnGON';document.getElementById(lastInstru).className='btnG';lastInstru=newValue;var url='orderentry.mpl?want=instrument&systemid='+systemid+'&instrument='+newValue;pendURL.push(url);}
function symboltype()
{var s=document.forms.ticket.symbol.value;if(s.length==0)
{return;}
if((s==='.')&&(lastInstru!='options'))
{handleInstruClick('options');}
var re=new RegExp(/\D+\d\d\d\d\D[\d\.]+/);var m=re.exec(s);if(m!==null)
{handleInstruClick('options');}
else
{re=new RegExp(/\D+\D\d/);m=re.exec(s);if(m!==null)
{handleInstruClick('futures');}
else
{re=new RegExp(/^EUR|^USD|^JPY|^CAD|^CHF|^AUD/i);m=re.exec(s);if(m!==null)
{handleInstruClick('forex');}}}
gLastKeyPressDate=new Date();if(gUnprocKeypress==0)
{gUnprocKeypress=1;setTimeout('checkPendingOrderKeypress();',10);}}
function intermittentSymbolCheck()
{var end=new Date();try{var msSinceKeyPress=end.getTime()-gLastKeyPressDate.getTime();if(msSinceKeyPress>2000)
{if(document.forms.ticket.symbol.value.length>0)
{var s=document.forms.ticket.symbol.value;var url='orderentry.mpl?want=symbollookup&systemid='+systemid+'&symbol='+s;if(url!==gLastSymbolURL)
{gLastSymbolURL=url;pendURL.push(url);}}}}
catch(err){}
checkbutton();setTimeout('intermittentSymbolCheck();',2000);}
function checkPendingOrderKeypress()
{if(gUnprocKeypress)
{var end=new Date();var msSinceKeyPress=end.getTime()-gLastKeyPressDate.getTime();if(msSinceKeyPress>580)
{var s=document.forms.ticket.symbol.value;if(s.length>0)
{var url='orderentry.mpl?want=symbollookup&systemid='+systemid+'&symbol='+s;pendURL.push(url);checkURLstackParallelOS();gUnprocKeypress=0;}
else{gUnprocKeypress=0;document.getElementById('ticketstatus').innerHTML='';}}
else
{setTimeout('checkPendingOrderKeypress();',10);}}}
function zeroPad(num,makelen)
{var numZeropad=num+'';while(numZeropad.length0)&&(gLastCondButtonState==1))
{document.getElementById('condbutton').className='btnGr';setSessionVal(gsess,'sessiononly_condchoicemode',0);}
clearTicket();if(gClearHintOnSubmit==1)
{gClearHintOnSubmit=0;document.getElementById('tickethint').innerHTML='';}
if(gIF['reloadOrderScreen']==1)
{gIF['reloadOrderScreen']=0;setTimeout('reloadOrderScreen('+systemid+');',1000);}}
function jBuildBlotterSignalLine(usetempid,systemid,action,quant,symbol,instru,tif,ordertype,limit,stop,toptarget,bottomstop,parkindef)
{var blot=document.getElementById('blotter').innerHTML;symbol=symbol.toUpperCase();var sigtype='@ MKT';if(ordertype=='stop')
{sigtype='@ stop '+stop;}
else if(ordertype=='limit')
{sigtype='@ limit '+limit;}
else if(ordertype=='reverse')
{if(limit>0)
{sigtype='@ '+limit;}
else
{sigtype='@ MKT';}}
blot=blot+'\
\
\
\
'+action+'
\
'+quant+'
\
'+symbol+'
\
'+sigtype+'
\
'+tif.toUpperCase()+'
\
Pending
\
\
';if(gIF['noOrderCheck']==1)
{}
else
{setTimeout('pollTempOrderStatus('+usetempid+');',3000);setTimeout('alertAboutFailedTempOrder('+usetempid+');',7000);}
gTempSignalID=gTempSignalID+1;if(bottomstop.length>0)
{var bottomaction='';var bottomsigtype='@ stop '+bottomstop;if(action=='BTO')
{bottomaction='STC';}
else if(action=='STO')
{bottomaction='BTC';}
if(bottomaction.length>0)
{blot=blot+'\
\
\
\
'+bottomaction+'
\
'+quant+'
\
'+symbol+'
\
'+bottomsigtype+'
\
GTC
\
Pending
\
\
\
';gTempSignalID=gTempSignalID+1;}}
if(toptarget.length>0)
{var topaction='';var topsigtype='@ limit '+toptarget;if(action=='BTO')
{topaction='STC';}
else if(action=='STO')
{topaction='BTC';}
if(topaction.length>0)
{blot=blot+'\
\
\
\
'+topaction+'
\
'+quant+'
\
'+symbol+'
\
'+topsigtype+'
\
GTC
\
Pending
\
\
\
';gTempSignalID=gTempSignalID+1;}}
var parkUntilParam='';if(gAdvanced==1)
{var year=document.ticket.yyyy.value;if(year.length==2)
{year='20'+year;}
parkUntilParam='&parkuntildatetime='+year+zeroPad(document.ticket.mm.value,2)+zeroPad(document.ticket.dd.value,2)+zeroPad(document.ticket.hr.value,2)+zeroPad(document.ticket.min.value,2);}
document.getElementById('blotter').innerHTML=blot;var url='/cgi-perl/signal.mpl?want=signal&systemid='+systemid+'&action='+action+'&quant='+quant+'&symbol='+symbol+'&instrument='+instru+'&duration='+tif+'&tempsignalid='+gTempSignalID+'&orderentry=1&parkindef='+parkindef+'&buttontype='+gButtonType+parkUntilParam;var ot=getCheckedValue(document.ticket.ordertype);if(ot=='stop')
{var mystop=document.ticket.stopvalue.value;mystop=mystop.replace("+",'PLUS');mystop=encodeURIComponent(mystop);url=url+'&stop='+mystop;}
else if(ot=='limit')
{var mylimit=document.ticket.limitvalue.value;mylimit=mylimit.replace("+",'PLUS');mylimit=encodeURIComponent(mylimit);url=url+'&limit='+mylimit;}
if((action=='BTO')||(action=='STO'))
{if(document.ticket.toptargetvalue.value.length>0)
{var pt=document.ticket.toptargetvalue.value;pt=pt.replace("+",'PLUS');pt=encodeURIComponent(pt);url=url+'&profittarget='+pt;}
if(document.ticket.bottomtargetvalue.value.length>0)
{var sl=document.ticket.bottomtargetvalue.value;sl=sl.replace("+",'PLUS');sl=encodeURIComponent(sl);url=url+'&stoploss='+sl;}}
if(document.ticket.xreplace.value>0)
{url=url+'&xreplace='+document.ticket.xreplace.value;}
if(document.ticket.conditionalupon.value>0)
{url=url+'&conditionalupon='+document.ticket.conditionalupon.value;}
if((gAdvanced==1)&&(document.ticket.commentary.value.length>0))
{url=url+'&comment='+encodeURIComponent(document.ticket.commentary.value);}
if(gExtraSubmitParam.length>0)
{url=url+gExtraSubmitParam;gExtraSubmitParam='';}
if(ordertype!=='reverse')
{pendURL.push(url);}}
function handleCancel(sigid)
{document.getElementById('stat'+sigid).innerHTML='Canceling';var url='/cgi-perl/signal.mpl?cmd=cancel&systemid='+systemid+'&signalid='+sigid+'&orderentry=1';pendURL.push(url);}
function restorePrevSubmit(restoreguid,overrideparams)
{var url='/cgi-perl/signal.mpl?cmd=restoreprevsubmit&systemid='+systemid+'&restoreguid='+restoreguid+'&orderentry=1&override='+overrideparams;pendURL.push(url);}
function toggleConnCheck()
{var url='/cgi-perl/utility/ajax_util.mpl?rm=toggleOrderCheck&systemid='+systemid;pendURL.push(url);}
function checkNumOnly(field)
{var check=true;var value=field.value;for(var i=0;i"9"))&&!(new_key=="")&&!(new_key=="."))
{check=false;break;}}
return(check);}
function checkNumOnlySL(field)
{var check=true;var value=field.value;for(var i=0;i"9"))&&!(new_key=="")&&!(new_key==".")&&!(new_key=="O")&&!(new_key=="T")&&!(new_key=="Q")&&!(new_key=="+")&&!(new_key=="-")&&!(new_key==" ")&&!(new_key=="/"))
{check=false;break;}}
return(check);}
function checkbutton()
{var otok=0;var ot=getCheckedValue(document.ticket.ordertype);if(ot=='market')
{otok=1;}
else if(ot=='stop')
{if((document.ticket.stopvalue.value.length>0)&&(checkNumOnlySL(document.ticket.stopvalue)))
{otok=1;}}
else if(ot=='limit')
{if((document.ticket.limitvalue.value.length>0)&&(checkNumOnlySL(document.ticket.limitvalue)))
{otok=1;}}
if(((document.ticket.quant.value.length>0)&&(checkNumOnly(document.ticket.quant)))&&(document.ticket.symbol.value.length>0)&&(otok))
{if(gLastButtonState==0)
{buttonOn();}}
else{if(gLastButtonState!=0)
{buttonOff();}}}
function buttonOn()
{document.getElementById('submitbuttonframe').innerHTML='Submit';gLastButtonState=1;if(gAdvanced)
{enableParkButtons();}}
function adjustParkButtonState()
{if((gAdvanced)&&(!gParkButtonsEnabled)&&(gLastButtonState))
{enableParkButtons();}}
function enableParkButtons()
{gParkButtonsEnabled=1;document.getElementById('pubuttonframe').innerHTML='';}
function disableParkButtons()
{gParkButtonsEnabled=1;document.getElementById('pubuttonframe').innerHTML='';}
function buttonOff()
{document.getElementById('submitbuttonframe').innerHTML='Submit';gLastButtonState=0;if(gAdvanced)
{disableParkButtons();}}
function initAllKeyPress()
{initTextEntryKeyPress('symbol');initTextEntryKeyPress('stopvalue');initTextEntryKeyPress('limitvalue');initTextEntryKeyPress('bottomtargetvalue');initTextEntryKeyPress('toptargetvalue');}
function initTextEntryKeyPress(inputname)
{document.getElementById(inputname).onkeypress=function(e){if(inputname=='symbol'){if(document.getElementById('tickethint').innerHTML.length>0){document.getElementById('tickethint').innerHTML='';gClearHintOnSubmit=0;}
if(document.ticket.xreplace.value>0)
{document.getElementById('blotitem'+document.ticket.xreplace.value).className='blotItem';setSessionVal(gsess,'sessiononly_xrplc',0);document.ticket.xreplace.value=0;}}
if(!e)e=window.event;if(e.keycode)
{if(e.keycode==13){setTimeout('submitIfOK();',50);return false;}}
else if(e.which)
{if(e.which==13){setTimeout('submitIfOK();',50);return false;}}
return true;}}
function clearTicket()
{document.ticket.quant.value='';document.ticket.symbol.value='';document.ticket.stopvalue.value='';document.ticket.limitvalue.value='';document.ticket.toptargetvalue.value='';document.ticket.bottomtargetvalue.value='';document.ticket.commentary.value='';document.getElementById('ticketstatus').innerHTML='';document.forms.ticket.quant.focus();if(document.ticket.xreplace.value>0)
{document.getElementById('blotitem'+document.ticket.xreplace.value).className='blotItem';setSessionVal(gsess,'sessiononly_xrplc',0);document.ticket.xreplace.value=0;}
if(document.ticket.conditionalupon.value>0)
{document.getElementById('blotitem'+document.ticket.conditionalupon.value).className='blotItem';setSessionVal(gsess,'sessiononly_conditionalupon',0);document.ticket.conditionalupon.value=0;}}
function submitIfOK()
{if(gLastButtonState==1)
{handleSubmit(systemid,0);}}
function orderEntryCheckin()
{var url='orderentry.mpl?want=checkin&systemid='+systemid;pendURL.push(url);gIF['lastOrderEntryCheckIn']=new Date();}
function buyPowerUpdate()
{var url='orderentry.mpl?want=buypower&systemid='+systemid;pendURL.push(url);gIF['lastBuyPowerUpdate']=new Date();}
function pollTickers()
{var url='orderentry.mpl?want=polltickers&systemid='+systemid;pendURL.push(url);gIF['lastPollTickers']=new Date();}
function fillTicket(typeofsymbol,action,symbol,quant,ordertype,limitvalue,stopvalue,pt,sl)
{clearTicket();handleInstruClick(typeofsymbol);document.ticket.symbol.value=symbol;symboltype();handleActionClick(action);handleOrderTypeClick(ordertype,systemid);document.ticket.quant.value=quant;if(limitvalue>0)
{document.ticket.limitvalue.value=limitvalue;}
else if(stopvalue>0)
{document.ticket.stopvalue.value=stopvalue;}
if(pt>0)
{document.ticket.toptargetvalue.value=pt;}
if(sl>0)
{document.ticket.bottomtargetvalue.value=sl;}
document.ticket.quant.focus();document.ticket.quant.blur()
checkbutton();}
function handleXRPLC(sigid,typeofsymbol,symbol,quant,action,limitvalue,stopvalue,tif,pt,sl,condupon,pudate)
{if(pudate.length==12)
{if(gAdvanced==0)
{choosetab('advanced');}
document.ticket.yyyy.value=pudate.substring(0,4);document.ticket.mm.value=pudate.substring(4,6);document.ticket.dd.value=pudate.substring(6,8);document.ticket.hr.value=pudate.substring(8,10);document.ticket.min.value=pudate.substring(10,12);}
if(document.ticket.xreplace.value>0)
{noXRPLC(document.ticket.xreplace.value);}
if((document.ticket.conditionalupon.value!=condupon)&&(document.ticket.conditionalupon.value>0))
{noCOND(document.ticket.conditionalupon.value);}
document.ticket.xreplace.value=sigid;document.getElementById('blotitem'+sigid).className='blotItemON';document.getElementById('tickethint').innerHTML='To cancel-and-replace the highlighted order, make changes in the ticket below and hit Submit.
Do not change order ';gClearHintOnSubmit=1;var ordertype='market';if(limitvalue>0){ordertype='limit';}
else if(stopvalue>0){ordertype='stop';}
fillTicket(typeofsymbol,action,symbol,quant,ordertype,limitvalue,stopvalue,pt,sl);handleTifClick(tif,systemid);document.ticket.xreplace.value=sigid;document.ticket.conditionalupon.value=condupon;var R=Math.random();var url='orderentry.mpl?want=startxrplc&session='+gsess+'&systemid='+systemid+'&R='+R+'&signalid='+sigid;pendURL.push(url);}
function noXRPLC(sigid)
{document.getElementById('blotitem'+sigid).className='blotItem';clearTicket();document.getElementById('tickethint').innerHTML='';gClearHintOnSubmit=0;}
function noOCA()
{gOCA=0;gOCAmode=0;document.getElementById('tickethint').innerHTML='';document.getElementById('ocabuttonholder').innerHTML='OCA';gClearHintOnSubmit=0;setSessionVal(gsess,'sessiononly_ocachoicemode',0);var R=Math.random();var url='orderentry.mpl?want=endocachoice&systemid='+systemid+'&R='+R;pendURL.push(url);}
function noCOND(sigid)
{setSessionVal(gsess,'sessiononly_condchoicemode',0);if(sigid!=0)
{document.getElementById('blotitem'+sigid).className='blotItem';}
gCond=0;clearTicket();document.getElementById('tickethint').innerHTML='';gClearHintOnSubmit=0;document.ticket.conditionalupon.value=0;document.getElementById('condbutton').className='btnGr';var url='orderentry.mpl?want=endcondchoice&systemid='+systemid;pendURL.push(url);}
function handleCloseTrade(typeofsymbol,symbol,quant,closeaction,autoSubmit)
{fillTicket(typeofsymbol,closeaction,symbol,quant,'market',0,0,0,0);if(autoSubmit==0)
{document.getElementById('tickethint').innerHTML='You must still press
Submit to send this closing order. If you prefer, you can enable One-Click close.
Enable ';gClearHintOnSubmit=1;intermittentglowDiv('tickethint',6);}
else
{document.getElementById('tickethint').innerHTML='Order to close '+symbol+' has been submitted. You can turn off One-Click close.
Turn off ';setTimeout('submitIfOK();',50);gClearHintOnSubmit=0;}}
function handleOneClick(newstate,symbol)
{setSessionVal(gsess,'autosubmitclose'+systemid,newstate);if(newstate==1)
{document.getElementById('tickethint').innerHTML='From now on, pressing
will close a position instantly. Don\'t forget, you still need to submit the closing '+symbol+' trade below (one final time).
';gClearHintOnSubmit=1;}
else
{document.getElementById('tickethint').innerHTML='Okay, from now on, when you press
you will still need to confirm by pressing Submit. (
Hide this message)
';gClearHintOnSubmit=0;}}
function requestBlotSort(sortstyle)
{var url='orderentry.mpl?want=blotsort&systemid='+systemid+'&style='+sortstyle;pendURL.push(url);}
function reverseBlotSort()
{var R=Math.random();var url='orderentry.mpl?want=reverseblotsort&session='+gsess+'&systemid='+systemid+'&R='+R;pendURL.push(url);}
function showHideCondButton(show)
{if(gLastCondButtonState!=show)
{if(show==1)
{var c='btnGr';if(document.ticket.conditionalupon.value>0)
{c='btnGrON';}
document.getElementById('condbuttonholder').innerHTML='Conditional';}
else
{document.getElementById('condbuttonholder').innerHTML='';}
gLastCondButtonState=show;}}
function showHideOCAButton(show)
{if(gLastOCAButtonState!=show)
{if(show==1)
{var c='btnGr';if((gOCA>0)||(gOCAmode))
{c='btnGrON';}
document.getElementById('ocabuttonholder').innerHTML='OCA';}
else
{document.getElementById('ocabuttonholder').innerHTML='';}
gLastOCAButtonState=show;}}
function handleCondClick()
{if((gOCA>0)||(gOCAmode))
{noOCA();}
if(document.ticket.conditionalupon.value>0)
{noCOND(document.ticket.conditionalupon.value);}
document.getElementById('condbutton').className='btnGrON';document.getElementById('tickethint').innerHTML='';gClearHintOnSubmit=1;var R=Math.random();var url='orderentry.mpl?want=startcondchoice&systemid='+systemid;pendURL.push(url);gCond=1;}
function toggleClassName(el)
{alert('toggle el='+el+' and class='+document.getElementById(el).className);if(document.getElementById(el).className=='blotItem')
{document.getElementById(el).className='blotItemON'}
else if(document.getElementById(el).className=='blotItemON')
{document.getElementById(el).className='blotItem';}}
function handleOCAClick()
{if((gOCA>0)||(gOCAmode))
{noOCA();}
else
{document.getElementById('condbuttonholder').innerHTML='Conditional';if(document.ticket.conditionalupon.value>0)
{noCOND(document.ticket.conditionalupon.value);}}
document.getElementById('ocabutton').className='btnGrON';document.getElementById('tickethint').innerHTML='Click 2 or more orders in Trade Blotter below to create One-Cancels-Another (OCA) group. ';gClearHintOnSubmit=1;var url='orderentry.mpl?want=startocachoice&systemid='+systemid;pendURL.push(url);gOCAmode=1;}
function lockOCA()
{if(gOCA<2)
{alert("You need to select at least two orders from the Trade Blotter to form an OCA group. Select another order.");}
else
{document.getElementById('tickethint').innerHTML='';document.getElementById('ocabuttonholder').innerHTML='OCA';gClearHintOnSubmit=0;gOCA=0;gOCAmode=0;var url='orderentry.mpl?want=lockoca&systemid='+systemid;pendURL.push(url);}}
function handleCondChoice(sigid)
{var R=Math.random();var url='orderentry.mpl?want=startconditional&session='+gsess+'&systemid='+systemid+'&R='+R+'&signalid='+sigid;pendURL.push(url);document.ticket.conditionalupon.value=sigid;document.getElementById('tickethint').innerHTML='New order entered below will be conditional upon highlighted order in the Blotter below. Cancel Conditional ';gClearHintOnSubmit=1;try
{Effect.ScrollTo('tickethint',-100,{axis:'y'});}
catch(err){}}
function handleOCAChoice(sigid,newstate)
{var R=Math.random();var url='orderentry.mpl?want=chooseocamember&systemid='+systemid+'&signalid='+sigid+'&state='+newstate;pendURL.push(url);var nowclick='Now click';if(newstate)
{gOCA=gOCA+1;}
else
{gOCA=gOCA-1;nowclick='Click';if(gOCA<0)
{gOCA=0;}}
var explain='';var button='';if(gOCA<=0)
{explain='Click two or more orders above. This will group them into a One-Cancels-Another (OCA) group.';}
else if(gOCA==1)
{explain=nowclick+' at least one more order to add to your OCA group.';}
else
{explain='You can add more orders to your OCA group. Or click Make OCA to finalize the OCA.';button='Make OCA';}
document.getElementById('tickethint').innerHTML='';}
function choosetab(whichtab)
{if(whichtab=='advanced')
{document.getElementById('advancedframe').style.display='block';gAdvanced=1;document.getElementById('basictab').className='tab';document.getElementById('advancedtab').className='tabON';document.getElementById('basictab').innerHTML='Basic';document.getElementById('advancedtab').innerHTML='Advanced';setSessionVal(gsess,'orderticketadvanced'+systemid,'advanced');adjustParkButtonState();}
else if(whichtab=='basic')
{document.getElementById('advancedframe').style.display='none';gAdvanced=0;document.getElementById('basictab').className='tabON';document.getElementById('advancedtab').className='tab';document.getElementById('basictab').innerHTML='Basic';document.getElementById('advancedtab').innerHTML='Advanced';setSessionVal(gsess,'orderticketadvanced'+systemid,'basic');}}
function handleUnpark(sigid)
{var url='orderentry.mpl?want=unpark&systemid='+systemid+'&signalid='+sigid;pendURL.push(url);try{document.getElementById('stat'+sigid).innerHTML='Working';}
catch(err){}}
function handleXrsrv(rsid)
{var url='orderentry.mpl?want=xreserve&systemid='+systemid+'&r='+rsid;pendURL.push(url);}
function doRev(stage,tradeid)
{if(stage==1)
{var url='orderentry.mpl?want=prepReverse&tradeid='+tradeid;pendURL.push(url);}}
function handleRev(tradeid,triggerprice,symbol)
{if(triggerprice==0)
{document.getElementById('revErr').innerHTML='Enter the price at which you want to trigger the reverse.';return false;}
if(triggerprice==-1){triggerprice=0;}
document.getElementById('revErr').innerHTML='';gTempSignalID=gTempSignalID+1;var url='signal.mpl?cmd=reverse&tradeid='+tradeid+'&systemid='+systemid+'&triggerprice='+triggerprice+'&orderentry=1&tempsignalid='+gTempSignalID;pendURL.push(url);jBuildBlotterSignalLine(gTempSignalID,systemid,'REV','',symbol,'','DAY','reverse',triggerprice,0,0,0,0);document.getElementById('genericPopup').innerHTML="
Collective2 is processing your reversal request. Please wait...
";setTimeout('Effect.DropOut(\'genericPopup\');',5000);}
function chooseOption(symbol)
{document.forms.ticket.symbol.value=symbol;symboltype();document.getElementById('lookSubmitHold').innerHTML='Look Up';}
function handleCloseAll(sysid,conf)
{var R=Math.random();if(conf==0)
{var url='orderentry.mpl?want=closeall&systemid='+sysid;pendURL.push(url);}
else
{var url='orderentry.mpl?want=closeall&systemid='+sysid+'&conf=1';pendURL.push(url);document.getElementById('genericPopup').innerHTML="
Initiating Close all request. Please wait...
";setTimeout('Effect.DropOut(\'genericPopup\');',4000);}}
function displayQuoteStrip(systemid,sess,show)
{var url='orderentry.mpl?want=toggleQuoteStrip&show='+show+'&systemid='+systemid;pendURL.push(url);}
function bm(el,symbol,typeofsymbol,quant)
{new Effect.Highlight(el);fillTicket(typeofsymbol,'BTO',symbol,quant,'market','','','','');return false;}
function sm(el,symbol,typeofsymbol,quant)
{new Effect.Highlight(el);fillTicket(typeofsymbol,'STO',symbol,quant,'market','','','','');return false;}
function preloadImages()
{redtrash=new Image(16,16);redtrash.src="/images/red_delete.png";graytrash=new Image(16,16);graytrash.src="/images/black_delete.png";}
function handleMouseUpQT(sigid,typeofsymbol,symbol,quant)
{var end=new Date();var msSinceMouseDown=end.getTime()-gMouseDownDate.getTime();if(msSinceMouseDown<=500)
{try{new Effect.Highlight('qt'+sigid);}catch(err){}
handleInstruClick(typeofsymbol);document.ticket.symbol.value=symbol;symboltype();document.ticket.quant.value=quant;document.ticket.quant.focus();document.ticket.quant.blur()
checkbutton();}}
function handleOnOffQT(systemid,sigid,state)
{if(state==0)
{document.getElementById('qt'+sigid).style.display='none';}
if(state==3)
{new Effect.Opacity('qtlist',{duration:.7,from:1,to:.2});}
var R=Math.random();var url='orderentry.mpl?want=onoffqt&session='+gsess+'&R='+R+'&state='+state+'&sigid='+sigid+'&systemid='+systemid;pendURL.push(url);return(false);}
function ordertip(t)
{if(t==1)
{document.getElementById('qstipcont').innerHTML="We show real-time forex prices here, but that does not mean you can trade only forex. In fact, you can feel free to also trade stocks, futures and options. While we are not allowed to show real-time prices for other instruments, we use real-time prices internally to determine at what price your orders should be filled.
";}
else if(t==2)
{document.getElementById('qhelp').innerHTML="Quantity Help
Forex. Enter "minilots" as quantity. One minilot is 10,000 currency units. For example, if you enter Buy 5 EUR/USD, you will buy 50,000 Euros.
Stocks. Enter shares.
Futures. Enter number of contracts.
Options. Enter number of lots.
";Effect.BlindDown('qhelp');}
else if(t==3)
{document.getElementById('qhelp').innerHTML="Symbol Help
Futures. To see a list of futures symbols, click here.
Stocks. To look up the stock symbol for a company, you can use a Google Finance.
Forex. Go ahead and type any forex pair.
Options. C2 supports equity and ETF options. Learn about the new Options Symbology Initiative (OSI) and the option symbols used by C2. To trade options on indexes such as S&P options, you need to find the appropriate ETF. For example, here are the options for the SPY ETF.
";Effect.BlindDown('qhelp');}
else if(t==4)
{document.getElementById('qhelp').innerHTML="How to create Market on Open (MOO) or Market on Close (MOC) orders
C2 effectively supports both types of order. Here are detailed instructions.
";Effect.BlindDown('qhelp');}}
function hideordertip(t)
{if(t==1)
{Effect.DropOut('qstipdiv');setSessionVal(gsess,'ackedQuoteStripTip3_'+systemid,'1');}
else
{Effect.BlindUp('qhelp');}}
function breakoca(sigid)
{if(confirm("Click OK if you really want to break this One-Cancels-Another (OCA) group?"))
{var R=Math.random();var url='orderentry.mpl?want=breakoca&systemid='+systemid+'&signalid='+sigid+'&R='+R;pendURL.push(url);}}
function foldup()
{Effect.BlindUp('tipdrawer');if(document.getElementById('qhelp').style.display!='none')
{setTimeout('Effect.BlindUp(\'qhelp\');',750);}}
function doOptionLookup()
{if(document.getElementById('lookroot').value.length<1)
{document.getElementById('lookupMsg').innerHTML='Type underlying stock symbol.';return;}
if(document.getElementById('lookstrike').value.length<1)
{document.getElementById('lookupMsg').innerHTML='Enter strike price.';return;}
var R=Math.random();var pc='p';if(document.getElementById('lookcalls').className=='btnGON')
{pc='c';}
var m=1;var i;for(i=1;i<6;i++)
{if(document.getElementById('lookmo'+i).className=='btnGON')
{m=i;}}
var url='orderentry.mpl?want=dooptionlookup&systemid='+systemid+'&R='+R+'&under='+document.getElementById('lookroot').value+'&strike='+document.getElementById('lookstrike').value+'&pc='+pc+'&month='+m;document.getElementById('lookupMsg').innerHTML='';document.getElementById('lookSubmit').className='btnG';document.getElementById('lookSubmitHold').innerHTML='Wait';pendURL.push(url);}
function removeBlotErr(systemid,num)
{pendURL.push('/cgi-perl/orderentry.mpl?want=ackErr&systemid='+systemid+'&num='+num);}
function scrollToBlotter()
{try
{Effect.ScrollTo('blotter',-200,{axis:'y'});}
catch(err){}}
function pollTempOrderStatus(tempID)
{pendURL.push('/cgi-perl/orderentry.mpl?want=requestTempOrderStatus&systemid='+systemid+'&tempid='+tempID);}
function alertAboutFailedTempOrder(tempID)
{if(gTempSignalIDStatus[tempID]!==1)
{var glowok=1;try
{document.getElementById('tempStatus'+tempID).innerHTML='Unable to confirm order (Recheck Order Status? | Turn off status-check?)';}
catch(err){glowok=0;if(gRecentTempToPerm[tempID]==0)
{document.getElementById('tickethint').innerHTML='There may be a problem with connectivity to C2. Please check the Trade Blotter (below) to make sure your recent orders are still Working.
';}}
if(glowok)
{intermittentglowDiv('blot'+tempID,15);}}}
function checkInFailsafe()
{var end=new Date();if(end.getTime()-gIF['lastOrderEntryCheckIn'].getTime()>6000)
{orderEntryCheckin();}
if(end.getTime()-gIF['lastPollTickers'].getTime()>7000)
{pollTickers();}
if(end.getTime()-gIF['lastBuyPowerUpdate'].getTime()>22000)
{buyPowerUpdate();}
if(end.getTime()-gLastConnectTime.getTime()>10000)
{startConnectionCheck(1,'oeConnCheck',gPageLoadID);}
setTimeout('checkInFailsafe();',1000);}
function reloadOrderScreen(systemid)
{window.location='/cgi-perl/orderentry.mpl?want=trade&systemid='+systemid;}
function checkURLstackParallelOS()
{if(pendURL.length)
{var URL=pendURL.shift();$j.ajax({url:URL,type:'get',timeout:5000,cache:'false',success:function(response,textStatus,jqXHR){var gotback=response.split("=9x8y");var arLen=gotback.length;for(var i=0,len=arLen;i