/*
The ultimate DHTML drop-down code
Nick Nettleton | www.fluid7.co.uk
--
You can adapt, use and distribute this code under GNU public licence, as long as:
(1) You leave all the comment and credit lines in, including these ones
(2) You don't sell it for profit
--
Enjoy!!!
*/

//browser vars

f7_v4=(parseInt(navigator.appVersion)>=4 && parseInt(navigator.appVersion)<=5)?1:0
f7_ie=(document.all && f7_v4)?1:0
f7_ns=(document.layers && f7_v4)?1:0

//code for drops

function f7_showdrop(thelayer,theimage,newsrc){
 f7_keep=thelayer; f7_hideall(); checkpos=0; f7_showitnow=1
 f7_showit(thelayer,theimage,newsrc)
 }

function f7_showit(thelayer){
 if(f7_ie){ eval(f7_droplayer[thelayer][0]+'.style.visibility="visible"') }
 if(f7_ns){ eval('document.'+f7_droplayer[thelayer][0]+'.visibility="show"');}
 document.images[f7_droplayer[thelayer][1]].src=f7_droplayer[thelayer][3]
 }


function f7_hidedrop(){
 f7_keep=-1; checkpos=1; setTimeout('f7_hideall()',3000)
 }

f7_keep=-1

function f7_hideall(){
 for(i=0;i<f7_droplayer.length;i++){ 
  if(f7_ie && f7_keep!=i){ 
   eval(f7_droplayer[i][0]+'.style.visibility="hidden"')
   document.images[f7_droplayer[i][1]].src=f7_droplayer[i][2]
  }
  if(f7_ns){
   f7_hideit=0; f7_checkmousepos(i)
   if(f7_hideit){ 
    eval('document.'+f7_droplayer[i][0]+'.visibility="hide"')
    document.images[f7_droplayer[i][1]].src=f7_droplayer[i][2]
   }
  }
  if(!f7_ns && !f7_ie && f7_keep!=i){ 
   document.images[f7_droplayer[i][1]].src=f7_droplayer[i][2]
   }
  }
 }

//deal with cursor over layer for ns

if(f7_ns){
 document.onmousemove = f7_getmousepos
 document.captureEvents(Event.MOUSEMOVE)
 }

function f7_getmousepos(e){
 if(f7_ns){f7_mousex=e.pageX; f7_mousey=e.pageY}
 }

checkpos=0

function f7_checkmousepos(i){          
 if(f7_ns && checkpos){     
  f7_x_min=eval('document.'+f7_droplayer[i][0]+'.left')
  f7_x_max=f7_x_min+eval('document.'+f7_droplayer[i][0]+'.clip.width')
  f7_y_min=eval('document.'+f7_droplayer[i][0]+'.top')
  f7_y_max=f7_y_min+eval('document.'+f7_droplayer[i][0]+'.clip.height')
  if (f7_mousex>=f7_x_min && f7_mousex<=f7_x_max && f7_mousey>=f7_y_min && f7_mousey<=f7_y_max){
   f7_hideit=0; setTimeout('f7_hideall()',500)
   }
  else { f7_hideit=1 }
  return f7_hideit
 }    
}

