
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

/********* Calendar Codes ************/

function dooropen(door)
{
	today=new Date();
	daynow=today.getDate();
	monthnow=today.getMonth();

// ###############################################
// I've de-activated the date controls for testing purposes
// Before launching, you should remove the // from the start of the next three lines that start with 'if'
// That will ensure that people can't use the calendar before December or after January
// And that they can't open doors early
// ###############################################
 
if (monthnow!=11 && monthnow!=0) {alert("This feature opens in December. Please come back then."); return false;}
if (daynow==door-1) {alert("No Peeking! Check back tomorrow to see the Annalee Advent Calendar online exclusive hiding behind that door!");return false;}
if (door>daynow) {alert("No Peeking! You\'ll have to wait "+(door-daynow)+" days before that door can be opened in the Annalee Advent Calendar online!"); return false;}

// you don't need to edit this bit 
	oNewWindow=window.open(urlsarray[door], '_blank','directories=no,height='+heightarray[door]+',width='+widtharray[door]+',location=0,menubar=0,resizable=yes,scrollbars='+scrollbarsarray[door]+',status=no,titlebar=0,toolbar=0');
}

urlsarray = new Array();
widtharray = new Array();
heightarray = new Array();
scrollbarsarray= new Array();

function writeCalendar()
{
	// ###############################################
	// edit variables here
	// ###############################################
	
	var x=32; // offset from left where doors begin in px
	var y=20; // offset from top where doors begin in px
	var rows=4; // number of rows of doors
	var cols=6; // number of columns of doors
	var spacinghoriz=100; // spacing between doors horizontal in px
	var spacingvert=79; // spacing between doors vertical in px
	
	
	// ###############################################
	// put your URLs, width and height in here. the scrollbarsarray[] is optional and should be set to 1 to enable scrollbars
	// ###############################################
	
	urlsarray[1]="1.htm"; widtharray[1]="800"; heightarray[1]="600"; scrollbarsarray[4]=1;
	urlsarray[2]="2.htm"; widtharray[2]="800"; heightarray[2]="600"; scrollbarsarray[4]=1;
	urlsarray[3]="3.htm"; widtharray[3]="800"; heightarray[3]="600"; scrollbarsarray[4]=1;
	urlsarray[4]="4.htm"; widtharray[4]="800"; heightarray[4]="600"; scrollbarsarray[4]=1;
	urlsarray[5]="5.htm"; widtharray[5]="800"; heightarray[5]="600"; scrollbarsarray[4]=1;
	urlsarray[6]="6.htm"; widtharray[6]="800"; heightarray[6]="600"; scrollbarsarray[4]=1;
	urlsarray[7]="7.htm"; widtharray[7]="800"; heightarray[7]="600"; scrollbarsarray[4]=1;
	urlsarray[8]="8.htm"; widtharray[8]="800"; heightarray[8]="600"; scrollbarsarray[4]=1;
	urlsarray[9]="9.htm"; widtharray[9]="800"; heightarray[9]="600"; scrollbarsarray[4]=1;
	urlsarray[10]="10.htm"; widtharray[10]="800"; heightarray[10]="600"; scrollbarsarray[4]=1;
	
	urlsarray[11]="11.htm"; widtharray[11]="800"; heightarray[11]="600"; scrollbarsarray[4]=1;
	urlsarray[12]="12.htm"; widtharray[12]="800"; heightarray[12]="600"; scrollbarsarray[4]=1;
	urlsarray[13]="13.htm"; widtharray[13]="800"; heightarray[13]="600"; scrollbarsarray[4]=1;
	urlsarray[14]="14.htm"; widtharray[14]="800"; heightarray[14]="600"; scrollbarsarray[4]=1;
	urlsarray[15]="15.htm"; widtharray[15]="800"; heightarray[15]="600"; scrollbarsarray[4]=1;
	urlsarray[16]="16.htm"; widtharray[16]="800"; heightarray[16]="600"; scrollbarsarray[4]=1;
	urlsarray[17]="17.htm"; widtharray[17]="800"; heightarray[17]="600"; scrollbarsarray[4]=1;
	urlsarray[18]="18.htm"; widtharray[18]="800"; heightarray[18]="600"; scrollbarsarray[4]=1;
	urlsarray[19]="19.htm"; widtharray[19]="800"; heightarray[19]="600"; scrollbarsarray[4]=1;
	urlsarray[20]="20.htm"; widtharray[20]="800"; heightarray[20]="600"; scrollbarsarray[4]=1;
	
	urlsarray[21]="21.htm"; widtharray[21]="800"; heightarray[21]="600"; scrollbarsarray[4]=1;
	urlsarray[22]="22.htm"; widtharray[22]="800"; heightarray[22]="600"; scrollbarsarray[4]=1;
	urlsarray[23]="23.htm"; widtharray[23]="800"; heightarray[23]="600"; scrollbarsarray[4]=1;
	urlsarray[24]="24.htm"; widtharray[24]="800"; heightarray[24]="600"; scrollbarsarray[4]=1;
	
	
	// you don't need anything below this line
	var doorno=1;
	
	for (h=0;h<rows;++h)
	{
		for(g=0; g<cols; ++g, ++doorno)
		{
			document.getElementById('calendarDiv').innerHTML += '<a class="cal_button" onClick="dooropen('+doorno+');" href="#" style="position: absolute; left:'+(x+(g*spacinghoriz))+'px; top:'+(y+(h*spacingvert))+'px;">'+doorno+'</a>';
			//document.write('<a class="button" onClick="dooropen('+doorno+');" href="#" style="position: absolute; left:'+(x+(g*spacinghoriz))+'px; top:'+(y+(h*spacingvert))+'px;">'+doorno+'</a>');
		}
	}
}
