			function selectRow( row ){
				//alert( searchUpToTag(row,'TABLE').name );
				tbl = searchUpToTag(row,'TABLE');
				for( i = 0; i < tbl.rows.length; i++ ){
					_tr = tbl.rows[i];
					for( j = 0; j < _tr.childNodes.length; j++ ){
						_td = _tr.childNodes[j];
						_td.className = 'tdItem';
					}					
				}
				for( i = 0; i < row.childNodes.length; i++ ){
					row.childNodes[i].className = 'tdItemSelected';
				}
				
			}

			function selectItem( row, href ){
//                                window.open('http://server.iad.liveperson.net/hc/57088204/?cmd=file&file=visitorWantsToChat&site=57088204&referrer='+document.location,'chat57088204','width=472,height=320');
                                window.open('https://siteheart.com/webconsultation/4183','siteheart_sitewindow_4183','width=550,height=400,top=30,left=30,resizable=yes')
			}

			function searchUpToTag( obj, tagName ){
				while( obj != null && obj.tagName != tagName )
					obj = obj.parentNode;

				return obj;
			}
			function showAttributes( obj ){
				
			}

			function searchDownToTag( obj, tagName ){
				if ( obj == null || !obj.hasChildNodes )
					return null;

				for( i = 0; i < obj.childNodes.length; i++ ){
					var sn = obj.childNodes[i];
					if ( sn.tagName == tagName )
						return sn;
					else
						searchDownToTag( sn, tagName );
				}
				/*for( i = 0; i < obj.childNodes.length; i++ ){
					var sn = obj.childNodes[i];
					return searchDownToTag( sn, tagName );
				}*/

			}
		
			function showDropDown(){
				_divDD = document.getElementById('divDD');
				if ( _divDD.style.display == 'none' ){
					_divDD.style.display = 'block';
					setDropDownFocus();
				}
				else
					_divDD.style.display = 'none';
			}
			function setDropDownFocus(){
				_divDD = document.getElementById('divDD');
				try
				{
					_divDD.focus();
				}
				catch(e){}
			}
			function setTextFocus(){
				_txtValue = document.getElementById('txtValue');
				try
				{
					_txtValue.focus();
				}
				catch(e){}
			}
			function processDDKeyDown( keyCode ){
				switch ( keyCode ){
				case 13 :
					//alert(13);
					selectNextRow( keyCode );
					break;
				default :
					selectNextRow( keyCode );
					break;
				}
			}
			function selectNextRow( keyCode ){
				var selIdx = -1;
				var _tbl2 = document.getElementById('tbl2');
				var rowsCount = _tbl2.rows.length;

				if ( rowsCount < 1  || !( keyCode == 37 || keyCode == 38 || keyCode == 39 || keyCode == 40 || keyCode == 13) )
					return;

				for( i = 0; i < _tbl2.rows.length; i++ ){
					_tr = _tbl2.rows[i];
					_td = _tr.childNodes[0];
					if ( _td.className == 'tdItemSelected' ) 
						selIdx = i;
				}
				//alert ( selIdx );
				switch (keyCode){
				case 13 :
					selectItem(_tbl2.rows[selIdx], '');
					setTextFocus();
					return;
					break;
				case 37 :
				case 38 :
					//alert('UP');
					if ( selIdx > 0 )
						selIdx -= 1;
					else
						selIdx = rowsCount - 1;

					break;
				case 39 :
				case 40 :
					//alert('DOWN');
					if ( selIdx != (rowsCount - 1) )
						selIdx += 1;
					else
						selIdx = 0;
				}
				selectRow(_tbl2.rows[selIdx]);
			}
function openwin(href)
{
  href= (href==1 ? "https://privat24.pbank.com.ua/" : href)
  window.open(href, '_blank');
//alert(href)
}

