/*
Title:			Michael Skaff chapter menu selection javascript
Created:		7 March 2006
Last Updated:	8 March 2006

/* [--- set variables ---] */
var W3CDOM = document.getElementById;


/* [--- get specified object ---] */
function getObj(idvalue) {
    return document.getElementById(idvalue);
}

/* [--- open new windows for chapters list ---] */
function displayChapters() {
	chaptersList = getObj('chapters');
	chapterSelected = chaptersList.selectedIndex;

	if (chapterSelected < 0) 
	alert("Please select a chapter to read.");
	
	else {
		var attr = "top=25,left=25,scrollbars=1,location=1,resizable=1,";

		switch (chapterSelected) {

			case 0:
			  attr += "width=540,height=590";
			  break;
			case 1:
				attr += "width=620,height=900";
				break;
			case 2:
			  attr += "width=600,height=300";
			  break;
			case 3:
			  attr += "width=600,height=900";
			  break;
			default:
			  attr += "width=620,height=600";
		} 
		open(chaptersList.options[chapterSelected].value,"_blank",attr);
	}
}
			

function start(){
    if (!W3CDOM) return;
    chaptersButton = getObj('readChapters');
    chaptersButton.onclick = displayChapters;
}

window.onload = start;