var is_ie = (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent));
function GID(id) { return (is_ie) ? document.all[id] : document.getElementById(id); }

$(document).ready(function() {
   $(document).pngFix();
   var offset = $("#topFlash").offset();
   var left = offset['left'] + 24;
   var top = offset['top'] + 20;
   $(".topTel").css({'left': left, 'top': top, 'display': 'block'});
   var htmlOptions = { src: '/images/new/klient-bank2.swf', width: '169', height: '61', replace: '<a href="" title="Клиент-банк"><img src="/images/new/klient-bank.gif" width="169" height="61" alt="Клиент-банк" /></a>' };
   $('#pic1').flash(htmlOptions, pluginOptions);
   htmlOptions = { src: '/images/new/plastic-karti3.swf', width: '169', height: '61', replace: '<a href="" title="Пластиковые карты"><img src="/images/new/karti.gif" width="169" height="61" alt="Пластиковые карты" /></a>' };
   $('#pic2').flash(htmlOptions, pluginOptions);
   htmlOptions = { src: '/images/new/drag-me2.swf', width: '169', height: '61', replace: '<a href="" title="Драгоценные металлы"><img src="/images/new/metalli.gif" width="169" height="61" alt="Драгоценные металлы" /></a>' };
   $('#pic3').flash(htmlOptions, pluginOptions);
   //htmlOptions = { src: '/images/new/sem-bankir2.swf', width: '169', height: '61', replace: '<a href="" title="Семейный банкир"><img src="/images/new/bankir.gif" width="169" height="61" alt="Семейный банкир" /></a>' };
   htmlOptions = { src: '/images/new/ozenka2.swf', width: '169', height: '61', replace: '<a href="" title="Оценка, инвестиционное проектирование"><img src="/images/new/ozenka.gif" width="169" height="61" alt="Оценка, инвестиционное проектирование" /></a>' };
   $('#pic4').flash(htmlOptions, pluginOptions);
   htmlOptions = { src: '/upload/diskount3.swf', width: '169', height: '128', replace: '' };
   $('#pic5').flash(htmlOptions, pluginOptions);
   htmlOptions = { src: '/images/brt-gold2.swf', width: '169', height: '128', replace: '<a href="http://www.brtgold.ru/" title="Продажа драгоценных металлов и монет" target="_blank"><img src="/images/new/moneti.gif" width="169" height="128" alt="Продажа драгоценных металлов и монет" /></a>' };
   $('#pic6').flash(htmlOptions, pluginOptions);
   htmlOptions = { src: '/images/new/20091117-v2.swf', width: '207', height: '276', replace: '' };
   $('#picCards').flash(htmlOptions, pluginOptions);
   htmlOptions = { src: '/images/top3.swf', width: '710', height: '90', wmode: 'transparent', replace: '<img src="/images/new/top.jpg" width="710" height="90" alt="Новые технологии завтра - плоды нашей работы сегодня" />' };
   $('#topFlash').flash(htmlOptions, pluginOptions);
});

function ShowSubmenu(idM) {
   //$("#menu"+idM).css('background', 'none');
   //$("#menu"+idM).css('background-color', '#7E7E7E');
   var offset = $("#menu"+idM).offset();
   var left = offset['left']+$("#menu"+idM).width();
   var top = offset['top'] - 3;
   $("#submenu"+idM).css({'left': left, 'top': top, 'display': 'block'});
}

function hideMenu(idM) {
   //$("#menu"+idM).css('background', 'url("/images/menu-vertical-bgd.gif") repeat-y');
   $("#submenu"+idM).css('display', 'none');
}

function selTopMenu1(idM) {
   $("#fotoMenu"+idM).attr('src', '/images/new/foto'+idM+'-aktiv.jpg');
}

function unselTopMenu1(idM) {
   $("#fotoMenu"+idM).attr('src', '/images/new/foto'+idM+'.jpg');
}

function selTopMenu2(idM) {
   $("#topMenu2"+idM).removeClass('topMenu2');
   $("#topMenu2"+idM).addClass('topMenu2Sel');
   $("#topMenu2"+idM+" > span").removeClass('topMenu2A');
   $("#topMenu2"+idM+" > span").addClass('topMenu2ASel');
   if (idM == 1) $("#topMenu2Left").attr('src', '/images/new/menu-gorizontal_left-a.gif');
   if (idM == 4) $("#topMenu2Right").attr('src', '/images/new/menu-gorizontal_right-a.gif');
}

function unselTopMenu2(idM) {
   $("#topMenu2"+idM).removeClass('topMenu2Sel');
   $("#topMenu2"+idM).addClass('topMenu2');
   $("#topMenu2"+idM+" > span").removeClass('topMenu2ASel');
   $("#topMenu2"+idM+" > span").addClass('topMenu2A');
   if (idM == 1) $("#topMenu2Left").attr('src', '/images/new/menu-gorizontal_left.gif');
   if (idM == 4) $("#topMenu2Right").attr('src', '/images/new/menu-gorizontal_right.gif');
}

function fnCheckSearchForm(f) {
   if (!f.search.value.match(/^.+$/)) {
      alert("Укажите поисковый запрос!");
      f.search.focus();
      return false;
   }
   return true;
}
