document.observe("dom:loaded", function(){
  initiateWall();
});

Event.observe(document.onresize ? document : window, "resize", function(){initiateWall();});

function initiateWall(){
  var wrapperWidth = document.viewport.getWidth();
  var wallWidth = document.viewport.getWidth();
  var modVal = wallWidth%50;
  var diff = 50-modVal;
  var setWidth = wallWidth + diff;
  if(wrapperWidth<960){wrapperWidth=960;setWidth=1000;}
  else{
    $('wall-wrapper').setStyle({width:wrapperWidth+'px'});
    $('wall').setStyle({width:setWidth+'px'});
  }
}

function showBlock(e,t,id){
  if(e.element()==$(id)){
     clearTimeout(t);
  }
  
  $(id).descendants().each(function(el){
    if(el==e.element()){
      clearTimeout(t);
    }
  });
  
  var popHeight = $('popup').getHeight();
  var negMargin = popHeight - 55;
  $('popup').setStyle({
      marginTop: '-'+negMargin+'px'
  });
  $('popup').show();
}

function hideBlock(){
  $('popup').hide();
}


