// Archive Browsing Script v0.9
// Three years of beta testing!!!
// customized for oldskooled.keenspace.com
// by Dave Schrader
// frogurt@geocities.com
var arcArray = new Array();
arcArray[0]  = "os20001218.gif";
arcArray[1]  = "os20001225.gif";
arcArray[2]  = "os20010101.gif";
arcArray[3]  = "os20010108.gif";
arcArray[4]  = "os20010115.gif";
arcArray[5]  = "os20010122.gif";
arcArray[6]  = "os20010129.gif";
arcArray[7]  = "os20010205.gif";
arcArray[8]  = "os20010212.gif";
arcArray[9]  = "os20010219.gif";
arcArray[10] = "os20010226.gif";
arcArray[11] = "os20010305.gif";
arcArray[12] = "os20010312.gif";
arcArray[13] = "os20010319.gif";
arcArray[14] = "os20010326.gif";
arcArray[15] = "os20010402.gif";
arcArray[16] = "os20010404.gif";
arcArray[17] = "os20010406.gif";
arcArray[18] = "os20010409.gif";
arcArray[19] = "os20010416.gif";
arcArray[20] = "os20010418.gif";
arcArray[21] = "os20010420.gif";
arcArray[22] = "os20010423.gif";
arcArray[23] = "os20010430.gif";
arcArray[24] = "os20010507.gif";
arcArray[25] = "os20010514.gif";
arcArray[26] = "os20010521.gif";
arcArray[27] = "os20010528.gif";
arcArray[28] = "os20010604.gif";
arcArray[29] = "os20010611.gif";
arcArray[30] = "os20010709.gif";
arcArray[31] = "os20010716.gif";
arcArray[32] = "os20010723.gif";
arcArray[33] = "os20010730.gif";
arcArray[34] = "os20010813.gif";
arcArray[35] = "os20010820.gif";
arcArray[36] = "os20010827.gif";
arcArray[37] = "os20010912.gif";
arcArray[38] = "os20010924.gif";
arcArray[39] = "os20011010.gif";
arcArray[40] = "os20011015.gif";
arcArray[41] = "os20011022.gif";
arcArray[42] = "os20011029.gif";
arcArray[43] = "os20011105.gif";
arcArray[44] = "os20011130.gif";
arcArray[45] = "os20011218.gif";
arcArray[46] = "os20020114.gif";
arcArray[47] = "os20020204.gif";
arcArray[48] = "os20020211.gif";
arcArray[49] = "os20020218.gif";
arcArray[50] = "os20020225.gif";
arcArray[51] = "os20020304.gif";
arcArray[52] = "os20020311.gif";
arcArray[53] = "os20020325.gif";
arcArray[54] = "os20020402.gif";
arcArray[55] = "os20020509.gif";
arcArray[56] = "os20020617.gif";
arcArray[57] = "os20020804.gif";
arcArray[58] = "os20020814.gif";
arcArray[59] = "os20021026.gif";
arcArray[60] = "os20021217.gif";
arcArray[61] = "os20030201.gif";
arcArray[62] = "os20030419.gif";
arcArray[63] = "os20031226.gif";
arcArray[64] = "os20040401.gif";
arcArray[65] = "os20050724.gif";
arcArray[66] = "os20051103.gif";
arcArray[67] = "os20061223.gif";

var i;

function oneDig(word) {
var w = "";
if (word < 10)
	w = "0" + word;
else
	w = word;
return w
} //end oneDig

function getCurrent(curDay) {
switch(getCurrent.arguments.length) {

case 1:
var tempi = 0;
var todayString = "" + today.getFullYear() + oneDig(today.getMonth()+1) + oneDig(today.getDate());
while ( (tempi <= arcArray.length-1) && (arcArray[tempi].substr(2,8) <= todayString)) 
	tempi++;
return tempi - 1;
break;

default:
return arcArray.length-1;
break;
}
} // End getCurrent

// extracts the yyyymmdd date from the URL
// then changes it to osyyyymmdd.gif
function getComicDate(i) {
var addy = window.location.search;
var stringStart = addy.search('date') + 5;
var imageString = "os" + addy.substr(stringStart) + ".gif";
i = 0;
while ( (arcArray[i] != imageString) && (i < arcArray.length) ) {
	i++; 
	}
}

// loads the archive navigation bar for archive page
// first, previous, archive list, next, recent
// each function changes image src
function navArc(i) {
var shortDate = arcArray[i].substr(2,8);
document.write('<center>');
document.write('<table border=0 cellpadding=0 cellspacing=0><tr>');
document.write('<td width="140">');
if (i == 0) {
document.write('<img src="images/first_day_bw.gif" alt="First Comic" height="80" width="106" border="0"></td>');
document.write('<td width="140">');
document.write('<img src="images/previous_day_bw.gif" alt="Previous Comic" height="80" width="80" border="0"></td>');
}
else {
shortDate = arcArray[0].substr(2,8);
document.write('<a href="archive.html?date=' + shortDate + '">');
document.write('<img src="images/first_day.gif" alt="First Comic" height="80" width="106" border="0"></a></td>');
document.write('<td width="140">');
shortDate = arcArray[i - 1].substr(2,8);
document.write('<a href="archive.html?date=' + shortDate + '">');
document.write('<img src="images/previous_day.gif" alt="Previous Comic" height="80" width="80" border="0"></a></td>');
}

document.write('<td width="140">');
document.write('<a href="archives.html">');
document.write('<img src="images/list.gif" alt="Archive" height="80" width="80" border="0"></a></td>');
document.write('<td width="140">');

if (i == (arcArray.length - 2) ) {
document.write('<a href="index.html">');
}
else {
shortDate = arcArray[i + 1].substr(2,8);
document.write('<a href="archive.html?date=' + shortDate + '">');
}

document.write('<img src="images/next_day.gif" alt="Next Comic" height="80" width="80" border="0"></a></td>');
document.write('<td width="140">');
document.write('<a href="index.html">');
document.write('<img src="images/last_day.gif" alt="Newest Comic" height="80" width="108" border="0"></a></td>');
document.write('</tr></table>');
document.write('</center>');
} // End navArc

function navArcHome() {

document.write('<center>');
document.write('<table width=700 border=0 cellpadding=0 cellspacing=0><tr>');
document.write('<td width="140">');
document.write('<a href="archive.html?date=20001218">');
document.write('<img src="images/first_day.gif" alt="First Comic" height="80" width="106" border="0"></a></td>');
document.write('<td width="140">');
var shortDate = arcArray[i-1].substr(2,8);
document.write('<a href="archive.html?date=' + shortDate + '">');
document.write('<img src="images/previous_day.gif" alt="Previous Comic" height="80" width="80" border="0"></a></td>');
document.write('<td width="140">');
document.write('<a href="archives.html">');
document.write('<img src="images/list.gif" alt="Archive" height="80" width="80" border="0"></a></td>');
document.write('<td width="140">');
document.write('<img src="images/next_day_bw.gif" alt="Next Comic" height="80" width="80" border="0"></td>');
document.write('<td width="140">');
document.write('<img src="images/last_day_bw.gif" alt="Newest Comic" height="80" width="108"></td>');
document.write('</tr></table>');
document.write('</center>');
} // End navArcHome