/* Preloading Images */
  var img = new Image();
  img.src = '/media/rc4/images/top-menu/menu-l.gif';
  img.src = '/media/rc4/images/top-menu/menu-c.gif';
  img.src = '/media/rc4/images/top-menu/menu-r.gif';
/* // Preloading Images */


$(document).ready(function(){
  $('#top-menu-container .top-menu-element').each(function(){
    var self = this;
    $(this).find('.top-menu-element-left').hover(
      function(){if (!$(self).hasClass('top-menu-element-active')) $(self).addClass('top-menu-element-over')},
      function(){if (!$(self).hasClass('top-menu-element-active')) $(self).removeClass('top-menu-element-over')}
    );
    $(this).find('.top-menu-element-center').hover(
      function(){if (!$(self).hasClass('top-menu-element-active')) $(self).addClass('top-menu-element-over')},
      function(){if (!$(self).hasClass('top-menu-element-active')) $(self).removeClass('top-menu-element-over')}
    );
    $(this).find('.top-menu-element-right').hover(
      function(){if (!$(self).hasClass('top-menu-element-active')) $(self).addClass('top-menu-element-over')},
      function(){if (!$(self).hasClass('top-menu-element-active')) $(self).removeClass('top-menu-element-over')}
    );
  });
  
  $('.orange-border').cornerz({radius: 10});
  /*$('.orange-border').corner();*/
  /*$('.popup-table').cornerz({radius: 10});*/
  
  /* Enabling highliting of simple table */
  $('.simple-table.highlite-table').each(function(){
    $(this).tableHover({
        rowClass        : 'hl',
        colClass        : 'active',
        headCols        : true,
        bodyCols        : false,
        headCells       : false,
        allowHead       : false,
        cellClass       : '',
        realRowClass    : 'hl',
        oddRealRowClass : 'hl-2'
    });
  });
  
  /* Enabling highliting of simple table */
  $('.simple-table.grey-highlite-table').each(function(){
    $(this).tableHover({
        rowClass        : 'hl',
        colClass        : 'active',
        headCols        : true,
        bodyCols        : false,
        headCells       : false,
        allowHead       : false,
        cellClass       : '',
        realRowClass    : 'hl-dd',
        oddRealRowClass : 'hl-dd'
    });
  });
  
  
  
  var quick_search_currency = new Array();
  quick_search_currency["RUSSIAN"] = '$';
  quick_search_currency["ENGLISH"] = '&euro;';
  
  var quick_search_square = new Array();
  quick_search_square["RUSSIAN"] = 'ì<sup>2</sup>';
  quick_search_square["ENGLISH"] = 'm<sup>2</sup>';
  
  /* Enabling changing of currency and squares in quick search */
  $('#quick-search-currency-select').change(function(){
    $('#quick-search-currency').html(quick_search_currency[$(this).val()]);
    $('#quick-search-square').html(quick_search_square[$(this).val()]);
  });
});

function show_popup(popup, text, callback)
{
  $(popup).find('.popup-text').html(text);
  $(popup).find('.agree-button input').unbind("click").click(callback);
  $(popup).modal( {close : false, maxHeight:400, maxWidth:600, overlayClose:true} );
}

function show_popup2(popup, text, callback)
{
  //$(popup).find('.popup-text').html(text);
  $(popup).find('.agree-button input').unbind("click").click(callback);
  $(popup).modal( {close : false, maxHeight:400, maxWidth:600, overlayClose:true} );
}


function show_hint(el)
{
  $(el).css('display', 'block');
}

function hide_hint(el)
{
  $(el).css('display', 'none');
}

function checkBoxLink(link, input)
{
  if ($(input).attr('value') == '1')
  {
    $(input).attr('value', '0');
    $(link).removeClass('checkbox-link-checked');
    $(link).addClass('checkbox-link');
  } else {
    $(input).attr('value', '1');
    $(link).removeClass('checkbox-link');
    $(link).addClass('checkbox-link-checked');
  }
}

