var _popup;
function popup (sLocation, width, height)
{
    if (!width) {
        width = 600;
    }
    if (!height) {
        height = 250;
    }

    _popup = window.open(sLocation, "_popup", "width=" + width + ", height=" + height + ", top=20, left=20, scrollbars=no, resizable=yes");
    _popup.focus();
    return _popup;
}
function doWindow(sLocation, width, height)
{
	popup(sLocation, width, height);
	return false;
}
function closePopup()
{
    if (opener) {
        window.close();
        return ;
    }
    if(_popup) {
        _popup.close();
        return ;
    }
}

function closeWindow()
{
	closePopup();
}

function refresh_opener(url)
{
     closePopup();
     window.opener.location.href = url;
//     window.opener.focus();
}

function action_unblock(action_value, field, value) {
    if(action_value == value) {
        document.getElementById(field).disabled = false;
    }
    else if(document.getElementById(field).disabled != true)
        document.getElementById(field).disabled = true;
}

function unselect(startIndex, stopIndex) {
    for(var i = startIndex; i <= stopIndex; i++) {
        var item = document.getElementById(i + "");
        item.checked = false;
    }
}

function select(startIndex, stopIndex) {
    for(var i = startIndex; i <= stopIndex; i++) {
        var item = document.getElementById(i + "");
        item.checked = true;
    }
}
