/* flash plug-in check ----------------------- */

var MM_FlashCanPlay = false;
var MM_contentVersion = 8;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
		if (isNaN(parseInt(words[i])))
				continue;
		var MM_PluginVersion = words[i];
	}
	MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('<\/SCR' + 'IPT\> \n');
}


function writeSWF(pFlashCanPlay, pSWF, pIMG, pWidth, pHeight, pFlashVars) {
	if (pFlashCanPlay) {
		var pWmode = "window";
		var pID = "";
		if (pSWF.indexOf("logoheader.swf",0) > -1) {
			pWmode = "transparent";
			pID = "header_swf";
		}
		var toWrite = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="swfWidth" height="swfHeight" id="swfID"><param name="allowScriptAccess" value="always" /><param name="movie" value="swfName" /><param name="quality" value="high" /><param name="wmode" value="swfWmode"><param name="FlashVars" value=';
		toWrite += "'" + pFlashVars + "'";
		toWrite += '><embed src="swfName" width="swfWidth" height="swfHeight" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="swfWmode" name="swfID" flashvars=';
		toWrite += "'" + pFlashVars + "'";
		toWrite += '/></object>';
		toWrite = toWrite.replace("swfID", pID);
		toWrite = toWrite.replace("swfID", pID);
		toWrite = toWrite.replace("swfName", pSWF);
		toWrite = toWrite.replace("swfName", pSWF);
		toWrite = toWrite.replace("swfWidth", pWidth);
		toWrite = toWrite.replace("swfWidth", pWidth);
		toWrite = toWrite.replace("swfHeight", pHeight);
		toWrite = toWrite.replace("swfHeight", pHeight);
		toWrite = toWrite.replace("swfWmode", pWmode);
		toWrite = toWrite.replace("swfWmode", pWmode);

	} else {
		var toWrite = '<img src="imgPath" width="imgWidth" height="imgHeight" alt="Flashが再生できません。" border=0>';
		toWrite = toWrite.replace("imgPath", pIMG);
		toWrite = toWrite.replace("imgWidth", pWidth);
		toWrite = toWrite.replace("imgWidth", pWidth);
	}
	//alert(toWrite);
	document.write(toWrite);
}



// twitter

function com_getTweet() {
	//alert("com_getTweet");
var twiURL = "http://twitter.com/statuses/user_timeline/shonen_takeshi.json?callback=com_getTweet2&count=1";
	var d=document;var s=d.createElement('script');s.type='text/javascript';var date = new Date();s.src=twiURL+'&time='+date.getTime(); s.charset='UTF-8';d.body.appendChild(s);
}
function com_getTweet2(json) {
	var date = json[0].created_at;
	var txt = json[0].text;
	var swf = (document.all? window['header_swf'] : document['header_swf']) || null;
	//alert(swf.setTweet);
	if(swf && swf.setTweet) { swf.setTweet(date, txt);}
	
}

window.onload = com_getTweet;

