//Written by Bogdan Blaszczak/BlaTek

BlaTek={
 mL:0,tI:0,A:0,w:0,k:0,
 D:function(){with(this){if(tI)return;A=1;if(k){w=l1().offsetHeight;this.Ar()}else{w=l2().offsetHeight;gG(0);mL=-w;l1().style.marginTop=mL+'px';this.Al()}}},
 Ar:function(){
 with(BlaTek){
  mL-=20
  if(-mL<w){
   l1().style.marginTop=mL+'px'
   tI=setTimeout('BlaTek.Ar()',50)
  }else{
   mL=0;tI=0
   l1().style.marginTop='0'
   gG(1);setTimeout('if(BlaTek.A)BlaTek.D()',1)
  }
 }
 },
 Al:function(){
 with(BlaTek){
  mL+=20
  if(mL<0){
   l1().style.marginTop=mL+'px'
   tI=setTimeout('BlaTek.Al()',50)
  }else{
   mL=0;tI=0
   l1().style.marginTop='0'
   setTimeout('if(BlaTek.A)BlaTek.D()',1)
  }
 }
 },
 gG:function(m){if(m)this.u().appendChild(this.l1());else this.u().insertBefore(this.l2(),this.l1())},
 u:function(){return document.getElementById('gallery').getElementsByTagName('ul')[0]},
 l1:function(){return this.u().getElementsByTagName('li')[0]},
 l2:function(x){x=this.u().getElementsByTagName('li');return x[x.length-1]},
 s:function(){this.A=0}
}
document.onmouseup=function(){BlaTek.s()}
if(document.getElementById)document.write('<style>#gallery{position:absolute;top:24px;width:101px;height:298px;overflow:hidden;visibility:hidden}#gallery-img{display:inline}<\/style>')
document.write('<style>#gallery img.here{border-color:#e06000}</style>')

function initGallery(g,a1,a2,i){
 if(!document.getElementById)return;
 g=document.getElementById('gallery')
 a1=document.getElementById('gallery-up-arrow')
 a2=document.getElementById('gallery-down-arrow')
 g.style.visibility='visible'
 Tgl=g.getElementsByTagName('a')
 if(Tgl.length>3)a1.style.visibility=a2.style.visibility='visible'
 a1.onmouseout=a2.onmouseout=function(){BlaTek.s()}
 a1.onmousedown=function(){BlaTek.k=0;BlaTek.D()};
 a2.onmousedown=function(){BlaTek.k=1;BlaTek.D()};
 a1=a1.getElementsByTagName('img')[0]
 a2=a2.getElementsByTagName('img')[0]
 a1.onmouseover=a1.onmouseout=a2.onmouseover=a2.onmouseout=rollMe

 mImg=document.getElementById('gallery-img').getElementsByTagName('img')[0]
 if(document.all)mImg.style.filter='blendTrans(duration=0.5)'

 Tmx=[]
 for(i=0;i<Tgl.length;i++){
  Tgl[i].I=i;Tmx[i]=new Image();Tmx[i].src=Tgl[i].href
  Tgl[i].onclick=loadImg
 }
 Tmi=[]
 Tmi[0]=new Image();Tmi[0].src='img/point.gif'
 Tmi[1]=new Image();Tmi[1].src='gallery/arrow_up_on.gif'
 Tmi[2]=new Image();Tmi[2].src='gallery/arrow_down_on.gif'
}

function loadImg(){
 var f
 if(!document.getElementById)return!0
 if(!window.mImg||!Tmx[this.I])return!1
   if(mImg.src==this.href||mImg.height<Tmx[this.I].height){
    mImg.src='img/point.gif'
   }
 eval('try{f=mImg.filters}catch(Er){}')
 if(f)eval('try{f[0].Apply()}catch(Er){}')
 mImg.src=this.href
 if(f)eval('try{f[0].Play()}catch(Er){}')
 for(i=0;i<Tgl.length;i++){
  Tgl[i].firstChild.className=Tgl[i]==this?'here':'';
 } 
 return!1
}

function rollMe(e){
 e=e||event;e=e.type=='mouseout'
 this.src=e?this.src.replace(/_on\.gif/i,'.gif'):this.src.replace(/.gif/i,'_on.gif')
}
