function disable_screen(screen) {
  var x,y;
  if (self.innerHeight) // all except Explorer
  {
        x = self.innerWidth;
        y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
        // Explorer 6 Strict Mode
  {
        x = document.documentElement.clientWidth;
        y = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
        x = document.body.clientWidth;
        y = document.body.clientHeight;
  }
  var a=document.getElementById('disable_screen');
  a.style.visibility='visible';
  a.style.display='block';
  a.style.height=y+'px';
  a.style.width=x+'px';
  var b=document.getElementById(screen);
  b.style.visibility='visible';
  b.style.display='block';
  b.style.top=Math.round(y/2-300/2)+'px';
  b.style.left=Math.round(x/2-250/2)+'px';
}
function enable_screen(screen) {
  var x=document.getElementById('disable_screen');
  x.style.visbility='hidden';
  x.style.display='none';
  var y=document.getElementById(screen);
  y.style.visbility='hidden';
  y.style.display='none';
}
function get_hours(date,hours_id) {
  var x=document.getElementById('hours');
  x.date.value=date;
  jQuery('#entry_date').text(date);
  x.exe_btn.value='Add';
  if(hours_id>0)
  {
    var y=document.getElementById('timecard');
    eval('x.project_id.value=y.project_id_'+hours_id+'.value');
    eval('x.hours.value=y.hours_'+hours_id+'.value');
    eval('x.overtime.value=y.overtime_'+hours_id+'.value');
    eval('x.tasks.value=y.tasks_'+hours_id+'.value');
    x.exe_btn.value='Update';
  }
  disable_screen('loading');
  x.hours.focus();
}
function validate_hours() {
  var x=document.getElementById('hours');
  if(!(x.hours.value*1>0))
  {
    alert("You must enter a number for hours.");
    x.hours.focus();
    return false;
  }
  if(x.hours.value*1>24)
  {
    alert("The number of hours you entered exceeds maximum.");
    x.hours.focus();
    return false;
  }
  if(!(x.overtime.value*1>0)&&x.overtime.value!='')
  {
    alert("You must enter a number for overtime.");
    x.overtime.focus();
    return false;
  }
  if(x.overtime.value*1>24)
  {
    alert("The nmmber of overtime hours you entered exceeds maximum.");
    x.overtime.focus();
    return false;
  }
  if(x.project_id.value*1<=0)
  {
    alert("You must select one of the Available Contracts.\nIf there are no avaialble contracts please email help@mindsource.com.");
    x.project_id.focus();
    return false;
  }
  if(x.tasks.value.length<=0)
  {
    alert("You must enter a description of the task you completed for this set of hours");
    x.tasks.focus();
    return false;
  }
  x.submit();
}
function get_notes(notes_id) {
  var x=document.getElementById('notes');
  x.exe_btn.value='Add';
  if(notes_id>0)
  {
    var y=document.getElementById('timecard');
    eval('x.project_id.value=y.tcn_project_'+notes_id+'.value');
    eval('x.content.value=y.tcn_content_'+notes_id+'.value');
    x.exe_btn.value='Update';
  }
  disable_screen('weekly_notes');
  x.content.focus();
}
function validate_notes() {
  var x=document.getElementById('notes');
  if(x.project_id.value*1<=0)
  {
    alert("You must select one of the Available Contracts.\nIf there are no avaialble contracts please email help@mindsource.com.");
    x.project_id.focus();
    return false;
  }
  if(x.content.value.length<=0)
  {
    alert("You must enter a description of the task you completed for this set of hours");
    x.notes.focus();
    return false;
  }
  x.submit();
}
