/*************************************/
var EMAIL = 'biuro@catering.bosek.pl'
/*************************************/

var ObjPopupId = '';

function goTo(Url){ document.location.href=Url; }
function obj(Id) { if(Id!='' && document.getElementById(Id)) return document.getElementById(Id); else return false; }
function objStyle(Id) { if(Id!='' && document.getElementById(Id)) return document.getElementById(Id).style; else return false; }
function objHide(Id) { if(Id!='' && document.getElementById(Id)) document.getElementById(Id).style.display='none'; }
function objShow(Id) { if(Id!='' && document.getElementById(Id)) document.getElementById(Id).style.display='block'; }
function isObj(Id) { if(Id!='' && document.getElementById(Id)) return true; else return false; }
function bgChange(Id, ImgSrc) { objStyle(Id).backgroundImage = "url("+ImgSrc+")"; }
function objPopup(Id){
  if( Id!=ObjPopupId ) objHide(ObjPopupId);
  if( objStyle(Id).display=='block' ) objStyle(Id).display='none';
  else  objStyle(Id).display='block';
  ObjPopupId = Id;
}
/**********************/

function menu_left (obj){
  var li = $(obj).getParent();
  var ul = li.getElement('ul');
  if( $(ul).getStyle('display')=='block' )
    $(ul).setStyle('display', 'none');
  else
    $(ul).setStyle('display', 'block');
}


/**********************/

function getOuterSize(Return){
  var w=0, h=0;
  if( typeof( window.innerWidth ) == 'number' ) {
    w = window.innerWidth;
    h = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    w = document.documentElement.clientWidth;
    h = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
  }
  if(Return=='w') return w;
  else return h;
}

function fit_footer(){
  if( isObj('footer_bottom') ){
    var H = getOuterSize('h') - $('footer_bottom').getPosition().y;
    if( H>0  ) objStyle('footer_bottom').height = H+'px';
  }
}

window.addEvent('domready', function(){
  fit_footer();
  $$('a._EMAIL').each(function(el){ el.href='mailto:'+EMAIL });
});
