AdImage = []
AdImage[0] = 'http://www.secretcorridor.co.uk/snags/adventcalendar/IMAGES/2009adsanta.gif'
AdImage[1] = 'http://www.secretcorridor.co.uk/snags/adventcalendar/IMAGES/2009adbing.gif'
AdImage[2] = 'http://www.secretcorridor.co.uk/snags/adventcalendar/IMAGES/2009adnativity.gif'
AdImage[3] = 'http://www.secretcorridor.co.uk/snags/adventcalendar/IMAGES/2009adnutcracker.gif'
AdImage[4] = 'http://www.secretcorridor.co.uk/snags/adventcalendar/IMAGES/2009adgrinch.gif'
AdImage[5] = 'http://www.secretcorridor.co.uk/snags/adventcalendar/IMAGES/2009adpudding.gif'

CalendarImage = []
CalendarImage[0] = 'IMAGES/09santa.gif'
CalendarImage[1] = 'IMAGES/09bing.gif'
CalendarImage[2] = 'IMAGES/09nativity.gif'
CalendarImage[3] = 'IMAGES/09nutcracker.gif'
CalendarImage[4] = 'IMAGES/09grinch.gif'
CalendarImage[5] = 'IMAGES/09pudding.gif'

allwindows = ['','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today','today']





function checkwindowstatusOLD()
{
var currentDay = new Date();
monthNo = currentDay.getMonth();
dayNo = currentDay.getDate();

if(monthNo==11){
    for (w=1;w<=dayNo;w++){
        allwindows[w] = 'open';
        }
    allwindows[dayNo] ='today'
    }
}

function checkwindowstatus()
{
}



function loadcalendar()
{
CalendarChoice = "url('" + CalendarImage[geturlvar()[0]] + "')";
document.getElementById('calendarframe').style.backgroundImage = CalendarChoice;

checkwindowstatus();

for (x=1;x<=25;x++){
    windowRef ='ac' + x.toString();

    switch(allwindows[x]){
        case 'open':
          openWindow = "url('" + acwindow[x][5] + "')";
          document.getElementById(windowRef).style.backgroundImage = openWindow;
          break;
        case 'closed':
          break;
        case 'today':
          break;
        default:
          break;
        }
    }
}




function changewindow(windowNo)
{
checkwindowstatus();

switch(allwindows[windowNo]){
        case 'today':
          openWindow = "url('" + acwindow[windowNo][5] + "')";
          windowRef = 'ac' + windowNo.toString();
          document.getElementById(windowRef).style.backgroundImage = openWindow;
        default:
          break;
        }
}



function openwindow(windowNo)
{
windowvariables = "height=236,width=494,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,status=no,left=200,top=200";
var windowpath="2009window.html?" + windowNo.toString();
adventwindowpopup=window.open(windowpath,"adventwindow",windowvariables);
adventwindowpopup.focus()
}





function loadpopup(){

checkwindowstatus();

windowNo = geturlvar()[0];

    switch(allwindows[windowNo]){
        case 'closed':
          windowNo = 0
        default:
          document.getElementById('popupimage').src = acwindow[windowNo][4];
          document.getElementById('popuptitle').innerHTML = acwindow[windowNo][2];
          document.getElementById('popupblurb').innerHTML = acwindow[windowNo][3];
          break;
        }
}





function gotoinstructions()
{
windowNo = geturlvar()[0];

window.close();

w = 1000
h = 700
if (window.screen) { 
   w = window.screen.availWidth-80; 
   h = window.screen.availHeight-180; 
   } 

windowvariables = "height="+h+",width="+w+",toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes,left=40,top=20";

    switch(allwindows[windowNo]){
        case 'closed':
          windowNo = 0
        default:
          var instructionpath=acwindow[windowNo][0];
          homewindow=window.open(instructionpath, "instructionhome", windowvariables);
          homewindow.focus();
          break;
    }
}





function copycalendar()
{
w = 1000
h = 700
if (window.screen) { 
   w = window.screen.availWidth-80; 
   h = window.screen.availHeight-180; 
   } 

windowvariables = "height="+h+",width="+w+",toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes,left=40,top=20";

var copycalendarpath="http://www.freeadventcalendar.blogspot.com"
homewindow=window.open(copycalendarpath, "instructionhome", windowvariables);
homewindow.focus();
}






function loadad()
{
AdChoice = AdImage[geturlvar()[0]];
document.getElementById('09ad').src = AdChoice;
}



function updateblogexample(exampleno)
{
NewExample = "url('http://www.secretcorridor.co.uk/snags/adventcalendar/" + CalendarImage[exampleno] + "')";
document.getElementById('calendarexample').style.backgroundImage = NewExample;

NewSrc = 'http://www.secretcorridor.co.uk/snags/adventcalendar/snag.html?' + exampleno;
NewCode = '&lt;IFRAME src="' + NewSrc + '" width=150 height=225 margin=0 padding=0 scrolling=no frameborder=0 style="overflow:hidden; border:0px;"&gt;Sorry your browser does not support frames&lt;/IFRAME&gt;';
document.getElementById('CodeBox').innerHTML = NewCode;
}


