// function to change images on a page without having to go to a new page.
// does not work in IE
var pictitle = new Array(20);
var caption = new Array(20);
var alt = new Array(20);
var author = new Array(20);
// Enter the total number of images for the page here.
// Make sure there are at least this many images and alt tags in the array.
var totalpics = 5;
// titles, captions, and alt text for each picture
pictitle[1]="1960s";
caption[1]="I'm sorry, sir. You can't list a blown mind as a capital loss.";
alt[1]="cartoon";
author[1]="Bruce Cochran"

pictitle[2]="1960s";
caption[2]="And to think all these years you've worried about some boy wonder taking over your job.";
alt[2]="cartoon";
author[2]="Clem Scazetti"

pictitle[3]="1960s";
caption[3]="Every Monday it's the same thing. But you're still always on that 8:13 bus!";
alt[3]="cartoon";
author[3]="Dave Gerard"

pictitle[4]="1960s";
caption[4]="Old McDonald's farm has been sold to Agribiz International&mdash;but for the time being, you'll all be kept on.";
alt[4]="cartoon";
author[4]="H.L. Schwadron"

pictitle[5]="1960s";
caption[5]="And to those who will become captains of industry&mdash;please keep this faculty in mind if you should be in need of consultants.";
alt[5]="cartoon";
author[5]="Marty Lowe"


var pn = 1  // start at 1

function showNext(){
	pn = pn + 1; 
	if (pn > totalpics) {pn = 1;} 
// unhighlight all the numbers		
for (var i = 1; i <= totalpics; i ++)
{
document.getElementById('a'+i).style.color = "#FF0000";
document.getElementById('a'+i).style.fontWeight = "normal";
}	
//	var heading = document.getElementById("heading");
//	heading.innerHTML = pictitle[pn];
//	var artist = document.getElementById("artist");
//	artist.innerHTML = author[pn];	
//	var currentnumber = document.getElementById("currentpic");
//	currentnumber.innerHTML = pn;
	var imagecaption = document.getElementById("imagecaption");
	imagecaption.innerHTML = caption[pn];
	img = document.getElementById('placeholder');
	img.src = 'cartoon60s/slide' + pn + '.jpg';
// highlight current number	
document.getElementById('a'+pn).style.color = "#000000";
document.getElementById('a'+pn).style.fontWeight = "bold";	
	return false;
}

function showPrev(){
	pn = pn - 1; 
	if (pn < 1) {pn = totalpics;}
// unhighlight all the numbers		
for (var i = 1; i <= totalpics; i ++)
{
document.getElementById('a'+i).style.color = "#FF0000";
document.getElementById('a'+i).style.fontWeight = "normal";
}	
//	var heading = document.getElementById("heading");
//	heading.innerHTML = pictitle[pn];
//	var artist = document.getElementById("artist");
//	artist.innerHTML = author[pn];	
//	var currentnumber = document.getElementById("currentpic");
//	currentnumber.innerHTML = pn;
	var imagecaption = document.getElementById("imagecaption");
	imagecaption.innerHTML = caption[pn];
	img = document.getElementById('placeholder');
	img.src = 'cartoon60s/slide' + pn + '.jpg';
// highlight current number	
document.getElementById('a'+pn).style.color = "#000000";
document.getElementById('a'+pn).style.fontWeight = "bold";	
	return false;	
}

function showThis(whichone){
	pn = whichone;
// unhighlight all the numbers		
for (var i = 1; i <= totalpics; i ++)
{
document.getElementById('a'+i).style.color = "#FF0000";
document.getElementById('a'+i).style.fontWeight = "normal";
}
//	var heading = document.getElementById("heading");
//	heading.innerHTML = pictitle[pn];
//	var artist = document.getElementById("artist");
//	artist.innerHTML = author[pn];
// 	var currentnumber = document.getElementById("currentpic"); currentnumber.innerHTML = pn;	
	var imagecaption = document.getElementById("imagecaption");
	imagecaption.innerHTML = caption[pn];
	img = document.getElementById('placeholder');
	img.src = 'cartoon60s/slide' + pn + '.jpg';
// highlight current number	
document.getElementById('a'+pn).style.color = "#000000";
document.getElementById('a'+pn).style.fontWeight = "bold";
	return false;
}

function writePicture() {
// picture and alt tag
document.write('<img id="placeholder" class="linedrawing" src="cartoon60s/slide' + pn + '.jpg" border="0" alt=\"' + alt[pn]+ '\" />');
// imagecaption
document.write('<p id="imagecaption">' + caption[pn] + '</p>');
// controls 
document.write('<div id="imagegallery"><a href="#" onclick="return showPrev()" title="Previous" id="previous"><img src="images/arrowleft.gif" alt="Previous" border="0" /></a> <a id="a1" href="#" onclick="return showThis(1)">1</a> <a id="a2" href="#" onclick="return showThis(2)">2</a> <a id="a3" href="#" onclick="return showThis(3)">3</a> <a id="a4" href="#" onclick="return showThis(4)">4</a> <a id="a5" href="#" onclick="return showThis(5)">5</a> <a href="#" onclick="return showNext()" title="Next" id="next"><img src="images/arrowright.gif" alt="Next" border="0"/></a></div>');
    // title
    // document.write('<h3 id="heading">' + pictitle[pn] + '</h3>');
    // artist
    // document.write('<p id="artist">' + author[pn] + '</p>');

    // first time the page loads highlight first link
    document.getElementById("a1").style.color = "#000000";
    document.getElementById("a1").style.fontWeight = "bold";
	// clear out noscript tag after a second
    window.setTimeout(function() {
        n = document.getElementsByTagName('noscript');
        if (n[0]) {
           n[0].style.display='none';
        }
    },1000);
}
