//ブログのエントリーIDから、色を割り出す
function getDice(id){
	//alert ("old= "+id)
	var id = Number( id.slice(-1) )
	//alert ("new= "+id)
	if (id > 4){
	var diceNum = Number(id) % 4
	}else{
	var diceNum = id
	}
	if (diceNum == 1){
		rVal = "red"
	}else if (diceNum == 2){
		rVal = "green"
	}else if (diceNum == 3){
		rVal = "blue"
	}else{
		rVal = "yellow"
	}
	var randomNum = Math.floor(Math.random()*2)+1
	rVal = "dice_"+rVal + randomNum
	return rVal
}
//h1タグを抜き出して、getDice()を実行する
function showDice(){
	tagObjects= document.getElementsByTagName("h1")
	for (i=0;i<tagObjects.length;i++){
		targetObj = tagObjects[i]
		targetObj.className = getDice(targetObj.id)
	}
}



//flashを書き出す
function publishSWF(obj){
	//
	
	var swfuri = obj.swfuri
	var width = obj.width
	var height = obj.height
	var id = obj.id
	if (id == undefined || id == ""){
		id = "swfmovie"
	}
	var flashvars = obj.flashvars
	var bgcolor = obj.bgcolor
	if ( bgcolor == undefined || bgcolor =="" ){
		bgcolor = "#FFFFFF"
	}
	var imgsrc = obj.imgsrc
	
	var imgalt = obj.imgalt
	var imgheight = obj.imgheight
	var imgwidth = obj.imgwidth

	document.write('<object type="application/x-shockwave-flash" data="'+swfuri+'"')
	document.write('width="' + width + '" height="' + height + '" id="' + id + '">')
	document.write('<param name="allowScriptAccess" value="sameDomain" />')
	document.write('<param name="movie" value="' + swfuri + '" />')
	document.write('<param name="quality" value="best" />')
	document.write('<param name="bgcolor" value="' + bgcolor + '" />')
	document.write('<param name="flashVars" value="'+ flashvars +'" />')
	if (imgsrc != undefined || imgsrc == ""){
		document.write('<img src="' + imgsrc +'" width="'+ imgwidth +'" height="'+ imgheight +'" alt="'+ imgalt +'" />')
	}
	document.write('</object>')
}
