
var ebb21_obj = document.getElementById("ebb21");
//ebb21 is a table element object

/* reference of product class
nDate ::
	this.date //date
	this.day = day;
	this.month = month;
	this.year = year;

PNewsClass ::
	
	this.newsdate //.date .day .month .year
	this.publication //which publication
	this.publicationlogo //the publication logo
	this.newstitle //the news title
	
	this.newsimage[0]
	this.newsimage[1]
	this.newsimage[2]
	this.newsimage[3]

	this.sortofnews // kind of news
	this.language // english, maly, chinese ?
	
	this.status // unknown 
	this.keyword[0]
	this.keyword[1]
	this.keyword[2]
};

*/
var thePnews = eval(PNEWS_CLASS);
var tempPnews = new Array; 
var blankPnews = new Array; 
var minus_length = 0;

var pnImgRoot = 'images/pnews/';
var pnLargeRoot = 'images/pnews/plarge/';
var pnThumbRoot = 'images/pnews/pthumb/';

////////////// simplePnewsAutoUpdater()
////////////// 1. just obtain the toppest data in the array
////////////// to be the newest news update.
////////////// 
function simplePnewsAutoUpdater( object ){
	//only 5 data will be choosen between from [0] to [6]
	var default_n_updates = 5;
	var the_builder_htm = '';
	var type_of_news = new Array( 'press', '' );
	
	var the_link_htm = ''; //
	
	for ( au=1; au<default_n_updates+1; au++ ){
		tempPnews[au] = thePnews[au];
	}
	
	for ( au=1; au<tempPnews.length; au++ ){
		if( !tempPnews ){ alert('error found in allocating memory to TEMP.'); }
		if( au==1 ){ 
			//"news_events/pnews/press/y2k5/press.htm?newsgroup=press&year=2005&month=9&day=16&publication=sun&extra=0"
			the_builder_htm += "<table width=257 border=0 cellpadding=0 cellspacing=0>";
			the_builder_htm += "<tr>";
			the_builder_htm += "<td width=20></td>";
			the_builder_htm += "<td width=75 height=75><img src=\"images/pmain/ebb21.png\" width=75 height=75></td>";
			the_builder_htm += "<td width=162 align=left valign=middle>";
			the_builder_htm += "<!--news-00-->";
			the_builder_htm += "<p class=\"green396-normal-11\" style=\"margin:5px; width:150px;\">";
			the_builder_htm += "<span class=\"green099-bo-11\">[ News Highlights ]</span>";
			the_builder_htm += "<br>";
			the_builder_htm += "<span class=\"green096-normal-11\">";
			the_builder_htm += tempPnews[au].publication+ ", " +tempPnews[au].newsdate.day+ " " +tempPnews[au].newsdate.month_full+ " '" +tempPnews[au].newsdate.year_yy+ "</span><br>"
			the_builder_htm += "<a class=\"green390-normal-11\" target=\"_parent\" ";
			the_builder_htm += "href=\"" +tempPnews[au].newssite+ "\">";
			the_builder_htm += tempPnews[au].newstitle;
			the_builder_htm += "</a><br></p>";
			the_builder_htm += "<!--/news-00-->";
			the_builder_htm += "</td></tr>";
			
			the_builder_htm += "<tr>";
			the_builder_htm += "<td></td>";
			the_builder_htm += "<td colspan=2 valign=top></td>";
			the_builder_htm += "</tr>"
			the_builder_htm += "<tr>";
			the_builder_htm += "<td></td>"
			the_builder_htm += "<td colspan=2>";
			the_builder_htm += "</td>"
			the_builder_htm += "</tr>"
			the_builder_htm += "<tr>"
			the_builder_htm += "<td></td>";
			the_builder_htm += "<td colspan=2 height=10>";
			the_builder_htm += "<span class=\"green390-normal-11\" style=\"line-height:10px;\">"
			the_builder_htm += "-------------------------------------------------------<br></span>";
			the_builder_htm += "</td>";
			the_builder_htm += "</tr>";
		}
		if ( au > 1 && tempPnews[au]!=null ){
			the_builder_htm += "<tr>";
			the_builder_htm += "<td></td>";
			the_builder_htm += "<td colspan=2 height=50>";
			the_builder_htm += "<!--news-    au   -->";
			the_builder_htm += "<p class=\"green096-normal-11 sty-ebn-txt-txt\">";
			the_builder_htm += "<span class=\"green096-bo-12 sty-ebn-txt-txt\">+</span>";
			the_builder_htm += tempPnews[au].publication+ ", " +tempPnews[au].newsdate.day+ " " +tempPnews[au].newsdate.month_full+ " '" +tempPnews[au].newsdate.year_yy+ "<br>";
			the_builder_htm += "<a class=\"green390-normal-11\" target=\"_parent\" ";
			the_builder_htm += "href=\"" +tempPnews[au].newssite+ "\">";
			the_builder_htm += tempPnews[au].newstitle;
			the_builder_htm += "</a><br></p>";
			the_builder_htm += "<!--/news-00-->";
			the_builder_htm += "</td></tr>";
		}
		if ( au == tempPnews.length-1 ){
			//alert(tempPnews.length-1)
			the_builder_htm += "<tr>";
			the_builder_htm += "<td></td>";
			the_builder_htm += "<td colspan=2 height=10>";
			the_builder_htm += "<span class=\"green390-normal-11 lh-10\">";
			the_builder_htm += "-------------------------------------------------------<br></span>";
			the_builder_htm += "</td>";
			the_builder_htm += "</tr>";
			the_builder_htm += "</table>";
		}
		//alert(the_builder_htm);
	}
	ebb21_obj.innerHTML = the_builder_htm;	
	
}

simplePnewsAutoUpdater( ebb21_obj );
