function buildForIE ()
{
  selectorsLastChild = '#main_menu li:last-child, #holding li:last-child';
  jQuery(selectorsLastChild).addClass('last-child');
}

function initDocumentStructure ()
{
  var docWidth = document.documentElement.clientWidth;
  var body = jQuery('body');
  var wideWidthSite = 1250;
  var isWidehSite =(docWidth > wideWidthSite) ? true : false;

  if (isWidehSite)
  {
    jQuery('#button_right_thinsite').hide();
    jQuery('#button_right_widesite').show();
    body.removeClass('thinSite');
    if (!document.body.id == "main_page")
      return;
    var portfolio_list = jQuery('#portfolio').find('li');
    portfolio_list.eq(15).show();
    portfolio_list.eq(14).show();
    portfolio_list.eq(13).show();
    portfolio_list.eq(12).show();
  }
  else
  {
    jQuery('#button_right_thinsite').show();
    jQuery('#button_right_widesite').hide();
    body.addClass('thinSite');
    if (!document.body.id == "main_page")
      return;
    var portfolio_list = jQuery('#portfolio').find('li');
    portfolio_list.eq(15).hide();
    portfolio_list.eq(14).hide();
    portfolio_list.eq(13).hide();
    portfolio_list.eq(12).hide();
  }
}

function showFlowers()
{
  if(jQuery('#flashs_flowers')[0])
  {
    jQuery('#flashs_flowers').show();
    return;
  }
  jQuery('#flashs_flowers').click(hideFlowers)
}

function hideFlowers()
{
  jQuery('#flashs_flowers').hide();
}


jQuery(document).ready(
function()
{
  if(jQuery.browser.msie)
    buildForIE();

  jQuery('#contact_info table img').click(showFlowers);

  initDocumentStructure();
  var currheight = null;
  if(!jQuery.browser.msie)
    jQuery(window).resize(initDocumentStructure);
  else
    window.onresize = function()
    {
      if(currheight != document.documentElement.clientHeight)
      {
        initDocumentStructure();
      }
      currheight = document.documentElement.clientHeight;
    }

    $('.catalog').hover(function(){$('.cat').css('z-index','2'),$('.vis').css('z-index','1'),$('.catalog').css('width','168px'),$('.catalog').css('left','58px'),$('.visitka').css('width','50px')},function(){})
    $('.visitka').hover(function(){$('.vis').css('z-index','2'),$('.cat').css('z-index','1'),$('.catalog').css('width','116px'),$('.catalog').css('left','105px'), $('.visitka').css('width','110px')},function(){})

    jQuery(".site_card").click(function() {ShowOrCloseContent(1,"site_cut-away");return false;});
    jQuery(".site_catalog").click(function() {ShowOrCloseContent(2,"site_catalog");return false;});
    jQuery(".form_link").click(function() {ShowPopap("custom_form_popap");return false;});

});

jQuery('.info_block').each(function(){
   html = '<div class="bgr_left_top"> </div><div class="bgr_right_top"> </div><div class="bgr_left_bot"></div><div class="bgr_right_bot"></div>';
   jQuery(this).append(html);
});

