if (window != window.top) {top.location.href = location.href;}

var y=0;
var lasty=0;
var uagent=navigator.userAgent;
var hop=0;
var eieio=0;
var scratch;
var workInterval = 0;
var scrollInterval = -2;
var nextpage;

if (!window.XMLHttpRequest) //IE below 7.0, Netscape and Opera less than ver.8 will return 0
{	eieio = 1;
}

function getScrollRate(){
		return document.getElementById("pongo").ss.options[document.getElementById("pongo").ss.selectedIndex].value;
}

function garrulax() {		
	y = getY() + 1;
	top.scroll(0,y);
	if (eieio) {
		holdwork();
	}
	return true;
}

function setfontsize(fs) {
	scratch=fs+"em";	
    	document.body.style.fontSize=scratch;
}

function getnextpage(np) {
	if (np != "none") {
		nextpage=np+".html";
		window.location=nextpage;
	}
 }

/* This function creates the scrollbar. 
 * The CSS position:fixed attribute fixes an element
 * relative to the browser window instead of the document but IE hasn't seen fit to implement it yet. 
 * hold() and holdwork() are the workarounds to fake a similar effect
 * by repositioning the control bar once a second.
 */

function runRabbit() {
	if (eieio) {
		document.writeln('<div id="pygathrix" style="position: absolute; left: 755px; top: 20px; margin: 0px; padding: 0px; background-color: #eeffdd; border: 1px solid; width: 235px">'); //* for browser not supporting position: fixed*/
	} else { 
		document.writeln('<div id="pygathrix" style="position: fixed; left: 755px; top: 10px; margin: 0px; padding: 0px; background-color: #ddffee; border: 1px solid; width: 240px;">'); /*firefox */
	}
/*	document.writeln('<br />'); */

	document.writeln('<table class="col" style="border: 1px; background: #eeeeee; background-color: transparent;">');
	document.writeln('<tr><td><span style="font-size: 0.9em; font-weight: bold;">Table of Contents:</span>');
	document.writeln('<form name="pongo" id="pongo" width="235px">');

/*	document.writeln('<select name="ss" id="ss" onChange="unpause();" onFocus="dopause();"');
	document.writeln('<option value="12">Very Fast Scroll');
	document.writeln('<option value="25">Fast Scroll');
	document.writeln('<option value="50">Medium Scroll');
	document.writeln('<option value="100">Slow Scroll');
	document.writeln('<option value="150" selected>Very Slow Scroll');
	document.writeln('<option value="200">Even Slower');
	document.writeln('<option value="500">Slowest');
	document.writeln('</select>');
*/

	document.writeln('<select name="np" id="np" onChange="getnextpage(this.options[this.selectedIndex].value); return true;">');
	document.writeln('<option value="http://designforlife.com.sg/index" selected><b>Design For Life start page</b>');
	document.writeln('<option value=none><br />Go to chapter: ');
	document.writeln('<option value="1summary">Abstract');
	document.writeln('<option value="12history">1.2 History of Zoos');
	document.writeln('<option value="21moat">2.1 The Nature of the Moat');
	document.writeln('<option value="22planting">2.2  Exhibit Planting');
	document.writeln('<option value="23mesh">2.3  Mesh & Fence Barriers');
	document.writeln('<option value="24exhibitry">2.4  Exhibitry: The Tools ');
	document.writeln('<option value="24exhibitry">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of Habitat Simulation');
	document.writeln('<option value="25graphics">2.5  Designing in Graphics');
	document.writeln('<option value="26shelter">2.6  Shelter');
	document.writeln('<option value="27lighting">2.7  Habitat Lighting');
	document.writeln('<option value="31behaviour">3.1 Visitor Behaviour');
	document.writeln('<option value="32perception">3.2 Perception of Zoo Exhibits');
	document.writeln('<option value="33aesthetics">3.3 Architectural Aesthetics');
	document.writeln('<option value="41case">4.1 Introduction to Case Studies');
	document.writeln('<option value="42polar">4.2 Polar Bear & ');
	document.writeln('<option value="42polar">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sealion Case Study');
	document.writeln('<option value="43phippo">4.3 Pygmy Hippo Case Study');
	document.writeln('<option value="44uwater">4.4 Underwater-viewed Exhibits');
	document.writeln('<option value="45pkingdm">4.5 Primate Kingdom Case Study');
	document.writeln('<option value="46cat">4.6 \'Cat Country\' Case Study');
	document.writeln('<option value="47nsafari">4.7 Night Safari Case Study');
	document.writeln('<option value="51resp">5.1 Responsibility & Limitations');
	document.writeln('<option value="52application">5.2 Application of Design to Zoos');
	document.writeln('<option value="53discuss">5.3 General Discussion');
	document.writeln('<option value="gloss">Glossary');
	document.writeln('<option value="endnotes">Endnotes');
	document.writeln('<option value="acknowledge">Acknowledgements');
	document.writeln('</select>');
	document.getElementById("pongo").np.options[1].selected=1;
	document.writeln('<br /><br />');

	document.writeln('<select name="fs" id="fs" onChange="setfontsize(this.options[this.selectedIndex].value); return true;">');
	document.writeln('<option value="0.80">Font Size 8pt');
	document.writeln('<option value="0.85">Font Size 9pt');
	document.writeln('<option value="0.90">Font Size 10pt');
	document.writeln('<option value="0.95">Font Size 11pt');
	document.writeln('<option value="1.00" selected>Font Size 12pt');
	document.writeln('<option value="1.10">Font Size 13pt');
	document.writeln('<option value="1.15">Font Size 14pt');
	document.writeln('<option value="1.20">Font Size 16pt');
	document.writeln('<option value="1.25">Font Size 18pt');
	document.writeln('</select>');

	document.getElementById("pongo").fs.options[4].selected=1;
	document.writeln('</td></tr><tr><td>');

	document.writeln('<form action="http://www.designforlife.com.sg/contact.html" target="_blank">'); 
	document.writeln('<input type=submit value="Comment">');
	document.writeln('</form>');	

/*	document.writeln('</td></tr><tr><td>');
 *	document.writeln('<input type=button id="pause" name=pause value=Scroll onclick=parent.pause()>');
 *	document.writeln('<input type=button id="hide" name=hide value=Hide onclick=parent.hide()>');
 *	document.writeln('</form>');
 *	document.writeln('</td></tr><tr><td><br />');
 *
 *	document.writeln( '<form action="#top">');
 *	document.writeln( '<input type=submit value="Top of page" onclick=parent.dopause()>');
 *	document.writeln( '</form>'); 
 */

	document.writeln('</td></tr>');
	document.writeln('</table>');
	document.writeln( '</div>');

/*	document.getElementById("pongo").ss.options [0].selectedIndex=3; */
/*	document.getElementById("pongo").ss.options [1].selectedIndex=1; */
	if (eieio) {
		hold();
	}
	return true;
}

