///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var BASEURL = "http://addon.atlusnet.jp/p3p/blg/";
//
if (cxt<10){
	cxt = "0"+cxt;
}
var filename = "p_pchxse_"+cxt+".swf";

var BlogpartsSwf = BASEURL+"/swf/"+filename;
var gsTickerId_AN = "Ticker_AN";
function writeBanner(){
	var BlogpartsUrl = BlogpartsSwf;
	
	var sHtml = "";
	sHtml += '<div style="text-align:center;">';
	sHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="370" id="' + gsTickerId_AN + '" align="middle">';
	sHtml += '<param name="allowScriptAccess" value="always" />';
	sHtml += '<param name="flashvars" value="cxt='+cxt+'&tpx='+tpx+'" />';
	sHtml += '<param name="movie" value="' + BlogpartsUrl + '" />';
	sHtml += '<param name="quality" value="high" />';
	sHtml += '<param name="bgcolor" value="#ffffff" />';
	sHtml += '<param name="wmode" value="transparent" />';
	sHtml += '<embed wmode="transparent" src="' + BlogpartsUrl + '?cxt='+cxt+'&tpx='+tpx+'" quality="high" bgcolor="#ffffff" width="160" height="370" name="' + gsTickerId_AN + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	sHtml += '</object></div>';

	if(document.all){ 
		var codeS =document.charset;
	}else{
	 var codeS =document.characterSet;
	}
	var codeS = codeS.toLowerCase();

	if (codeS == "utf-8"){
		sHtml += '<script type="text/javascript" src="'+BASEURL+'/js/utf-8.js"></script>';
	}else if (codeS == "euc-jp"){
		sHtml += '<script type="text/javascript" src="'+BASEURL+'/js/euc-jp.js"></script>';
	}else if (codeS == "shift_jis"){
		sHtml += '<script type="text/javascript" src="'+BASEURL+'/js/shift-jis.js"></script>';
	}else{
		sHtml += '<script type="text/javascript" src="'+BASEURL+'/js/js/utf-8.js"></script>';
	}
	document.write(sHtml);
}
writeBanner();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ChagngeTxt(){
	//
	MAX_STR_CNT = 0;
	CRNT_NUM = 0;
	//
	var obj = document.getElementsByTagName("BODY")[0].firstChild;
	while(obj != null){
		if (obj.hasChildNodes()){
			cnt_getLowerNodes(obj);
		}
		if (obj.nodeName == "#text"){
			cnt_Str(obj.nodeValue);
		}
		obj = obj.nextSibling;
	}
	tmrID = setInterval( "interval()", 10);
}
function cnt_getLowerNodes(obs){
	var ob = obs.firstChild;
	while(ob != null){
			if (ob.hasChildNodes()){
					cnt_getLowerNodes(ob);
			}
			if (ob.nodeName == "#text"){
				cnt_Str(ob);
			}
	ob = ob.nextSibling;
	}	
}

function cnt_Str(obs){
		var st = new String(obs.nodeValue);
		if (st.length > MAX_STR_CNT){
			MAX_STR_CNT = st.length;
		}
}
/*-----------------------------------------------------------------*/
function interval(){
	ExeChagngeTxt();
	CRNT_NUM++;
	//
	if (CRNT_NUM >= (MAX_STR_CNT+1)){
		clearInterval(tmrID);
	}
	if (CRNT_NUM >= 300){
			clearInterval(tmrID);	
	}
}
/*-----------------------------------------------------------------*/
function ExeChagngeTxt(){
	var obj = document.getElementsByTagName("BODY")[0].firstChild;
	while(obj != null){
		if (obj.hasChildNodes()){
			getLowerNodes(obj);
		}
		if (obj.nodeName == "#text"){
			replaceStr(obj.nodeValue);
		}
	obj = obj.nextSibling;
	}
}
function getLowerNodes(obs){
	var ob = obs.firstChild;
	while(ob != null){
			if (ob.hasChildNodes()){
					getLowerNodes(ob);
			}
			if (ob.nodeName == "#text"){
				replaceStr(ob);
			}
	ob = ob.nextSibling;
	}	
}

