/*
Koey's Popup Menu ver2.08
Copyright 2004 Koey事務所 三浦文人
mail : webdesign@koey.info
site : http://www.koey.info

上記URLにリンクをお願いいたします。
尚、このスクリプトの使用で起きたトラブルは一切責任を持ちません。
配布者及び使用者の責任でお願いいたします。<(._.)>
*/

function ImgPreload() {
var N = ImgPreload.arguments[0];
SwImg[N] = new Image();
SwImg[N][0] = new Image();
SwImg[N][0].src = ImgPreload.arguments[1];
SwImg[N][1] = new Image();
SwImg[N][1].src = ImgPreload.arguments[2];
}

function ImgChenge() {
var ID = ImgChenge.arguments[0];
var N  = ImgChenge.arguments[1];
document.images[ID].src = SwImg[ID][N].src;
}

function setBGC(pal) { document.all('Koey01').style.background=pal }
function setBackgroundColor(pal) { document.all('Koey01').style.background=pal }

function KoeyC01(pal){ document.all('KoeyC01').style.background=pal }
function KoeyC02(pal){ document.all('KoeyC02').style.background=pal }
function KoeyC03(pal){ document.all('KoeyC03').style.background=pal }
function KoeyC04(pal){ document.all('KoeyC04').style.background=pal }
function KoeyC05(pal){ document.all('KoeyC05').style.background=pal }
function KoeyC06(pal){ document.all('KoeyC06').style.background=pal }
function KoeyC07(pal){ document.all('KoeyC07').style.background=pal }
function KoeyC08(pal){ document.all('KoeyC08').style.background=pal }
function KoeyC09(pal){ document.all('KoeyC09').style.background=pal }
function KoeyC10(pal){ document.all('KoeyC10').style.background=pal }
function KoeyC11(pal){ document.all('KoeyC11').style.background=pal }
function KoeyC12(pal){ document.all('KoeyC12').style.background=pal }
function KoeyC13(pal){ document.all('KoeyC13').style.background=pal }
function KoeyC14(pal){ document.all('KoeyC14').style.background=pal }
function KoeyC15(pal){ document.all('KoeyC15').style.background=pal }
function KoeyC16(pal){ document.all('KoeyC16').style.background=pal }
function KoeyC17(pal){ document.all('KoeyC17').style.background=pal }
function KoeyC18(pal){ document.all('KoeyC18').style.background=pal }
function KoeyC19(pal){ document.all('KoeyC19').style.background=pal }
function KoeyC20(pal){ document.all('KoeyC20').style.background=pal }
function KoeyC21(pal){ document.all('KoeyC21').style.background=pal }
function KoeyC22(pal){ document.all('KoeyC22').style.background=pal }
function KoeyC23(pal){ document.all('KoeyC23').style.background=pal }
function KoeyC24(pal){ document.all('KoeyC24').style.background=pal }
function KoeyC25(pal){ document.all('KoeyC25').style.background=pal }
function KoeyC26(pal){ document.all('KoeyC26').style.background=pal }
function KoeyC27(pal){ document.all('KoeyC27').style.background=pal }
function KoeyC28(pal){ document.all('KoeyC28').style.background=pal }
function KoeyC29(pal){ document.all('KoeyC29').style.background=pal }
function KoeyC30(pal){ document.all('KoeyC30').style.background=pal }
function KoeyC31(pal){ document.all('KoeyC31').style.background=pal }
function KoeyC32(pal){ document.all('KoeyC32').style.background=pal }
function KoeyC33(pal){ document.all('KoeyC33').style.background=pal }
function KoeyC34(pal){ document.all('KoeyC34').style.background=pal }
function KoeyC35(pal){ document.all('KoeyC35').style.background=pal }
function KoeyC36(pal){ document.all('KoeyC36').style.background=pal }
function KoeyC37(pal){ document.all('KoeyC37').style.background=pal }
function KoeyC38(pal){ document.all('KoeyC38').style.background=pal }
function KoeyC39(pal){ document.all('KoeyC39').style.background=pal }
function KoeyC40(pal){ document.all('KoeyC40').style.background=pal }
function KoeyC41(pal){ document.all('KoeyC41').style.background=pal }
function KoeyC42(pal){ document.all('KoeyC42').style.background=pal }
function KoeyC43(pal){ document.all('KoeyC43').style.background=pal }
function KoeyC44(pal){ document.all('KoeyC44').style.background=pal }
function KoeyC45(pal){ document.all('KoeyC45').style.background=pal }
function KoeyC46(pal){ document.all('KoeyC46').style.background=pal }
function KoeyC47(pal){ document.all('KoeyC47').style.background=pal }
function KoeyC48(pal){ document.all('KoeyC48').style.background=pal }
function KoeyC49(pal){ document.all('KoeyC49').style.background=pal }
function KoeyC50(pal){ document.all('KoeyC50').style.background=pal }

var current="",timer,ready=false,ie,nn,d1,op

function popupmenu(e,id,menux,menuy){
hidemenu()
current=id
if(timer)clearTimeout(timer)
if(ie||op)e=window.event
if(!menux||!menuy){
if(ie||op){
menux=e.clientX+document.body.scrollLeft
menuy=e.clientY+document.body.scrollTop
}else{
menux=e.pageX
menuy=e.pageY
}
}
if(ie||d1){
with(document.all(id)){
style.left=menux
style.top=menuy
style.visibility="visible"
}
}else
if(nn){
with(document.layers[id]){
left=menux
top=menuy
visibility="show"
}
}
}

var doposcheck=false

function poscheck(e){
if(doposcheck){
if(ie||op)e=window.event
var l,t,w,h,x,y
if(ie||d1){
l=document.all(current).offsetLeft
t=document.all(current).offsetTop
w=document.all(current).offsetWidth
h=document.all(current).offsetHeight
x=eval("e.clientX+"+(op&&!document.createTextNode?0:ie?"document.body.scrollLeft":"window.pageXOffset"))
y=eval("e.clientY+"+(op&&!document.createTextNode?0:ie?"document.body.scrollTop":"window.pageYOffset"))
if(x<l||x>l+w||y<t||y>t+h)hidemenu()
}else
if(nn){
l=document.layers[current].left
t=document.layers[current].top
w=document.layers[current].document.width
h=document.layers[current].document.height
if(e.pageX<l||e.pageX>l+w||e.pageY<t||e.pageY>t+h)hidemenu()
}
}
}

function hidemenu(){
if(current!=""){
if(ie||d1)document.all(current).style.visibility="hidden"
else
if(nn)document.layers[current].visibility="hide"
doposcheck=false
}
}

function hide(){
if(!ready){timer=setTimeout("hide();doposcheck=true",100);return}
timer=setTimeout('if(!doposcheck){hidemenu()}',1000)
}

function initmenu(){
ie=!!document.all
nn=!!document.layers
d1=!!document.getElementById
op=!!window.opera
if(!ie&&d1)
document.all=function(id){return document.getElementById(id)}
if(!(ie||d1||nn))return
if(nn)document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=poscheck
var over=function(e){doposcheck=true;if(nn&&e.target.constructor!=Layer)document.routeEvent(e)}
for(i=1;;i++){
if((nn&&!document.layers["menu"+i])||(!nn&&!document.all("menu"+i)))break
if(nn){
document.layers["menu"+i].captureEvents(Event.MOUSEOVER)
document.layers["menu"+i].onmouseover=over
}else{
document.all("menu"+i).onmouseover=over
}
}
ready=true
}
window.onload=initmenu


