var showchristmas = new Date().getMonth() == 11;

var seasons          = new Array();
seasons["fruehling"] = new Array(68);
seasons["sommer"]    = new Array(56);
seasons["herbst"]    = new Array(83);
seasons["winter"]    = new Array(58);
seasons["weihnacht"] = new Array(20);
var current          = seasons["winter"];

for (var season in seasons)
  {
   for (var i = 0; i < seasons[season].length; i++)
     {
      seasons[season][i] = "/global/images/Home/"+season+""+(i+1)+".jpg";
     }
  }
    
var currentdate = new Date();
var comparedate = new Date();

comparedate.setMonth(2);
comparedate.setDate(15);

if (currentdate.getTime() >= comparedate.getTime()) current = seasons["fruehling"];

comparedate.setMonth(5);
comparedate.setDate(10);

if (currentdate.getTime() >= comparedate.getTime()) current = seasons["sommer"];

comparedate.setMonth(8);
comparedate.setDate(1);

if (currentdate.getTime() >= comparedate.getTime()) current = seasons["herbst"];

comparedate.setMonth(11);
comparedate.setDate(1);

if (currentdate.getTime() >= comparedate.getTime()) current = seasons["winter"];


if (showchristmas) current = current.concat(seasons["weihnacht"]);

current = current.sort(randomSort);

for (i = 0; i < 10; i++)
  {
   var pic = Math.floor(Math.random()*current.length);
   document.write("<img src=\""+current[i]+"\"/>\n");
  }
  
function randomSort(a,b)
  {
   // Get a random number between 0 and 10
   var temp = parseInt( Math.random()*10 );
   // Get 1 or 0, whether temp is odd or even
   var isOddOrEven = temp%2;
   // Get +1 or -1, whether temp greater or smaller than 5
   var isPosOrNeg = temp>5 ? 1 : -1;

   // Return -1, 0, or +1
   return( isOddOrEven*isPosOrNeg );
  }
