////////////////////////////////////////////////////////////////////////////////
/// Popup 　--  V4 r1 --
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
/// 初期設定
////////////////////////////////////////////////////////////////////////////////
/* time
----------------------------------------------------------------------*/
var speedH=100;
var speedM=300;


////////////////////////////////////////////////////////////////////////////////
/// html
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
/// main Protocol
////////////////////////////////////////////////////////////////////////////////
/*
Handler
----------------------------------------------------------------------*/
$(document).ready(function(){												 

});
$(window).load(function(){												 

});


/*
open
----------------------------------------------------------------------*/
function flOpn(id,event){
	$('#'+id+' .flContWrap').hide();
	$('#FLOAT_BASE').show();
	$('#'+id).show();
	$('#'+id+' .flContWrap').fadeIn(speedM);
	$('#'+id+' .flBg').height($('#'+id+' .flContWrap').innerHeight());
	fulHt('FLOAT_BASE');
	floatC(id);
	if(UAuIE6) $('select').hide();
	$('#FLOAT_BASE').click(function(){flCls(id);});
	$('#'+id+' .flClose').click(function(){flCls(id);});

	if(event.preventDefault){
		event.preventDefault();
		event.stopPropagation();
	} else {
		event.returnValue=false;
		event.cancelBubble=true;
	}

}

/*
close
----------------------------------------------------------------------*/
function flCls(id){
	$('#'+id+' .flContWrap').fadeOut(speedM);
	setTimeout(function(){
		$('.flItem').hide();
		$('#FLOAT_BASE').hide();
		if(UAuIE6) $('select').show();
	},speedM);
}


////////////////////////////////////////////////////////////////////////////////
/// height100%
////////////////////////////////////////////////////////////////////////////////

function fulHt(id){
	var idB=document.getElementById(id);
	var dB=(document.documentElement&&document.documentElement.clientHeight)?
	document.documentElement:document.body;
	var bH=(document.all&&!window.opera)?dB.clientHeight:window.innerHeight;
	var cH=dB.scrollHeight;
	idB.style.height=(cH>bH)?cH+'px':bH+'px';
}


////////////////////////////////////////////////////////////////////////////////
/// Central float coordinates operation
////////////////////////////////////////////////////////////////////////////////

function floatC(id){
	var idB=document.getElementById(id);
	var dB=(document.documentElement&&document.documentElement.clientHeight)?
	document.documentElement:document.body;
	/* Window display area size
	----------------------------------------------------------------------*/
	var bW=(document.all&&!window.opera)?dB.clientWidth:window.innerWidth;
	var bH=(document.all&&!window.opera)?dB.clientHeight:window.innerHeight;
	/* Scrolling increment
	----------------------------------------------------------------------*/
	var sW=(document.all&&!window.opera)?dB.scrollLeft:window.scrollX;
	var sH=(document.all&&!window.opera)?dB.scrollTop:window.scrollY;
	/* Size of float block
	----------------------------------------------------------------------*/
	var oW=idB.scrollWidth;
	var oH=idB.scrollHeight;
	/* Processing
	----------------------------------------------------------------------*/
	var dLeft=(bW-oW)/2+sW;
	if($("#containerPane").hasClass("P2_Rmain") || $("#containerPane").hasClass("P3")) { dLeft += 200; } //ajust [P2_Rmain、P3]
	var dTop=(bH-oH)/2+sH;
	idB.style.left=(dLeft>0)?dLeft+'px':0;
	idB.style.top=(dTop>0)?dTop+'px':0;
}


////////////////////////////////////////////////////////////////////////////////
/// The browser judgment
////////////////////////////////////////////////////////////////////////////////

var UA=navigator.userAgent;

/*
..IE 6 or less.. judgment
----------------------------------------------------------------------*/
var UAuIE6=UA.slice(UA.indexOf("MSIE ")+"MSIE ".length,UA.indexOf("MSIE ")+"MSIE ".length+1)<7;




////////////////////////////////////////////////////////////////////////////////
/// Object operation
////////////////////////////////////////////////////////////////////////////////

function floatObjOparation() {

	//Style setting only of javascript on
	$(".flItem").css("position","absolute");
	$(".flItem").css("display","none");
	$(".flContWrap").css("position","absolute");

	$(".flWidth870").css("width","918px");
	$(".flWidth650").css("width","698px");
	$(".flWidth430").css("width","478px");
	
	itemPath = "/common_v4/src/eng/images/misc/";

	//Float Size Big
	var ftopStr870 = '<p class="flTop"><img src="'+itemPath+'jb870_wt.png" alt="" width="918" height="39"></p>';
	ftopStr870 += '<div class="flBg"></div>';
	ftopStr870 += '<p class="flBtm"><img src="'+itemPath+'jb870_wb.png" alt="" width="918" height="36"></p>';
	$(".flWidth870 .floatPartsTop").html(ftopStr870);

	//Float Size Medium
	var ftopStr650 = '<p class="flTop"><img src="'+itemPath+'jb650_wt.png" alt="" width="698" height="39"></p>';
	ftopStr650 += '<div class="flBg"></div>';
	ftopStr650 += '<p class="flBtm"><img src="'+itemPath+'jb650_wb.png" alt="" width="698" height="36"></p>';
	$(".flWidth650 .floatPartsTop").html(ftopStr650);

	//Float Size Small
	var ftopStr430 = '<p class="flTop"><img src="'+itemPath+'jb430_wt.png" alt="" width="478" height="39"></p>';
	ftopStr430 += '<div class="flBg"></div>';
	ftopStr430 += '<p class="flBtm"><img src="'+itemPath+'jb430_wb.png" alt="" width="478" height="36"></p>';
	$(".flWidth430 .floatPartsTop").html(ftopStr430);

	//close button
	var printBtnStr = '<a href="javascript:void(0);" class="flClose"><span>close</span></a>';
	$(".flBtn").html(printBtnStr);
}

// add onload
	try {
		window.addEventListener('load', floatObjOparation, false);
	} catch (e) {
		window.attachEvent('onload', floatObjOparation);
	}

