//------------------------- scripts.js -------------------------
//Usefull scripts for vary purposes
//--------------------------------------------------------------
//Created by Yury Semyonov
//--------------------------------------------------------------

DocumentDate = new Date(document.lastModified)
var Months = new Array()
Months[0]  = 'января'
Months[1]  = 'февраля'
Months[2]  = 'марта'
Months[3]  = 'апреля'
Months[4]  = 'мая'
Months[5]  = 'июня'
Months[6]  = 'июля'
Months[7]  = 'августа'
Months[8]  = 'сентября'
Months[9]  = 'октября'
Months[10] = 'ноября'
Months[11] = 'декабря'
var Months_e = new Array()
Months_e[0]  = 'January';
Months_e[1]  = 'February'
Months_e[2]  = 'March'
Months_e[3]  = 'April'
Months_e[4]  = 'May'
Months_e[5]  = 'June'
Months_e[6]  = 'July'
Months_e[7]  = 'August'
Months_e[8]  = 'September'
Months_e[9]  = 'October'
Months_e[10] = 'November'
Months_e[11] = 'December'

//---------------------------------------------------------------------------
//------------- WriteDocumentDate ---------------------------------
function WriteDocumentDate()
{
  document.write(DocumentDate.getDate())
  document.write('&nbsp;')
  document.write(Months[DocumentDate.getMonth()])
  document.write('&nbsp;')
  theYear = DocumentDate.getYear();
  if (theYear < 100)
    theYear+=2000; 
  if (theYear < 2000)
   theYear+=1900; 
  document.write (theYear);
  document.write('&nbsp;г.')
}

//------------- WriteDocumentDate_e ---------------------------------
function WriteDocumentDate_e()
{
  document.write(DocumentDate.getDate())
  document.write('&nbsp;')
  document.write(Months_e[DocumentDate.getMonth()])
  document.write('&nbsp;')
  if (theYear < 100)
    theYear+=2000; 
  if (theYear < 2000)
   theYear+=1900; 
  document.write (theYear);
  document.write('&nbsp;')
}

//------------------ WriteDocumentDateInBrief ------------------------
function WriteDocumentDateInBrief()
{
  document.write(DocumentDate.getDate())
  document.write('.')
  document.write(DocumentDate.getMonth()+1)
  document.write('.')
  if (theYear < 100)
    theYear+=2000; 
  if (theYear < 2000)
   theYear+=1900; 
  document.write (theYear);
}

//------------------ PrintDate ---------------------------------------
function PrintDate(date)
{
  document.write(date.getDate())
  document.write(' ')
  document.write(Months[date.getMonth()])
  document.write(' ')
  if (theYear < 100)
    theYear+=2000; 
  if (theYear < 2000)
   theYear+=1900; 
  document.write (theYear);
  document.write('&nbsp;г.')
}

//------------------ PrintDate_e ---------------------------------------
function PrintDate_e(date)
{
  document.write(date.getDate())
  document.write(' ')
  document.write(Months_e[date.getMonth()])
  document.write(' ')
  if (theYear < 100)
    theYear+=2000; 
  if (theYear < 2000)
   theYear+=1900; 
  document.write (theYear);
}


//--------------------- DownloadString --------------------------------
//Print download string under the disk-button according version and language
function DownloadString (ver, lang)
{
  var Sum = 0;
  if (lang == 'eng') {
    for (var i = 0; i < ProfEng.length; i++) {
      Sum = Sum + ProfEng[i];
    }
  }
  else {
    if (ver == 'prof') {
      for (var i = 0; i < ProfRus.length; i++){
        Sum = Sum + ProfRus[i];
      }
    }
    else if (ver == 'lite') {
      for (var i = 0; i < LiteRus.length; i++){
        Sum = Sum + LiteRus[i];
      }
    }
  }
  SumStr = new String (Sum);
  var pos = SumStr.indexOf (".");
  if (pos != -1) {
    var IntStr = SumStr.substr (0, pos);
    var DecStr = SumStr.substr (pos + 1, 1);
    Sum = IntStr + "." + DecStr;
  }
  if (lang == 'rus') {
    document.write('Размер дистрибутива ');
    document.write(Sum);
    document.write(' МБайт.');
    /*if (ver == 'prof') {
      document.write(ProfRus_U[0]);
    }
    else if (ver == 'lite') {
      document.write(LiteRus_U[0]);
    }
    document.write(' МБайт.');*/
  }
  else if (lang == 'eng') {
    document.write('Size: ');
    document.write(Sum);
    document.write(' Mb');
  }
}
