var junk=new Array();

//0:title,1:link,2:source,3:summary,4:picture,5:width,6:height
junk[0]=new Array('Rare Tibetan Buddhist shrine goes on display in Washington','http://www.phayul.com/news/article.aspx?id=26886','','The exhibition coincides with Tibetans marking the anniversary of the March 12, 1959 uprising against China, and amid continuing tensions between China and Tibetan independence activists', '100313021143YV.jpg', '110', '70');junk[1]=new Array('Protesters storm Chinese Embassy to mark Women\'s Uprising Day','http://www.phayul.com/news/article.aspx?id=26882','','Eight Tibetan students belonging to pro-Independence Tibetan Youth Congress (TYC) Saturday staged vigorous protests outside of the Chinese Embassy in the Indian capital.', '100312102635C7.jpg', '110', '74');junk[2]=new Array('Other world leaders should meet Dalai Lama: envoy','http://www.phayul.com/news/article.aspx?id=26880','','World leaders should follow the example of US President Barack Obama and meet the Dalai Lama despite China\'s objections, the Tibetan spiritual leader\'s envoy to Europe said Thursday', '1003120741232S.jpg', '74', '110');junk[3]=new Array('Nepal jails Tibetan protesters without trial for 90 days','http://www.phayul.com/news/article.aspx?id=26874','','At least Sixteen Tibetan exiles arrested after they attempted to storm the Chinese Embassy in Nepal\'s capital earlier this week will remain in jail without trial for 90 days, Nepalese officials have said', '100312042149EH.jpg', '110', '62');junk[4]=new Array('China calls U.S. a hypocrite over human rights','http://www.phayul.com/news/article.aspx?id=26876','','China accused Washington of hypocrisy on Friday for its criticism of Beijing\'s restrictions on the Internet and dissent, blaming the United States for the', '', '110', '62');junk[5]=new Array('Tibetan Language version of Dalai Lama\'s website launched','http://www.phayul.com/news/article.aspx?id=26872','','Amidst growing demand for Tibetan version of the official website of His Holiness the Dalai Lama, a new website www.gyalwarinpoche.com l', '1003120337526R.jpg', '110', '69');junk[6]=new Array('US criticizes China\'s domestic, economic policies','http://www.phayul.com/news/article.aspx?id=26871','','The Obama administration accused China on Thursday of abusing its citizens\' rights and maintaining currency policies that cost millions of U.S. jobs, a double-ba', '', '110', '69');junk[7]=new Array('Angry China blasts Dalai Lama\'s Tibet anniversary speech','http://www.phayul.com/news/article.aspx?id=26853','','Officials of the Chinese Communist government have reacted with anger to a speech by exiled Tibetan leader His Holiness the Dalai Lama in which he said Tibetan Buddhists were living in prison-like conditions and, expressed sympathy with the people of East Turkestan and Chinese intellectuals campaigning for greater freedom.', '100311010343MO.jpg', '110', '82');junk[8]=new Array('March 10 rally in Ottawa calls on G8 leaders to promote Tibet dialogue with Hu','http://www.phayul.com/news/article.aspx?id=26861','','The Canada Tibet Committee (CTC) called on Prime Minister Stephen Harper, as host of the G8 summit, to bring his counterparts together to deliver an unambiguous', '', '110', '82');junk[9]=new Array('March 10 around the world - compiled report','http://www.phayul.com/news/article.aspx?id=26864','','As thousands of Tibetans and Tibet supporters in dozens of countries took to the streets yesterday to commemorate the 51st anniversary of Tibetan National Uprising Day and to show solidarity with a new nonviolent resistance movement ga', '100311041812RB.jpg', '110', '82');
if(arrLength>10)
{
	arrLength=10;
}

document.write("<table width=" + tWidth + " bgColor=" + bgColor + " cellpadding=" + tPadding + ">");
for(i=0; i<=arrLength-1; i++)
{

	document.write("<tr>");
	document.write("<td>");

	//SHOWS ARTICLE TITLE
	document.write("<a target=\"_blank\" href=\"" + junk[i][1] + "\"><font face=\"" + AtfType + "\" color=" + AtfColor + " size=" + AtfSize + ">");

	if(AtB) { document.write("<b>"); }
	if(AtI) { document.write("<i>"); }
	document.write(crop_text(junk[i][0], AtLen));
	if(AtI) { document.write("</i>"); }
	if(AtB) { document.write("</b>"); }

	document.write("</font></a>");


	//SHOWS ARTICLE SOURCE
	if(ShowASource && junk[i][2]!="-")
	{
		document.write("<br><font face=\"" + AsfType + "\" color=" + AsfColor + " size=" + AsfSize + ">");
		if(AsB) { document.write("<b>"); }
		if(AsI) { document.write("<i>"); }
		if(AsU) { document.write("<u>"); }
		document.write(junk[i][2]);
		if(AsU) { document.write("</u>"); }
		if(AsI) { document.write("</i>"); }	
		if(AsB) { document.write("</b>"); }
	}	

	//SHOWS ARTICLE SUMMARY
	if(ShowASummary)
	{
		document.write("<br><font face=\"" + AsumfType + "\" color=" + AsumfColor + " size=" + AsumfSize + ">");
		
		//SHOW PICTURE
		if(ShowPic && junk[i][4]!="")
		{
			document.write("<IMG height=" + junk[i][6] + " width=" + junk[i][5] + " hspace=" + SpHS + " vspace=" + SpVS + " border=" + SpB + " src=\"http://www.phayul.com/images/thumbnails/news/articles/" + junk[i][4] + "\"  align=left>");
		}

		if(AsumB) { document.write("<b>"); }
		if(AsumI) { document.write("<i>"); }
		if(AsumU) { document.write("<u>"); }
		document.write(junk[i][3]);
		if(AsumU) { document.write("</u>"); }
		if(AsumI) { document.write("</i>"); }	
		if(AsumB) { document.write("</b>"); }
	}	

	document.write("</td></tr>");

}	
document.write("<tr><td><a href=\"http://www.phayul.com\" target=\"_blank\"><font face=\"Arial, Helvetica, sans-serif\" color=\"#999999\" size=\"1\">News powered by Phayul.com</font></a></td></tr>");
document.write("</table>");


function crop_text(text, max_length) {
  // If the string is already small enough, return it unscathed
  if (text.length <= max_length) { return( text ); }

  // If the user has specified a length of 0, it means he wants the whole thing
  if (max_length == 0) { return( text ); }

  // Start looking for a space, leaving space for an elipsis on the end
  var test_length = (max_length - 3);
  if (test_length < 1) { return( '...' ); }   // max_length too small
  while (text.charAt(test_length) != ' ') {
    test_length--;

    // If we didn't find any spaces to break on, return the string broken at max_length
    if (test_length == 0) { return( text.substring(0, max_length - 3) + '...' ); }
  }

  return text.substring(0, test_length) + '...';
}