function getY(){
	return document.body.scrollTop;
}

function holdwork(){
	obj = document.getElementById("pygathrix").style;
	obj.top = getY();
}

function hold(){
	holdwork();
	workInterval = setInterval("holdwork()", 1000);
}

function hide(){	
	document.getElementById("pygathrix").style.visibility = "hidden";
	document.getElementById("floatBottom").style.visibility = "hidden";
	clearInterval( workInterval);
	return false;
}

function pause(){
	if(getScrollRate() == 0){
		return;
	}
	if( hop == 0){
		unpause();
	} else {
		dopause();
	}
	return true;
}

function dopause(){
	if( scrollInterval != -2){
		clearInterval( scrollInterval);
	}
	hop = 0;
		document.getElementById("pause").value = "Scroll";
}

function unpause(){
	if( scrollInterval != -2 ){
		clearInterval( scrollInterval );
	}
	hop = 1;
		document.getElementById("pause").value = "Stop";
	if( getScrollRate() != 999 ){
		scrollInterval = setInterval("garrulax()", getScrollRate());
	}
}

function lsq() {
/*	document.getElementById("q").style.visibility = "hidden";*/
	document.write("&lsquo;");
}

function rsq() {
	document.write("&rsquo;");
}

function ldq() {
	document.write("&ldquo;");
}

function rdq() {
	document.write("&rdquo;");
}