// Stock landing page javascript

		  jQuery(document).ready(
	      		    
		      function getQuote(){
            var q = escape('select * from yahoo.finance.quotes where symbol in ("AEIS","AMD","A","AGU","ACAS","APC","ARTL","ATO","ADP","BAESY.PK","BKS","BEC","BJS","BRCM","BNI","CBC","CTX","CHB","CCU","CAG","CTCT","DHR","DF","DDR","EK","FTO","GCI","GE","GGP","GBNK","HSKA","HPQ","INTC","JCI","JPM","KEY","KR","LOW","LSI","MAC","MAR","MMC","NSM","NBL","NVS","OI","PMTC","PAYX","PCZ","PX","PCP","QLTI","IQW","Q","RGCI","RBA","RRD","SWY","SRT","TGT","TLVT","UNP","UFPI","UQM","USB","VECO","WMT","WMI","WFC","WFMI","WWD","XEL")');
              jQuery.ajax({
                url: "http://query.yahooapis.com/v1/public/yql?q=" + q + "&format=json&env=http://datatables.org/alltables.env",
                dataType: 'json',
                data: 'data',
                success: function(data){
                  var s = data.query.results.quote;
                  jQuery("#response-source").html(data.toSource());
                  for(var r in s){
					if(r==0){
					  jQuery("#stocksContainer").html('<table id="stockquotes"><thead><tr><td>Company</td><td>Symbol</td><td>Open</td><td>Change</td><td>Last</td></tr></thead><tbody></tbody></table>');
					}
					var changePos = /\+/.test(s[r].Change);
					var changeNeg = /-/.test(s[r].Change);
					var changeStatus = "default";
					if(changePos==true){changeStatus="up";}
					if(changeNeg==true){changeStatus="down";}
					if(changePos==false && changeNeg==false){changeStatus="NA";}
					rowColor=r;
					if(rowColor>1){rowColor=rowColor%2;}
					if(rowColor==0){rowColor="even";}else(rowColor="odd");
					jQuery("table#stockquotes").append('<tr class="'+rowColor+'"><td class="stk-company">'+s[r].Name+'</td><td class="stk-symbol">'+s[r].symbol+'</td><td class="stk-open">'+s[r].Open+'</td><td class="stk-change '+changeStatus+'">'+s[r].Change+'</td><td class="stk-last">$'+s[r].LastTradePriceOnly+'</td></tr>');
                  }
                }
              });
          }
		  	  		  
		  );


