function showImage(path, width, height, alt)
{
   w = window.open('', '', 'width='+(width+20)+', height='+(height+20)+', left='+(screen.width/2 - width/2)+', top='+(screen.height/2 - height/2 - 100)+', toolbar=no, menubar=no, location=no, status=no, resizable=no, scrollbars=no');
   w.document.write('<html><title>'+alt+'</title><body Onclick="window.close();">');
   w.document.write('<div align="center"><img src="'+path+'" alt="'+alt+'"></div>');
   w.document.write('</body></html>');
}

/*
   [startList] - вызов выпадающего меню
   параметры:
   id - идентификатор элемента меню

*/

function startList(id) {
         navRoot = document.getElementById(id);
         for (i=0; i<navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName=="LI") {
               node.onmouseover=function() {
                  this.className="over";
               }
               node.onmouseout=function() {
                  this.className=this.className.replace("over", "");
               }
            }
         }
   }

/*
   [/startList]
**********************************************/

/***********************************************
   [showBlock] - отображение вкладок
   параметры:
   elemsId - общая часть имени идентификатора,
   thisId - номер вызываемой вкладки,
   num - сколько всего вкладок
   Функция showBlock отображает "вкладки"
   При вызове функции вкладке присваивается класс over, а отображаемому блоку класс vis,
   остальным блокам присваивается класс invis, а имя класса вкладки убирается.
   Вкладка должна иметь id вида "elemsIdn", а блок "elemsId_n", где n - порядковый номер вкладки/блока
   Номера должны идти подряд и совпадать для соответствия блока вкладке
*/
function showBlock(elemsId,thisId,num,n) {
  n = n ? n : 1;
  while (n <= num) {
    if (n != thisId) {
    document.getElementById(elemsId+n).className = '';
    document.getElementById(elemsId+'_'+n).className = 'invis';
    } else {
    
    document.getElementById(elemsId+n).className = 'over';
    document.getElementById(elemsId+'_'+n).className = 'vis';
    }
  n++;
  }
}
function showBlock2(elemsId,thisId,num,n) {
  n = n ? n : 1;
  while (n <= num) {
    if (n != thisId) {
    document.getElementById(elemsId+n).className = '';
	if(n==3){
		document.getElementById(elemsId+'_'+n).className = 'invis'
	}else{
		document.getElementById(elemsId+'_'+n).className = 'invis2';
	}
    } else {
    
    document.getElementById(elemsId+n).className = 'over';
	if(n==3){
		document.getElementById(elemsId+'_'+n).className = 'vis';
	}else{
		document.getElementById(elemsId+'_'+n).className = 'vis2';
	}
    }
  n++;
  }
}

/*
[/showBlock]
**********************************************/

/*******************************************

Функции для скроллинга таблицы на главной

*/
   function scrUp(Id) {
      Pos = new Number(document.getElementById('scrDown_num').value);
      n = Pos;
      if (n > 0) {
         while (n > (Pos-50)) {
            document.getElementById(Id).contentWindow.scrollTo(0,n);
            document.getElementById('move').style.top = ((n-1)/2);
            document.getElementById('scrDown_num').value = n-1;
            n--;
         }
      }
   }
   function scrDown(Id) {
      Height = document.getElementById('trn_tbl_iframe').contentWindow.document.getElementById('np-tourn-tbl').offsetHeight+20;
      Pos = new Number(document.getElementById('scrDown_num').value);
      n = Pos;
      if (n < (Height-170)) {
         while (n < (Pos+50)) {
            document.getElementById(Id).contentWindow.scrollTo(0,n);
            document.getElementById('move').style.top = ((n+1)/2)-13;
            document.getElementById('scrDown_num').value = n+1;
            n++;
         }
      }
   }
/**********************************************/

function details(x, y, w, h, url)
{
  var win = window.open(url, "_blank", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,titlebar=0,channelmode=0,left="+x+",top="+y+",width="+w+",height="+h)
}

function selItem(id,f_id,val)
{
  document.getElementById("sel_"+f_id+"_inpv").value = val;
  document.getElementById("sel_"+f_id+"_inpn").value = id;
  document.getElementById("sel_"+f_id).style.display = 'none';
}

function selOpen(f_id) {
  if (document.getElementById("sel_"+f_id).style.display == 'none') {
     document.getElementById("sel_"+f_id).style.display = 'block';
  } else {
     document.getElementById("sel_"+f_id).style.display = 'none';
  }
}

function img_open(img_src, w, h, title) {
  var win = window.open(img_src, "", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+w+",height="+h+"")
  win.moveTo((win.screen.availWidth/2) - (w/2), (win.screen.availHeight/2) - (h/2))
  win.document.open()
  win.document.write(
'<html><head><title>'+title+'</title></head>'+
'<body bgcolor="#FFffff" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">'+
'<a href="javascript:window.close()"><img border="0" alt="'+title+'" src="'+img_src+'" width="'+w+'" height="'+h+'" />'+
'</body></html>')
  win.document.close()
  return false
}

function makeIframe(h) {
document.getElementById('vote_i').style.height = h+'px';
}

function make_vote_iframe() {
   i = 0;
   iframe_load_check();
   ticker = setInterval(iframe_load_check, 3000);

   function iframe_load_check()
   {
      if (typeof(z) == "undefined" && i < 10)
      {
          return;
      }
      else
      {
        document.getElementById('vote_i').style.height = z+'px';
         if (typeof(ticker) != "undefined")
        {
            clearInterval(ticker);
        }
      }
   }
}

