currimg = 1;
currstory = 11;
currpage = 1;
npages = 12;

nps1 = 8;
nps2 = 3;
nps3 = 8;
nps4 = 14;
nps5 = 11;
nps6 = 10;
nps7 = 11;
nps8 = 8;
nps9 = 6;
nps10 = 6;
nps11 = 12;
nps12 = 9;
nps13 = 9;
nps14 = 12;

var dhtmlRange = (document.all) ? "all." : "";
var dhtmlStyle = (document.all) ? ".style" : "";
var hiddenName = (document.all) ? "hidden" : "hide";
var header = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"200\"><tr><td>";
var footer = "</td></tr></table>";

// pageRollOn

function pageRollOn (id) {
	if (currpage != id  && id <= npages) {
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['page' + txt].src = '../images/comics/page' + txt + '_r.gif'
	}
}

// storyRollOn

function storyRollOn (id) {
	if (currstory != id) {
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['story' + txt].src = '../images/comics/story' + txt + '_r.gif'
	}
}

// galleryRollOn

function galleryRollOn (id) {
	if (currimg != id) {
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['icn' + txt].src = '../images/gallery/galicn' + txt + '-r.gif'
	}
}

// pageRollOff

function pageRollOff (id) {
	if (currpage != id && id <= npages) {
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['page' + txt].src = '../images/comics/page' + txt + '.gif'
	}
}

// storyRollOff

function storyRollOff (id) {
	if (currstory != id) {
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['story' + txt].src = '../images/comics/story' + txt + '.gif'
	}
}

// galleryRollOff

function galleryRollOff (id) {
	if (currimg != id) {
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['icn' + txt].src = '../images/gallery/galicn' + txt + '-i.gif'
	}
}

// galleryPrev

function galleryPrev () {
	if (currimg == 1) {
		galleryClickOn (20);
	}
	else {
		galleryClickOn (currimg - 1);
	}
}

// galleryNext

function galleryNext () {
	if (currimg == 20) {
		galleryClickOn (1);
	}
	else {
		galleryClickOn (currimg + 1);
	}
}


// galleryClickOn

function galleryClickOn (id) {
	
	galtxt01 = "The cover to Electric Girl #1, featuring Virginia, Oogleeoog the gremlin and Blammo (Summer 1998)";
	galtxt02 = "The cover to Electric Girl #2. The main story features the \"origin\" of Blammo. (Spring 1999)";
	galtxt03 = "The cover to Electric Girl #3. The main story features the introduction of Professor Flosznik. (Fall 1999)";
	galtxt04 = "The cover to Electric Girl #4. The main story features the introduction of Virginia's cousins, Heather and Rick. (Winter 1999)";
	galtxt05 = "The cover to Electric Girl #5. Stories include Virginia fighting off an \"alien invasion\", and the return of the toddler/genius known as Timmy. (Spring 2000)";
	galtxt06 = "The cover to Electric Girl #6. The main story: \"what if Virginia decided to become a superhero?\" with the help of Oogleeoog of course. (Summer 2000)";
	galtxt07 = "The cover to Electric Girl #7. The main story features the return of Professor Flosznik and her newest robotic creation: Lisa! (Spring 2001)";
	galtxt08 = "The cover to Electric Girl #8. The main story features Virginia's trip to the dentist! (Fall 2001)";
	galtxt09 = "The cover to Electric Girl #9. This is the \"Mondo Blammo\" issue, with stories that star Blammo! (Spring 2002)";
	galtxt10 = "The cover to Electric Girl #10. The main story features Virginia taking on the witch of her cousin Heather's home town on Halloween night! (Fall 2002)";
	galtxt11 = "The cover to Electric Girl volume 1 TPB. This volume collects issues 1 through 4 of the EG comic book. (2000)";
	galtxt12 = "The cover to Electric Girl volume 2 TPB. This volume collects issues 5 through 8 of the EG comic book. (June 2002)";
	galtxt13 = "From \"A Blammo for All Seasons\" in EG#9: Spring.";
	galtxt14 = "From \"A Blammo for All Seasons\" in EG#9: Summer.";
	galtxt15 = "From \"A Blammo for All Seasons\" in EG#9: Fall.";
	galtxt16 = "From \"A Blammo for All Seasons\" in EG#9: Winter.";
        galtxt17 = "The cover to Electric Girl volume 3 TPB. This volume collects the final two issues of the Electric Girl comic book series plus new and previously unpublished stories. (September 2005)";
        galtxt18 = "Back cover art to Electric Girl volume 1 TPB.";
        galtxt19 = "Back cover art to Electric Girl volume 2 TPB.";
        galtxt20 = "Back cover art to Electric Girl volume 3 TPB.";

	if (currimg < 10) {
		txt = '0' + currimg
	}
	else {
		txt = currimg
	}
	document['icn' + txt].src = '../images/gallery/galicn' + txt + '-i.gif'
	currimg = id
	if (id < 10) {
		txt = '0' + id
	}
	else {
		txt = id
	}
	document['icn' + txt].src = '../images/gallery/galicn' + txt + '-r.gif'
	document['galart'].src = '../images/gallery/galart' + txt + '.jpg'

 	if (document.layers) {
//		alert ('NS4')
		document.text1.document.write(header+eval('galtxt'+txt)+footer)
     	document.text1.document.close()
	}
    else if (document.all) {
//		alert ('IE')
        document.all.text1.innerHTML = header+eval('galtxt'+txt)+footer
	}
   else {
//		alert ('DOM')
        document.getElementById("text1").innerHTML = header+eval('galtxt'+txt)+footer
	}

}

