<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Konstantin Jagello | http://javascript-array.com/ */

var TimeOut         = 300;
var currentLayer    = null;
var currentitem     = null;
var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

function mopen(n) {
  var l  = document.getElementById("menu"+n);
  var mm = document.getElementById("mmenu"+n);
	
  if(l) {
    mcancelclosetime();
    l.style.visibility='visible';
    if(currentLayer && (currentLayerNum != n))
      currentLayer.style.visibility='hidden';
    currentLayer = l;
    currentitem = mm;
    currentLayerNum = n;			
  } else if(currentLayer) {
    currentLayer.style.visibility='hidden';
    currentLayerNum = 0;
    currentitem = null;
    currentLayer = null;
 	}
}
function mclosetime() {
  closeTimer = window.setTimeout(mclose, TimeOut);
}
function mcancelclosetime() {
  if(closeTimer) {
    window.clearTimeout(closeTimer);
    closeTimer = null;
  }
}
function mclose() {
  if(currentLayer && noClose!=1)   {
    currentLayer.style.visibility='hidden';
    currentLayerNum = 0;
    currentLayer = null;
    currentitem = null;
  } else {
    noClose = 0;
  }
  currentLayer = null;
  currentitem = null;
}
document.onclick = mclose; 

SubMenu1 = "http://www.takacho.jp/news/list.php";
SubMenu2 = "http://www2.takacho.jp/newly_arrived/menu.asp";
SubMenu3 = "http://www.takacho.jp/oraga/index.html";
SubMenu4 = "http://www2.takacho.jp/calender/gyouji/today.asp";
SubMenu5 = "http://www.takacho.jp/facebook/wall/index.html";
function addstring() {
        document.forms[0].q.value = 'site:www.takacho.jp ' + document.forms[0].q.value;
        return true;
}
function mhHover(tbl,idx,cls){
	var t,d;
	if(document.getElementById)
		t=document.getElementById(tbl);
	else
		t=document.all(tbl);
	if(t==null)return;
	if(t.getElementsByTagName)
		d=t.getElementsByTagName("TD");
	else
		d=t.all.tags("TD");
	if(d==null)return;
	if(d.length<=idx)return;
	d[idx].className=cls;
}

	imgnum=1;
	function changeImage(){
    if(imgnum==1){
        document.myimg.src="image/banner1.jpg";
        imgnum=2;
    }else if(imgnum==2){
        document.myimg.src="image/banner2.jpg";
        imgnum=3;
	}else if(imgnum==3){
        document.myimg.src="image/banner3.jpg";
        imgnum=4;
	}else if(imgnum==4){
        document.myimg.src="image/banner4.jpg";
        imgnum=5;
	}else if(imgnum==5){
        document.myimg.src="image/banner5.jpg";
        imgnum=6;
	}else if(imgnum==6){
        document.myimg.src="image/banner6.jpg";
        imgnum=1;
    }
    setTimeout("changeImage()",5000);
}
function Open_Win(para){
	wx = 500; wy = 400;
	x = (screen.width - wx) / 2;
	y = (screen.height - wy) / 2;
	win=window.open(para,"new","width="+wx+" height="+wy+" left="+x+" top="+y+" scrollbars=yes");
	win.focus();
}
function saveSubMenu(theValue) {
	theName = "submenu";
	theDay = 30;
	setDay = new Date();
	setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
	expDay = setDay.toGMTString();
	document.cookie = theName + "=" + theValue + ";expires=" + expDay;
}
function loadSubMenu() {
	theData = "1"
	theName = "submenu=";
	theCookie = document.cookie + ";";
	start = theCookie.indexOf(theName);
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		theData = theCookie.substring(start + theName.length,end);
	}
	if (theData == 1) {
		setElementClassById('id1','item1 active');
		setElementClassById('id2','item2');
		setElementClassById('id3','item3');
		setElementClassById('id4','item4');
		setElementClassById('id5','item5');
		submenu.location.href=SubMenu1;
	}
	if (theData == 2) {
		setElementClassById('id1','item1');
		setElementClassById('id2','item2 active');
		setElementClassById('id3','item3');
		setElementClassById('id4','item4');
		setElementClassById('id5','item5');
		submenu.location.href=SubMenu2;
	}
	if (theData == 3) {
		setElementClassById('id1','item1');
		setElementClassById('id2','item2');
		setElementClassById('id3','item3 active');
		setElementClassById('id4','item4');
		setElementClassById('id5','item5');
		submenu.location.href=SubMenu3;
	}
	if (theData == 4) {
		setElementClassById('id1','item1');
		setElementClassById('id2','item2');
		setElementClassById('id3','item3');
		setElementClassById('id4','item4 active');
		setElementClassById('id5','item5');
		submenu.location.href=SubMenu4;
	}
	if (theData == 5) {
		setElementClassById('id1','item1');
		setElementClassById('id2','item2');
		setElementClassById('id3','item3');
		setElementClassById('id4','item4');
		setElementClassById('id5','item5 active');
		submenu.location.href=SubMenu5;
	}
	return theData;
}
// class要素の追加・変更
function setElementClassById(elem, value) {
   if(document.getElementById) {
         var obj = document.getElementById(elem);
         if(obj) {
            obj.className = value;
         }
   }
}

// HpbImgFind:
//
function HpbImgFind(doc, imgName)
{
  for (var i=0; i < doc.layers.length; i++)
  {
    var img = doc.layers[i].document.images[imgName];
    if (!img) img = HpbImgFind(doc.layers[i], imgName);
    if (img) return img;
  }
  return null;
}
// HpbImgSwap:
//
function HpbImgSwap(imgName, imgSrc)
{
  var appVer=parseInt(navigator.appVersion);
  var isNC=false,isN6=false,isIE=false;
  if (document.all && appVer >= 4) isIE=true; else
    if (document.getElementById && appVer > 4) isN6=true; else
      if (document.layers && appVer >= 4) isNC=true;
  if (isNC||isN6||isIE)
  {
    if (document.images)
    {
      var img = document.images[imgName];
      if (!img) img = HpbImgFind(document, imgName);
      if (img) img.src = imgSrc;
    }
  }
}
var swImg; swImg=new Array;
function _HpbJumpURLinNewWindow(url) 
{
  if (url != '')
  {
    window.open(url, '_blank');
  }
}
// -->

