function initDocumentStructure ()
{
    var body = jQuery('body');
    var docWidth = jQuery(window).width();

    body.removeClass('smallSite');
    if (docWidth <= 1024)
      body.addClass('smallSite');
}

jQuery(document).ready(function(){
  initDocumentStructure();
  if(!jQuery.browser.msie)
    jQuery(window).resize(initDocumentStructure);
  else
    window.onresize = function(){initDocumentStructure();}

  if(jQuery.browser.msie)
    buildForIE();
});

function buildForIE ()
{
  selectorsLastChild = '.ul_navigation li:last-child';
  jQuery(selectorsLastChild).addClass('last-child');
}

function on_ugol(id)
{
    var ugol = document.getElementById(id);
    if (ugol==null) return false;
    ugol.style.visibility='visible';
}

function out_ugol(id)
{
    var ugol = document.getElementById(id);
    if (ugol==null) return false;
    ugol.style.visibility='hidden';
}

function popup(url)
{
  var width = 808;
  var new_height = Math.round(window.screen.height - 80);
  var new_left = Math.round(window.screen.width / 2 - width / 2);
  var window_params = 'left=' + new_left + ',top=20,width=' + width + ',height=' + new_height + ',scrollbars=yes,resizable=no,help=no,status=no';
  //url = HTTP_BASE_PATH+url.slice(1);
  var myWin = open(url, "photo", window_params);
  myWin.resizeTo(width, new_height);
}

function popup(src)
{
  var default_left=window.screen.width / 2 - 20;
  var default_top=window.screen.height / 2 - 50;
  var window_params = 'width=30,height=10,scrollbars=no,resizable=no,help=no,status=yes,left=' + default_left + ',top=' + default_top;
  var myWin = open("", "", window_params);
  var HTMLtext = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body style='margin:0; padding:0;' onload='wResize();'>";
  HTMLtext += "<script>function wResize() { var oImg=document.images[0]; var width=oImg.width+6; var height=oImg.height+53; var left = Math.round(window.screen.width / 2 - width / 2); var top = Math.round(window.screen.height / 2 - height / 2); document.getElementById('hide').style.visibility='hidden'; window.moveTo(left, top); window.resizeTo(width, height); oImg.style.visibility='visible'; }</script>";
  HTMLtext += "<img id='img' src='" + src + "' onclick='window.close();' style='visibility:hidden;'><div id='hide' style='color:#FF0000; padding-left:5px;'>Загрузка...</div>";
  HTMLtext += "</body></html>";
  myWin.document.write(HTMLtext);
  myWin.document.close();

  return false;
}

function change_font_size(d)
{
  alert(document.body.style.fontSize);
  document.body.style.fontSize = d + "px";
  return false;
}

function showMessageText()
{
  if (document.getElementById('modalWindow'))
  {
    document.getElementById('modalWindow').style.display = 'block';
    document.getElementById('modalWindowOverlay').style.display = 'block';
    return;
  }
  var modalWindow = document.createElement('div');
  modalWindow.id = "modalWindow";
  var modalWindowOverlay = document.createElement('div');
  var message = document.createElement('div');
  message.className = "message";
  modalWindowOverlay.id = "modalWindowOverlay";
  var close_icon = document.createElement('a');
  close_icon.className = "close_icon";
  close_icon.href = '#';
  close_icon.onclick = function(){this.parentNode.style.display = 'none';document.getElementById('modalWindowOverlay').style.display = 'none';return false;}

  message.innerHTML = '<span class="icon"></span>При использовании материалов официального интернет-портала Правительства Пензенской области, ссылка на <a href="http://penza.ru/">www.penza.ru</a> - обязательна!';

  document.body.appendChild(modalWindow);
  document.body.appendChild(modalWindowOverlay);
  modalWindow.appendChild(close_icon);
  modalWindow.appendChild(message);
}

