function winLoad(){
	if (window.addEventListener) { //for W3C DOM
		window.addEventListener("load", EffSat, false);
	}else if (window.attachEvent) { //for IE
		window.attachEvent("onload", EffSat);
	}else  {
		window.onload = EffSat;
	}
}
function winReSize(){
	if (window.addEventListener) { //for W3C DOM
		window.addEventListener("resize", setWinReSize, false);
	}else if (window.attachEvent) { //for IE
		window.attachEvent("onresize", setWinReSize);
	}else  {
		window.onresize = setWinReSize;
	}
}

function DispFloat(){

document.write('<div style="position:absolute;filter:alpha(opacity=0);opacity:0;-moz-opacity:0;-moz-user-select: none;-khtml-user-select: none;z-index:999;" id="flt_main">');
document.write('  <div><img src="/img/top/side_top_mini.gif"></div> ');
document.write('  <div style="background:url(/img/top/side_bg_mini.gif);background-repeat: repeat-y;">');
document.write('    <div style="padding:3px 0 0 0px;text-align:center;"></div>');
document.write('<div style="text-align:center;"><img src="/img/top/tel_official_b.gif"></div>');
document.write('</div>');
document.write('');
document.write('  <div style="background:url(/img/top/side_bg_mini.gif);background-repeat: repeat-y;"> ');
document.write('    <p style="margin:0; padding:16px 0 0 0;font-size:10px; text-align:center"><strong style="color:#FF0000"><a href="http://www.ssf-analysis.com/cjumpc/cjumpc.cgi?url=https://www.s-b-c.net/mypage/mail.cgi?ent=p01&name=ad_shonan1"><img src="/img/top/float_doc_b.gif" border="0"></a></strong></p> ');
document.write('    <div style="padding:3px 0 0 0px;text-align:center;"></div> ');
document.write('</div>');
document.write('');
document.write('  <div style="background:url(/img/top/side_bg_mini.gif);background-repeat: repeat-y;">');
document.write('    <p style="margin:0; padding:7px 0 0 0;font-size:10px; text-align:center"><strong style="color:#FF0000 "><a href="http://www.ssf-analysis.com/cjumpc/cjumpc.cgi?url=https://www.s-b-c.net/mypage/yoyaku.cgi?ent=p01&name=ad_shonan1"><img src="/img/top/float_yoyaku_b.gif" border="0"></a></strong></p>');
document.write('    <div style="padding:3px 0 0 0px;text-align:center;"></div>');
document.write('</div>');
document.write('');
document.write('  <div style="background:url(/img/top/side_bg_mini.gif);background-repeat: repeat-y;"> ');
document.write('    <p style="margin:0; padding:7px 0 0 0;font-size:10px; text-align:center"><strong style="color:#FF0000 "><a href="http://www.ssf-analysis.com/cjumpc/cjumpc.cgi?url=http://www.s-b-c.net/data_claim.html&name=ad_shonan1"><img src="/img/top/float_shiryo_b.gif" border="0"></a></strong></p> ');
document.write('    <div style="padding:3px 0 0 0px;text-align:center;"></div> ');
document.write('    ');
document.write('<div style="padding-right:10px;" align="right"><a href="javascript: void(0);" onclick=\'javascript:myClose();\'style="font-size:10px;">閉じる</a></div> ');
document.write('  </div> ');
document.write('');
document.write('  <div><img src="/img/top/side_end_mini.gif"></div>');
document.write(' ');
document.write('</div>');
document.write('</div>');


document.write('<div id="flt_ifm" style="position:absolute;top:0px;left:0px;display:none;overflow:hidden;">');
document.write('<iframe scrolling="no" frameborder="0" style="width:0px;height:0px;filter:alpha(opacity=0);opacity:0;-moz-opacity:0;z-index:998;" ');
document.write('marginwidth="0" marginheight="0" hspace="0" vspace="0" border="0" id="ifm_frame"></iframe></div>');

myEff();
}

