/*
	Avacco Soft 2004
	разработчик: Анциферов Н.М.
*/

function get_item(code){
    if (document.getElementById){
        if (typeof(document.getElementById(code)) != "undefined")
            return document.getElementById(code);
    }
    else
    if (document.all){
        if (typeof(document.all[code]) != "undefined")
            return document.all[code];
    }
    return null;
}

function toggleDisplay(spanid){
    var obj = get_item(spanid);
    if (obj != null ){
        var obj = obj.style;
        obj.display = (obj.display == "block" ? "none" : "block");
    }
    return false;
}

function hightlightMenu(zoneid,on){
    var pos = zoneid.indexOf("_");
    if (pos != -1){
        var overzone = zoneid.substring(pos+1);
        if (overzone != curzone){
            if (typeof(document.all["menu_"+overzone]) != 'undefined'){
                var menuobj = document.all["menu_"+overzone];
                menuobj.style.backgroundColor= on ? "#194388" : "#507DB8";
            }
        }
    }
    return false;
}
function addToFavourites(){
    window.external.AddFavorite(location.href , document.title);
    return false;
}

function focusSearch(dosel){
    with (document.forms['search'].what){
        focus();
        if (dosel == true) select();
    }
    window.status = 'Введите фразу для поиска';
    document.all['searchgo'].src = "images/searchred.gif"
    return false;
}
function submitSearch(){
    var whatobj = document.forms['search'].what;
    if (whatobj.value==''||whatobj.value==whatobj.defaultValue){
        alert('Следует ввести слово для поиска');
        return false;
    }
    return true;
}
function makeHightlighted(codes){
    var hglzone,i;
    for (i=0; i<codes.length; i++){
        if (typeof document.all[codes[i]] != 'undefined'){
            hglzone = document.all[codes[i]];
            hglzone.onmouseover = new Function("return hightlightMenu(this.id,true);")
            hglzone.onmouseout =  new Function("return hightlightMenu(this.id,false);")
        }
    }
}

