var org = {p3k: ({url:"http://rss.news.yahoo.com/rss/afghanistan", xml:"<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\" xmlns:ynews=\"http://news.yahoo.com/rss/\">\n<channel>\n<title>Yahoo! News: Afghanistan</title>\n<copyright>Copyright (c) 2010 Yahoo! Inc. All rights reserved.</copyright>\n<link>http://news.yahoo.com/world/asia/afghanistan</link>\n<category>world</category>\n<description>Afghanistan</description>\n<language>en-us</language> \n<lastBuildDate>Thu, 09 Sep 2010 05:40:00 GMT</lastBuildDate>\n<ttl>5</ttl> \n<image>\n<title>Yahoo! News</title>\n<width>142</width>\n<height>18</height>\n<link>http://news.yahoo.com/world/asia/afghanistan</link>\n<url>http://l.yimg.com/a/i/us/nws/th/main_142c.gif</url>\n</image>\n<item>\n<title>Afghan Cleric Uses Koran Burning for Political Gain \n    (Time.com)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/time/20100909/wl_time/08599201680800</link>\n <guid isPermaLink=\"false\">time/20100909/08599201680800</guid>\n<source>Time.com</source>\n<category>world</category>\n<pubDate>Thu, 09 Sep 2010 05:40:00 GMT</pubDate>\n<description>Time.com - Whether or not the Koran burning happens in Gainesville on Saturday, a religious conservative in Kabul is already using the event to propel his political ambitions</description>\n</item>\n<item>\n<title>Study urges US to scale back Afghan troops, goals \n    (AFP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100909/wl_sthasia_afp/afghanistanunrestuspolitics</link>\n <guid isPermaLink=\"false\">afp/20100909/afghanistanunrestuspolitics</guid>\n<source>AFP</source>\n<category>world</category>\n<pubDate>Thu, 09 Sep 2010 05:33:34 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100909/wl_sthasia_afp/afghanistanunrestuspolitics\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100909/capt.photo_1283996488479-1-0.jpg?x=130&amp;y=86&amp;q=85&amp;sig=9mOuJbgM7MZ6FR2WpP516w--\" align=\"left\" height=\"86\" width=\"130\" alt=\"US soldiers take cover during a patrol in the Arghandab Valley on September 6. The United States should scale back troops and goals in Afghanistan as its military campaign has backfired and boosted the Taliban, according to a study billed as a Plan B for President Barack Obama.(AFP/File/Patrick Baz)\" border=\"0\" />&#60;/a>AFP - The United States should scale back troops and goals in Afghanistan as its military campaign has backfired and boosted the Taliban, according to a study billed as a Plan B for President Barack Obama.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/afp/20100909/capt.photo_1283996488479-1-0.jpg?x=130&amp;y=86&amp;q=85&amp;sig=9mOuJbgM7MZ6FR2WpP516w--\" type=\"image/jpeg\" height=\"86\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100909/wl_sthasia_afp/afghanistanunrestuspolitics\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100909/capt.photo_1283996488479-1-0.jpg?x=130&amp;y=86&amp;q=85&amp;sig=9mOuJbgM7MZ6FR2WpP516w--\" align=\"left\" height=\"86\" width=\"130\" alt=\"photo\" title=\"US soldiers take cover during a patrol in the Arghandab Valley on September 6. The United States should scale back troops and goals in Afghanistan as its military campaign has backfired and boosted the Taliban, according to a study billed as a Plan B for President Barack Obama.(AFP/File/Patrick Baz)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AFP)</media:credit>\n</item>\n<item>\n<title>Karzai aims to limit foreign role in probes: report \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100909/wl_nm/us_afghanistan_corruption_rules</link>\n <guid isPermaLink=\"false\">nm/20100909/us_afghanistan_corruption_rules</guid>\n<source>Reuters</source>\n<category>world</category>\n<pubDate>Thu, 09 Sep 2010 04:51:07 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100909/wl_nm/us_afghanistan_corruption_rules\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" align=\"left\" height=\"94\" width=\"130\" alt=\"Afghan President Hamid Karzai speaks during a meeting with U.S. senator John Kerry at the Presidential Palace in Kabul August 20, 2010. REUTERS/Yuri Cortez/Pool\" border=\"0\" />&#60;/a>Reuters - Afghan President Hamid Karzai intends to impose rules restricting international involvement in anti-corruption investigations, The Washington Post reported on Thursday.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" type=\"image/jpeg\" height=\"94\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100909/wl_nm/us_afghanistan_corruption_rules\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" align=\"left\" height=\"94\" width=\"130\" alt=\"photo\" title=\"Afghan President Hamid Karzai speaks during a meeting with U.S. senator John Kerry at the Presidential Palace in Kabul August 20, 2010. REUTERS/Yuri Cortez/Pool\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(Reuters)</media:credit>\n</item>\n<item>\n<title>Army: Fort Lewis-based sergeant kept body parts \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100909/ap_on_re_us/us_afghan_probe</link>\n <guid isPermaLink=\"false\">ap/20100909/us_afghan_probe</guid>\n<source>AP</source>\n<category>us</category>\n<pubDate>Thu, 09 Sep 2010 00:50:49 GMT</pubDate>\n<description>AP - New documents released by the Army say a staff sergeant charged in a conspiracy to murder civilians kept Afghan body parts and threatened subordinates.</description>\n</item>\n<item>\n<title>Mullah Omar tells Afghans Taliban are winning \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_afghanistan</link>\n <guid isPermaLink=\"false\">ap/20100908/as_afghanistan</guid>\n<source>AP</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 17:58:48 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_afghanistan\">&#60;img src=\"http://d.yimg.com/a/p/ap/20100908/capt.11ceb0627f524847990bf9100d7c6374-c4282f55b12a49d6ae48685820c2e8a0-0.jpg?x=130&amp;y=96&amp;q=85&amp;sig=OveVdWMHBzwt6oTi1OFtCA--\" align=\"left\" height=\"96\" width=\"130\" alt=\"A worker cleans a poster of Afghanistan&#039;s Ahmad Shah Massoud, on the eve of his ninth death anniversary in Kabul, Afghanistan, Wednesday, Sept. 8, 2010. Two foreign suicide assassins, who had camouflaged themselves as journalists, killed Massoud on Sept. 9, 2001. (AP Photo/Andrew Biraj, Pool)\" border=\"0\" />&#60;/a>AP - The Taliban&#039;s shadowy leader told Afghans on Wednesday that the insurgents are winning the war and warned Americans that they are wasting lives and billions in tax dollars by continuing in the conflict.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/ap/20100908/capt.11ceb0627f524847990bf9100d7c6374-c4282f55b12a49d6ae48685820c2e8a0-0.jpg?x=130&amp;y=96&amp;q=85&amp;sig=OveVdWMHBzwt6oTi1OFtCA--\" type=\"image/jpeg\" height=\"96\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_afghanistan\">&#60;img src=\"http://d.yimg.com/a/p/ap/20100908/capt.11ceb0627f524847990bf9100d7c6374-c4282f55b12a49d6ae48685820c2e8a0-0.jpg?x=130&amp;y=96&amp;q=85&amp;sig=OveVdWMHBzwt6oTi1OFtCA--\" align=\"left\" height=\"96\" width=\"130\" alt=\"photo\" title=\"A worker cleans a poster of Afghanistan&#039;s Ahmad Shah Massoud, on the eve of his ninth death anniversary in Kabul, Afghanistan, Wednesday, Sept. 8, 2010. Two foreign suicide assassins, who had camouflaged themselves as journalists, killed Massoud on Sept. 9, 2001. (AP Photo/Andrew Biraj, Pool)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AP)</media:credit>\n</item>\n<item>\n<title>Mahmood Karzai profited on deal tied to Kabul Bank \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_mi_ea/ml_dubai_afghanistan_banks</link>\n <guid isPermaLink=\"false\">ap/20100908/ml_dubai_afghanistan_banks</guid>\n<source>AP</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 13:33:49 GMT</pubDate>\n<description>AP - Afghan President Hamid Karzai&#039;s brother says he made at least $800,000 by buying and then reselling a high-end Dubai villa using a loan provided by the chairman of the troubled Kabul Bank.</description>\n</item>\n<item>\n<title>Guards beat customers at crisis-hit Afghan bank \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100908/wl_nm/us_afghanistan_bank_queues</link>\n <guid isPermaLink=\"false\">nm/20100908/us_afghanistan_bank_queues</guid>\n<source>Reuters</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 13:00:02 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100908/wl_nm/us_afghanistan_bank_queues\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100908/i/r1569490002.jpg?x=130&amp;y=86&amp;q=85&amp;sig=1G2EXDSDQ_oVHfyEn0_KJg--\" align=\"left\" height=\"86\" width=\"130\" alt=\"Soldiers stand guard in front of Kabulbank, as people gather, in Kabul September 6, 2010. REUTERS/Andrew Biraj\" border=\"0\" />&#60;/a>Reuters - Afghan security forces used batons on unruly customers scrambling to withdraw their savings on Wednesday from a branch of the graft-hit Kabulbank, the country&#39;s biggest private financial institution.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/rids/20100908/i/r1569490002.jpg?x=130&amp;y=86&amp;q=85&amp;sig=1G2EXDSDQ_oVHfyEn0_KJg--\" type=\"image/jpeg\" height=\"86\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100908/wl_nm/us_afghanistan_bank_queues\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100908/i/r1569490002.jpg?x=130&amp;y=86&amp;q=85&amp;sig=1G2EXDSDQ_oVHfyEn0_KJg--\" align=\"left\" height=\"86\" width=\"130\" alt=\"photo\" title=\"Soldiers stand guard in front of Kabulbank, as people gather, in Kabul September 6, 2010. REUTERS/Andrew Biraj\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(Reuters)</media:credit>\n</item>\n<item>\n<title>U.N. agency to report fall in Afghan opium output \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100908/wl_nm/us_afghan_drugs</link>\n <guid isPermaLink=\"false\">nm/20100908/us_afghan_drugs</guid>\n<source>Reuters</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 12:52:40 GMT</pubDate>\n<description>Reuters - A United Nations agency will report that opium poppy production has fallen in Afghanistan this year but there are enough stocks to keep supplying heroin production, the agency&#39;s new chief said on Wednesday.</description>\n</item>\n<item>\n<title>Suspected US missile attacks rock NW Pakistan \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_pakistan</link>\n <guid isPermaLink=\"false\">ap/20100908/as_pakistan</guid>\n<source>AP</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 16:41:21 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_pakistan\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283925901379-1-0.jpg?x=130&amp;y=83&amp;q=85&amp;sig=Bx5VPDLAUSTSfB6qoqL2bQ--\" align=\"left\" height=\"83\" width=\"130\" alt=\"File photo of a US Predator unmanned drone armed with a missile on the tarmac of Kandahar military airport. A US missile strike on a militant compound in Pakistan&#39;s tribal district on the Afghan border killed 10 rebels on Wednesday, local security officials said.(AFP/File/Massoud Hossaini)\" border=\"0\" />&#60;/a>AP - Three suspected U.S. missile strikes in less than 12 hours hit militant targets in northwestern Pakistan on Wednesday, officials said, an unusually intense barrage that follows four other such attacks in the last week. At least 14 suspected militants were killed.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283925901379-1-0.jpg?x=130&amp;y=83&amp;q=85&amp;sig=Bx5VPDLAUSTSfB6qoqL2bQ--\" type=\"image/jpeg\" height=\"83\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_pakistan\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283925901379-1-0.jpg?x=130&amp;y=83&amp;q=85&amp;sig=Bx5VPDLAUSTSfB6qoqL2bQ--\" align=\"left\" height=\"83\" width=\"130\" alt=\"photo\" title=\"File photo of a US Predator unmanned drone armed with a missile on the tarmac of Kandahar military airport. A US missile strike on a militant compound in Pakistan&#39;s tribal district on the Afghan border killed 10 rebels on Wednesday, local security officials said.(AFP/File/Massoud Hossaini)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AP)</media:credit>\n</item>\n<item>\n<title>I tricked Afghan captors with Twitter: Japan journalist \n    (AFP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100908/wl_asia_afp/afghanistanunrestjapanjournalistkidnap</link>\n <guid isPermaLink=\"false\">afp/20100908/afghanistanunrestjapanjournalistkidnap</guid>\n<source>AFP</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 10:12:38 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100908/wl_asia_afp/afghanistanunrestjapanjournalistkidnap\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283926611279-1-0.jpg?x=103&amp;y=130&amp;q=85&amp;sig=QcCoWprM6jUnqsFcYlqWwA--\" align=\"left\" height=\"130\" width=\"103\" alt=\"Japanese freelance journalist Kosuke Tsuneoka in Tokyo after returning to Japan following five months&#39; captivity in Afghanistan. Tsuneoka was freed after a five-month hostage ordeal in Afghanistan says he used Twitter to announce he was still alive under the noses of his captors, who did not understand English.(AFP/Yoshikazu Tsuno)\" border=\"0\" />&#60;/a>AFP - A Japanese freelance journalist freed after a five-month hostage ordeal in Afghanistan says he used Twitter to announce he was still alive under the noses of his captors, who did not understand English.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283926611279-1-0.jpg?x=103&amp;y=130&amp;q=85&amp;sig=QcCoWprM6jUnqsFcYlqWwA--\" type=\"image/jpeg\" height=\"130\" width=\"103\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100908/wl_asia_afp/afghanistanunrestjapanjournalistkidnap\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283926611279-1-0.jpg?x=103&amp;y=130&amp;q=85&amp;sig=QcCoWprM6jUnqsFcYlqWwA--\" align=\"left\" height=\"130\" width=\"103\" alt=\"photo\" title=\"Japanese freelance journalist Kosuke Tsuneoka in Tokyo after returning to Japan following five months&#39; captivity in Afghanistan. Tsuneoka was freed after a five-month hostage ordeal in Afghanistan says he used Twitter to announce he was still alive under the noses of his captors, who did not understand English.(AFP/Yoshikazu Tsuno)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AFP)</media:credit>\n</item>\n<item>\n<title>Britain&#39;s Afghan envoy resigns: Foreign Office \n    (AFP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100908/wl_sthasia_afp/britainafghanistanpakistannatomilitary</link>\n <guid isPermaLink=\"false\">afp/20100908/britainafghanistanpakistannatomilitary</guid>\n<source>AFP</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 09:47:36 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100908/wl_sthasia_afp/britainafghanistanpakistannatomilitary\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283937911342-1-0.jpg?x=96&amp;y=130&amp;q=85&amp;sig=5ULJNrYUYyUj8bl01EVT3w--\" align=\"left\" height=\"130\" width=\"96\" alt=\"Britain&#39;s special representative to Afghanistan and Pakistan, Sherard Cowper-Coles, seen here in 2009. Cowper-Coles is quitting with immediate effect, following a reported clash with NATO and US officials on fighting the Taliban.(AFP/File/Farooq Naeem)\" border=\"0\" />&#60;/a>AFP - Britain&#39;s special representative to Afghanistan and Pakistan is quitting with immediate effect, London said Wednesday, following a reported clash with NATO and US officials on fighting the Taliban.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283937911342-1-0.jpg?x=96&amp;y=130&amp;q=85&amp;sig=5ULJNrYUYyUj8bl01EVT3w--\" type=\"image/jpeg\" height=\"130\" width=\"96\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100908/wl_sthasia_afp/britainafghanistanpakistannatomilitary\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100908/capt.photo_1283937911342-1-0.jpg?x=96&amp;y=130&amp;q=85&amp;sig=5ULJNrYUYyUj8bl01EVT3w--\" align=\"left\" height=\"130\" width=\"96\" alt=\"photo\" title=\"Britain&#39;s special representative to Afghanistan and Pakistan, Sherard Cowper-Coles, seen here in 2009. Cowper-Coles is quitting with immediate effect, following a reported clash with NATO and US officials on fighting the Taliban.(AFP/File/Farooq Naeem)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AFP)</media:credit>\n</item>\n<item>\n<title>Japan reporter tricked captors into using Twitter \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_japan_afghan_missing_journalist</link>\n <guid isPermaLink=\"false\">ap/20100908/as_japan_afghan_missing_journalist</guid>\n<source>AP</source>\n<category>world</category>\n<pubDate>Wed, 08 Sep 2010 02:45:01 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_japan_afghan_missing_journalist\">&#60;img src=\"http://d.yimg.com/a/p/ap/20100907/capt.35e03658518440de8e716cd422d3973e-35e03658518440de8e716cd422d3973e-0.jpg?x=94&amp;y=130&amp;q=85&amp;sig=_6k9A1qQw8gqL.u94Zeb0Q--\" align=\"left\" height=\"130\" width=\"94\" alt=\"Freed Japanese freelance journalist Kosuke Tsuneoka ponders on reporters&#039; questions during a press conference at the Foreign Correspondents&#039; Club of Japan in Tokyo, Tuesday, Sept. 7, 2010. Tsuneoka was kidnapped in April, when he traveled to a Taliban-controlled area in northern Afghanistan, and was released Saturday night to a Japanese Embassy. (AP Photo/Shizuo Kambayashi)\" border=\"0\" />&#60;/a>AP - A Japanese journalist held hostage in Afghanistan for five months managed to send out a message via Twitter that he was alive when his captors asked him how to use a cell phone.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/ap/20100907/capt.35e03658518440de8e716cd422d3973e-35e03658518440de8e716cd422d3973e-0.jpg?x=94&amp;y=130&amp;q=85&amp;sig=_6k9A1qQw8gqL.u94Zeb0Q--\" type=\"image/jpeg\" height=\"130\" width=\"94\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100908/ap_on_re_as/as_japan_afghan_missing_journalist\">&#60;img src=\"http://d.yimg.com/a/p/ap/20100907/capt.35e03658518440de8e716cd422d3973e-35e03658518440de8e716cd422d3973e-0.jpg?x=94&amp;y=130&amp;q=85&amp;sig=_6k9A1qQw8gqL.u94Zeb0Q--\" align=\"left\" height=\"130\" width=\"94\" alt=\"photo\" title=\"Freed Japanese freelance journalist Kosuke Tsuneoka ponders on reporters&#039; questions during a press conference at the Foreign Correspondents&#039; Club of Japan in Tokyo, Tuesday, Sept. 7, 2010. Tsuneoka was kidnapped in April, when he traveled to a Taliban-controlled area in northern Afghanistan, and was released Saturday night to a Japanese Embassy. (AP Photo/Shizuo Kambayashi)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AP)</media:credit>\n</item>\n<item>\n<title>NATO says Afghan forces can take control next year \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100907/ap_on_go_ca_st_pe/us_us_afghanistan</link>\n <guid isPermaLink=\"false\">ap/20100907/us_us_afghanistan</guid>\n<source>AP</source>\n<category>politics</category>\n<pubDate>Tue, 07 Sep 2010 23:55:16 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100907/ap_on_go_ca_st_pe/us_us_afghanistan\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" align=\"left\" height=\"94\" width=\"130\" alt=\"Afghan President Hamid Karzai speaks during a meeting with U.S. senator John Kerry at the Presidential Palace in Kabul August 20, 2010. REUTERS/Yuri Cortez/Pool\" border=\"0\" />&#60;/a>AP - U.S.-led NATO troops in Afghanistan should be able to start handing off responsibility for security to the Kabul government sometime next year, Secretary-General Anders Fogh Rasmussen said Tuesday.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" type=\"image/jpeg\" height=\"94\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100907/ap_on_go_ca_st_pe/us_us_afghanistan\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" align=\"left\" height=\"94\" width=\"130\" alt=\"photo\" title=\"Afghan President Hamid Karzai speaks during a meeting with U.S. senator John Kerry at the Presidential Palace in Kabul August 20, 2010. REUTERS/Yuri Cortez/Pool\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AP)</media:credit>\n</item>\n<item>\n<title>U.S. says not considering NATO Afghan troop request \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100907/wl_nm/us_afghanistan_usa_nato</link>\n <guid isPermaLink=\"false\">nm/20100907/us_afghanistan_usa_nato</guid>\n<source>Reuters</source>\n<category>world</category>\n<pubDate>Tue, 07 Sep 2010 19:25:14 GMT</pubDate>\n<description>Reuters - The United States does not plan to contribute to a NATO request for 2,000 troops for the Afghan war, the Pentagon said on Tuesday, even as the head of the alliance held out the possibility of U.S. participation.</description>\n</item>\n<item>\n<title>Afghanistan freezes troubled bank shareholder assets \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100907/wl_nm/us_afghanistan_bank_assets</link>\n <guid isPermaLink=\"false\">nm/20100907/us_afghanistan_bank_assets</guid>\n<source>Reuters</source>\n<category>world</category>\n<pubDate>Tue, 07 Sep 2010 17:48:46 GMT</pubDate>\n<description>Reuters - Afghanistan has frozen the assets of leading shareholders and borrowers at the country&#39;s top private bank, officials said on Tuesday, causing long queues of anxious depositors to throng its branches.</description>\n</item>\n<item>\n<title>Pressure mounts in U.S. against Koran-burning plan \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100907/ts_nm/us_afghanistan_usa_koran</link>\n <guid isPermaLink=\"false\">nm/20100907/us_afghanistan_usa_koran</guid>\n<source>Reuters</source>\n<category>topstories</category>\n<pubDate>Tue, 07 Sep 2010 17:38:22 GMT</pubDate>\n<description>Reuters - Civil and military leaders stepped up calls on Tuesday for an obscure U.S. pastor to drop his plans to burn copies of the Koran on the anniversary of the September 11 attacks, as fears grew it would fan religious hatred.</description>\n</item>\n<item>\n<title>Afghan Elections: Candidates Flock to Kabul for Safety \n    (Time.com)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/time/20100907/wl_time/08599201618800</link>\n <guid isPermaLink=\"false\">time/20100907/08599201618800</guid>\n<source>Time.com</source>\n<category>world</category>\n<pubDate>Tue, 07 Sep 2010 16:40:00 GMT</pubDate>\n<description>Time.com - More than 600 candidates are running for office out of Afghanistan&#39;s capital because it isn&#39;t safe to campaign in the provinces</description>\n</item>\n<item>\n<title>Petraeus warns on Koran burning as Muslim world reacts \n    (AFP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100907/pl_afp/afghanistanunrestusreligionislam</link>\n <guid isPermaLink=\"false\">afp/20100907/afghanistanunrestusreligionislam</guid>\n<source>AFP</source>\n<category>politics</category>\n<pubDate>Tue, 07 Sep 2010 16:19:44 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100907/pl_afp/afghanistanunrestusreligionislam\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100907/capt.photo_1283843585250-4-0.jpg?x=130&amp;y=97&amp;q=85&amp;sig=EKCB3KgK9VktbbCwMvWzgA--\" align=\"left\" height=\"97\" width=\"130\" alt=\"International Security Assistance Force (ISAF) commander and the head of NATO in Afghanistan, General David Petraeus speaks to the media at his office in Kabul in August 2010. Petraeus warned Tuesday that a decision by American evangelicals to burn the Koran on 9/11 would endanger his troops as the Muslim world reacted angrily to the plan.(AFP/File/Shah Marai)\" border=\"0\" />&#60;/a>AFP - The US commander of the Afghan war warned Tuesday that a decision by American evangelicals to burn the Koran on 9/11 would endanger his troops as the Muslim world reacted angrily to the plan.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/afp/20100907/capt.photo_1283843585250-4-0.jpg?x=130&amp;y=97&amp;q=85&amp;sig=EKCB3KgK9VktbbCwMvWzgA--\" type=\"image/jpeg\" height=\"97\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/afp/20100907/pl_afp/afghanistanunrestusreligionislam\">&#60;img src=\"http://d.yimg.com/a/p/afp/20100907/capt.photo_1283843585250-4-0.jpg?x=130&amp;y=97&amp;q=85&amp;sig=EKCB3KgK9VktbbCwMvWzgA--\" align=\"left\" height=\"97\" width=\"130\" alt=\"photo\" title=\"International Security Assistance Force (ISAF) commander and the head of NATO in Afghanistan, General David Petraeus speaks to the media at his office in Kabul in August 2010. Petraeus warned Tuesday that a decision by American evangelicals to burn the Koran on 9/11 would endanger his troops as the Muslim world reacted angrily to the plan.(AFP/File/Shah Marai)\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AFP)</media:credit>\n</item>\n<item>\n<title>NATO aims to oust Taliban from Kandahar by November \n    (Reuters)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/nm/20100907/wl_nm/us_afghanistan_kandahar</link>\n <guid isPermaLink=\"false\">nm/20100907/us_afghanistan_kandahar</guid>\n<source>Reuters</source>\n<category>world</category>\n<pubDate>Tue, 07 Sep 2010 15:53:54 GMT</pubDate>\n<description>Reuters - Afghan and NATO forces are planning an offensive to clear Taliban insurgents from areas around the city of Kandahar by late November, the NATO commander for southern Afghanistan said on Tuesday.</description>\n</item>\n<item>\n<title>NATO: Taliban outnumbered around key Afghan city \n    (AP)\n</title>\n <link>http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100907/ap_on_re_eu/eu_nato_afghanistan</link>\n <guid isPermaLink=\"false\">ap/20100907/eu_nato_afghanistan</guid>\n<source>AP</source>\n<category>world</category>\n<pubDate>Tue, 07 Sep 2010 15:27:26 GMT</pubDate>\n<description>&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100907/ap_on_re_eu/eu_nato_afghanistan\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" align=\"left\" height=\"94\" width=\"130\" alt=\"Afghan President Hamid Karzai speaks during a meeting with U.S. senator John Kerry at the Presidential Palace in Kabul August 20, 2010. REUTERS/Yuri Cortez/Pool\" border=\"0\" />&#60;/a>AP - The NATO-led coalition has overwhelming numerical superiority over the Taliban around the key southern Afghan city of Kandahar and expects to clear the area of insurgents by November&#039;s end, a top commander said Tuesday.&#60;/p>&#60;br clear=\"all\"/></description>\n<media:content url=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" type=\"image/jpeg\" height=\"94\" width=\"130\"/>\n<media:text type=\"html\">&#60;p>&#60;a href=\"http://us.rd.yahoo.com/dailynews/rss/afghanistan/*http://news.yahoo.com/s/ap/20100907/ap_on_re_eu/eu_nato_afghanistan\">&#60;img src=\"http://d.yimg.com/a/p/rids/20100909/i/r3876420104.jpg?x=130&amp;y=94&amp;q=85&amp;sig=dtmGZPwtTmsDYqZIhKheqQ--\" align=\"left\" height=\"94\" width=\"130\" alt=\"photo\" title=\"Afghan President Hamid Karzai speaks during a meeting with U.S. senator John Kerry at the Presidential Palace in Kabul August 20, 2010. REUTERS/Yuri Cortez/Pool\" border=\"0\"/>&#60;/a>&#60;/p>&#60;br clear=\"all\"/></media:text>\n<media:credit role=\"publishing company\">(AP)</media:credit>\n</item>\n</channel>\n</rss>\n<!-- server api5.sub.news.mud.yahoo.com -->\n", message:undefined, modified:(new Date(1284015070659)), baseUri:"http://p3k.org/rss/", query:"frameColor=black&textColor=black&_=1206278688524&titleBarColor=#3366ff&compact=&fontFace=&align=center&showXmlButton=true&maxItems=10&boxFillColor=#ccffff&undefined=&titleBarTextColor=black&width=750&url=http://rss.news.yahoo.com/rss/afghanistan&", param:{textColor:"black", width:"750", align:"center", fontFace:"", url:"http://rss.news.yahoo.com/rss/afghanistan", compact:"", frameColor:"black", showXmlButton:"true", undefined:"", boxFillColor:"#ccffff", _:"1206278688524", titleBarColor:"#3366ff", maxItems:"10", titleBarTextColor:"black"}, box:"<table class=\"rssBox\" width=\"${width}\" bgcolor=\"${frameColor}\" \n      style=\"table-layout: fixed; overflow: hidden; font-family: ${fontFace};\" \n      align=\"${align}\" cellspacing=\"1\" cellpadding=\"7\" border=\"0\">\n<tr bgcolor=\"${titleBarColor}\">\n<td>\n   ${xmlButton}\n   <strong>${title}</strong>\n   <div>\n      <small style=\"color: ${titleBarTextColor};\">${date}</small>\n   </div>\n</td>\n</tr>\n<tr bgcolor=\"${boxFillColor}\">\n<td class=\"rssBoxContent\" style=\"color: ${textColor};\">\n   ${image}\n   ${items}\n   ${input}\n   <div class=\"rssBoxPromo\" style=\"margin-top: 0px; text-align: left; \n         font: 9px verdana, sans-serif\">\n      RSS box by <a href=\"http://p3k.org/rss\">p3k.org</a>.\n   </div>\n</td>\n</tr>\n</table>\n\n", image:"<a href=\"${link}\"><img src=\"${source}\" width=\"${width}\" height=\"${height}\" \nalt=\"${title}\" title=\"${title}\" align=\"${align}\" valign=\"${valign}\" \nhspace=\"${hspace}\" vspace=\"${vspace}\" border=\"0\" /></a>\n\n", input:"<form method=\"get\" action=\"${link}\">\n${description}\n<input type=\"text\" name=\"${name}\" size=\"15\" /> <input type=\"submit\" \nvalue=\"${title}\" />\n</form>\n\n", item:"<div class=\"rssBoxItemContent\">\n${title}\n${break}\n${description}\n${buttons}\n</div><br />\n\n", date:"${year}-${month}-${day}, ${hours}:${minutes}h\n\n", link:"<a class=\"${class}\" href=\"${link}\" style=\"${style}\">${text}</a>\n", error:"<?xml version=\"1.0\"?>\n<rss version=\"error\">\n   <channel>\n      <title>RSS Box Error</title>\n      <link>${link}</link>\n      <description>This output was automatically generated to report an error \n      that occurred during a request to the JavaScript RSS Box Viewer.</description>\n      <item>\n         <title>Oops, something went wrong...</title>\n         <description>An error occurred while processing the request to the \n         JavaScript RSS Box Viewer.</description>\n      </item>\n      <item>\n         <title>An error message was returned by the server.</title>\n         <description>${message}</description>\n      </item>\n      <item>\n         <description>Most likely, this might have happened because of a \n         non-existent or invalid RSS feed URL. Please check and possibly correct \n         your input, then try again.</description>\n      </item>\n   </channel>\n</rss>\n\n"})};
function debug(str) {
   return document.write('<p><span style="background-color: yellow;">', 
         str, '</span><p>');
}

