function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function showWelcome()
{
   if(!document.getElementById)
   {
      return;
   }
   /*
	var today = new Date();
	var hours = today.getHours(); 
	var day = today.getDate();
	var month = today.getMonth();
	var salutation = null;
	
	if(month == 11 && day > 16 && day < 27)
	{
	   salutation = 'Merry Christmas!';
	}
	else if(month == 11 && day > 26 )
	{
	   salutation = 'Happy new year!';
	}
	else
	{
	   salutation = 'Hello';
	   if(hours < 12)
	   {
	      salutation += ', Good morning';
	   }
	   if(hours >= 12 && hours < 18)
	   {
	      salutation += ', Good afternoon';
	   }
	   if(hours >=18)
	   {
	      salutation += ', Good evening';
	   }
	   salutation += ' and Welcome.';
	}
	
	var locSal = document.getElementById("welcome");
	if(locSal)
	{
	   var textNode = document.createTextNode(salutation);
	   locSal.removeChild(locSal.childNodes[0]);
	   locSal.appendChild(textNode);
	}	
	*/
	var locJS = document.getElementById("jsEnabled");
	if(locJS)
	{
	   locJS.removeChild(locJS.childNodes[0]);
		var textNode = document.createTextNode("It is OK, I have detected that you have Javascript enabled.");
	   locJS.appendChild(textNode);
	}
   var brow = document.getElementById("browserDetect");
	if(brow)
	{
      if(getInternetExplorerVersion() != -1 )
	   {
        t=document.createTextNode("Best viewed in ");
        a = document.createElement("a");
        a.href='http://getfirefox.com/';
        a.innerHTML="Firefox";
        brow.appendChild(t);
        brow.appendChild(a);
        
        t2=document.createTextNode(". See the following  ");
        a2 = document.createElement("a");
        a2.href='./what-IE-cannot-do.php';
        a2.innerHTML="page";
        t3=document.createTextNode(" to see just why I recommend that you should use a more advanced browser if you possibly can.");
        brow.appendChild(t2);
        brow.appendChild(a2);
        brow.appendChild(t3);
	   }
	}

	var locYear = document.getElementById("curYear");
	if(locYear)
	{
	   locYear.removeChild(locYear.childNodes[0]);
		var text = "" + today.getFullYear();
		var textNode = document.createTextNode(text);
		locYear.appendChild(textNode);	
	}
}

// Fire up the message on loading the page.
window.onload = showWelcome;
