function Item(linkUrl, imgUrl, title, name, comment)
{
	this.linkUrl = linkUrl;
	this.imgUrl = imgUrl;
	this.title = title;
	this.name = name;
	this.comment = comment;
	
	this.showtest = function ()
	{
		return this.name;
	}
	
	this.getHTML = function (handleId)
	{
		var ret = "";
		ret += "<a href='";
		ret += this.linkUrl;
		ret += "' target='_blank' onMouseOver='show(";
		ret += handleId;
		ret += ")'><img src='";
		ret += this.imgUrl;
		ret += "' width='100' height='20' border='0'></a>";
		return ret;
	}
}

function addList(linkUrl, imgUrl, title, name, comment)
{
	lst.push(new Item(linkUrl,imgUrl,title,name,comment));
}

function runShuffle()
{
	var i;
	for(i=0; i<lstMax; i++)
	{
		r1 = Math.round(Math.random() * (lstMax - 1));
		r2 = Math.round(Math.random() * (lstMax - 1));
		
		temp = lst[r1];
		lst[r1] = lst[r2];
		lst[r2] = temp;
	}

}


function makeTable()
{
	/*どこを中央にするか。0はじまり。centerWsize*centerHsizeマス占有する。*/
	centerW = 2;
	centerH = 4;
	
	globalCount=0;
	
	var buf = "\n\n<BR><table cellspacing='0'>";
	for(i=0; i<h; i++)
	{
		buf+="<tr>";
		for(j=0; j<w; j++)
		{
			if(j>=centerW && j<centerW+centerWsize && i>=centerH && i<centerH+centerHsize)
			{
				if(i==centerH && j==centerW)
				{
					buf += "<td colspan='" + centerWsize + "' rowspan='" + centerHsize + "'>";
					buf += "<img src='" + defaultImg + "' width='200' height='40' name='centerImg'><BR>\n";
					buf += "<form id='centerForm' name='centerForm'><textarea name='inner' id='inner'></textarea></form>";
					buf += "</td>";
				}
			}
			else
			{
				buf+="<td>";
				buf+=lst[globalCount].getHTML(globalCount);
				buf+="</td>";
				globalCount++;
			}
		}
		buf+="</tr>";
	}
	buf += "</table>";
	return buf;
}


function show(handleId)
{
	//画像を設定
	document.images['centerImg'].src = lst[handleId].imgUrl;
	//メッセージを設定
	msgBuf = lst[handleId].title;
	msgBuf += " (";
	msgBuf += lst[handleId].name;
	msgBuf += ")\n";
	msgBuf += lst[handleId].comment;
	msgBufIndex=0;
	timeId=setInterval("msgType()", 180);
}

function msgType()
{
	if(msgBufIndex >= msgBuf.length)
	{
		clearInterval(timeId);
	}
	msgBufIndex++;
	document.centerForm.inner.value=msgBuf.substring(0,msgBufIndex) + "■";
}

