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); }

var hmVertShift = 0;

function hmDivOn(id) { id.style.visibility = 'visible'; }
function hmDivOff(id) { id.style.visibility = 'hidden'; }
function hmx(e) { return e.offsetLeft+(e.offsetParent!=null&&e.tagName!='BODY'?hmx(e.offsetParent):0); }
function hmy(e) { return e.offsetTop+(e.offsetParent!=null&&e.tagName!='BODY'?hmy(e.offsetParent):0); }
function hmOff(id) { var e = GID(id); e.style.visibility = 'hidden'; }
function hmOn(id,parent) { var e = GID(id); e.style.left = hmx(parent); e.style.top = hmy(parent)+hmVertShift; e.style.visibility = 'visible'; }

function checkFlash() {
   var flash_versions = 20; var flash_installed = 0; var flash_version = '0.0'; var java_installed = 0;
   if (navigator.plugins && navigator.plugins.length) {  // Netscape style plugin detection
      for (x = 0; x < navigator.plugins.length; x++) {
         if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
            flash_version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
            flash_installed = 1;
            break;
         }
      }
      for (x = 0; x < navigator.plugins.length; x++) {
         if (navigator.plugins[x].name.indexOf('Java(TM)') != -1) {
            java_installed = 1;
            break;
         }
      }
   }
   else if (window.ActiveXObject) {  // ActiveX style plugin detection
      for (x = 2; x <= flash_versions; x++) {
         try {
            oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
            if (oFlash) {
               flash_installed = 1;
               flash_version = x + '.0';
            }
         }
         catch(e) { }
      }
   }
   return flash_installed;
}

function fnCheckSearchForm(f) {
   if (!f.search.value.match(/^.+$/)) {
      alert("Óêàæèòå ïîèñêîâûé çàïðîñ!");
      f.search.focus();
      return false;
   }
   return true;
}
