function FocusFirst() {
      // Based on http://www.codeproject.com/KB/scripting/FocusFirstInput.aspx
      var bFound = false;
      //for each form
      for (f=0; f < document.forms.length; f++) {
            //for each form element
            for (i=0; i < document.forms[f].length; i++) {
                  el = document.forms[f][i]
                  if (el.disabled != true) {
                        if (el.type != undefined) {
                              switch (el.type.toLowerCase()) {
                                    case "text" : el.focus(); bFound = true; break;
                                    case "textarea" : el.focus(); bFound = true; break;
                                    case "checkbox" : el.focus(); bFound = true; break;
                                    case "radio" : el.focus(); bFound = true; break;
                                    case "file" : el.focus(); bFound = true; break;
                                    case "password" : el.focus(); bFound = true; break;
                                    case "select-one" : el.focus(); bFound = true; break;
                                    case "select-multiple" : el.focus(); bFound = true; break;
                              } // switch el.type
                        } //if (el.type != undefined)
                  } //if (el.disabled != true)
                  if (bFound == true) break;
            } //for each form element
            if (bFound == true) break;
      } //for each form
}

function confirm_delete()
{
  if (confirm("Are you sure you want to delete this?")==true)
    return true;
  else
    return false;
}

function confirm_cancel()
{
  if (confirm("Are you sure you want to cancel this?")==true)
    return true;
  else
    return false;
}

function wopen(url, w, h)
{
	w += 32;
	h += 96;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(url,
		'Allocate',
		'width=' + w + ', height=' + h + ', ' +
		'left=' + wleft + ', top=' + wtop + ', ' +
		'location=no, menubar=no, ' +
		'status=no, toolbar=no, scrollbars=no, resizable=no');
	win.resizeTo(w, h);
	win.moveTo(wleft, wtop);
	win.focus();
}

function printpage() {
	window.print();
	window.close();  
}