function get_over_src(src)   { return '/i/'+ src.replace(/.[a-zA-Z]{3}$/, "").replace (/(http.*)\/i\//, "") + '_over.' + src.replace(/.*\./, ""); }
function get_normal_src(src) { return '/i/' + src.replace(/_over/, "").replace (/(http.*)\/i\//, ""); }

function img_over(img) { img.src = get_over_src(img.src); }
function img_out(img)  { img.src = get_normal_src(img.src); }

function preload_images()
{
  var img = new Object(); 

  arguments = preload_images.arguments;

  for( i=0; i < arguments.length; i++) 
  {
    img[i]     = new Image();
    img[i].src = arguments[i];
  }

  i = 0;
  images = document.getElementsByTagName('img')
  while( image = images[i++] )
  {
    if( image.className.match(/over/, "") )
    {
      image.onmouseover = function() { this.src = get_over_src(this.src); } 
      image.onmouseout  = function() { this.src = get_normal_src(this.src); }  
    } 
  }

  /* map  */

  i = 0;
  areas = document.getElementsByTagName('area');

  while( area = areas[i++] )
  {
    if( area.className )
    {
     area.onmouseover = function() 
                         { 
                           document.getElementById('z'+ this.className).style.display = 'block';
                         } 

      area.onmouseout  = function() 
                         { 
                           for( j = 1; j < 13; j++ )
                             if( document.getElementById('z'+j) )
                               document.getElementById('z'+j).style.display = 'none' ;
                         }
    }
  }
}

function map_show_liepaya()
{
  document.getElementById('wmap1').style.display = 'none';
  document.getElementById('wmap2').style.display = 'block';
  document.getElementById('wmap_info').className = 'second';

  return false;
}

function map_show_main()
{
  document.getElementById('wmap2').style.display = 'none';
  document.getElementById('wmap1').style.display = 'block';
  document.getElementById('wmap_info').className = '';

  return false;
}

function set_pu_images()
{
  j = 0;
  links = document.getElementsByTagName('a')

  while( clink = links[j++] )
  {
    if( clink.className.match(/pu/, "") )
    {
      clink.onclick = function() 
      { 
        re     = new RegExp("([0-9]+)","i");
        result = re.exec( this.href );

        if (result == null) return ;

        num = RegExp.$1;

        window.open('/pw.php?id='+num,'SB1','width=356,height=521,top=105,left=75', 'status=yes', 'toolbar=yes', 'menubar=yes', 'resizable=yes');
        return false;
      
      }
    }

  }
}

onload = function()
{
  preload_images('/i/ru/m/company_over.gif', '/i/ru/m/internet_over.gif', '/i/ru/m/tv_over.gif', '/i/ru/m/connection_over.gif', '/i/ru/m/support_over.gif', '/i/lv_over.gif');
  set_pu_images();
}

function write_lic(){
 document.write('<a href="http://www.liveinternet.ru/click" '+
 'target="_blank"><img src="http://counter.yadro.ru/hit?t26.4;r'+
 escape(document.referrer)+((typeof(screen)=='undefined')?'':
 ';s'+screen.width+'*'+screen.height+'*'+(screen.colorDepth?
 screen.colorDepth:screen.pixelDepth))+';u'+escape(document.URL)+
 ';'+Math.random()+
 '" title="" '+'border="0" width="88" height="15" alt=""></a>')//--></script>
}