function Float(){
	DispFloat();
	
	// 閉じる以降非表示
	var flag = chkSince(__COOKIE,_PID,_DAY, 0);
	if( flag ) return;
	
	winLoad();
}

function Lpo(){
	return;
}

var flt, ifm, cls;
function myEff(){
	if ( document.getElementById ){
		flt = document.getElementById ( "flt_main" );
		ifm = document.getElementById ( "flt_ifm" );
		ifm_f = document.getElementById ( "ifm_frame" );
		cls = document.getElementById ( "btnCls" ); 
	}else{
		flt = document.all ["flt_main"];
		ifm = document.all ["flt_ifm"];
		ifm_f = document.all ["ifm_frame"];
		cls = document.all ["btnCls"];
	}
}

function EffSat(){
	moveStop = 0;
	//表示位置設定
	setPosition();
	//リサイズを準備
	winReSize();
	
	// 実行
	setEff();
}


//表示位置
var setX = 0, setY = 0;
//現在地
var Px = 0, Py = 0;
//エフェクト種別
var eff = 1;
//閉じるボタン
var setCls = 1;
//ドラッグ可能
var setDrag = 1;
//位置保持
var setKeep = 1;
//テーブル幅
var tblWidth = 0, tblHeight = 0;
//表示位置選択
var Ps = 1;
//表示位置種別
var Pk = 0;
// ウィンドウサイズ
var winH = 0, winW = 0;

function setPosition(){
	
	ReSize = 0;
	startEff = 0;
	
	flt.style.display = "";
	
	flt.onselectstart = function(){
		return false;
	}
	
	//閉じるボタン
	if( cls && setCls ){
		cls.style.display = "";
	}
	//ウィンドウ幅を取得
	getWinSize()
	//テーブル幅を取得
	tblWidth = getDivWidth(flt);
	tblHeight = getDivHeight(flt)
	//重なり
	var zIn;
	zIn = flt.style.zIndex;
	if( zIn <= 0 ){
		zIn = 999;
		flt.style.zIndex = zIn;
	}
	zIn -= 1;
	ifm_f.style.zIndex = zIn;
	
	//準備
	flt.style.display = "none";
	flt.style.filter = 'alpha(opacity=100)';
	flt.style.MozOpacity = 1;
	flt.style.opacity = 1;
	
	//iframeを準備
	resizeDivTo(ifm_f,tblWidth,tblHeight);
	resizeDivTo(ifm,tblWidth,tblHeight);
	
	flt.style.left = -tblWidth;
	
	if( Ps ){
		var num = Pk -0;
		switch ( num ){
			//左上
			case 0:
				setLeftTop();
				break;
			//左下
			case 1:
				setLeftBottom();
				break;
			//右上
			case 2:
				setRightTop();
				break;
			//右下
			case 3:
				setRightBottom();
				break;
			//中央
			case 4:
				setCenter();
				break;
		}
		Py = setY;
		Px = setX;
	}
}
var ReSize = 0;
function setLeftTop(){
	setY = 0;
	setX = 0;
}
function setLeftBottom(){
	if( moveStop ){
		return;
	}
	setY = winH - tblHeight;
	setX = 0;
	if( Ps ){
		if( ReSize ){
			Py = setY;
			Px = setX;
		}else{
			setReSize();
		}
		sLB = setTimeout("setLeftBottom();",300);
	}
}
function setRightTop(){
	if( moveStop ){
		return;
	}
	setY = 0;
	setX = winW  - tblWidth;
	if( Ps ){
		if( ReSize ){
			Py = setY;
			Px = setX;
		}else{
			setReSize();
		}
		sRT = setTimeout("setRightTop();",300);
	}
}
function setRightBottom(){
	if( moveStop ){
		return;
	}
	setY = winH  - tblHeight;
	setX = winW - tblWidth;
	if( Ps ){
		if( ReSize ){
			Py = setY;
			Px = setX;
		}else{
			setReSize();
		}
		sRB = setTimeout("setRightBottom();",300);
	}
}
function setCenter(){
	if( moveStop ){
		return;
	}
	setY = (winH - tblHeight) / 2;
	setX = (winW - tblWidth) / 2;
	
	if( Ps ){
		if( ReSize ){
			Py = setY;
			Px = setX;
		}else{
			setReSize();
		}
		sC = setTimeout("setCenter();",300);
	}
}
function getWinSize(){
	winW = getWindowWidth();
	winH = getWindowHeight();
}
function setWinReSize(){
	if( !setKeep ){
		return;
	}
	if( flt.style.display == "none" ){
		return;
	}
	flt.style.display = "none";
	ifm.style.display = "none";
	flt.style.top = -tblHeight;
	flt.style.left = -tblWidth;
	ifm.style.top = -tblHeight;
	ifm.style.left = -tblWidth;
	getWinSize();
	flt.style.display = "";
	ifm.style.display = "";
}
function setReSize(){
	var num = eff -0;
	switch ( num ){
		//フェードイン
		case 0:
			Py = setY;
			Px = setX;
			break;
		//上から
		case 1:
			if( startEff && Py > setY ){
				ReSize = 1;
			}
			Px = setX;
			break;
		//左から
		case 2:
			if( startEff && Px > setX ){
				ReSize = 1;
			}
			Py = setY;
			break;
		//右から
		case 3:
			if( startEff && Px < setX ){
				ReSize = 1;
			}
			Py = setY;
			break;
		//下から
		case 4:
			if( startEff && Py < setY ){
				ReSize = 1;
			}
			Px = setX;
			break;
	}
}
function getWindowWidth(){
	var
		w = window,
		b = document.body,
		e = document.documentElement,
		dcM = document.compatMode == "CSS1Compat" && !window.opera;
	
	if( window.opera ){
		return b.clientWidth;
	}
	// opera, netscape を除く標準モードの場合
	else if(dcM && !window.opera && e && e.clientWidth ){
		return e.clientWidth;
	}
	// opera, netscape と、互換モードの場合
	else if(b && b.clientHeight && b.clientWidth){
		return b.clientWidth;
	}
	// その他
	else if( w.innerWidth ){
		// inner??? と offset??? がある場合
		if( e && e.offsetHeight && e.offsetWidth ){
			return (w.innerHeight < e.offsetHeight ) ? w.innerWidth - 14 : w.innerWidth;
		}
		// inner??? がある場合
		else{
			return w.innerWidth;
		}
	}
	// どうにもならない場合
	else{
		return 0;
	}
}

