<!--
var playing = "";
var asxFile = "http://www.exblog.jp/podcast/asx.asp";
var imageDir = "http://md.exblog.jp/podcast/"; 
var btnPlay = "player_startbtn.gif";
var btnStop = "player_stopbtn.gif";
var htmlLoading = "http://md.exblog.jp/podcast/player_readystate.gif"; 
var htmlPlaying = "http://md.exblog.jp/podcast/player_stopstate.gif";
var htmlWait = "http://md.exblog.jp/podcast/player_startstate.gif";

function btnPressed( fileUrl, postID) {

	var ua = navigator.userAgent;
	fileUrl = fileUrl.substring( 0 , fileUrl.indexOf(".mp3") );
	
	if(!envCheck()) {
		// windows && IE 以外
		try
		{
			if( playing != "" )
			{
				// now playing exists
				document.getElementById("sts_img_" + playing ).setAttribute( 'src' , htmlWait );

			}
				var code = "<object name=\"QuickTime\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" type=\"video/quicktime\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" width=\"2\" height=\"2\">"
						+ "    <param name=\"src\" value=\"http://www.exblog.jp/podcast/dummy.mov\" />"
						+ "    <param name=\"qtsrc\" value=\"" + fileUrl + ".mp3" + "\" />"
						+ "    <param name=\"autoplay\" value=\"true\" />"
						+ "    <param name=\"controller\" value=\"false\" />"
						+ "    <param name=\"bgcolor\" value=\"#000000\" />"
						+ "    <embed name=\"QuickTime\" src=\"http://www.exblog.jp/podcast/dummy.mov\" qtsrc=\"" + fileUrl + ".mp3" + "\" autoplay=\"true\" controller=\"false\" bgcolor=\"#000000\" enablejavascript=\"true\" width=\"2\" height=\"2\" hidden pluginspage=\"http://www.apple.com/qtactivex/qtplugin.cab\"></embed>"
						+ "</object>";

			document.getElementById( "player" ).innerHTML = code;
			document.getElementById("sts_img_" + postID ).setAttribute( 'src' , htmlPlaying );
			document.getElementById("btn_" + postID ).src = imageDir + btnPlay;

			playing = postID;

			return false;
			
		}catch(e)
		{
			var link = document.getElementById("sound_" + postID);
			var url = link.getAttribute("href");
			location.href = url;
			return false;
		}
	}
	// IE
	if( playing == "" )
	{
		if( ( ua.indexOf("MSIE 5") > -1 || ua.indexOf("MSIE 6") > -1) )
		{
			wmp.URL = fileUrl;
		}else
		{
			wmp.URL = asxFile + "?url=" + fileUrl;
		}
		playing = postID;
	}
	else if( playing != postID )
	{
		wmp.controls.stop();

		 // 再生中のプレイヤーの表示を停止にする
		document.getElementById("btn_" + playing ).setAttribute( 'src' , imageDir + btnPlay );
		document.getElementById("sts_img_" + playing ).setAttribute( 'src' , htmlWait );
		
		playing = postID;

		if( ( ua.indexOf("MSIE 5") > -1 || ua.indexOf("MSIE 6") > -1) )
		{
			wmp.URL = fileUrl;
		}else
		{
			wmp.URL = asxFile + "?url=" + fileUrl;
		}
		
		
	}
	else if( playing == postID )
	{
		if( wmp.playState == 3 || wmp.playState == 6 )
		{
			wmp.controls.stop();
		}else
		{
			wmp.controls.play();
		}
		
	}
}

function envCheck() {
	var ua = navigator.userAgent;

	if ( ua.indexOf("Windows") == -1 ) {
		
		return false;
		
	}
	if( ( ua.indexOf("MSIE") > -1 ) && (parseInt(wmp.versionInfo) > 7) )
	{
		return true;
	} else 
	{
		return false;
	}
}
function stateChange(NewState) {
    
    if( playing == "" )
    {	
        return;
    }
	if (NewState == 9) {
		document.getElementById("sts_img_" + playing ).setAttribute( 'src' , htmlLoading );
		
	} else if (NewState == 3 || NewState == 6) {

		document.getElementById("sts_img_" + playing ).setAttribute( 'src' , htmlPlaying );
		document.getElementById("btn_" + playing).src = imageDir + btnStop;
		
	}else {

		document.getElementById("sts_img_" + playing ).setAttribute( 'src' , htmlWait );
		document.getElementById("btn_" + playing).src = imageDir + btnPlay;
	}
}

var ua = navigator.userAgent;
if ( ua.indexOf("Windows") > -1 && ( ua.indexOf("MSIE") > -1 ) )
{
	
	var code = "<script type=\"text/javascript\" for=\"wmp\" event=\"playStateChange(NewState)\">" 
			     + "stateChange(NewState)" 
			     + "</script>" 
			     + "<object id=\"wmp\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" type=\"application/x-oleobject\" height=\"0\" width=\"0\">" 
			     + "<param name=\"uiMode\" value=\"none\">" 
			     + "<param name=\"AutoStart\" value=\"true\">" 
			     + "<param name=\"enableContextMenu\" value=\"false\">" 
			     + "<param name=\"url\" value=\"\">" 
			     + "<embed name=\"wmp\" type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" src=\"\" width=\"0\" height=\"0\" autostart=\"1\" showcontrols=\"0\"></embed>" 
			     + "</object>" ;
    document.write( code );
}
else
{
	document.write( "<div id=\"player\" style=\"display:hidden; height:0px; width:0px;\"></div>" );
}
// -->

