function isEmpty(theField)
{
    //trim leading spaces
    var ret=true;
    var i,len,temp;

    if (theField == null) return true;
    
    if ((theField.value == "") || (theField.value.length == 0))
    {
        return true;
    }
    else
    {
        len = theField.value.length;
        for (i=0; i<len; i++)
        {
            temp = theField.value.substr(i, 1);
            if (temp!=" " && temp!="\t")
            {
                ret = false;
                break;
            }
        }
        return ret;
    }
}

function Open()
{
  if(isEmpty(checkusage.userId))
  {
    alert("Invalid Userid or Password entered. Please ensure your password do not contain |, @, %, &, #. Otherwise, please change your password before trying again.");
    return false;
  }

  scrWidth = screen.availWidth*0.9;
  scrHeight = screen.availHeight*0.9;

  var w=window.open('','CheckConnectionUsage','width='+scrWidth+',height='+scrHeight+',toolbar=no,menubar=no,resizable=no,location=no,directories=no,scrollbars=yes,status=no,top=0,left=0');
  w.focus();
}

function StaffOpen()
{
  if(isEmpty(checkusage.userId))
  {
    alert("Invalid Userid or Password entered. Please ensure your password do not contain |, @, %, &, #. Otherwise, please change your password before trying again.");
    return false;
  }

  scrWidth = screen.availWidth*0.9;
  scrHeight = screen.availHeight*0.8;
  
  var w=window.open('','CheckConnectionUsage','width='+scrWidth+',height='+scrHeight+',toolbar=yes,menubar=yes,resizable=no,location=no,directories=no,scrollbars=yes,status=no,top=0,left=0');
  w.focus();
}

//show file
function show_file(location_path) 
{
  window.location = location_path
}

function SessionLogout()
{
  window.open("sessioninvalidate.jsp","CheckConnectionUsage");
}

function SaveFrame(name)
{
  name.document.execCommand('SaveAs', true, '');
}

function PrintFrame(name)
{
  name.focus();
  name.print();
}