// tag.js by Tsukasa Jitoh 2002/ 4/ 9 (Tue) 19:17:03

function iGetAgentType()
{
	var i = 0;
	if(document.all)					//IE
		i = 1;
	else if(document.getElementById)	//NN6
		i = 2;
	else if(document.layers)			//NN4
		i = 3;
	return i;
}

function vWriteHTML(oDoc, sId, sStr)
{
	switch(iGetAgentType())
	{
	case 1:		//IE
		oDoc.all(sId).innerHTML = sStr;
		break;
	case 2:		//NN6
		oDoc.getElementById(sId).innerHTML = sStr;
		break;
	case 3:		//NN4
		with(oDoc.layers[sId].document)
		{
			open();
			write(sStr);
			close();
		}
		break;
	}
}

//TDraw class (draw text for div-tag)
function TDraw()
{
	function TDraw_vClearItem(iXoff, iYoff, iNN4Yoff)
	{
		this.sImgStr = "";
		if(iXoff)
			this.iXoffs = iXoff;
		if(iYoff)
			this.iYoffs = iYoff;
		if(iGetAgentType() == 3)	//NN4
			this.iYoffs += iNN4Yoff;
	}
	function TDraw_vSetItem(iX, iY, sStr, sOptStyle)
	{
		if(!sOptStyle)
			sOptStyle = "";
		this.sImgStr += '<span style="position:absolute;left:' +
			(this.iXoffs + iX) + ';' + 'top:' + (this.iYoffs + iY) + ';' +
			sOptStyle + '">' + sStr + '<\/span>';
	}
	function TDraw_vRun(oDoc, sFldId)
	{
		vWriteHTML(oDoc, sFldId, this.sImgStr);
	}

	this.iXoffs = 0;
	this.iYoffs = 0;
	this.sImgStr = "";
	this.vClearItem = TDraw_vClearItem;
	this.vSetItem = TDraw_vSetItem;
	this.vRun = TDraw_vRun;
}

