
var news_cgi = "http://www.square-enix.co.jp/chocobo/cgi-bin/swf/blognews.cgi";
var swf_url = "http://www.square-enix.co.jp/chocobo/parts/chocolog1.swf";
var swf_url2 = "http://www.square-enix.co.jp/chocobo/parts/chocolog1s.swf";

//Connection ID
var dobj = new Date();
var dnum = dobj.getTime();
var str;

str  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="140" height="200" id="chocolog" align="middle">';
str += '<param name="allowScriptAccess" value="always" />';
str += '<param name="movie" value="'+swf_url+'" />';
str += '<param name="quality" value="high" />';
str += '<param name="bgcolor" value="#ffffff" />';
str += '<param name=FlashVars value="news_cgi='+news_cgi+'&lc_id='+dnum+'" />';
str += '<embed src="'+swf_url+'" quality="high" bgcolor="#ffffff" width="140" height="200" ';
str += 'FlashVars="news_cgi='+news_cgi+'&lc_id='+dnum+'" ';
str += 'name="chocolog" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
str += '</object>';

document.open();
document.write(str);
document.close;

//Create Layer
window.onload = function() {
	var htm;
	
	htm = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="flalayer" align="middle">';
	htm += '<param name="allowScriptAccess" value="always" />';
	htm += '<param name="movie" value="'+swf_url2+'" />';
	htm += '<param name="quality" value="high" />';
	htm += '<param name="bgcolor" value="#ffffff" />';
	htm += '<param name=FlashVars value="lc_id='+dnum+'" />';
	htm += '<param name="wmode" value="transparent" />';
	htm += '<embed src="'+swf_url2+'" quality="high" bgcolor="#ffffff" width="100%" height="100%" ';
	htm += 'FlashVars="lc_id='+dnum+'" ';
	htm += 'name="flalayer" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	htm += '</object>';
	
	var ele = document.createElement('div');
	ele.setAttribute('id','flash');
	ele.innerHTML = htm;
	ele.style.position = 'absolute';
	ele.style.width='200px';
	ele.style.height='200px';
	ele.style.visibility = 'hidden';
	document.body.appendChild(ele);

	//Window Resize
	window.onresize = function(){
		set_layer();
	}
	window.onscroll = window.onresize;
}

function css1_compat(){
	if (document.compatMode) return (document.compatMode=="CSS1Compat");
	return 0;
}
function doc_body(){
	if (css1_compat()) return document.documentElement;
	if (document.body) return document.body;
	return 0;
}


//Layer Set
function set_layer(){
	var obj, ww, wh, st;
	
	if (window.opera){
		ww = document.body.clientWidth;
		wh = document.body.clientHeight;
		st = document.body.scrollTop;
	} else if (document.all) {
		ww = doc_body().clientWidth;
		wh = doc_body().clientHeight;
		st = doc_body().scrollTop
	} else if (document.getElementById) {
		ww = window.innerWidth;
		wh = window.innerHeight;
		st = window.pageYOffset;
    }
	obj = document.getElementById('flash').style;
	obj.left = 0+'px';
	obj.top = (st+wh-200)+'px';
	obj.width = ww+'px';
}

//Layer ON/OFF
function show_layer(f){
	if (f) {
		document.getElementById('flash').style.visibility = "visible";
	} else {
		document.getElementById('flash').style.visibility = "hidden";
	}
}

//Flash Start
function start_flash(){
	set_layer();
	show_layer(true);
}
//Flash END
function end_flash(){
	show_layer(false);
}