function replaceStr(obs){
		//
		var st = new String(obs.nodeValue);
		if (CRNT_NUM <= st.length){
			var ts = "";
			for (i=0; i<CRNT_NUM; i++){
				if (outTxt != 'undefined'){
				ts+=outTxt;
				}
			}
			
			obs.nodeValue = ts+st.substr(CRNT_NUM,st.length);
		}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function SWFLayer(){
	this.swf_url = "";
	this.swf_id = "Flash";
	this.layer_name = "";
	this.xx = 0;
	this.yy = 0;
	this.width = 1;
	this.height = 1;
	this.zIndex = 0;
	this.body = document['CSS1Compat' == document.compatMode ? 'documentElement' : 'body'];
	this._oLayer = "";

	this.flashvars_labels = [];
	this.flashvars_values = [];

	this._ww_full_flg = "false";
	this._hh_full_flg = "false";
}
SWFLayer.prototype._createFlashVarsValue = function(){
	var value = "browser=" + this._checkBrowser() + "&";
	var flashvars_labels = this.flashvars_labels;
	var flashvars_values = this.flashvars_values;
	for(var i=0; i < flashvars_labels.length; i++){
		value += flashvars_labels[i] + "=" + flashvars_values[i] + "&";
	}
	value = value.substring(0,value.length - 1);
	return value;
};
SWFLayer.prototype.create = function(){
	var swf_url = this.swf_url;
	var swf_id = this.swf_id;
	var layer_name = this.layer_name;
	var stime = this.stime
	
	var html = "";
	html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='100%' height='100%' id='"+swf_id+"' align='middle'>";
	html += "<param name='allowScriptAccess' value='always' />";

	if(this.flashvars_labels.length > 0){
		html += "<param name='flashvars' value='" + this._createFlashVarsValue() + "'>";
	}

	html += "<param name='movie' value='" + swf_url + "' /><param name='scale' value='noscale' /><param name='flashvars' value='stime="+stime+"&cxt="+cxt+"&tpx="+tpx+"&SWF_PATH="+BASEURL+"' /><param name='salign' value='t' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><embed src='" + swf_url+"?stime="+stime+"&cxt="+cxt+"&tpx="+tpx+"&SWF_PATH="+BASEURL+"' quality='high' scale='noscale' salign='t' wmode='transparent' width='100%' height='100%' name='"+swf_id+"' id='"+swf_id+"' swLiveConnect=true align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'";
	if(this.flashvars_labels.length > 0){
		html += " flashvars='" + this._createFlashVarsValue() + "'";
	}
	html += "/>";
	html += "</object>";

	var oLayer = document.createElement('div');
	oLayer.setAttribute('id',layer_name);
	oLayer.innerHTML = html;
	oLayer.style.position = 'absolute';
	oLayer.style.zIndex = this.zIndex;
	document.body.appendChild(oLayer);
	this._oLayer = oLayer;

};
SWFLayer.prototype._checkBrowser = function(){
	var uName = navigator.userAgent;
	if (uName.indexOf("Safari") > -1) return "Safari";
	if (uName.indexOf("MSIE") > -1){
		return "MSIE";
	}
	return "Netscape";
};
SWFLayer.prototype.setSize = function(ww,hh){
	var browser = this._checkBrowser();
	if(ww == 'full'){
		this._ww_full_flg = "true";
		if(browser == "MSIE"){
			this.width = this.body.clientWidth;
		}else if(browser == "Netscape"){
			this.width = window.innerWidth - 17;
		}else{
			this.width = window.innerWidth;
		}
	}else{
		this._ww_full_flg = "false";
		this.width = ww;
	}
	if(hh == 'full'){
		this._hh_full_flg = "true";
		if(browser == "MSIE"){
			this.height = this.body.clientHeight;
		}else if(browser == "Netscape"){
			this.height = window.innerHeight-17;
		}else{
			this.height = window.innerHeight;
		}
	}else{
		this._hh_full_flg = "false";
		this.height = hh;
	}
	this._oLayer.style.width = this.width + 'px';
	this._oLayer.style.height = this.height + 'px';
};
SWFLayer.prototype.setPos = function(xx,yy){
	var browser = this._checkBrowser();

	this.xx = xx;
	this.yy = yy;

	if(browser == "MSIE"){
		this._oLayer.style.left = this.xx + this.body.scrollLeft + 'px';
		this._oLayer.style.top = this.yy + this.body.scrollTop + 'px';
	}else {
		this._oLayer.style.left = this.xx + pageXOffset + 'px';
		this._oLayer.style.top = this.yy + pageYOffset + 'px';
	}

};
SWFLayer.prototype.setPosFixed = function(xx,yy){

	this.xx = xx;
	this.yy = yy;

	this._oLayer.style.left = this.xx + 'px';
	this._oLayer.style.top = this.yy + 'px';

};
SWFLayer.prototype.setdPos = function(d_xx,d_yy){

	this.xx += d_xx;
	this.yy += d_yy;

	this.setPos(this.xx,this.yy);
};
SWFLayer.prototype.setWindowAlign = function(str){
	var browser = this._checkBrowser() ;
	if(str == 'right'){
		if(browser == "MSIE"){
			this.xx = this.body.clientWidth - this.width;
		}else {
			this.xx = window.innerWidth - this.width;
			if(browser == "Netscape"){
				this.xx -= 17;
			}
		}
	}else{
		if(browser == "MSIE"){
			this.xx = 0;
		}else {
			this.xx = 0;
		}
	}


	this.setPos(this.xx,this.yy);
};
SWFLayer.prototype.setWindowAlignFixed = function(str){
	var browser = this._checkBrowser() ;
	if(str == 'right'){
		if(browser == "MSIE"){
			this.xx = this.body.clientWidth - this.width + this.body.scrollLeft;
		}else {
			this.xx = window.innerWidth - this.width + pageXOffset;
			if(browser == "Netscape"){
				this.xx -= 17;
			}
		}
	}else{
		if(browser == "MSIE"){
			this.xx = 0;
		}else {
			this.xx = 0;
		}
	}


	this.setPosFixed(this.xx,this.yy);
};
SWFLayer.prototype.setWindowValign = function(str){
	var browser = this._checkBrowser();
	if(str == 'bottom'){
		if(browser == "MSIE"){
			this.yy = this.body.clientHeight - this.height;
		}else {
			this.yy = window.innerHeight - this.height;
			if(browser == "Netscape"){
				this.yy -= 17;
			}
		}
	}else{
		if(browser == "MSIE"){
			this.yy = 0;
		}else {
			this.yy = 0;
		}
	}
	this.setPos(this.xx,this.yy);
};
SWFLayer.prototype.setWindowValignFixed = function(str){
	var browser = this._checkBrowser();
	if(str == 'bottom'){
		if(browser == "MSIE"){
			this.yy = this.body.scrollHeight - this.height;
		}else {
			this.yy = this.body.offsetHeight - this.height;
			if(browser == "Netscape"){
				this.yy -= 17;
			}
		}
	}else{
		if(browser == "MSIE"){
			this.yy = 0;
		}else {
			this.yy = 0;
		}
	}
	this.setPosFixed(this.xx,this.yy);
};
SWFLayer.prototype.setVisible = function(str){
	this._oLayer.style.visibility = str;
};
SWFLayer.prototype.correctWindowSize = function(str){
	if(this._ww_full_flg == "true" && this._hh_full_flg == "true"){
		this.setSize("full","full");
	}
	else if(this._ww_full_flg == "true"){
		this.setSize("full",this.height);
	}
	else if(this._hh_full_flg == "true"){
		this.setSize(this.width,"full");
	}
};
function eventObserve(obj,e, func, bool){
	if (obj.addEventListener){
		obj.addEventListener(e, func, bool)
	}else if (obj.attachEvent){
		obj.attachEvent("on" + e, func)
	}
}

var oSoukan_floatingLayer = "";
var Soukan_floating_zindex = 1;

function ShowPage(data,fname,stime){
fname = "pcommondetail.swf"

if (document.getElementById("attentionBox")){
var obj = document.getElementById("attentionBox");
obj.innerHTML = "      ";
}
	oSoukan_floatingLayer = new SWFLayer();
	oSoukan_floatingLayer.zIndex = Soukan_floating_zindex;
	oSoukan_floatingLayer.swf_url = BASEURL+"/swf/"+fname;
	oSoukan_floatingLayer.swf_id = "soukan_blogparts";
	oSoukan_floatingLayer.layer_name = "soukan_floating";
	oSoukan_floatingLayer.stime = stime;
	
	oSoukan_floatingLayer.create();
	oSoukan_floatingLayer.setSize("full","full");
	oSoukan_floatingLayer.setWindowAlign('center');
	oSoukan_floatingLayer.setWindowValign('top');
	if(checkBrowser() == "Safari"){
		window.resizeBy(1,0);
	}
}

var iii = 0;
function resizeBlog_Guard(){
	oSoukan_floatingLayer.correctWindowSize();
	oSoukan_floatingLayer.setWindowAlign('center');
	oSoukan_floatingLayer.setWindowValign('top');

}
eventObserve(window, 'resize', resizeBlog_Guard, false);

function scrollBlog_Guard(){
	oSoukan_floatingLayer.setWindowAlign('center');
	oSoukan_floatingLayer.setWindowValign('top');
}
eventObserve(window, 'scroll', scrollBlog_Guard, false);

document.getElementsByTagName("html")[0].style.overflow="scroll";

function hideLayer(){
	//oSoukan_floatingLayer.setVisible("hidden");
	window.location.reload();
}

function setCenter(){
	oSoukan_floatingLayer.setSize("full","full");
	scrollBlog_Guard();
}


function checkBrowser(){
	var uName = navigator.userAgent;
	if (uName.indexOf("Safari") > -1) return "Safari";
	if (uName.indexOf("MSIE") > -1){
		return "MSIE";
	}
	return "Netscape";
};

