/* ---------------------------------------------------------------------- */
/*                                                                        */
/*  					   Original Javascript Document. Code Name "ACROSS-JS" 						    */
/*                                                                        */
/*               Ver.9.10.15.1 (Last revision : 2009.10.15)               */
/*                                                                        */
/*                												Encode : UTF-8  												                */
/*                                                                        */
/* ---------------------------------------------------------------------- */

/* ----- Window Control ----- */
var url,name,win_width,win_height;
	
function openWin(url,name,width,height,resizeset,fit) { // サイズ変動式＋スクロール（数値によるリサイズ可）
	if(resizeset){
		var options = "width=" + width + ",height=" + height + ",top=0,Left=0,location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes";
	} else {
		var options = "width=" + width + ",height=" + height + ",top=0,Left=0,location=no,menubar=no,status=no,toolbar=no,resizable=no,scrollbars=no";
	}
	var sub = window.open(url,name,options);
	sub.moveTo(0,0);
	if(fit){
		sub.resizeTo(width,screen.height-30);
	}else{
		sub.resizeTo(width,height);
	}
	sub.focus();
}

function openWin2(url,name,width,height) { // サイズ変動式＋スクロール（数値によるリサイズ可）
	var options2 = "width=" + width + ",height=" + height + ",top=0,Left=0,resizable=1,scrollbars=yes";
	var sub = window.open(url,name,options2);
	sub.moveTo(0,0);
	sub.resizeTo(width,screen.height-30);
	sub.focus();
}

function closeWin() { // 親窓移動 or CLOSE時の自動CLOSE（BODYタグにunload指定必須）
	if (sub && !sub.closed) sub.close();
}

function openerWin(url) { // 子窓から親窓を操作する
	opener.location.href=url;
	opener.window.focus();
}

<!-- マウスの近くに小窓を開く -->
  // openSWIN(event,'url','targetName',offsetx,offsety,width,height)を起動する
  function openSWIN(e,url,targetName,offsetx,offsety,width,height){

    //マウスの現在位置
    var mouseXonScreen = null
    var mouseYonScreen = null
  
    //マウスの現在位置取得
    if(document.all){    
                           
       //e4,e5,e6
       mouseXonScreen = window.event.screenX 
       mouseYonScreen = window.event.screenY

    } else if(document.layers || document.getElementById ){

       //n4,n6,n7,m1,o6
       mouseXonScreen = e.screenX
       mouseYonScreen = e.screenY

    }

    //マウスの現在位置から何ピクセル離すかをセット
    var setx = mouseXonScreen + offsetx
    var sety = mouseYonScreen + offsety

    //サブウインドウを開く
    //(引数以外のパラメータも下記でセットできます)
    var parm =""
             +" left="        +setx
             +",screenX="     +setx
             +",top="         +sety
             +",screenY="     +sety
             +",toolbar="     +0
             +",location="    +0
             +",directories=" +0
             +",status="      +0
             +",menubar="     +0
             +",scrollbars="  +0
             +",resizable="   +1
             +",innerWidth="  +width
             +",innerHeight=" +height
             +",width="       +width
             +",height="      +height

      smallwin=window.open(url,targetName,parm);
      smallwin.focus();
  }

/* ----- /Window Control ----- */

/* ----- Flash File Control ----- */
function flash_ctrl(f_file, with_px, height_px){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width=' + with_px + ' height=' + height_px + '><param name="movie" value=' + f_file + '><param name="quality" value="high"><embed src=' + f_file + ' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width=' + with_px +' height=' + height_px + '></embed></object>');
}

/* ----- /Flash File Control ----- */

/* ----- Smooth scroll ----- */
var eventTimer;	//タイマー変数
var restScroll=0;	//スクロール残量

function Scroll(base,move){

	//移動元(base)要素＆オブジェクトを取得
	var obj_base  = getElemPosition(base);

	//移動先(move)要素＆オブジェクトを取得
	var elem_move = document.getElementById(move);
	var obj_move  = getElemPosition(elem_move);

	restScroll = obj_move.y-obj_base.y;
	eventTimer = setInterval(setScrollPosition,10);
}
//スクロール処理をする
function setScrollPosition() {

	var moveValue=0;

	//スクロール残量が80以上の場合、スクロール量を変える
	//Math.abs()では値の絶対値を取得
	if(Math.abs(restScroll)>80){
		moveValue = (restScroll>0)?20:-20;
	}else{
		moveValue = Math.round(restScroll/4);
	}
	//スクロールを処理
	parent.scrollBy(0,moveValue);

	//スクロール残量を計算して、残りが無ければタイマー解除
	restScroll = (restScroll>0)?restScroll-moveValue:restScroll-moveValue;

	if(moveValue==0){
		clearInterval(eventTimer);
		restScroll=0;
	}
}

//要素の位置を取得し、オブジェクトとして返す
function getElemPosition(elem) {
	var obj = new Object();
	obj.x = elem.offsetLeft;
	obj.y = elem.offsetTop;

	//親要素を取得して位置情報を修正する
	while(elem.offsetParent) {
		elem = elem.offsetParent;
		obj.x += elem.offsetLeft;
		obj.y += elem.offsetTop;
	}
	return obj;
}

/* ----- /Smooth scroll ----- */

/* ----- Image Preloader ----- */
function PreLoad(obj,val) {
	if(document.images){
  var d = document; var img = obj;
  d.img = new Image(); d.img.src = val;
	}
}
/* ----- /Image Preloader ----- */