function getWindowHeight(){
	var
		w = window,
		b = document.body,
		e = document.documentElement,
		dcM = document.compatMode == "CSS1Compat" && !window.opera;
	
	if( window.opera ){
		return b.clientHeight;
	}
	// opera, netscape を除く標準モードの場合
	else if(dcM && !window.opera && e && e.clientHeight ){
		return e.clientHeight;
	}
	// opera, netscape と、互換モードの場合
	else if(b && b.clientHeight && b.clientWidth){
		return b.clientHeight;
	}
	// その他
	else if( w.innerHeight ){
		// inner??? と offset??? がある場合
		if( e && e.offsetHeight && e.offsetWidth ){
			return (w.innerWidth < e.offsetWidth ) ? w.innerHeight - 14 : w.innerHeight;
		}
		// inner??? がある場合
		else{
			return w.innerHeight;
		}
	}
	// どうにもならない場合
	else{
		return 0;
	}
}

function getDivWidth (div){ 
	return document.layers? div.clip.width:(div.offsetWidth||div.style.pixelWidth||0);
}
function getDivHeight(div){
	return document.layers? div.clip.height:(div.offsetHeight||div.style.pixelHeight||0);
}
function resizeDivTo(div,width,height){
	if(document.layers) { // NN4
		div.resizeTo(width,height);
	}
	// IE5+, Mozilla, Opera 7     
	else if(typeof div.style.width!="undefined"&& typeof div.style.width=="string"){
		div.style.width =width +'px';
		div.style.height=height+'px';
	}
	else if(typeof div.style.pixelWidth!="undefined"){ // IE4, Opera 6
		div.style.pixelWidth  = width;
		div.style.pixelHeight = height;
	}
}

