﻿// JavaScript Document


//ロールオーバー*********************************************

//.jpg
function rollOver_jpg(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_mo.jpg";
	_obj.src = newFile;
}

function rollOut_jpg(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_of.jpg";
	_obj.src = newFile;
}

//.gif
function rollOver_gif(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_mo.gif";
	_obj.src = newFile;
}

function rollOut_gif(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_of.gif";
	_obj.src = newFile;
}

//ウィンドウオープン*********************************************

function myOpWin(theURL) { //v2.0
  var fs = 'toolbar=no,'
	+'location=no,'
	+'status=no,'
	+'menubar=no,'
	+'scrollbars=yes,'
	+'resizable=yes,'
	+'width=600,'
	+'height=370'; 
	window.open(theURL,'',fs);
}
function myOpWinlo(theURL) { //v2.0
  var fs = 'toolbar=no,'
	+'location=no,'
	+'status=no,'
	+'menubar=no,'
	+'scrollbars=yes,'
	+'resizable=yes,'
	+'width=740,'
	+'height=740'; 
	window.open(theURL,'',fs);
}

function myOpWinTV(theURL) { //v2.0
  var fs = 'toolbar=no,'
	+'location=no,'
	+'status=yes,'
	+'menubar=no,'
	+'scrollbars=no,'
	+'directories=no,'
	+'resizable=yes,'
	+'toolbar=no,'
	+'width=900,'
	+'height=600'; 
	window.open(theURL,'',fs);
}

function myOpWinNews(theURL) { //v2.0
  var fs = 'toolbar=no,'
	+'location=no,'
	+'status=yes,'
	+'menubar=no,'
	+'scrollbars=yes,'
	+'directories=no,'
	+'resizable=yes,'
	+'toolbar=no,'
	+'width=740,'
	+'height=600'; 
	window.open(theURL,'',fs);
}


//フラッシュの読み込み*********************************************

function callflash(){

document.write('');

}

//窓を閉じる*********************************************

function CloseWin(){
    window.close();
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/****************************************************************
* 機　能： 中央になるようにTopマージンを設定する
* 引　数： ch 対象のID
* 戻り値： なし
****************************************************************/
function chTmg(ch,InH){
	myH = WinHeight();
	tgM = myH - InH;
	alert(tgM +"px");
	var obj = document.getElementById(ch);
	obj.style.marginTop = tgM +'px';
}

/****************************************************************
* 機　能： ブラウザの高さ(内側)を返す
* 引　数： なし
* 戻り値： ウインドの高さ
****************************************************************/
function WinHeight(){
    var pHeight=null;
    //NN用
    if(document.layers) pHeight=window.innerHeight;
    //IE用
    if(document.all) pHeight=document.body.clientHeight;
    alert(pHeight);
		return pHeight;
}

var getViewPort = function() {
 	var width, heiht;
 	if (self.innerHeight) {
		// all except Explorer
		width = self.innerWidth;
		height = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if (document.body) {
		// other Explorers
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	return {width: width, height: height};
}

var resize = function(event) {
	var main = document.getElementById('AllFlashFlame');
	var viewport = getViewPort();
	//var height = viewport.height - 200; // 200 = header.height + footer.height
	var height = viewport.height -0 -100;
	//alert(height);
	if(viewport.width < 900){
		tgW = 900;
		main.style.width = (tgW <= 0 ? 0 : tgW) + 'px';
	}else{
		tgW = viewport.width;
		main.style.width = (tgW <= 0 ? 0 : tgW) + 'px';
	}
	main.style.height = (height <= 0 ? 0 : height) + 'px';
	
	var FooterN1 = document.getElementById('FTLeft');
	var FooterN2 = document.getElementById('FTNL');
	var FooterN3 = document.getElementById('Footer');
	var MyWidth1 = tgW -500;
	var MyWidth2 = MyWidth1 -90;
	FooterN1.style.width = (MyWidth1 <= 0 ? 0 : MyWidth1) + 'px';
	FooterN2.style.width = (MyWidth2 <= 0 ? 0 : MyWidth2) + 'px';
	FooterN3.style.width = tgW + 'px';
	window.onresize=resize();
}



function chHight(ch){
    var pHeight=null;
    //NN用
    if(document.layers) pHeight=window.innerHeight;
    //IE用
    if(document.all) pHeight=document.body.clientHeight;
    alert(pHeight);
		return pHeight;
}

/****************************************************************
* 機　能： 
****************************************************************/
function footer_resize(){
	var h = ((document.body.clientHeight) ? document.body.clientHeight : ((window.innerHeight) ? window.innerHeight : 0));
	document.getElementById("Layer1").style.height =  h-55+'px';
	document.getElementById("AllFlashFlame").style.height =  h-55+'px';
	document.getElementById("Layer2").style.top  =  h-55+'px';
	var viewport = getViewPort();
	if(viewport.width < 900){
		tgW = 900;
		document.getElementById("Layer2").style.width = '901px';
	}else{
		tgW = viewport.width;
		document.getElementById("Layer2").style.width = '100%';
	}
	
	var FooterN1 = document.getElementById('FTLeft');
	var FooterN2 = document.getElementById('FTNL');
	//var FooterN3 = document.getElementById('Footer');
	var MyWidth1 = tgW -500;
	var MyWidth2 = MyWidth1 -90;
	FooterN1.style.width = (MyWidth1 <= 0 ? 0 : MyWidth1) + 'px';
	FooterN2.style.width = (MyWidth2 <= 0 ? 0 : MyWidth2) + 'px';
	//FooterN3.style.width = tgW + 'px';
}




