 var zaznacz=null, width, height,opa;


function m_over(f)
{
  
  if (IE())
  { 
   opa=f.filters.alpha.opacity;
   f.filters.alpha.opacity=60;
  }
 else 
  {
   opa=f.style.opacity;
    f.style.opacity=0.6;
  }
}

function m_out(f)
{

  if (IE())
   f.filters.alpha.opacity=opa;
 else 
    f.style.opacity=opa;
 
}

function ch_opacity(id)
{
 var  i,f , wid ;
  for (i=1; i<4; i++)
  {
   f=document.getElementById('td'+i);
   if (i !=id)
     if (IE()) f.filters.alpha.opacity=40; else f.style.opacity=0.4;
       else
      {  
        if (document.getElementById( 'obraz_'+i).style.display=='block')   
          if (IE()) f.filters.alpha.opacity=40; else f.style.opacity=0.4;
             else
           if (IE()) f.filters.alpha.opacity=100; else f.style.opacity=1;

          if (IE()) opa=f.filters.alpha.opacity; else opa= f.style.opacity;

      }
  }
}

function doblend(menu_id,dwidth,dheight)
{
 width=dwidth ;height=dheight;
 if (IE())
 {
   makefoto(menu_id);
   var dok=document.getElementById('foto');
   dok.filters.blendTrans.Apply();  
   dok.src=document.getElementById(menu_id).src;
   dok.style.width='';
   dok.style.height='';
   dok.filters.blendTrans.Play();  
 } else putfoto(menu_id);
}


 function clearmenu()
{

   for ( i=2; i<4;i++)
   {
    document.getElementById("obraz_"+i).style.display='none';

   }
  }

 function zmienwid(obraz_id)
 {
  var nr=obraz_id.split('_')[1] , s;
  ch_opacity(nr);
  if (document.getElementById('obraz_1').style.display=='block') 
  {
   if (nr != 1)   dok1=document.getElementById(obraz_id);
    hidefoto();
  }
   else
     if (nr==1)
    {
     clearmenu();
     hidefoto();
    }
  else
  {
   for ( i=2; i<4;i++)
   {
    s=document.getElementById("obraz_"+i).style;
    if (obraz_id=='obraz_'+i) 
       if (s.display=='none') s.display='block'; else s.display='none';
    else s.display='none';
   }
  }

 }


//  dok -  edytowany obraz
// mini - miniatura
// fc - procent wysokości obrazu
var dok, dok1=null, fc=8, b , t , div , mini;

function IE()
{
 var c=navigator.appName;
 
 return( c != 'Netscape' );
}


 function clearfoto()
 {
   if (zaznacz!=null)
   {
    var x=zaznacz.style;
    x.width='70px';
    x.height='50px';
    x.borderColor='gold'; 
     if (IE())
      zaznacz.filters.alpha.opacity=40;
      else
      x.opacity=0.4 ;   
    }
   zaznacz=null;
 }

function timeCount()
{
 if (b==true) fc=fc+4;
    else   fc=fc-4;
  //dok.style.height=fc + '%';

var  x=Math.round(fc/100*width);

dok.style.width=x+'px';
var  y=Math.round(fc/100*height);
dok.style.height=y+'px';

 t=setTimeout( "timeCount()",5);
 if (b==true && fc>=100)
 {
     clearTimeout(t);
 }
 else
   if (b==false && fc<10)
   {
    clearTimeout(t);
    div.style.display='none';
    if (dok1 != null)
    {
     dok1.style.display='block';
     dok1=null;
    }
   }

}


function hidefoto()
{
div=document.getElementById('obraz_1');
 if (div.style.display=='block')
 {
  b=false;
  timeCount();
 }  else
 {
    div.style.display='block';
    putfoto(mini.id);
 }
}

function fullfoto()
{
 dok.style.height='';
}

function putfoto1(f, dwidth,dheight)
{
 width=dwidth;
 height=dheight;
 putfoto(f);
}

function makefoto(mini_id)
{
   clearfoto();  
   mini=document.getElementById(mini_id);
   mini.style.width='80px';
   mini.style.height='60px';
   mini.style.borderColor='red';
  zaznacz=mini;   
 if (IE())
       mini.filters.alpha.opacity=100;
    else
     mini.style.opacity=1;
   dok=document.getElementById('foto');
   dok.style.marginTop='10px';
   dok.title=mini.title + "." + String.fromCharCode(13,10);
  var comm=document.getElementById('comment');
  comm.innerHTML=mini.title;

}

  function putfoto(mini_id)
  {
   makefoto(mini_id);
   document.getElementById('foto').src=document.getElementById(mini_id).src;
   b=true;fc=10;
   timeCount();
  }

