function showChart(whatSort, which) { setCookie("chartType", whatSort ); setCookie("chartTidm", which ); top.location.reload(); return true; } function getAmountFromPortfolio(index_code) { var portlist=getCookie("portlist"); if ((portlist==null)||(portlist == "")) {return 0} return portFuncs("AMM",portlist,"","",index_code); } function getPaidFromPortfolio(index_code) { var portlist=getCookie("portlist"); if ((portlist==null)||(portlist=="")) {return 0.0} return portFuncs("PID",portlist,"","",index_code); } function setValuesInPortfolio(index_code,newpaid,newamount) { var portlist=getCookie("portlist"); var count=0; objToPass={newlist:""} if ((portlist==null)||(portlist=="")) {return} count=portFuncs("SVI",portlist,objToPass,"",index_code,newpaid,newamount) setCookie("portlist",objToPass.newlist); return; } function outputAsPrice(value) { var strValue=""; var strThousands=""; var strHundreds="000"; var strFractionalbit="00"; var negative=0; var index=0; var thousands=0; var hundreds=0; var fractionalbit=0; var integer=""; var fraction=""; var subfraction=""; with(Math) { if (value<0) { negative=1; value=abs(value); } thousands=floor(value/1000); if (thousands!=0) { strThousands=""+thousands; } if (thousands!=0) { hundreds=floor(value-(thousands*1000)); } else { hundreds=floor(value); } strHundreds=""+hundreds; if (thousands!=0) { if (strHundreds.length==1){strHundreds="00"+hundreds}; if (strHundreds.length==2){strHundreds="0" +hundreds}; } if (strHundreds.length==0){ if (thousands!=0){ strHundreds="000"; } else { strHundreds="0"; } } fractionalbit=(value-abs(floor(value)))*100; if (fractionalbit==0) { strFractionalbit="00"; } else { if (fractionalbit<10) { strFractionalbit="0"+floor(fractionalbit); } else { strFractionalbit=""+fractionalbit; } } if (strFractionalbit.length>2) { strFractionalbit=strFractionalbit.substring(0,2); } if (strFractionalbit.length==0) { strFractionalbit="00"; } else { if (strFractionalbit.length==1) { strFractionalbit=strFractionalbit+"0"; } } if (negative==1) { d("-"); } if (thousands==0) { d(""+strHundreds+"."+strFractionalbit); } else { d(""+strThousands+","+strHundreds+"."+strFractionalbit); } } } function addToTotals(worth,gain) { totalSharesWorth=totalSharesWorth+worth; totalGain=totalGain+gain; } function showUserHeadings() { dln('
Paid
'); dln('
Qty
'); dln('
Value (gain)
'); } function displayUsersm(bidPrice,askPrice,stockCurrency) { var amount=0; var totalworth=0.0; var price; var paid; var gain; var origworth=0.0; incrementTidmCount(); amount=callGetAmountFromPortfolio(tidmId); if (amount==0.1) {amount=0} paid=callGetPaidFromPortfolio(tidmId); if (amount>0) {price=bidPrice} else if (amount<0) {price=askPrice} else {price=0} totalworth=((amount*price)/100); origworth=((amount*paid)/100); if (totalworth==0) { dln('-'); dln('-'); dln('-'); } else { dln(''+paid+''); dln(''+amount+''); d(''); outputAsPrice(totalworth); gain=totalworth-origworth; if (gain<0.0) {d(' (')} else if (gain>0.0){d(' (')} else {d(' (')} outputAsPrice(gain); dln(')'); addToTotals(totalworth,gain); if (currentCurr==""){currentCurr=stockCurrency} else {if (currentCurr!=stockCurrency){currencySame=false}} } } function displayTotals() { var value; var gain; if (!currencySame) { dln('Due to a mix of currencies in your stock list, a total cannot be displayed'); return; } dln('Total'); value=getTotalWorth(); gain=getTotalGain(); d(''); outputAsPrice(value); if (gain<0.0) {d(' (')} else if (gain>0.0) {d(' (')} else {d(' (')} outputAsPrice(gain); dln(')'); } function displayValid(diObj) { var stockID=diObj.diID; var displayLine; var col1="#FFFFFF"; var col2="#efefef"; var colour="#FFFFFF"; if (stock_counter==0) { colour=col1; } else { colour=col2; } dln('
'+diObj.diName+'
'); dln(''); dln(''+diObj.diMidOpen+''); dln(''+diObj.diDirection+' '+diObj.diDiff+' ('+diObj.diDiffPC+')'); dln(''+diObj.diBidOpen+''); dln(''+diObj.diAskOpen+''); displayUsersm(diObj.diBid,diObj.diAsk,diObj.diCurr); dln('
'); stock_counter=stock_counter+1; if (stock_counter==2){stock_counter=0;} } function addToList(tidm,amount,paid) { if (blankString(amount)){amount="0"} if (blankString(paid)){paid="0"} if ((checkNumber(amount))&&(checkPrice(paid))) { if (callAddToPortfolio(tidm.toUpperCase(),amount,paid)) {rp(callaxl+"hotedit")} } }