org.p3k.RssBox = function() {
   var ref;
   var ISOPATTERN = /([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9:]+).*$/;
   
   var data = org.p3k;
   data.defaults = {
      url: "http://blog.p3k.org/rss",
      maxItems: 7,
      width: 200,
      align: "",
      frameColor: "black",
      titleBarColor: "lightblue",
      titleBarTextColor: "black",
      boxFillColor: "white",
      textColor: "black",
      showXmlButton: "",
      compact: ""
   };
   
   var baseUri = data.baseUri;
    
   var getColor = function(str) {
      if (str.length === 6 && parseInt(str, 16) && str.indexOf("#") !== 0) {
         str = "#" + str;
      }
      return str.toLowerCase();
   }

   var value;
   for (var i in data.defaults) {
      value = data.param[i];
      if (!value || value.length === 0) {
         data.param[i] = data.defaults[i];
      } else if (i.indexOf("Color") > 0) {
         data.param[i] = getColor(value);
      }
   }

   // FIXME: Ugly work-around for many boxes using too small width 
   // values because the former version did not show the exact output.
   if (data.param.javascript && data.param.width < 200) {
      data.param.width = 200;
   }
   // Remove obsolete parameters from param and query
   delete data.param.javascript;
   data.query = data.query.replace("javascript=true", "");   

   var NAMESPACES = {
      dc: "http://purl.org/dc/elements/1.1/",
      rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   };

   var getUrl = function(url) {
      url = baseUri + "proxy.r?" + encodeURIComponent(url);
   
      var HttpRequest = function() {
         return (typeof XMLHttpRequest !== "undefined") ?
            new XMLHttpRequest() : new ActiveXObject("Msxml2.XMLHTTP");
      }
   
      var request = new HttpRequest();
      request.open("GET", url, false);
      request.send(null);   
      if (!request.getResponseHeader("Date")) {
         var cached = request;
         var ifModifiedSince = cached.getResponseHeader("Last-Modified") || 
               new Date(0); // January 1, 1970
         request = new HttpRequest();
         request.open("GET", url, false);
         request.setRequestHeader("If-Modified-Since", ifModifiedSince);
         request.send("");
         if (request.status === 304) {
            request = cached; 
         }
      }
      return request;
   }
   
   var getDocument = function(source) {
      if (source) {
         if (document.implementation.createDocument) {
            var parser = new DOMParser();
            var doc = parser.parseFromString(source, "text/xml");
            return doc;
         } else if (window.ActiveXObject) {
            var doc = new ActiveXObject("Microsoft.XMLDOM");
            doc.async = "false";
            doc.loadXML(source);
            return doc;
         }
      }
      return null;
   }
   
   var getError = function() {
      var msg = null, root;
      if (!xml || data.message) {
         msg = data.message || "Unknown error.";
      } else if (xml.parseError && xml.parseError.errorCode) {
         msg = xml.parseError.reason; // IExplore
      } else if (root = xml.documentElement) {
         var errorNode;
         if (root.nodeName === "parsererror") {
            msg = xml.documentElement.textContent; // Mozilla
         } else if ((errorNode = root.childNodes[0]) && 
               errorNode.nodeName === "parsererror") {
            msg = errorNode.textContent; // Safari
         } else if (!/rss|rdf|scriptingNews/i.test(xml.documentElement.nodeName)) {
            msg = "Incompatible data format. Are you sure this is an RSS feed?";
         }
      }
      return msg;
   }
   
   var getNode = function(parent, name, namespace) {
      if (namespace) {
         if (typeof parent.getElementsByTagNameNS === "undefined") {
            var elements = parent.getElementsByTagName(namespace + ":" + name);
         } else {
            var elements = parent.getElementsByTagNameNS(NAMESPACES[namespace], name);
         }
      } else {
         var elements = parent.getElementsByTagName(name);
      }
      if (elements && elements[0]) {
         return elements[0];
      }
      return null;
   }
   
   var getText = function(node) {
      if (node && node.childNodes && node.childNodes.length > 0) {
         return node.childNodes[0].nodeValue || "";
      }
      return "";
   }
   
   var trim = function(str) {
      if (str) {
         return str.replace(/^\s*(\S*)\s*$/, "$1");
      }
      return "";
   }
   
   var padZero = function(n) {
      if (n < 10) {
         return "0" + n
      }
      return n;
   }

   var encodeXml = function(str) {
      if (!str) {
         return "";
      }
      return str.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/&/g, "&amp;");
   }
      
   var render = function(template, param) {
      if (!template || !param) {
         return template;
      }
      template = template.replace(/\$\{([^}]+)\}/g, function() {
         var key = arguments[1];
         return param[key] || "";
      });
      return template;
   }
   
   var renderDate = function(date) {
      if (date.constructor !== Date) {
         var str = String(date);
         var millis = Date.parse(str.replace(ISOPATTERN, "$1/$2/$3 $4"));
         if (millis) {
            date = new Date(millis);
         } else {
            date = new Date;
         }
      }

      return render(data.date, {
         year: date.getFullYear(),
         month: padZero(date.getMonth() + 1),
         day: padZero(date.getDate()),
         hours: padZero(date.getHours()),
         minutes: padZero(date.getMinutes()),
         seconds: padZero(date.getSeconds()),
         timeZone: "" // date.getTimezoneOffset()
      });
   }
   
   var renderButtons = function(enclosure, source) {
      var result = "";
      if (enclosure && enclosure.link) {
         result += render(data.image, {
            source: baseUri + "enclosure.gif",
            title: enclosure.type,
            link: encodeURI(enclosure.link),
            width: 13,
            height: 16
         });
      }
      if (source && source.link) {
         result += render(data.image, {
            source: baseUri + "source.gif",
            title: source.title,
            link: encodeURI(source.link),
            width: 15,
            height: 15
         });
      }
      return result;         
   }
   
   var param = data.param;
   var rss = data.rss = {items: []};
   var xml = getDocument(data.xml);

   rss.error = getError();
   if (rss.error !== null) {
      xml = getDocument(render(data.error, {
         link: baseUri + "?" + encodeXml(data.query),
         message: encodeXml(rss.error)
      }));
      param.compact = 0;
      param.showXmlButton = 1;
   }

   var root = xml.documentElement;
   var type = root.nodeName;

   if (type === "scriptingNews") {
      var channel = getNode(xml, "header");
      rss.format = "Scripting News";
      rss.version = getText(getNode(channel, "scriptingNewsVersion"));
      rss.title = getText(getNode(channel, "channelTitle"));
      rss.description = getText(getNode(channel, "channelDescription"));
      rss.link = getText(getNode(channel, "channelLink"));
      if (ref = getText(getNode(channel, "imageUrl"))) {
         ref = rss.image = {source: ref};
         ref.title = getText(getNode(channel, "imageTitle"));
         ref.link = getText(getNode(channel, "imageLink"));
         ref.width = getText(getNode(channel, "imageWidth"));
         ref.height = getText(getNode(channel, "imageHeight"));
         ref.description = getText(getNode(channel, "imageCaption"));
      }
   } else {
      var channel = getNode(xml, "channel");
      rss.format = "RSS";
      rss.version = (type === "rdf:RDF") ? "1.0" : 
            root.getAttribute("version");
      rss.title = getText(getNode(channel, "title"));
      rss.description = getText(getNode(channel, "description"));
      rss.link = getText(getNode(channel, "link"));
      var image = getNode(xml, "image");
      if (image) {
         ref = rss.image = {};
         ref.source = getText(getNode(image, "url"));
         ref.title = getText(getNode(image, "title"));
         ref.link = getText(getNode(image, "link"));
         ref.width = getText(getNode(image, "width"));
         ref.height = getText(getNode(image, "height"));
         ref.description = getText(getNode(image, "description"));
      }
   }
   
   if (type === "rdf:RDF") {
      rss.date = renderDate(getText(getNode(channel, "date", "dc")) || data.modified);
      rss.rights = getText(getNode(channel, "creator", "dc"));
      var input = getNode(root, "textinput");
      if (input && !getNode(input, "link")) {
         input = root.getElementsByTagName("textinput")[1];
      }
      if (input) {
         ref = rss.input = {};
         ref.link = getText(getNode(input, "link"));
         ref.description = getText(getNode(input, "description"));
         ref.name = getText(getNode(input, "name"));
         ref.title = getText(getNode(input, "title"));
      }
   } else {
      rss.date = renderDate(getText(getNode(channel, "lastBuildDate") || getText(getNode(channel, "pubDate"))) || data.modified);
      rss.rights = getText(getNode(channel, "copyright"));
   }
   
   var item, text, node;
   var items = xml.getElementsByTagName("item");

   for (var i=0; i<Math.min(items.length, param.maxItems); i+=1) {
      item = items[i];

      if (type === "scriptingNews") {
         ref = {title: ""};
         ref.description = getText(getNode(item, "text")).replace(/\n/g, " ");
         ref.link = getText(getNode(item, "link"));
         if (text = trim(getText(getNode(item, "linetext")).replace(/\n/g, " "))) {
            ref.description = ref.description.replace(new RegExp(text), 
                  '<a href="' + getText(getNode(item, "url")) + '">' + text + '</a>');
         }
      } else {
         ref = {
            title: getText(getNode(item, "title")),
            description: getText(getNode(item, "description")),
            link: getText(getNode(item, "link") || getNode(item, "guid"))
         };
     }

     if (node = getNode(item, "source")) {
        ref.source = {
           link: node.getAttribute("url"),
           title: getText(node)
        }
     }
     
     if (node = getNode(item, "enclosure")) {
        ref.enclosure = {
           link: node.getAttribute("url"),
           length: node.getAttribute("length"),
           type: node.getAttribute("type")
        }
     }
     
     if (node = getNode(item, "category")) {
        ref.category = {
           domain: node.getAttribute("domain") || "",
           content: getText(node)
        }
     }
     
     rss.items.push(ref);
   }
   
   var item, items = "";
   for (var i=0; i<rss.items.length; i+=1) {
      item = rss.items[i];
      items += render(data.item, {
         title: new function() {
            var title = (!param.compact ? "<strong>" : "");
            if (item.link) {
               title += render(data.link, {
                  link: encodeURI(item.link),
                  text: item.title,
                  'class': "rssBoxItemTitle"
               });
            } else {
               title += item.title;
            }
            !param.compact && (title += "</strong>");
            return new String(title); // FIXME: Funny, title alone will be rendered as [object]
         }(),
         'break': item.title && item.description ? "<br />" : "",
         description: (!param.compact || !item.title) && item.description,
         buttons: renderButtons(item.enclosure, item.source)
      });
   }
   
   var box = render(data.box, {
      title: rss.link ? render(data.link, {
         link: encodeURI(rss.link),
         text: rss.title,
         'class': "rssBoxTitle",
         style: "color: " + param.titleBarTextColor
      }) : rss.title,
      description: rss.description,
      items: items,

      xmlButton: param.showXmlButton && render(data.image, {
         link: param.url,
         source: baseUri + "rss.png",
         title: rss.format + " " + rss.version,
         width: 16,
         height: 16,
         align: "right",
         hspace: 3
      }),
      
      image: !param.compact && rss.image && render(data.image, {
         link: encodeURI(rss.image.link),
         source: rss.image.source,
         width: rss.image.width,
         height: rss.image.height,
         title: rss.image.title,
         align: "right",
         valign: "baseline",
         hspace: 5,
         vspace: 5
      }),
      
      input: !param.compact && rss.input && render(data.input, {
         link: encodeURI(rss.input.link),
         description: rss.input.description,
         name: rss.input.name,
         title: rss.input.title
      }),
      
      date: rss.date,
      width: param.width,
      frameColor: param.frameColor,
      fontFace: param.fontFace,
      align: param.align,
      titleBarColor: param.titleBarColor,
      titleBarTextColor: param.titleBarTextColor,
      boxFillColor: param.boxFillColor,
      textColor: param.textColor
   });

   if (!window.rssBoxSetup) {
      document.write(box);
   }
   
   return box;
};

org.p3k.RssBox();

