// define which month
// January = 1, February = 2, etc.
currentMonth = 3;
currentYear = 2007; //if it's a new year, change the year

//stop editing the js here

function monthURL (monthVar){
	var whichMonth = months[monthVar%12].toLowerCase();
	// whichMonth = whichMonth.toLowerCase();
	if (whichMonth != "june"){
		return(whichMonth.substring(0,3)); // all months only show first 3 letters
	}else{
		return(whichMonth.substring(0,4)); /// except june, it shows all 4
	}
}

function writeLink (monthNum){
	if(thisMonth <= 12 && thisYear==true){
		prevYear--;
		thisYear = false; // now we're in last year
	}
	if (monthNum==0 && isCurrent > -1){
		document.write ('<A href="#top">');
	} else if (monthNum==0){
		document.write ('<A href="http://disney.go.com/disneyvideos/newsletter/'+monthURL(currentMonth)+currentYear+'/">');
	} else {
		document.write ('<A href="http://disney.go.com/disneyvideos/newsletter/'+monthURL(thisMonth-prevMonth)+prevYear+'/">');
	}
	// checking to see if you are viewing this month or past issue
	// if this month's issue, back to top
	if (monthNum==0 && isCurrent > -1){
		document.write ('Return to top');
	} else if (monthNum==0 && isCurrent == -1){
	// if not, back to this month's
		document.write ('Back to '+months[currentMonth]+' '+currentYear);
	} else {
		thisMonth--;
		document.write (months[thisMonth%12]+' '+prevYear);
	}
	document.write ('</a><br>');
}

currentMonth-=1; // start month array at 0
thisYear = true; // we're in this year
prevMonth = 1; // we're in this year
prevYear = 2007; // we're in this year
thisMonth = currentMonth+12; // add 12 mos to trace new year
months = ["January","February","March","April","May","June","July","August","September","October","November","December"]; //months array
pageLoc = location.href;
currentDate = monthURL(thisMonth)+currentYear;
isCurrent = pageLoc.indexOf(currentDate);

document.write ('<table cellpadding="0" cellspacing="4">');
// if prior to Dec 2004, hide this line
if (pageLoc.indexOf("2004")>-1 && pageLoc.indexOf("dec2004")==-1){
} else {
	document.write ('<tr><td align="center" valign="top" colspan="2" class="legalese"><b><a href="javascript:popup(&#39;http://disneyvideos.disney.go.com/tracking_general.html?url=disneyvideos.disney.go.com/calendar/index.html&mlc=/disneyvideos/tracking/exit+links;/tracking/exit+links/general/disneyvideos&pn=nav+release+cal&#39;,&#39;releasecalendar&#39;,&#39;width=690,height=400,scrollbars=yes,resizable=no&#39;)" onMouseOver="MM_displayStatusMsg(&#39;Release Calendar&#39;);return document.MM_returnValue" onMouseOut="MM_displayStatusMsg(&#39;&#39;);return document.MM_returnValue">For more upcoming releases, click here</a></b></td></tr>');
}
document.write ('<tr><td align="center" valign="top" colspan="2" class="legalese"><b>Newsletter Back Issues</b></td></tr>');
document.write ('<tr><td align="center" valign="top" class="legalese"><b>');
//first column
writeLink (prevMonth);
writeLink (prevMonth);
writeLink (prevMonth);
//end first
document.write ('</b></td><td align="center" valign="top" class="legalese"><b>');
//second column
writeLink (prevMonth);
writeLink (prevMonth);
writeLink (prevMonth);
//end second
document.write ('</b></td></tr>');
document.write ('<tr><td align="center" valign="top" colspan="2" class="legalese"><b>');
writeLink (0);
document.write ('</b></td></tr></table>');