var light_color = 'rgb(19, 27, 183)'; //цвет, на который подсвечиваются строки
var out_color = 'rgb(255, 255, 255)';          //цвет, возвращаемый строкам (т.е. тот, который стоял)

var select_color = 'rgb(233,16,27)';
var select_color2 = 'rgb(233, 16, 27)';
//var select_color = 'rgb(0, 0, 0)';

var _wind=window,_dd=document;
_wind.onerror = null;
//_wind.onload=function(td){setEvents('hilighttable')} - вызавает ошибку вместе с tooltips.js,
// т.к. там тоже стоит onload функции
// если подключать один этот файл - раскомментировать.

function setevents(tableindex)
{

//var tableindex;
//var debug = document.getElementById('debug');

// если id="hilighttable" стоит в теге TBODY
// так удобнее - не подсвечивается THEAD с заголовком таблицы
td=_dd.all?_dd.all:_dd.getElementsByTagName("div");
//debug.innerHTML += tableindex + td.length + '--';
// если id="hilighttable" стоит в теге TABLE
//td=_dd.all?_dd.all:_dd.getElementsByTagName("table");
    taLength=td.length;
    for(var it=0;it<taLength;it++)
    {
    var tb=td[it].getAttribute("id");
    
      if (tb&&(tb.indexOf(tableindex)!=-1)) {
      //var tbthis=td[it].getAttribute("id");
      //debug.innerHTML += tb + '--<br>';
      //var table1 = document.getElementById(tbthis);

//var arrElements = document.getElementByClassName('i3');



//for (var i=0; i<arrElements.length; i++) {
	// Save the original outer element for later
			//oElement = arrElements[i];
//if (!td[it].onclick){
			td[it].onmouseover = function omo() {
		//debug.innerHTML += tb + '--';
      if ((this.style.backgroundColor != select_color) && (this.style.backgroundColor != select_color2)) this.style.backgroundColor = light_color;
      //debug.innerHTML = oElement.style;
      }
      td[it].onmouseout = function omo() {
      //if (this.style.border != select_color) 
      //debug.innerHTML = this.style.backgroundColor;
      if ((this.style.backgroundColor == select_color)) this.style.backgroundColor = select_color;
      else if ((this.style.backgroundColor == select_color2))  {
      this.style.backgroundColor = select_color;
      
      }
      else {this.style.backgroundColor = out_color;}
      }
    //}
      
      td[it].onclick = function omo() {
      //this.style.border = select_color;
      if ((this.style.backgroundColor == select_color)) this.style.backgroundColor = out_color;
      else if ((this.style.backgroundColor == select_color2))  {
      this.style.backgroundColor = out_color;
      
      }
      else {this.style.backgroundColor = select_color;}
      //debug.innerHTML = this.style.backgroundColor;
      }
      

//	}

}
//debug.innerHTML += light_color;




}
}
