﻿function getStockQuotes() {
if( typeof irxmlstockquote != 'undefined' && irxmlstockquote.length > 0 ){
  // irxml times are in ET
  var irxmlrows = [ {"name":'Company', "field":'ticker.companyname'},
               {"name":'Last Trade', "field":'irxmlfunctions.formatDate(ticker.lastdatetime, "hh:mm TT \\\\E\\\\T - MMM dd yyyy")'},
               {"name":'Price', "field":'irxmlfunctions.currencyFormat(ticker.lastprice, 2)'},
               {"name":'Change', "field":'irxmlfunctions.currencyFormatColored("#6D7231","","#A72115",ticker.change)'},
               {"name":'Volume', "field":'irxmlfunctions.numberFormat(ticker.volume)'},
               {"name":'Trades', "field":'irxmlfunctions.numberFormat(ticker.trades)'},
               {"name":'Day Low', "field":'irxmlfunctions.currencyFormat(ticker.low, 2)'},
               {"name":'Day High', "field":'irxmlfunctions.currencyFormat(ticker.high, 2)'},
               {"name":'52 Week Low', "field":'irxmlfunctions.currencyFormat(ticker.yearlow, 2)'},
               {"name":'52 Week High', "field":'irxmlfunctions.currencyFormat(ticker.yearhigh, 2)'}
              ];
  var thisquote = '';
  //for( var r=0; r<irxmlrows.length; r++ ){
    //thisquote = thisquote +'<tr><td><strong>' + irxmlrows[2].name + '</strong></td>';
    //thisquote = thisquote +'<tr><td><strong>' + irxmlrows[3].name + '</strong></td>';
    //for( var ix=0; ix<irxmlstockquote.length; ix++ ){
      var ticker = irxmlstockquote[0];
      thisquote = thisquote +'<h2 style="display:inline;color:black;font-size:16px;font-weight:bold;padding-right:4px;">' + eval(irxmlrows[2].field) + '</h2>';
      thisquote = thisquote + '<p style="display:inline;font-size:12px;">' + eval(irxmlrows[3].field) + '</p><br/>';
    //}
  //}
  //thisquote = thisquote +'</table>';
  thisquote = thisquote + '<span style="font-size:10px;">As of ' + irxmlfunctions.formatDate(new Date()) + '</span>';
    //thisquote = thisquote +'</p>';
} else {
  thisquote = '<p>Stock quote is not available at this time.</p>';
}
return thisquote;
}//end function

