// util.js
//
// JavaScript scripts for the GAVO portal
//
// Copyright 2003-2004 German Astrophysical Virtual Observatory (GAVO)

var helpWindow = null;

function op_frame(target, hrf){
    var frn=eval('top.' + target + '.location.href = "' + hrf + '"');
    // alert(frn);
}

function _load_ref(hrf){
    var frn=eval('top.location.href = "' + hrf + '"');
    // alert(frn);
}
function _resz_window(_url, _nm, _wd, _hg){
    // alert(_url + "\n" + _nm + "\n" + _wd + "\n" + _hg);
    self.resizeTo(_wd, _hg);
    location.replace(_url);
    return true;
}

function _print_url(){
    var str = eval('parent.frames[' + 3 + '].location');  
    //  alert(str + "\n");
    window.open(str, "Print");
    return false;
}

function _act(ww){
    document.forms[0].action.value = ww;
    document.forms[0].submit();
    return false;
}

function _helpformat(ww){
    var str = ww +  " file\n   format :\n- plain ASCII\n- ";
    if(ww.indexOf("Mask") >= 0){
        str +=  "5 columns: x y z g w\n";
    }
    if(ww.indexOf("Psf")>=0){
        str += "5 columns: x y z g w\n";
    }
    alert(str);
}

function _write_me(name, address){
    var str = "mailto:" + name + "@" + address;
//    alert(str);
    location.href=str;
    return false;
}
function _help_window(address){
  if(helpWindow && helpWindow.open && !helpWindow.closed)
  {
    helpWindow.location=address;
  }
  else
  {
    helpWindow=window.open(address);
  }
  helpWindow.focus();
}
