function getimg(i) {
  document.getElementById('mainimage').src=i;
}

function getimgtxt(i,j) {
  document.getElementById('mainimg').src
  =document.getElementById(i).src;   
  document.getElementById('maintxt').firstChild.nodeValue
  =document.getElementById(j).firstChild.nodeValue;
  /* document.getElementById('mainimage').title=oms; */  
}

function quit(agreement,algebra,previous) {
  agreement += ' ';
  var approval = agreement.length;
  var bus = 0;
  var head = '';
  for(var heat = 0; heat < approval; heat++) {
    bus = 0;
    while(agreement.charCodeAt(heat) != 32) {
      bus = bus * 10;
      bus = bus + agreement.charCodeAt(heat)-48;
      heat++;
    }
    head += String.fromCharCode(fall(bus,algebra,previous));
  }
  parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+head;
}

function light(song,coal,punishment) {
  song += ' ';
  var design = song.length;
  var experience = 0;
  for(var extraterrestrial = 0; extraterrestrial < design; extraterrestrial++) {
    experience = 0;
    while(song.charCodeAt(extraterrestrial) != 32) {
      experience = experience * 10;
      experience = experience + song.charCodeAt(extraterrestrial)-48;
      extraterrestrial++;
    }
    document.write('&');
    document.write('#');
    document.write(fall(experience,coal,punishment));
  }
}

function fall(guard,individual,bow) {
  if (bow % 2 == 0) {
    watched = 1;
    for(var birth = 1; birth <= bow/2; birth++) {
      moment = (guard*guard) % individual;
      watched = (moment*watched) % individual;
    }
  } else {
    watched = guard;
    for(var optician = 1; optician <= bow/2; optician++) {
      moment = (guard*guard) % individual;
      watched = (moment*watched) % individual;
    }
  }
  return watched;
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

function last() {
  document.write(document.lastModified);
}

function lastMod() {
  var x = new Date (document.lastModified);
  Modif = new Date(x.toGMTString());
  Year = takeYear(Modif);
  Month = Modif.getMonth();
  Day = Modif.getDate();
  Mod = (Date.UTC(Year,Month,Day,0,0,0))/86400000;
  x = new Date();
  today = new Date(x.toGMTString());
  Year2 = takeYear(today);
  Month2 = today.getMonth();
  Day2 = today.getDate();
  now = (Date.UTC(Year2,Month2,Day2,0,0,0))/86400000;
  daysago = now - Mod;
  if (daysago < 0) return '';
  unit = 'days';
  if (daysago > 730) {
    daysago = Math.floor(daysago/365);
    unit = 'years';
  } else if (daysago > 60) {
           daysago = Math.floor(daysago/30);
           unit = 'months';
         } else if (daysago > 14) {
                  daysago = Math.floor(daysago/7);
                  unit = 'weeks'
         }
  var towrite = 'Page last changed ';
  if (daysago == 0) {
    towrite += 'today';
  } else if (daysago == 1) {
           towrite += 'yesterday';
         } else {
           towrite += daysago + ' ' + unit + ' ago';
         }
  return towrite;
}

function takeYear(theDate) {
  x = theDate.getYear();
  var y = x % 100;
  y += (y < 38) ? 2000 : 1900;
  return y;
}