function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
 return false;
}

var showPoup = function(status)
{
   status = 'block';
    var popup = document.getElementById('loginPopupContainer');
    var popupGhost = document.getElementById('loginPopupGhost');

    if(popup) popup.style.display=status;
    if(popupGhost) popupGhost.style.display=status;
}

function switchTo(numberStep)
{
    var TAB             = 'step';
    var TAB_CONTENT     = 'contentStep';
    var ACTIVE_FLAG     = '_active';
    var UNACTIVE_FLAG   = '_passive'; 

    var tabIDA       = TAB + numberStep + ACTIVE_FLAG;
    var tabIDU       = TAB + numberStep + UNACTIVE_FLAG;
    var contentID   = TAB_CONTENT + numberStep;

    for(var I = 1; I < 10; I ++){

        var tabContainerA   = document.getElementById(TAB + I + ACTIVE_FLAG);
        var tabContainerU   = document.getElementById(TAB + I + UNACTIVE_FLAG);
        var tabCotent       = document.getElementById(TAB_CONTENT + I);

        if(tabContainerA){
            tabContainerA.style.display = 'none';
        }
        if(tabContainerU){
            tabContainerU.style.display = 'block';
        }
        if(tabCotent){
            tabCotent.style.display = 'none';
        }
    }

    var tab = document.getElementById(tabIDA);
    if(tab) tab.style.display='block';

    var tab = document.getElementById(tabIDU);
    if(tab) tab.style.display='none';

    var content = document.getElementById(contentID);
    if(content) content.style.display='block';    

    return true;
}

function highlightTableRows(tableId, hoverClass)
{
	var table = document.getElementById(tableId);
	
	if (hoverClass)
	{
		table.onmouseover = table.onmouseout = function(e)
		{
			if (!e) e = window.event;
			var elem = e.target || e.srcElement;
			while (!elem.tagName || !elem.tagName.match(/td|th|table/i)) elem = elem.parentNode;

			//Если событие связано с элементом TD или TH из раздела TBODY
			if (elem.parentNode.tagName == 'TR' && elem.parentNode.parentNode.tagName == 'TBODY')
			{
				var row = elem.parentNode;//ряд содержащий ячейку таблицы в которой произошло событие

				if(e.type=="mouseover"){
				    row.style.backgroundColor = "#CC87F2";
				} else {
    				row.style.backgroundColor = "";

				}
			}
		};
	}

}

var pushToTheSearch = function(text)
{
    var searchField = document.getElementById('searchField');

    if(searchField) searchField.value = text;
//    if(searchField) searchField.value = '*,..,* BOO';
}
