var body = "";
var headlines = new Array();
var page = 1;
var pages = 1;
var pagesize = 20;
var total = 20;
page = 1;
pages = 2;
total = 24;
headlines.push({"dateTime":"Jul 29, 2010 15:33 EDT",
"headline":"CANADA RESEARCH SUMMARY: July 29 1930 GMT", "article":"urn:newsml:reuters.com:20100729:nSGE66S0F8:2"});
headlines.push({"dateTime":"Jul 28, 2010 21:33 EDT",
"headline":"UPDATE 3-CP Rail profit up 23 pct on volumes, cost controls", "article":"urn:newsml:reuters.com:20100728:nN28188152:3"});
headlines.push({"dateTime":"Jul 28, 2010 20:05 EDT",
"headline":"CORRECTED-UPDATE 2-CP Rail earnings rise 23 pct on volumes", "article":"urn:newsml:reuters.com:20100728:nN27149660:16"});
headlines.push({"dateTime":"Jul 28, 2010 10:52 EDT",
"headline":"CANADA STOCKS-TSX edges lower as oils, golds retreat", "article":"urn:newsml:reuters.com:20100728:nN28179674:4"});
headlines.push({"dateTime":"Jul 28, 2010 09:01 EDT",
"headline":"CANADA STOCKS-TSX may open lower as oil prices flag", "article":"urn:newsml:reuters.com:20100728:nN28167973:2"});
headlines.push({"dateTime":"Jul 28, 2010 07:39 EDT",
"headline":"BRIEF-Canadian Pacific reports Q2 results", "article":"urn:newsml:reuters.com:20100728:nWNAB0191:7"});
headlines.push({"dateTime":"Jul 20, 2010 17:53 EDT",
"headline":"Montreal port idled a second day by labor dispute", "article":"urn:newsml:reuters.com:20100720:nN20110167:2"});
headlines.push({"dateTime":"Jul 19, 2010 15:07 EDT",
"headline":"UPDATE 1-Port of Montreal mostly shut by lock-out", "article":"urn:newsml:reuters.com:20100719:nN19139706:2"});
headlines.push({"dateTime":"Jul 14, 2010 09:38 EDT",
"headline":"UPDATE 1-Raymond James upgrades CN Rail to outperform", "article":"urn:newsml:reuters.com:20100714:nSGE66D0GL:2"});
headlines.push({"dateTime":"Jun 29, 2010 16:55 EDT",
"headline":"CANADA RESEARCH SUMMARY: June 29 2054 GMT", "article":"urn:newsml:reuters.com:20100629:nSGE65S0DE:2"});
headlines.push({"dateTime":"Jun 30, 2010 01:30 EDT",
"headline":"UPDATE 1-CP Rail details financial impact of flooding", "article":"urn:newsml:reuters.com:20100629:nN29154822:3"});
headlines.push({"dateTime":"Jun 29, 2010 12:08 EDT",
"headline":"BRIEF-CP says line closure will cut Q2 EPS C$0.10-C$0.13", "article":"urn:newsml:reuters.com:20100629:nWNA4528:5"});
headlines.push({"dateTime":"Jun 28, 2010 18:10 EDT",
"headline":"CANADA RESEARCH SUMMARY: June 28 2210 GMT", "article":"urn:newsml:reuters.com:20100628:nSGE65R0D1:2"});
headlines.push({"dateTime":"Jun 28, 2010 12:35 EDT",
"headline":"CP sees all of flood-hit rail track opened Tuesday", "article":"urn:newsml:reuters.com:20100628:nN28258888:2"});
headlines.push({"dateTime":"Jun 23, 2010 23:14 EDT",
"headline":"BRIEF-CP, TSI sign productivity and performance agreement", "article":"urn:newsml:reuters.com:20100623:nWNAB0594:5"});
headlines.push({"dateTime":"Jun 22, 2010 16:03 EDT",
"headline":"CP Rail says Canada traffic delayed by floods", "article":"urn:newsml:reuters.com:20100622:nN22274337:2"});
headlines.push({"dateTime":"Jun 16, 2010 15:10 EDT",
"headline":"UPDATE 1-Canada grain farmers say railways overcharging", "article":"urn:newsml:reuters.com:20100616:nN16179633:2"});
headlines.push({"dateTime":"Jun 16, 2010 13:09 EDT",
"headline":"Canada grain farmers say railways overcharging", "article":"urn:newsml:reuters.com:20100616:nN16169815:2"});
headlines.push({"dateTime":"Jun 12, 2010 19:09 EDT",
"headline":"BRIEF-Moody's raises Canadian Pacific debenture stock rtgs", "article":"urn:newsml:reuters.com:20100611:nWNA3286:4"});
headlines.push({"dateTime":"Jun 04, 2010 14:43 EDT",
"headline":"CANADA RESEARCH SUMMARY: June 4 1843 GMT", "article":"urn:newsml:reuters.com:20100604:nSGE653098:2"});
$(document).ready(function(){
var out = "";
if(body != null && body.length > 0){
out += body;
}
var white = true;
if(headlines.length > 0){
if(white) color = "ffffff";
else color = "eeeeee";
white = !white;
out += getPagination() + ""+
"
"+
""+
"";
out += ""+
"| Time | "+
" | "+
"News Story | ";
for(var i = 0; i < headlines.length; i++){
out += " | "+
" | "+
"";
var headline = headlines[i];
out += "| "+headlines[i].dateTime+" | "+
" | "+
""+
""+headlines[i].headline+"";
out += " | ";
}
out += " |
";
}
$('div#news').html(out);
});
function getPagination(){
var ret = "";
for(var i = 1; i < (pages + 1); i++){
var left = (i - 1) * pagesize;
var right = left + pagesize;
if(right > total) right = total;
var label = "["+left+"-"+right+"]";
if(i == page){
ret += "
"+label+"";
}else{
ret += "
"+label+"";
}
}
return ret + "
";
}