function setEff(){
	var num = eff -0;
	switch ( num ){
		//フェードイン
		case 0:
			flt.style.filter = 'alpha(opacity=0)';
			flt.style.MozOpacity = 0;
			flt.style.opacity = 0;
			flt.style.top  = Py + 'px';
			flt.style.left = Px + 'px';
			flt.style.display = "";
			ifm.style.top  = Py + 'px';
			ifm.style.left = Px + 'px';
			ifm.style.display = "";
			if( setKeep ) myKeep();
			myfdIn();
			break;
		//上から
		case 1:
			Py = - tblHeight;
			flt.style.top  = Py + 'px';
			flt.style.left = Px + 'px';
			flt.style.display = "";
			ifm.style.top  = Py + 'px';
			ifm.style.left = Px + 'px';
			ifm.style.display = "";
			if( setKeep ) myKeep();
			moveEff();
			break;
		//左から
		case 2:
			Px = - tblWidth;
			flt.style.top  = Py + 'px';
			flt.style.left = Px + 'px';
			flt.style.display = "";
			ifm.style.top  = Py + 'px';
			ifm.style.left = Px + 'px';
			ifm.style.display = "";
			if( setKeep ) myKeep();
			moveEff();
			break;
		//右から
		case 3:
			Px = winW;
			flt.style.top  = Py + 'px';
			flt.style.left  = Px + 'px';
			flt.style.display = "";
			ifm.style.top  = Py + 'px';
			ifm.style.left = Px + 'px';
			ifm.style.display = "";
			if( setKeep ) myKeep();
			moveEff();
			break;
		//下から
		case 4:
			Py = winH;
			flt.style.top  = Py + 'px';
			flt.style.left = Px + 'px';
			flt.style.display = "";
			ifm.style.top  = Py + 'px';
			ifm.style.left = Px + 'px';
			ifm.style.display = "";
			if( setKeep ) myKeep();
			moveEff();
			break;
	}
	flt.onmousedown = myDown;
}

function moveX ( ) {
   return ( ( document.body.scrollLeft ) ? document.body.scrollLeft : document.documentElement.scrollLeft ) + Px + 'px';
} 
function moveY ( ) {
   return ( ( document.body.scrollTop ) ? document.body.scrollTop : document.documentElement.scrollTop ) + Py + 'px'; 
}

var Fx, Fy;
function myMove ( e ) {
	mX = ( document.all ) ? event.clientX : e.clientX;
	mY = ( document.all ) ? event.clientY : e.clientY;
	Px += mX - Fx;
	Py += mY - Fy;
	Fx = mX;
	Fy = mY;
	
	flt.style.top = ifm.style.top = moveY ( );
	flt.style.left = ifm.style.left = moveX ( );
	
}
function myOff ( ) {
	
}
function myUp ( ) {
	document.onmousemove = myOff;
	document.onmouseup   = myOff;
}
function myDown ( e ) {
	if( setDrag != 1 ){
		return;
	}
	moveStop = 1;
	var posX = flt.offsetLeft;
	var posY = flt.offsetTop;
	var scrX = ( document.body.scrollLeft ) ? document.body.scrollLeft : document.documentElement.scrollLeft;
	var scrY = ( document.body.scrollTop ) ? document.body.scrollTop : document.documentElement.scrollTop;
	Px = posX - scrX;
	Py = posY - scrY;
	
	Fx = ( document.all ) ? event.clientX : e.clientX;
	Fy = ( document.all ) ? event.clientY : e.clientY;
	document.onmousemove = myMove;
	document.onmouseup   = myUp;
}

