hdl		= new Array();
flg		= new Array();

scrHgt	= 18;
witTim	= 5000;






function scrStt()
{
	for (i=0; i<rssCnt; i++)
	{
			x	= Math.floor(Math.random()*rssCnt);

		while (flg[x]==x)
		{
			x	= Math.floor(Math.random()*rssCnt);
		}

		flg[x]	= x;
		hdl[i]	= rss[x];
	}

	document.write('<div class=bgGrd>');

	for(i=0; i<rssCnt; i++)
	{
		document.write('<div id="hdlID' +i+ '" class=hdLin style="top:' +((i)?(scrHgt):(0))+ ';">');
		document.write(hdl[i]);
		document.write('</div>');
	}

	document.write('</div>');
	setTimeout('scrLop(0)', witTim);
}

function scrLop(n)
{
	pusCnt	= 30;
	n2		= [n,((n<(rssCnt-1))?(n+1):(0))];

	for (i=0; i<2; i++)
	{
			hdlLng		= document.getElementById('hdlID'+n2[i]).style;
			tpPst		= hdlLng.top.replace(/px|pt/, '') -1;
			hdlLng.top	= tpPst;

		if (tpPst<=scrHgt*(-1))
		{
			hdlLng.top	= scrHgt;
			n			= n2[1];
		}

		if (tpPst==0)
		{
			pusCnt		= witTim;
		}
	}

	setTimeout('scrLop('+n+')', pusCnt);
}






function cntDwn(chkFlg, tgtURL, tgtALT, tgtMsg1, tgtMsg2, tgtYY, tgtMM, tgtDD, trmDs)
{
	tdy		= new Date();
	tgtDat	= new Date(tgtYY, tgtMM-1, tgtDD);
	rmn		= tdy.getTime()-tgtDat.getTime();
	dayCnt	= Math.floor(rmn/(24*60*60*1000));
	trmDs	= trmDs -1;

	if		(tgtURL=="")	{	tgtURL	=	'<a';					}
	else					{	tgtURL	=	'<a href=' + tgtURL;	}

	if	(chkFlg==2)
	{
		if		(dayCnt< 0    )	{	document.write(tgtURL + ' title="' + tgtALT + '">' + tgtMsg1 + '</a>' + tgtMsg2 + 'まで、あと ' +dayCnt*(-1)+ '日');		}
		else if	(dayCnt> trmDs)	{	document.write(tgtURL + ' title="' + tgtALT + '">' + tgtMsg1 + '</a>' + tgtMsg2 + 'から ' +(dayCnt-trmDs)+ '日経過');		}
		else if (trmDs== 0    )	{	document.write(tgtURL + ' title="' + tgtALT + '">' + tgtMsg1 + '</a>' + tgtMsg2 + '！　…のハズ　(^^;');					}
		else					{	document.write(tgtURL + ' title="' + tgtALT + '">' + tgtMsg1 + '</a>' + tgtMsg2 + '中！　…のハズ　(^^;');					}
	}
	else if(chkFlg==1)			{	document.write(tgtMsg1);	}
}






function digClk()
{
	if (document.all || document.getElementById || document.layers)
	{
		if (document.all)
		{
			clkObj1	= document.all("forIE");
			clkObj2	= document.all("forNS");
		}
		else if (document.getElementById)
		{
			clkObj1	= document.getElementById("forIE");
			clkObj2	= document.getElementById("forNS");
		}
		else if (document.layers)
		{
			clkObj1	= document.layers["forIE"];
			clkObj2	= clkObj1.document.layers["forNS"];
		}

		movClk();
	}
}

function movClk()
{
	nowTim	= new Date();

	nowYer	= nowTim.getYear();
	nowMon	= nowTim.getMonth()+1;
	nowDat	= nowTim.getDate();
	nowHor	= nowTim.getHours();
	nowMin	= nowTim.getMinutes();
	nowSec	= nowTim.getSeconds();

	if (nowYer<1900)	{	nowYer	= nowYer +1900; }
							nowYer	= nowYer -2000;

	if (nowYer<10)		{	nowYer	= '0'+nowYer;	}
	if (nowMon<10)		{	nowMon	= '0'+nowMon;	}
	if (nowDat<10)		{	nowDat	= '0'+nowDat;	}
	if (nowHor<10)		{	nowHor	= '0'+nowHor;	}
	if (nowMin<10)		{	nowMin	= '0'+nowMin;	}
	if (nowSec<10)		{	nowSec	= '0'+nowSec;	}

	drwClk(clkObj2, nowYer +'/'+ nowMon +'/'+ nowDat +'　'+ nowHor +':'+ nowMin +':'+ nowSec);
	setTimeout('movClk()', 1000);
}

function drwClk(obj, mes)
{
	if (document.all || document.getElementById)
	{
		obj.innerHTML	= mes;
	}
	else if (document.layers)
	{
		obj.document.open();
		obj.document.write(mes);
		obj.document.close();
	}
}

