home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 December
/
Chip_2000-12_cd1.bin
/
internet
/
ukazky
/
aukce.cz_soubory
/
menu.js
< prev
next >
Wrap
Text File
|
2000-10-19
|
8KB
|
207 lines
// Hierarchicka MENU v.1.0, Autori: Jan Svoboda, Jan Bartos, http://www.KeyWay.cz
var mg_showing="click"
var mg_BH=33
var mg_FS=8
var mg_FT="Verdana, Arial"
var mg_FCH="#FFFFFF"
var mg_FC="#000000"
var mg_inactFC="#AAAAAA"
var mg_TW=100
var mg_LH=15
var mg_cGrid="#000000"
var mg_cBody="#CCCCCC"
var mg_top=110
var mg_fromright=130
var mg_imgadr="http://www.dobreweby.cz/button/dbwa2.gif"
var mg_imgwid=88
var mg_imghei=31
var mg_imgleft="left.gif"
var mg_imgright="right.gif"
var mg_tmoac=2000
var mg_makepicture=false//rozhodnuti zda defaultne vyplesknout obrazek na absolutni pozici
var mg_NSou=true
var mg_Act=false
var mg_ST,mg_hI,mg_TP,mg_HP,mg_Temp,mg_BS,mg_d1,mg_d3,mg_d4
var mg_LP="height="+mg_LH+" style='font-family: "+mg_FT+"; font-size: "+mg_FS+"pt; color: "+mg_FC+"'"
var mg_inactLP="height="+mg_LH+" style='cursor: default; font-family: "+mg_FT+"; font-size: "+mg_FS+"pt; color: "+mg_inactFC+"'"
var mg_clmx,mg_tmpclmx,mg_clmy,mg_tmpclmy,mg_momx,mg_momy
images=new Array(3)
images[2]=new Image();images[2].src=mg_imgleft
images[3]=new Image();images[3].src=mg_imgright
document.write ('<table id=mi_MENU1></table>')
document.write ('<table id=mi_MENU2></table>')
document.write ('<script EVENT=onmousedown() FOR=document LANGUAGE=JavaScript>')
document.write ('if(mg_NSou){mg_clmx=event.clientX;mg_clmy=event.clientY}')
document.write ('else{if(mi_MENU2.style.visibility=="visible"){mg_NSou=true;mg_clmx=event.clientX;mg_clmy=event.clientY}}')
document.write ('</script>')
document.write ('<script EVENT=onmousemove() FOR=document LANGUAGE=JavaScript>')
document.write ('mg_momx=event.clientX;mg_momy=event.clientY')
document.write ('</script>')
document.write ('<script EVENT=onmousemove() FOR=mi_MENU1 LANGUAGE=JavaScript>')
document.write ('window.clearTimeout(mg_STO)')
document.write ('</script>')
if(mg_makepicture)
{
images[1]=new Image();images[1].src=mg_imgadr
if(mg_showing=="click")document.write ('<img ID=mi_navigation style="cursor: hand" onclick=mf_M1(1) border=0 src='+mg_imgadr+' width='+mg_imgwid+' height='+mg_imghei+'>')
if(mg_showing=="move")document.write ('<img ID=mi_navigation style="cursor: hand" onmousemove="if(mg_NSou){mg_clmx=mg_momx;mg_clmy=mg_momy;mf_M1(1)}" border=0 src='+mg_imgadr+' width='+mg_imgwid+' height='+mg_imghei+'>')
mi_navigation.style.visibility="visible"
mi_navigation.style.posTop=mg_top
mi_navigation.style.posLeft=document.body.clientWidth-document.body.scrollLeft-mg_fromright
}
function mf_MN()
{
mi_navigation.style.posLeft=document.body.clientWidth-document.body.scrollLeft-mg_fromright+15
}
function mf_SetTablePar()
{
mg_TP=" border=1 width="+mg_TW+" cellspacing=0 style=border-left: 2px solid "+mg_cGrid+"; border-right: 0px solid "+mg_cGrid+"; border-top: 1px "+mg_cGrid+"; border-bottom: 2px solid "+mg_cGrid+" cellpadding=2 bordercolor="+mg_cGrid+" bordercolorlight="+mg_cGrid+" bordercolordark="+mg_cGrid
mg_HP="height="+mg_LH+" style='background-color: "+mg_cGrid+"; font-family: "+mg_FT+"; font-size: "+mg_FS+"pt; color: "+mg_FCH+";' align=center"
}
function mf_HideLayer(layerName)
{
mg_NSou=true
eval('document.all["'+layerName+'"].style.visibility="hidden"')
}
function mf_MoveLayer(layerName,left,top)
{
mg_NSou=false
eval('document.all["'+layerName+'"].style.visibility="visible"')
eval('document.all["'+layerName+'"].style.top='+top)
eval('document.all["'+layerName+'"].style.left='+left)
}
function mf_ChangeCol_PL_M1(mp_iRow,mp_iName,mp_iCell,mp_iHasBranch,mp_iHead)
{
if(typeof mg_Temp=="object")mg_Temp.className=''
mp_iCell.className='cmenuact'
window.clearTimeout(mg_ST)
mg_d1=mp_iRow
mg_d3=mp_iHead
var ml_a=mp_iCell.id.split("_")
mg_d4="a"+mp_iName+"_"+ml_a[1]
mp_iHasBranch==1?mg_ST=window.setTimeout('mf_M2(mg_d1,mg_d3,mg_d4)',50):mf_HideLayer("mi_MENU2")
}
function mf_DeCol_PL_M1(mp_iCell)
{
if(mi_MENU2.style.visibility!="visible")mp_iCell.className=''
mg_Temp=mp_iCell
}
function mf_M1(mp_ArrayName)
{
if(typeof mg_clmx=="undefined")
{
alert('Strßnka se doΦφtß. PoΦkejte prosφm chvφli.');return false
}
mg_STO=window.setTimeout('mf_HideLayer("mi_MENU1")',mg_tmoac)
var ml_cururl=document.URL.toUpperCase()
var ml_Picture,ml_Tail,ml_obr
mf_SetTablePar()
mg_BS=document.body.offsetWidth-25-mg_TW
if(mg_clmx>mg_BS)mg_clmx=mg_BS
if(mg_clmx+mg_TW-6>mg_BS){ml_ml_Tail=" align='top'";ml_Picture=mg_imgleft}
else {ml_ml_Tail=" align='right'";ml_Picture=mg_imgright}
var ml_j=1;var ml_iPL=eval("a"+mp_ArrayName)
var ml_R="<TABLE onMouseOut='mf_ShowOrHide()' ID=mi_MENU1"+mg_TP+">"
ml_R+="<TR><TD "+mg_HP+">"+ml_iPL[0]+"</TD></TR>"
for(var ml_i=1;ml_i<ml_iPL.length;ml_i+=3)
{
if(ml_iPL[ml_i+2]==1)ml_obr="<img ID=mi_T src='"+ml_Picture+"' width='12' height='12'"+ml_ml_Tail+">"
else ml_Picture=="left"?ml_obr="<img ID=mi_T src='"+ml_Picture+"' width='12' height='1'"+ml_Tail+">":ml_obr=""
var ml_A='"'+ml_iPL[ml_i+1]+'"';
var ml_B='"'+mp_ArrayName+'"';
var ml_C='"'+ml_iPL[ml_i]+'"';
if(ml_cururl.indexOf(ml_iPL[ml_i+1].toUpperCase())!=-1)
{
mg_tmpclmx=mg_clmx;mg_tmpclmy=mg_clmy
ml_R+="<TR><TD bgcolor="+mg_cBody+" "+mg_inactLP+" ID=mi_"+ ml_j++ +" onClick='mg_clmx=mg_tmpclmx;mg_clmy=mg_tmpclmy;return false' onMouseOver='mf_ChangeCol_PL_M1("+ml_j+","+ml_B+",this,"+ml_iPL[ml_i+2]+","+ml_C+")' onMouseOut='mf_DeCol_PL_M1(this)'>"+ml_obr+ml_iPL[ml_i]+"</TD></TR>"
}
else
ml_R+="<TR><TD bgcolor="+mg_cBody+" "+mg_LP+" ID=mi_"+ ml_j++ +" onClick='mf_Follow_Link("+ml_A+")' onMouseOver='mf_ChangeCol_PL_M1("+ml_j+","+ml_B+",this,"+ml_iPL[ml_i+2]+","+ml_C+")' onMouseOut='mf_DeCol_PL_M1(this)'>"+ml_obr+ml_iPL[ml_i]+"</TD></TR>"
}
ml_R+="</TABLE>"
var ml_toTop=0
if(parseInt(ml_iPL.length/3)*(mg_LH+1)+mg_clmy+mg_BH+15>document.body.offsetHeight)
{
ml_toTop=parseInt(ml_iPL.length/3)*(mg_LH+1)+mg_clmy+mg_BH+35-document.body.offsetHeight
}
mi_MENU1.outerHTML=ml_R;mf_MoveLayer("mi_MENU1",mg_clmx,mg_clmy+document.body.scrollTop-ml_toTop)
}
function mf_ChangeCol_PL_M2(mp_iCell)
{
mp_iCell.className='cmenuact'
}
function mf_DeCol_PL_M2(mp_iCell)
{
mp_iCell.className=''
}
function mf_Follow_Link(mp_Link)
{
mf_HideLayer("mi_MENU2");mf_HideLayer("mi_MENU1")
window.status="P°echßzφm na strßnku http://"+mp_Link
document.location="http://"+escape(mp_Link)
}
function mf_M2(mp_Row,mp_Head,mp_Name)
{
var ml_cururl=document.URL.toUpperCase()
var ml_iPL=eval(mp_Name)
var ml_R="<TABLE onMouseOut=mf_ShowOrHide() ID=mi_MENU2"+mg_TP+">"
ml_R+="<TR><TD "+mg_HP+">"+mp_Head+"</TD></TR>"
for(var ml_i=0;ml_i<ml_iPL.length;ml_i+=2)
{
var ml_A='"'+ml_iPL[ml_i+1]+'"'
if(ml_cururl.indexOf(ml_iPL[ml_i+1].toUpperCase())!=-1)
{
mg_tmpclmx=mg_clmx;mg_tmpclmy=mg_clmy
ml_R+="<TR><TD "+mg_inactLP+" bgcolor="+mg_cBody+" onClick='mg_clmx=mg_tmpclmx;mg_clmy=mg_tmpclmy;return false' onMouseOver='mf_ChangeCol_PL_M2(this)' onMouseOut='mf_DeCol_PL_M2(this)'>"+ml_iPL[ml_i]+"</TD></TR>"
}
else
ml_R+="<TR><TD "+mg_LP+" bgcolor="+mg_cBody+" onClick='mf_Follow_Link("+ml_A+")' onMouseOver='mf_ChangeCol_PL_M2(this)' onMouseOut='mf_DeCol_PL_M2(this)'>"+ml_iPL[ml_i]+"</TD></TR>"
}
ml_R+="</TABLE>"
mi_MENU2.outerHTML=ml_R
var ml_posX=mg_clmx+mg_TW-6
if(ml_posX>mg_BS){ml_posX=mg_clmx-mg_TW+6;if(ml_posX<0)ml_posX=1}
var ml_posY=mp_Row*mg_LH+mg_clmy-12
if(ml_posY+ml_i*mg_LH+ml_i*2>document.body.offsetHeight-mg_BH)ml_posY=(document.body.offsetHeight-mg_BH-ml_i*mg_LH)
mf_MoveLayer("mi_MENU2",ml_posX,ml_posY+document.body.scrollTop+mp_Row)
}
function mf_Decide()
{
var ml_e=document.elementFromPoint(mg_momx,mg_momy)
if(ml_e.tagName=="TD")ml_e=ml_e.parentElement.parentElement.parentElement
else if(ml_e.tagName=="IMG" && ml_e.id=="mi_T")ml_e=ml_e.parentElement.parentElement.parentElement.parentElement
if(ml_e.id!="mi_MENU1" && ml_e.id!="mi_MENU2"){mf_HideLayer("mi_MENU2");mf_HideLayer("mi_MENU1")}
mg_Act=false;window.clearTimeout(mg_hI)
}
function mf_ShowOrHide()
{if (mg_Act==false){mg_Act=true;mg_hI=window.setTimeout("mf_Decide()",700)}}