var IE = 0,NN = 0,N6 = 0;
if(document.all) IE = true;
else if(document.layers) NN = true;
else if(document.getElementById) N6 = true;

var openedMenu = null;
var submenuTimer;
var MyMsg;
var FF_m_x
var FF_m_y

function get_MouseXY_FF(evt)
{
	FF_m_x = evt.pageX;
	FF_m_y = evt.pageY;
}

		window.onmousemove = get_MouseXY_FF;

//-----------------------------------------------------------
//ポップアップ表示
//-----------------------------------------------------------
function OnLink(Msg){
var pX = 0,pY = 0;
var sX = 10,sY = 10;

  if (document.getElementById) {
		MyMsg = document.getElementById(id).style;
		MyMsg.visibility = "visible";
  } else if (document.all) {
		MyMsg = document.all(id).style;
		MyMsg.visibility = "visible";
  } else if (document.layers) {
		MyMsg = document.layers[id];
		MyMsg.visibility = "show";
  } 

MyMsg.left = 0;
MyMsg.top = 0;

	if(document.all){
		pX = document.body.scrollLeft;
		pY = document.body.scrollTop;
		MyMsg.left = event.x + sX + pX + Xoffset;
		MyMsg.top = event.y + sY + pY + Yoffset;
	} else if (document.layers) {
		MyMsg.left = event.layerX + sX + Xoffset;
		MyMsg.top = event.layerY + sY + Yoffset;
	} else {
		window.onmousemove = get_MouseXY_FF;
		MyMsg.left = FF_m_x + sX + Xoffset;
		MyMsg.top = FF_m_y + sY + Yoffset;
	}

	clearTimeout(submenuTimer);
	openedMenu = id;
}
//-----------------------------------------------------------
//ポップアップ非表示
//-----------------------------------------------------------
function OffLink(Msg){
  if (document.getElementById) {
		MyMsg = document.getElementById(openedMenu).style;
		MyMsg.visibility = "hidden";
  } else if (document.all) {
		MyMsg = document.all(openedMenu).style;
		MyMsg.visibility = "hidden";
  } else if (document.layers) {
		MyMsg = document.layers[openedMenu];
		MyMsg.visibility = "hide";
  } 
  openedMenu = null;
}
//-----------------------------------------------------------
//ポップアップ表示2
//-----------------------------------------------------------
function OnLink2(id,Xoffset,Yoffset){
var pX = 0,pY = 0;
var sX = 10,sY = 10;

  if (document.getElementById) {
		MyMsg = document.getElementById(id).style;
		MyMsg.visibility = "visible";
  } else if (document.all) {
		MyMsg = document.all(id).style;
		MyMsg.visibility = "visible";
  } else if (document.layers) {
		MyMsg = document.layers[id];
		MyMsg.visibility = "show";
  } 

MyMsg.left = 0;
MyMsg.top = 0;

	if(document.all){
		pX = document.body.scrollLeft;
		pY = document.body.scrollTop;
		MyMsg.left = event.x + sX + pX + Xoffset;
		MyMsg.top = event.y + sY + pY + Yoffset;
	} else if (document.layers) {
		MyMsg.left = event.layerX + sX + Xoffset;
		MyMsg.top = event.layerY + sY + Yoffset;
	} else {
		window.onmousemove = get_MouseXY_FF;
		MyMsg.left = FF_m_x + sX + Xoffset;
		MyMsg.top = FF_m_y + sY + Yoffset;
	}

	clearTimeout(submenuTimer);
	openedMenu = id;
}
//-----------------------------------------------------------
//ポップアップ非表示2
//-----------------------------------------------------------
function OffLink2(){
  if (document.getElementById) {
		MyMsg = document.getElementById(openedMenu).style;
		MyMsg.visibility = "hidden";
  } else if (document.all) {
		MyMsg = document.all(openedMenu).style;
		MyMsg.visibility = "hidden";
  } else if (document.layers) {
		MyMsg = document.layers[openedMenu];
		MyMsg.visibility = "hide";
  } 
  openedMenu = null;
}
//-----------------------------------------------------------
//ポップアップ表示　非表示　制御
//-----------------------------------------------------------
function menuOvr2(id,Xoffset,Yoffset){
	// 開いているメニューと違うメニューであれば隠す。
	if (openedMenu && openedMenu != id){
		OffLink2(id);
	}
	// サブウィンドウの表示
	OnLink2(id,Xoffset,Yoffset);
}
//-----------------------------------------------------------
//ブロック単位で表示、非表示の制御
//-----------------------------------------------------------
var MylimitDate = 'Thu, 1-Jan-2100 00:00:00 GMT';
var MytimeLimit = ';' + 'expires=' + MylimitDate;
var dc = document.cookie;

function Myopenbox(targetID, TempVal) {
	if(TempVal.match('on')) {
		document.getElementById('open-box' + targetID).style.display = 'block'
		document.cookie = 'open-box' + targetID + '=' + TempVal + MytimeLimit;
	} else if (TempVal.match('mix')) {
		dispCheck = document.getElementById('open-box' + targetID).style.display;
		if (dispCheck == '') {
			if (dc.match('open-box' + targetID + '\=on')) {
				nowDisp = 'block'
			} else {
				nowDisp = 'none'
			};
		} else {
			nowDisp = document.getElementById('open-box' + targetID).style.display;
		}
		if (nowDisp == 'none') {
			document.getElementById('open-box' + targetID).style.display = 'block'
			document.cookie = 'open-box' + targetID + '=' + 'on' + MytimeLimit;
		} else {
			document.getElementById('open-box' + targetID).style.display = 'none'
			document.cookie = 'open-box' + targetID + '=' + 'off' + MytimeLimit;
		};
	} else {
		document.getElementById('open-box' + targetID).style.display = 'none'
		document.cookie = 'open-box' + targetID + '=' + TempVal + MytimeLimit;
	};
};
