			// Top 20 list,
			// By iZ Group 2007-2008
			// Yoakim A, 2007 
			// Update : Tanaka K 2008
			// 
			// For PCBdB*
			// 
			
			
			RTkeyword = function( objName ) {
			this.objname 		= objName;
			this._datafile	    = "/js/getrtword.tbc";
			this._imglink	    = "/img/rank";
			this._firstRolltime = 2000;
			this._linebylineslp = 800;
			this._RollMovespeed = 10;
			this.currentspeed   = 0;
			this.scrollspeed    = 50;
			this.pausetime      = 2000;
			this.pause			= false;
			this.stop 			= false;
			this._cutLen		= 15;		//keyword length
			this._itemcount		= 0;
			this._Item			= new Array();
			this._ItemDivName   = "rtitem_";
			this._ItemW			= 160;
			this._ItemTop		= 18;
			this._moveindex		= 0;
			this._StartIdx		= 0;
			this._displayLimit  = 10;
			this._MaxTryAjax	= 3;		//retry ajax
			var sAgent = navigator.userAgent;
			var t1 = sAgent.indexOf("Mac") > -1;
			var t2 = sAgent.indexOf("MSIE") > -1;
			var t3 = sAgent.indexOf("Safari") > -1;
			var t4 = sAgent.indexOf("Firefox") > -1;
			var t5 = sAgent.indexOf("Opera") > -1;
			this._ismac = 0;
			this._ismacie = 0;
			if ( t1 && t2 ) {
			this._ismacie = 1;
			}
			this.createHttpRequest = function() {
			if (window.ActiveXObject) {
			try {
			//win ie4, ie5, ie6
			return new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
			try {
			return new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
			return null;
			}
			}
			} else if(window.XMLHttpRequest) {
			//ie, safari, kconqueror, firefox, nescape, opera
			return new XMLHttpRequest();
			} else {
			return null;
			}
			}
			this._setDataSet = function ( sdata ) {
			var datas   	= sdata.split('\n');
			if ( datas.length >= 9 ) {
			this._itemcount = 0;
			for (i=1;i<datas.length;i++) {
			this.AddLine(datas[i]);
			}
			}
			}
			this._response = function() {
			var uniq = new Date();
			uniq = "?"+uniq.getTime();
			var self = this;
			if (self._http == null ) {
			self._http = this.createHttpRequest();
			}
			self._http.open("GET", this._datafile+uniq, true);
			self._http.setRequestHeader("Content-Type", "text/html");
			self._http.setRequestHeader("Accept-Language","en");
			self._http.onreadystatechange = function () {
			if (self._http.readyState == 4) {
			if (self._http.status == 200){
			self._tryCount = 0;
			self._setDataSet(self._http.responseText);
			} else if (self._http.status == 404) {
			self._tryCount++;
			if ( self._tryCount <= self._MaxTryAjax ) {
			if (self._TryTimeId)  { clearTimeout(self._TryTimeId); }
			self._TryTimeId = setTimeout(self._objName+"._response();", 1000);
			} else {
			if (self._TryTimeId)  { clearTimeout(self._TryTimeId); }
			}
			}
			}
			}
			self._http.send(null);
			return;
			}
			this.AddLine = function ( sData ) {
			this._Item[this._itemcount]     = sData;
			this._itemcount++;
			}



			//draw realtime keyword box
			this._DrawItem = function ( index ) {
			index += this._StartIdx;
			if ( index != 9 ) {
			var ndrcode= "RFA0"+eval(index+1);
			} else {
			var ndrcode= "RFA"+eval(index+1);
			}
			var sRankImg= "";
			var tmplist = this._Item[index].split(";");
			var keyword = tmplist[0];
			var keywordorg = keyword;
			var url     = tmplist[1];
			var level   = tmplist[2];
			var count   = tmplist[3];
			if ( level == "+" ) {
			sRankImg = "up";
			} else if ( level == "-" ) {
			sRankImg = "dn";
			} else if ( level == "n" ) {
			sRankImg = "new";
			count   = "&nbsp;";
			} else {
			sRankImg = "no";
			count   = "&nbsp;";
			}
			if(keyword.length > this._cutLen) {
			keyword = keyword.substr(0,this._cutLen) + "..";
			}
			var record = "";
			record+= "<li><dl>";
			record+= "<dt><img src='"+this._imglink+"/num_bl_"+index+".gif' width=14 height=13></dt>";
			record+= "<dd><a href='"+url+"' style='cursor:pointer' title='"+keywordorg+"' onclick=\"nc('"+ndrcode+"');\">"+keyword+"</a>";
			record+= "<span class='"+sRankImg+"'>"+count+"</span></dd>";
			record+= "</dl></li>";
			return record;
			}
			this._DrawLineData = function ( index ) {
			var record = "";
			var style =  "style='position:relative; overflow:hidden;left:0px; width:"+this._ItemW+"px; height:"+this._ItemTop+"px;top:0px'";
			record+= "<div id=rtword_'"+index+"' "+style+">";
			record+= "<div id='"+this._ItemDivName+index+"' style='position:relative;left:0px;top:0px;'>";
			record+= this._DrawItem(index);
			record+= "</div>";
			record+= "</div>";
			return record;
			}
			
			this._DrawTitleBox = function() {
			var recordHTML = "";
			recordHTML+= "<div id='searchRank' OnMouseOver='"+this.objname+".onmouseover();' OnMouseOut='"+this.objname+".onmouseout();'>";
			recordHTML+= "<div class='tit'>Top 20 visit PCBs";
			recordHTML+= "<span id='more_btn' class='searchbtn'>"
			recordHTML+= "<a href='javascript:"+this.objname+"._DrawBox(1);' onclick=\"nc('RFA00');\">";
			recordHTML+= "<img src='"+this._imglink+"/btn_searchrank02.gif' width=31 height=7></a>"
			recordHTML+= "</span>";
			recordHTML+= "</div>";
			recordHTML+= "<div id="+this.objname+"></div>";
			recordHTML+= "</div>";
			document.write(recordHTML);
			}
			
			this._DrawTitleBox = function() {
			var recordHTML = "";
			recordHTML+= "<div id='searchRank' OnMouseOver='"+this.objname+".onmouseover();' OnMouseOut='"+this.objname+".onmouseout();'>";
			recordHTML+= "<div class='tit'>Top 20 visited PCBs";
			recordHTML+= "<span id='more_btn' class='searchbtn'>"
			recordHTML+= "<a href='javascript:"+this.objname+"._DrawBox(1);' onclick=\"nc('RFA00');\">";
			recordHTML+= "<img src='"+this._imglink+"/btn_searchrank02.gif' width=31 height=7></a>"
			recordHTML+= "</span>";
			recordHTML+= "</div>";
			recordHTML+= "<div id="+this.objname+"></div>";
			recordHTML+= "</div>";
			document.write(recordHTML);
			}


			//small box = 0, large box = 1
			this._DrawBox = function( mode ) {
			if ( mode == 0 ) {
			this._StartIdx = 0;
			} else {
			this._StartIdx = 10;
			}
			this._moveindex = 0;
			this._MakeHTML();
			this._MoreHTML(mode);
			}
			this._MoreHTML = function ( mode ) {
			var recordHTML  = "";
			if ( mode == 0 ) {
			recordHTML+= "<a href='javascript:"+this.objname+"._DrawBox(1);' onclick=\"nc('RFA00');\">";
			recordHTML+= "<img src='"+this._imglink+"/btn_searchrank02.gif' width=31 height=7>";
			recordHTML+= "</a>"
			} else {
			recordHTML+= "<a href='javascript:"+this.objname+"._DrawBox(0);' onclick=\"nc('RFA00');\">";
			recordHTML+= "<img src='"+this._imglink+"/btn_searchrank01.gif' width=26 height=7>";
			recordHTML+= "</a>"
			}
			obj = document.getElementById("more_btn");
			if ( obj ) {
			obj.innerHTML = recordHTML;
			}
			}
			this._MakeHTML = function () {
			var recordHTML  = "";
			recordHTML+= "<ul>";
			for (i=0;i<this._displayLimit;i++) {
			recordHTML+= this._DrawLineData(i);
			}
			recordHTML+= "</ul>";
			var obj = document.getElementById(this.objname);
			if ( obj ) {
			obj.innerHTML = recordHTML;
			}
			}
			this._firstMove = function () {
			if ( this._ismacie == 1 ) { return; }
			var obj = document.getElementById(this._ItemDivName+this._moveindex);
			if ( this.pause == true ) {
			if ( obj ) {
			obj.style.top = 0;
			}
			if (this._timeoutId1)  { clearTimeout(this._timeoutId1); }
			this._timeoutId1 = setTimeout(this.objname+"._firstMove();", this.pausetime );
			} else {
			if ( obj ) {
			if ( parseInt(obj.style.top) == 0 ) {
			obj.style.top = this._ItemTop;
			var str = this._DrawItem(this._moveindex);
			if ( obj.innerHTML != str ) {
			obj.innerHTML = str;
			}
			}
			obj.style.top = parseInt(obj.style.top) - 1;
			if ( parseInt(obj.style.top) <= 0 ) {
			this._moveindex++;
			if (this._timeoutId1)  { clearTimeout(this._timeoutId1); }
			this._timeoutId1 = setTimeout(this.objname+"._firstMove();", this._linebylineslp );
			return
			}
			if (this._timeoutId1)  { clearTimeout(this._timeoutId1); }
			this._timeoutId1 = setTimeout(this.objname+"._firstMove();", this._RollMovespeed );
			}
			}
			if ( !(obj) && this._moveindex >= this._displayLimit ) {
			if ( this._StartIdx == 0 ) {
			this._DrawBox(1);
			} else {
			this._response();
			this._DrawBox(0);
			}
			if (this._timeoutId1)  { clearTimeout(this._timeoutId1); }
			this._timeoutId1 = setTimeout(this.objname+"._firstMove();", this._firstRolltime );
			return;
			}
			}
			this.onmouseover = function () {
			this.pause = true;
			}
			this.onmouseout = function () {
			this.pause = false;
			}
			this._play = function () {
			this._MakeHTML();
			if (this._timeoutId1)  { clearTimeout(this._timeoutId1); }
			this._timeoutId1 = setTimeout(this.objname+"._firstMove();", this._firstRolltime );
			}

			//start proc
			this._DrawTitleBox();
			}
				function setMyUCC (mymode) {
			d = new Date(2010,1,1);
			document.cookie = "MyUCC=" + mymode + ";";
			}
			function ChangeStyle( divid, display, height ) {
			var obj = document.getElementById( divid );
			if ( obj ) {
			obj.style.display = display;
			if ( height != "" ) {
			obj.style.height  = height;
			}
			}
			}


				//mac ie check
			var sAgent = navigator.userAgent;
			var t1 = sAgent.indexOf("Mac") > -1;
			var t2 = sAgent.indexOf("MSIE") > -1;
			var ismac = 0;
			if ( t1 && t2 ) {
			ismac = 1;
			}
			var newsIndex = 0;
			var newstabload = 0;
			var newsInterval;
			var newstabInterval;
			var newsrollindex   = 0;
			var newsrollspeed   = 8000;   //ms
			var newsMaxroll     = 100;    //limit rolling count
			var newsDelayCnt    = 15;
			var newsrollStop    = true;
			function InitNews( nIndex ) {
			newsIndex = nIndex;
			}
			function ClearTimeOut() {
			if (newstabInterval) {
			clearTimeout(newstabInterval);
			}
			}
			function MoveTab(Index) {
			ClearTimeOut();
			var changespeed = 300;
			if ( Index == "2" ) {
			GetNewsHTML(newsIndex,Index);
			} else if ( Index == "3" ) {
			GetNewsHTML(newsIndex,Index);
			}
			newstabInterval = setTimeout('ShowTab('+Index+');',changespeed);
			}