﻿
     var jq = jQuery.noConflict();

     function refreshMeetInfo() {
		 
function round(v,e) 
{ 
var t=1; 
for(;e>0;t*=10,e--); 
for(;e<0;t/=10,e++); 
return Math.round(v*t)/t; 
} 
         jq.get("quato/quote_list.php?id=" + Math.random(), retxt);
         function retxt(data) {
			 eval(data);//
			 function repstr(str, f, e) {
                 var obj = str;
                 var newobj = obj.replace(f, e);
                 return newobj;
                                        }
			 quotelist[0].Item = repstr(quotelist[0].Item, "LLG", "倫敦金");
			 quotelist[1].Item = repstr(quotelist[1].Item, "LLS", "倫敦銀");
             quotelist[2].Item = repstr(quotelist[2].Item, "EURUSD", "歐元");
             quotelist[3].Item = repstr(quotelist[3].Item, "USDJPY", "日元");
             quotelist[4].Item = repstr(quotelist[4].Item, "GBPUSD", "英鎊");
             quotelist[5].Item = repstr(quotelist[5].Item, "USDCHF", "瑞郎");
            
			 tmpDate=new Date();    
             hrs=tmpDate.getHours();
             mins=tmpDate.getMinutes();
			 if(hrs<10)
             hrs="0"+hrs;
             if(mins<10)
             mins="0"+mins;
			 var tableBodyArray=new Array();
			 tableBodyArray.push("<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" valign=\"top\" class=\"mtb\">");
			 tableBodyArray.push("<tr>");
			 tableBodyArray.push("<td class=\"tbg\">&nbsp;</td>");
			 tableBodyArray.push("<td class=\"tbg\">賣價</td>");
			 tableBodyArray.push("<td class=\"tbg\">買價</td>");
			 tableBodyArray.push("<td class=\"tbg\">最高價</td>");
			 tableBodyArray.push("<td class=\"tbg\">最低價</td>");
			 tableBodyArray.push("<td class=\"tbg\">時間</td>");
			 tableBodyArray.push("</tr>");             
			 for (var i=0;i<6;i++)
			 {
				 
				 if(i%2==0)
				 {
					var w;
					w="#ffffff";
				 }else{w="";}
			 tableBodyArray.push("<tr>");
			 tableBodyArray.push("<td style=background-color:#F5F4E7;font-weight:bold>"+quotelist[i].Item+"</td>");
			 tableBodyArray.push("<td style=background-color:"+w+" >"+round(quotelist[i].BidPrice,4)+"</td>");
			 tableBodyArray.push("<td style=background-color:"+w+" >"+round(quotelist[i].AskPrice,4)+"</td>");
			 tableBodyArray.push("<td style=background-color:"+w+" >"+round(quotelist[i].highbid,4)+"</td>");
			 tableBodyArray.push("<td style=background-color:"+w+" >"+round(quotelist[i].lowbid,4)+"</td>");
			 tableBodyArray.push("<td style=background-color:"+w+" >"+hrs+":"+mins+"</td>");
			 tableBodyArray.push("</tr>");  
			 }
			 tableBodyArray.push("</table>"); 
			 //alert (quotelist[1].Item);
			 var tabelHQ=tableBodyArray.join('');
			 jq("#quote_pannel").html(tabelHQ);
             //jq("#quote_pannel").html(newstr);
         }
     }

 window.setInterval(refreshMeetInfo, 2000);
