var tips2 = new Array();
tips2[0] = '<img src="http://www.lilleheden.dk/grafik/topleft2a.jpg" width="80" height="190" border="0">';
tips2[1] = '<img src="http://www.lilleheden.dk/grafik/topleft2b.jpg" width="80" height="190" border="0">';
tips2[2] = '<img src="http://www.lilleheden.dk/grafik/topleft2c.jpg" width="80" height="190" border="0">';
tips2[3] = '<img src="http://www.lilleheden.dk/grafik/topleft2d.jpg" width="80" height="190" border="0">';
tips2[4] = '<img src="http://www.lilleheden.dk/grafik/topleft2e.jpg" width="80" height="190" border="0">';
tips2[5] = '<img src="http://www.lilleheden.dk/grafik/topleft2f.jpg" width="80" height="190" border="0">';
tips2[6] = '<img src="http://www.lilleheden.dk/grafik/topleft2g.jpg" width="80" height="190" border="0">';
tips2[7] = '<img src="http://www.lilleheden.dk/grafik/topleft2h.jpg" width="80" height="190" border="0">';

function Topleft2(frequency) {
  var max = tips2.length;
  var dateObj = new Date();
  switch(frequency) {
    case "month": // 0 - 11
      tipIndex = dateObj.getMonth();
      break
    case "dayOfTheMonth": // 1 - 31
      tipIndex = dateObj.getDate() - 1 // 0 - 30
      break;
    case "dayOfTheWeek": // 0 - 6
      tipIndex = dateObj.getDay();
      break;
    case "hour": // 0 - 23
      tipIndex = dateObj.getHours();
      break;
    case "now": // Default
    default:
      tipIndex = getRandomIndex(max);
   }
 tipIndex = tipIndex % max;
 document.write(tips2[tipIndex]);
}

function getRandomIndex(max) {
 var randomNum = Math.random();
 randomNum = randomNum * max;
 randomNum = parseInt(randomNum);
 if(isNaN(randomNum)) randomNum = 0; // for Netscape
 return randomNum;
}

