/* Otestovani delky hodnoty */
function isEmptyMsg(el,message){
   var element = document.getElementById(el);
   if(element.value.length == 0){
      alert(message);
      return false;
   }
   return true;
}
/* Zobrazit nebo schovat prvek, zmenit text */
function showItemBox(elbox,ellink,msgshow,msgclose){
  if($(elbox).hasClass('item_hidden')){
     $(elbox).removeClass('item_hidden');
     $(ellink).set('text',msgclose);
  }
  else{
     $(elbox).addClass('item_hidden');
     $(ellink).set('text',msgshow);
  }
}

/* Zobrazeni boxu centrovane */
ViewPort = {
   centerObject : function(obj, width, height) {
      var viewportWidth, viewportHeight, scrollTop;
      if (self.innerHeight) {
         viewportWidth  = self.innerWidth;
         viewportHeight = self.innerHeight;
      } else if (document.documentElement && document.documentElement.clientHeight) {
         viewportWidth  = document.documentElement.clientWidth;
         viewportHeight = document.documentElement.clientHeight;
      } else if (document.body) {
         viewportWidth  = document.body.clientWidth;
         viewportHeight = document.body.clientHeight;
      }

      if (self.pageYOffset) {
         scrollTop = self.pageYOffset;
      } else if (document.documentElement && document.documentElement.scrollTop) {
         scrollTop = document.documentElement.scrollTop;
      } else if (document.body) {
         scrollTop = document.body.scrollTop;
      }

      obj.style.top  = parseInt(((viewportHeight - height) / 2) + parseInt(scrollTop)) + 'px';
      obj.style.left = parseInt((viewportWidth - width) / 2) + 'px';
   }
}

/* Box pro apliakce*/
ShowAppBox = {
   showBox : function(obj) {
      var scrollTop;
      if (self.pageYOffset) {
         scrollTop = self.pageYOffset;
      } else if (document.documentElement && document.documentElement.scrollTop) {
         scrollTop = document.documentElement.scrollTop;
      } else if (document.body) {
         scrollTop = document.body.scrollTop;
      }
      // Nastavit horni rozmer
      obj.style.top  = parseInt(scrollTop) + 'px';

      // Zobrazit div pro oblast
      if(obj.hasClass('item_hidden')) {
         obj.removeClass('item_hidden');
      }
      else obj.addClass('item_hidden');
   }
}


