



/* 1. fontswitch
--------------------------------------------------------------------------	*/

if (document.images) {
	var s_off = new Image(); s_off.src = '/common/images/font_small_off.gif';
	var s_on  = new Image(); s_on.src  = '/common/images/font_small_on.gif';
	var m_off = new Image(); m_off.src = '/common/images/font_middle_off.gif';
	var m_on  = new Image(); m_on.src  = '/common/images/font_middle_on.gif';
	var b_off = new Image(); b_off.src = '/common/images/font_big_off.gif';
	var b_on  = new Image(); b_on.src  = '/common/images/font_big_on.gif';
}

function setActiveStyleSheet(title) {
    var i, a, main;
/*
	if(title == "f_s"){
		document.images["s_img"].src = s_on.src;
		document.images["m_img"].src = m_off.src;
		document.images["b_img"].src = b_off.src;
	}else if(title == "f_b"){
		document.images["s_img"].src = s_off.src;
		document.images["m_img"].src = m_off.src;
		document.images["b_img"].src = b_on.src;
	}else{
		// f_type == "default"
		document.images["s_img"].src = s_off.src;
		document.images["m_img"].src = m_on.src;
		document.images["b_img"].src = b_off.src;
	
	}
*/
  var flg = true;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title){
        a.disabled = false;
	flg = false;
      }
    }
  }
  if (flg){
    title = 'default';
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
      if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
        a.disabled = true;
        if(a.getAttribute("title") == title){
          a.disabled = false;
          flg = false;
        }
      }
    }
  }
  createCookie("style", title, 365);
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled)
      return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function getSwitch() {
  var cookie = readCookie("style");
  if(!cookie){
	cookie =  "default";
  }
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}



/* 2. top
--------------------------------------------------------------------------	*/

function unLoadSub(Num){

//プルダウンを消す(Opera対策)

	var agent = navigator.userAgent ;

	if ((agent.indexOf('Mac') != -1 ) && (agent.indexOf('MSIE') != -1 ) && (Num==1)) {}else{
//MacIE対策(プルダウンを消すタイミング)

//全てのプルダウンのIDを並べる
		imgList="news01,news02,news03";
		imgList =imgList+",profile01,profile02,profile03,profile04,profile05,profile06,profile07,profile08,profile09";
		imgList =imgList+",rd01,rd02,rd03,rd04,rd05,rd07";
		imgList =imgList+",ir01,ir02,ir03,ir04,ir06,ir07,ir08";
		imgList =imgList+",health01,health02,health03,health04,health05,health06,health07,health08";
		
//カンマ区切りのイメージリストを配列におさめる
		myCategoryArray=imgList.split(','); 

//ここから処理
		if(document.all){

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				if (document.all(myTmpVal)){
					document.all(myTmpVal).style.visibility = "hidden";
				}
			}

		}else if(document.getElementById){

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				if (document.getElementById(myTmpVal)){
					document.getElementById(myTmpVal).style.visibility = "hidden";
				}
			}

		}else if(document.layers){

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				if (document.myTmpVal){
					document.myTmpVal.visibility = "hide";
				}
			}

		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				if (document.myTmpVal){
					document.myTmpVal.style.display="none";
				}
			}
		}
	}
}


globalNum=0;


function visibleMenu(theLayer,theImage,imgList){

//プルダウンを表示する(メイン画像のID,メイン画像のuri,プルダウンIDをカンマ区切りで)

	globalNum=1;

//カンマ区切りのイメージリストを配列に
	myCategoryArray=imgList.split(','); 

	if(document.all){

 //メイン画像の差し換え
		if (theLayer==""){
		}else{
			document.all(theLayer).style.background = "url("+theImage+")";
		}

		if (imgList ==""){
		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.all(myTmpVal).style.visibility = "visible";
			}
		}

	}else if(document.getElementById){
		if (theLayer==""){
		}else{
			document.getElementById(theLayer).style.background = "url("+theImage+")";
		}

		if (imgList ==""){
		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
			myTmpVal = myCategoryArray[loop];
			document.getElementById(myTmpVal).style.visibility = "visible";
			}
		}

	}else if(document.layers){

		if (theLayer==""){
		}else{
			document.theLayer.background = "url("+theImage+")";
		}

		if (imgList ==""){}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.myTmpVal.visibility = "show";
			}
		}

	}else{

		if (theLayer==""){
		}else{
			document.theLayer.style.background = "url("+theImage+")";
		}

		if (imgList ==""){
		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.myTmpVal.style.display="block";
			}
		}
	}
}


function hideMenu(imgList){

//プルダウンを消す(プルダウンIDをカンマ区切りで)

	myCategoryArray=imgList.split(','); //カンマ区切りのイメージリストを配列に

	if(document.all){

		if (imgList ==""){
		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.all(myTmpVal).style.visibility = "hidden";
			}
		}

	}else if(document.getElementById){

		if (imgList ==""){
		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.getElementById(myTmpVal).style.visibility = "hidden";
			}
		}

	}else if(document.layers){

		if (imgList ==""){
		}else{

			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.myTmpVal.visibility = "hide";
			}
		}

	}else{

		if (imgList ==""){
		}else{
			for (loop = 0; loop < myCategoryArray.length; loop++){
				myTmpVal = myCategoryArray[loop];
				document.myTmpVal.style.display="none";
			}
		}
	}

	timerID = setTimeout('resetIMG()',300) ;
	globalNum=0
}


function resetIMG(){

//メイン画像を元に戻す

	if (globalNum==0){

		theImage="common/images/content/index_01.jpg";

		if(document.all){
			if (document.all("title")){
				document.all("title").style.background = "url("+theImage+")"; //メイン画像の差し換え
			}
		}else if(document.getElementById){
			if (document.getElementById("title")){
				document.getElementById("title").style.background = "url("+theImage+")";
			}
		}else if(document.layers){
			if (document.title){
				document.title.background = "url("+theImage+")";
			}
		}else{
			if (document.title){
				document.title.style.background = "url("+theImage+")";
			}
		}
	}
}

//サブウィンドウを開く

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}