

var d = document; 



function getElement(i)
{
 var ob = d.all?d.all[i]:d.layers?d.layers[i]:d.getElementById(i);
 
 return ob; 
}





function divMng(id,param)
{ 
var ob = getElement(id); 

if (param=='-') 
  { 
   ob.style.display = 'none'; 
  }
else 
  if (param=='+')
    { 
     getElement(id+'').style.display='none'; 
     ob.style.display = 'block'; 
    } 
}





function chDaP(div_id)
{
 if (div_id!=div_last_showed)
   {
    if (div_last_showed!='')
      {
       divMng('dtd'+div_last_showed, '-');
       getElement('pico'+div_last_showed).src='gfx/k.gif';
      }
    
    divMng('dtd'+div_id, '+');
    getElement('pico'+div_id).src='gfx/strzalka.gif';
    div_last_showed=div_id;
   }
}	





function ofreplphdiv(pn, div_id, pict, dish_id, ord_st, act_link)
{
 last_dact=document.forms.fdsh.act_dish_id.value;
 last_ordstact=document.forms.fdsh.act_ordst.value;
 
 if (last_dact!='') divMng('ddpr'+last_dact, '-');
 
 if (ord_st!=last_ordstact)
   {
    if (last_ordstact=='zdjecie')
      {
       divMng('dost_zdjecie', '-');
       divMng('dost_potrawa', '+');
      }
    else
      {
       divMng('dost_potrawa', '-');
       divMng('dost_zdjecie', '+');
      }
    
    document.forms.fdsh.act_ordst.value=ord_st;
   }
 
 getElement(pn).src=pict;
 
 document.forms.fdsh.act_dish_id.value=dish_id;
 document.forms.fdsh.act_link.value=act_link;
 
 divMng('ddpr'+div_id, '+');
}






function addDishToFav()
{
 l='dish_fav.php?';
 l=l+'dish_id='+document.forms.fdsh.act_dish_id.value;
 
 frames["sprawdzaj"].location.href=l;
}






function addDishPhotoToFav()
{
 l='dish_fav.php';
 l=l+'?dish_id='+document.forms.fgo.dish_id.value;
 l=l+'&dishphoto_id='+document.forms.fgo.act_photo_id.value;
 
 frames["sprawdzaj"].location.href=l;
}






function akt_data_czas_daj()
{
 var czas  = new Date();
 rok   = czas.getYear();
 mies  = ( ( czas.getMonth() < 10 ) ? "0": "" ) + ( czas.getMonth() + 1 );
 dzien = ( ( czas.getDate()  < 10 ) ? "0": "" ) + ( czas.getDate() );
 godz  = ( ( czas.getHours() < 10 ) ? "0": "" ) + ( czas.getHours() );
 min   = ( ( czas.getMinutes() < 10 ) ? "0": "" ) + ( czas.getMinutes() );
 sek   = ( ( czas.getSeconds() < 10 ) ? "0": "" ) + ( czas.getSeconds() );
 
 return dzien+"_"+mies+"_"+rok+"_"+godz+"_"+min+"_"+sek;
}






function peok(url, width, height, params)
{
 aktdata=akt_data_czas_daj();
 maxszer=window.screen.width;
 maxwys=window.screen.height;
 polx=Math.round( (maxszer-width)/2);
 poly=Math.round( (maxwys-height)/2)-20;
 
 if (params=='') params="toolbar=no, scrollbars=auto, directories=no, menubar=no, resizable=no,";
 
 window.open(url,aktdata,params+", top="+poly+", left="+polx+", width="+ width +",height="+ height);
}






function ofertapodmzdjecia(miejsce, nowe, opis, id)
{
 miejsce.src=nowe.src;
 changeDIVcontent('pic_title', opis, document);
 document.forms.fgo.act_photo_id.value=id;
}






function loadPage(page)
{
 document.location.href=page;
}






function mngLogin()
{
 divMng('dloginprev', '-');
 divMng('dlogin', '+');
}






function mngNewsletter()
{
 divMng('dnewslprev', '-');
 divMng('dnewsl', '+');
}






function changeDIVcontent(div_id, content, doc)
{
 if (doc=='') doc=document;
 
 if(doc.layers)
 with(doc.layers[div_id+""].document)
  {
   write(content);
   close();
  }
 else
  {
   if(doc.getElementById)
    doc.getElementById(div_id+"").innerHTML=content;
   
   else
    if(doc.all)
     doc.all[div_id+""].innerHTML=content;
  }

}
  

  
 


 
function goToSite(url)
{
 document.location.href=url;
}





function grPrChH(a, b)
{
 m = 0;
 
 //set same tiitle's div height
 grPrTitChH(a, b);
 
 //look for highest value
 for (i = a; i <= b; i ++)
   {
    h = getElement('dcntgrn'+i).offsetHeight + getElement('dtgrn'+i).offsetHeight;
    if (h > m) m = h;
   }
 
 //set highest value to all divs
 for (i = a; i <= b; i ++)
   {
    getElement("dcntgrn"+i).style.height = (m - getElement('dtgrn'+i).offsetHeight);
   }
 
}



function grPrTitChH(a, b)
{
 m = 0;
 
 //look for highest value
 for (i = a; i <= b; i ++)
   {
    h = getElement('dtgrn'+i).offsetHeight;
    if (h > m) m = h;
   }
 
 //set highest value to all divs
 for (i = a; i <= b; i ++)
   {
    getElement('dtgrn'+i).style.height = m ;
   }
}



function wrkrsChH(a, b)
{
 m = 0;
 
 //look for highest value
 for (i = a; i <= b; i ++)
   {
    h = getElement('dcntgrn'+i).offsetHeight + getElement('dtgrn'+i).offsetHeight;
    if (h > m) m = h;
   }
 
 //set highest value to all divs
 for (i = a; i <= b; i ++)
   {
    getElement("dcntgrn"+i).style.height = (m - getElement('dtgrn'+i).offsetHeight);
   }
 
 
 mdh = getElement('dcntgrns').offsetHeight;
 
 i=0;
 nmdh = 0;
 while (i==0)
   {
    nmdh=nmdh+h;
    
    if (nmdh>mdh)
      {
       getElement('dcntgrns').style.height=nmdh;
       i=1;
      }
   }
 
}






