//////////////////////////////////////////////////////
//
// Module:           news.js
//
// Description:      Contains functions that work
//                   with news objects
//
//////////////////////////////////////////////////////

//
// name of the object edit form used everywhere
// in the templates
//
var OBJ_EDIT_FORM = 'ObjEditForm';

function SetToday(field) {
   field.value = GetTodaysDate();
}

function GetToday() {
   var obj = GetTodayParts( );
   return obj.Year+'-'+obj.Month+'-'+obj.MonthDay+' '+obj.Hour+':'+obj.Minutes+':'+obj.Seconds;
}

function GetTodayParts()
{
   today = new Date();
   year = today.getYear();
   var name = navigator.appName;
   if (name == "Netscape" || name == "Konqueror") {
      if (year > 0 && year < 200) {
         year = year+1900;
      }
   }
   month = today.getMonth() + 1;
   date = today.getDate();
   hour = today.getHours();
   minutes = today.getMinutes();
   seconds = today.getSeconds();

   if (month < 10)
      month     = "0" + month;
   if (date < 10)
      date      = "0" + date;
   if (hour < 10)
      hour      = "0" + hour;
   if (minutes < 10)
      minutes   = "0" + minutes;
   if (seconds < 10)
      seconds   = "0" + seconds;

   var obj = new Object( );
   obj.Year       = year;
   obj.Month      = month;
   obj.MonthDay   = date;
   obj.Hour       = hour;
   obj.Minutes    = minutes;
   obj.Seconds    = seconds;

   return obj;
}

function GetTodaysDate()
{
   var obj = GetTodayParts();
   return obj.Year+'-'+obj.Month+'-'+obj.MonthDay;
}
