<!--//JavaScript Document - advent.asp functions.
///////////////////////////////////////////PAGE FUNCTION CODE///////////////////////////////////////////
var lastTipID = 'tip0';

function togDay(linkID, imgID, tipID)
{
 var theLink, theImg, lastTip; var theTip = document.getElementById(tipID); var theDay = Number(tipID.replace(/tip/, ''));
 if (theDay <= theDate)
 {
  if (linkID != '')
  {
   theLink = document.getElementById(linkID); theImg = document.getElementById(imgID); 
   theLink.style.visibility = 'hidden'; theLink.style.display = 'none';
   theImg.style.visibility = 'visible'; theImg.style.display = 'block';
   if (lastTipID != tipID) {lastTip = document.getElementById(lastTipID); lastTip.style.visibility = 'hidden'; lastTip.style.display = 'none'; theTip.style.visibility = 'visible'; theTip.style.display = 'block';}    
   lastTipID = tipID;
  }
  else {if (lastTipID != tipID) {lastTip = document.getElementById(lastTipID); lastTip.style.visibility = 'hidden'; lastTip.style.display = 'none'; theTip.style.visibility = 'visible'; theTip.style.display = 'block';} lastTipID = tipID;}
 }
 else 
 {if (lastTipID != 'tip0') {lastTip = document.getElementById(lastTipID); lastTip.style.visibility = 'hidden'; lastTip.style.display = 'none';}
  lastTip = document.getElementById('tip0')
  lastTip.innerHTML = '<apan style="color: #ff0000;">Sorry, you can\'t open this door until the right day, but if you really can\'t wait, you can view all of our <a href="http://www.wasteawarescotland.org.uk/html/christmasTips.asp" target="newWin" onclick="openWin(\'http://www.wasteawarescotland.org.uk/html/christmasTips.asp\');">Christmas tips</a> on the main Waste Aware Scotland website.</span><br /><br />'; 
  if (lastTip.style.visibility = 'hidden') {lastTip.style.visibility = 'visible'; lastTip.style.display = 'block'; lastTipID = 'tip0';}
 }
}

function openWin(theUrl)//Opens a new full window for out-of-site links.
{
 var newWin;
 if (!newWin)
    {newWin = window.open(theUrl, 'newWin', 'width=1024,height=600,top=100,left=100,location=1,menubar=1,resizable=1,scrollbars=1,statusbar=1,toolbar=1');}
 else {newWin.location = theUrl;}
 if (window.focus) {newWin.focus();}
}
// -->