// storyClick

function storyClick (id) {

	npages = eval ('nps'+id);

	if (currstory < 10) {
		txt = '0' + currstory
	}
	else {
		txt = currstory
	}
	document['story' + txt].src = '../images/comics/story' + txt + '.gif'

	currstory = id
	if (currstory < 10) {
		txt = '0' + currstory
	}
	else {
		txt = currstory
	}
	document['story' + txt].src = '../images/comics/story' + txt + '_r.gif'

	document['storytitle'].src = '../images/comics/title' + txt + '.gif'
	
	document['page01'].src = '../images/comics/page01_r.gif'

	for (i = 2; i <= npages; i++) {
		if (i < 10) {
			txt = '0' + i
		}
		else {
			txt = i
		}
		document['page' + txt].src = '../images/comics/page' + txt + '.gif'
	}

	for (i = npages+1; i <= 14; i++) {
		if (i < 10) {
			txt = '0' + i
		}
		else {
			txt = i
		}
		document['page' + txt].src = '../images/pixel_clear.gif'
	}

	pageClick(1);
	
}

// pageClick

function pageClick (id) {

	if (id <= npages) {
		if (currpage < 10) {
			txt = '0' + currpage
		}
		else {
			txt = currpage
		}
		document['page' + txt].src = '../images/comics/page' + txt + '.gif'
		currpage = id
		if (id < 10) {
			txt = '0' + id
		}
		else {
			txt = id
		}
		document['page' + txt].src = '../images/comics/page' + txt + '_r.gif'
		document['pageart'].src = '../images/comics/story' + currstory + '/st' + currstory + 'pg' + txt + '.gif'
	}
}

// comicsPrev

function comicsPrev() {
	if (currpage >= 2) {
		pageClick(currpage - 1)
	}
	else {
		if (currstory == 1) {
			storyClick(14)
		}
		else {
			storyClick(currstory - 1)
		}
	}
}

// comicsNext

function comicsNext() {
	if (currpage < npages) {
		pageClick(currpage + 1)
	}
	else {
		if (currstory == 14) {
			storyClick(1)
		}
		else {
			storyClick(currstory + 1)
		}
	}
}

// openWindow

function openWindow (page, title, width, height) {
	window.open(page,title,"width=" + width + ",height=" + height + ",toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no");
}

// updateVotes

function updateVotes () {
	
	total_votes = votes_1 + votes_2 + votes_3;
	percent_1 = (votes_1/total_votes)*100;
	percent_2 = (votes_2/total_votes)*100;
	percent_3 = (votes_3/total_votes)*100;

	txt1 = "<b>Poster 1</b><br> " + percent_1.toFixed(2) + " %<br>";
	txt2 = "<b>Poster 2</b><br> " + percent_2.toFixed(2) + " %<br>";
	txt3 = "<b>Poster 3</b><br> " + percent_3.toFixed(2) + " %<br>";

 	if (document.layers) {
//		alert ('NS4')
		document.vote1.document.write(txt1);
     	document.vote1.document.close();
		document.vote2.document.write(txt2);
     	document.vote2.document.close();
		document.vote3.document.write(txt3);
     	document.vote3.document.close();
	}
    else if (document.all) {
//		alert ('IE')
        document.all.vote1.innerHTML = txt1;
        document.all.vote2.innerHTML = txt2;
        document.all.vote3.innerHTML = txt3;
	}
   else {
//		alert ('DOM')
        document.getElementById("vote1").innerHTML = txt1;
        document.getElementById("vote2").innerHTML = txt2;
        document.getElementById("vote3").innerHTML = txt3;
	}

}


// updateVotes2

function updateVotes2 () {
	
	total_votes = votes_1 + votes_2 + votes_3;
	percent_1 = (votes_1/total_votes)*100;
	percent_2 = (votes_2/total_votes)*100;
	percent_3 = (votes_3/total_votes)*100;

	txt1 = "<b>Poster 1</b><br> " + percent_1.toFixed(2) + " %<br> (" + votes_1 + " votes)";
	txt2 = "<b>Poster 2</b><br> " + percent_2.toFixed(2) + " %<br> (" + votes_2 + " votes)";
	txt3 = "<b>Poster 3</b><br> " + percent_3.toFixed(2) + " %<br> (" + votes_3 + " votes)";

 	if (document.layers) {
//		alert ('NS4')
		document.vote1.document.write(txt1);
     	document.vote1.document.close();
		document.vote2.document.write(txt2);
     	document.vote2.document.close();
		document.vote3.document.write(txt3);
     	document.vote3.document.close();
	}
    else if (document.all) {
//		alert ('IE')
        document.all.vote1.innerHTML = txt1;
        document.all.vote2.innerHTML = txt2;
        document.all.vote3.innerHTML = txt3;
	}
   else {
//		alert ('DOM')
        document.getElementById("vote1").innerHTML = txt1;
        document.getElementById("vote2").innerHTML = txt2;
        document.getElementById("vote3").innerHTML = txt3;
	}
}
