
/*
	http://naksnd.seesaa.net/
*/


JSMML.swfurl = "http://naksnd.up.seesaa.net/js/JSMML.swf";
//JSMML.swfurl = "./JSMML.swf";
JSMML.onLoad = function() 
{
	mml = new JSMML();
};


function mmlplay(id)
{
	var t = document.getElementById(id).innerHTML;
	t = t.replace(/<.+?>/g, "");
	t = t.replace(/&amp;/g, "&");
	t = t.replace(/&lt;/g, "<");
	t = t.replace(/&gt;/g, ">");
	mml.play(t);
}

function none(){}


function mmlplayer(id, ishidden)
{
	var t = document.getElementById(id);
	var d = document.createElement("div");
	var bplay = document.createElement("input");
	var bstop = document.createElement("input");
	bplay.type = "button";
	bplay.value = "play";
	bplay.onclick = function(){ mmlplay( id ); };
	bstop.type = "button";
	bstop.value = "stop";
	bstop.onclick = function(){ mml.stop(); };
	d.appendChild(bplay);
	d.appendChild(bstop);
	t.parentNode.insertBefore(d,t);
	var n = document.createElement("a");
	n.appendChild(document.createTextNode("Show MML"));
	n.setAttribute("href", "javascript:none();");
	n.onclick = function(){ showelem(n,t) };
	t.parentNode.insertBefore(n, t);
	if(ishidden)
		t.style.display = "none";
}

function hideelem(a, t)
{
	t.style.display = "none";
	a.innerHTML = "Show MML";
	a.setAttribute("href", "javascript:none();");
	a.onclick = function(){ showelem(a,t) };
}

function showelem(a, t)
{
	t.style.display = "block";
	a.innerHTML = "Hide MML";
	a.setAttribute("href", "javascript:none();");
	a.onclick = function(){ hideelem(a,t) };
}

