function dw(str) {
document.write(str)
}
var wnew=null
function wopen(src,w,h) {
if(!wnew || wnew.closed) {
wnew=window.open('','new','left=150,top=100,width='+w+',height='+(h+20)+',scrollbars=auto,resizable')
wnew.wid=src
}
if(wnew.wid!=src) {wnew.focus(); wnew.resizeTo(w+12,h+50)}
wnew.document.clear()
wnew.document.write('<html><head><title>Изображение</title></head>\r\n<body style="margin:0px;padding:0px;text-align:center;vertical-align:top;font:bold 9px Verdana">\r\n<img src="'+src+'" width="'+w+'" height="'+h+'" border="0"><br><a href="javascript:self.close()">Закрыть окно</a></body></html>')
wnew.wid=src
wnew.document.close()
wnew.focus()
}

function getSelect(url, obj)
{
    nocache = new Date();
    url += (/\?/i.test(url) ? '&' : '?') + 'nocache=' + nocache.getTime();
    JsHttpRequest.query(url, {}, function(result, text) { fillSelect(obj, result); });
}

function fillSelect(obj, fill)
{
    jQuery(function($) {
        $(obj).empty();
        for (key in fill) {
            $(obj).append('<option value="' + key + '">' + fill[key] + '</option>');
        }
        //$(obj).selectedIndex = 0;
    });
}

function resetSelect(obj)
{
    for (var i = 0; i < obj.options.length; i++) {
        if (obj.options[i].value == '' || obj.options[i].value == '0') {
            obj.selectedIndex = i;
            break;
        }
    }
}

function clearSelect(obj)
{
    var i = 0;
    while (i < obj.options.length) {
        if (obj.options[i].value == '' || obj.options[i].value == '0') {
            obj.selectedIndex = i;
            i++;
        } else {
            obj.removeChild(obj.options[i]);
        }
    }

}

function getElementsByRegexpName(tagname, regexp)
{
    var result = new Array();
    var i;
    if (typeof(regexp) == 'string') {
        regexp = new RegExp(regexp, 'i');
    }
    
    temp = document.getElementsByTagName(tagname);
    for (i = 0; i < temp.length; i++) {
        if (regexp.test(temp[i].name)) {
            result[result.length] = temp[i];
        }
    }
    return result;
}

function getElementsByRegexpId(tagname, regexp)
{
    var result = new Array();
    if (typeof(regexp) == 'string') {
        regexp = new RegExp(regexp, 'i');
    }
    
    temp = document.getElementsByTagName(tagname);
    for (var i = 0; i < temp.length; i++) {
        if (regexp.test(temp[i].id)) {
            result[result.length] = temp[i];
        }
    }
    return result;
}

jQuery(function($) {
    $('p.jsLongNavigator a').click(function() {
        $(this).closest('table').find('tr.jsLongNavigator').removeClass('jsLongNavigator');
        $(this).closest('tr').remove();
        return false;
    });
    
    
});