//表示位置保持
var Kclatime;
var sLB;
var sRT;
var sRB;
var sC;
var mEFF;
var fdin;
function myKeep(){
	if( setKeep ){
		ifm.style.top = moveY ( );
		ifm.style.left = moveX ( );
		flt.style.top = moveY ( );
		flt.style.left = moveX ( );
	}
	Kclatime = setTimeout ( "myKeep();", 100 );
}
/* -------------------------------------------------------------------------
//移動
-----------------------------------------------------------------------------*/
var moveStop = 0;
var startEff = 0;
var stopEff = 0;
function moveEff( ) {
	if( moveStop || ReSize ){
		return;
	}
	var _Y = Math.abs ( Py - setY );
	var _X = Math.abs ( Px - setX );
	var _moveY = _Y / 10;
	var _moveX = _X / 10;
	if ( Py != setY || Px != setX ){
		startEff = 1;
		if ( Py != setY ){
			if ( Math.abs ( Py - setY ) <= 1.000000 )
				Py = setY;
			else if ( Py < setY )
				Py += _moveY;
			else
				Py -= _moveY;
		}
		if ( Px != setX ){
			if ( Math.abs ( Px - setX ) <= 1.000000 )
				Px = setX;
			else if ( Px < setX )
				Px += _moveX;
			else
				Px -= _moveX;
		}
		flt.style.top  = ifm.style.top = moveY( );
		flt.style.left = ifm.style.left = moveX ( );
		mEFF = setTimeout ( "moveEff();", 20 );
	}else{
		ReSize = 1;
	}
}

/* -------------------------------------------------------------------------
//フェードイン
-----------------------------------------------------------------------------*/
var spd = 25; // 変化させる間隔（ミリ秒単位）
var ntc = 2; // 何%ずつ変化させるか
var cnt = 5;

function myfdIn() {
	flt.style.top  = moveY( );
	flt.style.left = moveX ( );
	flt.style.filter = 'alpha(opacity=' + cnt + ')';
	flt.style.MozOpacity = cnt / 100;
	flt.style.opacity = cnt / 100;
	cnt = cnt + (cnt*0.2);
	if(cnt >= 100 ){
		flt.style.filter = 'alpha(opacity=100)';
		flt.style.MozOpacity = 1;
		flt.style.opacity = 1;
		return;
	}
	fdin = setTimeout("myfdIn();",spd);
}

//閉じる
function myClose(){
	flt.style.display = "none";
	ifm.style.display = "none";
	chkSince(__COOKIE,_PID,_DAY, 1);
}

//閉じる以降非表示
var __COOKIE = 'FLOAT_SINCE';
var _PID = '121306331681512';
var _DAY = 365;

function chkSince(cookieId,pid,myDay,since){
	if(!navigator.cookieEnabled) {
		return 0;
	}
	var val = getCookie( cookieId );
	var ids = new Array();
	if( val != null ){
		ids = val.split(':');
		for(var i = 0; i < ids.length ; i++){
			var id = ids[i];
			if( id == pid) {
				if( 0 ){
					return 1;
				}else{
					ids.splice(i,1);
				}
			}
		}
	}
	if( 0 && since ){
		ids.push( pid );
	}
	var newValue = ids.join( ':' );
	setCookie( cookieId, newValue, myDay );
	return 0;
}

function setCookie(cookieId,myValue,myDay){
	if( myDay <= 0 ) myDay = 1;
	myExp = new Date();
   	myExp.setTime(myExp.getTime()+(myDay*24*60*60*1000));
	myItem = cookieId + "=" + escape(myValue) + ";";
	document.cookie =  myItem;
}
function getCookie(cookieId){
	var cookie_name = cookieId + "=";
	myValue = null;
	myStr = document.cookie + ";" ;
	myOfst = myStr.indexOf(cookie_name);
	if (myOfst != -1){
		myStart = myOfst + cookie_name.length;
		myEnd   = myStr.indexOf(";" , myStart);
		myValue = unescape(myStr.substring(myStart,myEnd));
	}
	return myValue;
}

