function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}

function popup(url,w,h)
{
	atr = '';
	atr = atr + 'toolbar=no,';
	atr = atr + 'scrollbars=yes,';
	atr = atr + 'location=no,';
	atr = atr + 'statusbar=no,';
	atr = atr + 'menubar=no,';
	atr = atr + 'resizable=yes,';
	if (w) {
	atr = atr + 'width='+w+',';
	atr = atr + 'height='+h;
	}
	else{
	atr = atr + 'width=700,';
	atr = atr + 'height=500';
	}
	new_window=window.open(url,'popup',atr);
	new_window.focus();
}

function goopener (url) {
window.opener.focus();
window.opener.location=url;
window.close();
}

function goback (url) {
window.location=url;
}


function SetFocus() {
  if (document.forms.length > 0) {
    var field = document.forms[0];
    for (i=0; i<field.length; i++) {
      if ( (field.elements[i].type != "image") && 
           (field.elements[i].type != "hidden") && 
           (field.elements[i].type != "reset") && 
           (field.elements[i].type != "submit") ) {

        document.forms[0].elements[i].focus();

        if ( (field.elements[i].type == "text") || 
             (field.elements[i].type == "password") )
          document.forms[0].elements[i].select();
        
        break;
      }
    }
  }
}

function openhelp(context,term)
{

	features = '';
	features = features + 'toolbar=no,';
	features = features + 'scrollbars=yes,';
	features = features + 'location=no,';
	features = features + 'statusbar=yes,';
	features = features + 'menubar=no,';
	features = features + 'resizable=yes,';
	features = features + 'width=451,';
	features = features + 'height=500';
	
	helpURL = '/help/?'
	helpURL = helpURL + 'context=' + context
	helpURL = helpURL + '&'
	helpURL = helpURL + 'term=' + term
	
	window.open(helpURL,'help',features);
}