/**
	Master of Epic - common Javascript
	2006
*/

/**
	別窓
*/
function openSubWindow(wname,URLStr, width, height){
  subwin = open(URLStr, wname, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height);
  subwin.focus();
}

/**
	MM
*/
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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}

//ネスケチェック

browser = navigator.appName;
version = Number(navigator.appVersion.charAt(0));
if ((browser == "Netscape") && (version < 5)) {
	location.href="nn4x.html";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
/**
	共通メニュー用メニュー表示切替
*/
function tglCommonMenu( id ){
	var obj = document.getElementById(id);
	if( obj ){
		obj.style.display = (obj.style.display!='block')? 'block':'none';
		var btnobj = document.getElementById(id+"_btn");
		var src_r  = btnobj.src.substring(0,btnobj.src.length-5);
		src_r += (obj.style.display=='block') ? "2.gif" : "1.gif";
		btnobj.src = src_r;
	}
}
function tglCommonSubMenu( id ){
	var obj = document.getElementById(id);
	if( obj ){
		obj.style.display = (obj.style.display!='block')? 'block':'none';
		var liobj = document.getElementById(id+"_btn");
		liobj.style.listStyleImage = (obj.style.display=='block') ? "url(/img/face_side_list_arrow2.gif)" : "url(/img/face_side_list_arrow1.gif)";
	}
}
/**-------------------------------------------------------------------

	GlobalMenu Javascript

*/
var gmenud = [
	{id:'gms1',childs:[
		{id:'gms1s1',childs:[]},{id:'gms1s2',childs:[]},{id:'gms1s3',childs:[]},{id:'gms1s4',childs:[]}
	]}
	,
	{id:'gms2',childs:[
		{id:'gms2s1',childs:[
			{id:'gms2s1s1',childs:[]},{id:'gms2s1s2',childs:[]},{id:'gms2s1s3',childs:[]}
		]}
	]}
	,
	{id:'gms3',childs:[]}
	,
	{id:'gms4',childs:[]}
	,
	{id:'gms5',childs:[
		{id:'gms5s1',childs:[]}
	]}
	,
	{id:'gms6',childs:[]}
];

var intervalid     = undefined;
var menuclick_bool = false;
var gmenuroll_bool = false;

function getMenuChilds(id,nodes){
	for(var i=0;i<nodes.length;i++){
		if( nodes[i].id == id ){
			return nodes[i].childs;
		}else if( nodes[i].childs.length>0 ){
			var res = getMenuChilds(id,nodes[i].childs);
			if( res != undefined )
				return res;
		}
	}
	return undefined;
}
function getMenuParentChilds(id,nodes){
	for(var i=0;i<nodes.length;i++){
		if( nodes[i].id == id ){
			return nodes;
		}else if( nodes[i].childs.length>0 ){
			var res = getMenuParentChilds(id,nodes[i].childs);
			if( res != undefined )
				return res;
		}
	}
	return undefined;
}

/**
	menu control
*/
function setVisibleMenu( id , visible ){
	document.getElementById(id).style.visibility = visible;
}
function setVisibleMenuGroup( nodes , visible ){
	for(var i=0;i<nodes.length;i++){
		setVisibleMenu( nodes[i].id , visible );
		if( nodes[i].childs.length>0 ){
			setVisibleMenuGroup(nodes[i].childs,visible);
		}
	}
}
function tgl(id){
	mclick();
	var v = "";
	if( document.getElementById(id).style.visibility!="visible"){
		v = "visible"; gmenuroll_bool=true;
	}else{
		v = "hidden"; gmenuroll_bool=false;
	}
	setVisibleMenuGroup( getMenuParentChilds(id,gmenud) ,"hidden");
	setVisibleMenu( id ,v );
	chgGMenuBtn( id , v );
}
function tglg(id){
	if( gmenuroll_bool==true ){
		setVisibleMenuGroup( gmenud ,"hidden");
		setVisibleMenu(id,"visible");
		chgGMenuBtn( id , "visible" );
	}
}
function chgGMenuBtn(id,visible){
	for(var i=0;i<gmenud.length;i++){
		var mid = gmenud[i].id;
		if( mid!=id || visible!="visible" ){
			document.getElementById(mid+"i").src = "/img/btn_" + mid + "a.gif";
		}else{
			document.getElementById(mid+"i").src = "/img/btn_" + mid + "b.gif";
		}
	}
}
//子グループ消し
function tgl2(){
	setVisibleMenuGroup( getMenuChilds(arguments[0],gmenud) ,"hidden");
	if( arguments.length>1 ){ setVisibleMenu( arguments[1],"visible"); }
}
//on body clicked , hide menus.
function mclick(){
	menuclick_bool = true;
	if( intervalid != undefined ){ clearInterval(intervalid); }
	intervalid = setInterval( "cancelMenuClickBool()",1 );
}
function cancelMenuClickBool(){
	clearInterval(intervalid);
	intervalid=undefined;
	menuclick_bool = false;
}
function bodyclick(){
	if( menuclick_bool==false ){
		setVisibleMenuGroup(gmenud,'hidden');
		chgGMenuBtn("",'hidden');
		gmenuroll_bool=false;
	}
}
/**
	menu layout
*/
function setMenuPos( id , xx , yy ){
	document.getElementById(id).style.top = yy;
	document.getElementById(id).style.left = xx;
	//alert(document.getElementById(id).style.top)
}
function layoutGMenu(ox,oy){
	var h  = 20;
	setMenuPos('gms1'     , ox       , oy );
	setMenuPos('gms1s1'   , ox + 200 , oy );
	setMenuPos('gms1s2'   , ox + 200 , oy + h );
	setMenuPos('gms1s3'	  , ox + 200 , oy + h*2 );
	setMenuPos('gms1s4'	  , ox + 200 , oy + h*6 );
	setMenuPos('gms2'     , ox + 93  , oy );
	setMenuPos('gms2s1'   , ox + 93  + 150 , oy + h*6 );
	setMenuPos('gms2s1s1' , ox + 93  + 150*2 , oy + h*6 );
	setMenuPos('gms2s1s2' , ox + 93  + 150*2 , oy + h*7 );
	setMenuPos('gms2s1s3' , ox + 93  + 150*2 , oy + h*8 );
	setMenuPos('gms3'     , ox + 186 , oy );
	setMenuPos('gms4'     , ox + 279 , oy );
	setMenuPos('gms5'     , ox + 372 , oy );
	setMenuPos('gms5s1'   , ox + 372 + 150 , oy + h*2 );
	setMenuPos('gms6'     , ox + 465 , oy );
}
function resize(){
	var xx = (navigator.appName.indexOf("Microsoft")>-1) ? -14 : 0 ;
	xx += Math.round( ( document.body.offsetWidth - 800 )/2 );
	xx = ( xx<0 ) ? 0 : xx;
	layoutGMenu( xx , 170 );
}
function onloadMenu(){
	resize();
	MM_preloadImages("/img/btn_gms1a.gif","/img/btn_gms2a.gif","/img/btn_gms3a.gif","/img/btn_gms4a.gif","/img/btn_gms5a.gif","/img/btn_gms6a.gif");
}
function resizeTop(){
	var xx = (navigator.appName.indexOf("Microsoft")>-1) ? -14 : 0 ;
	xx += Math.round( ( document.body.offsetWidth - 800 )/2 );
	xx = ( xx<0 ) ? 0 : xx;
	layoutGMenu( xx , 240 );
}
function onloadMenuTop(){
	resizeTop();
	MM_preloadImages("/img/btn_gms1a.gif","/img/btn_gms2a.gif","/img/btn_gms3a.gif","/img/btn_gms4a.gif","/img/btn_gms5a.gif","/img/btn_gms6a.gif");
}
//

function axwrite(str){
	document.write(str);
}

//


var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-11460598-1");
pageTracker._trackPageview();
} catch(err) {}

