// Enter here the last page number of this report
var LastPageOfReport = 160;

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); 
  if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function CurrentPageNumber() {
	return parseInt(location.pathname.substr(location.pathname.length-7,3),10);
}

function ChapterSelected(lo,hi,idp) {
	if ((CurrentPageNumber() >= lo) && (CurrentPageNumber() <= hi)) {
		return(' selected');
	} else {
		return('');
	}
}

function ShowChapterJumpMenu(idp) {
	document.write ('<select class="field" name="ChapterJumpMenu" onChange="MM_jumpMenu(\'parent\',this,1)">');
	document.write ('<option value="index.php?idp=0">Table of contents</option>');
	// Set the values in the call to ChapterSelected as the first and last web page numbers of the chapter.
	// Set the option value to the first web page of the chapter.
	document.write ('<option' + ChapterSelected(1,1,idp) + ' value="index.php?idp=1">Foreword</option>');
	document.write ('<option' + ChapterSelected(2,2,idp) + ' value="index.php?idp=2">Preface</option>');
	document.write ('<option' + ChapterSelected(3,12,idp) + ' value="index.php?idp=3">Summary for Policymakers</option>');
	document.write ('<option' + ChapterSelected(13,19,idp) + ' value="index.php?idp=13">Chapter 1 Introduction</option>');
	document.write ('<option' + ChapterSelected(20,30,idp) + ' value="index.php?idp=20">Chapter 2 Impacts of Aircraft Emissions on Atmospheric Ozone</option>');
	document.write ('<option' + ChapterSelected(31,43,idp) + ' value="index.php?idp=31">Chapter 3 Aviation-Produced Aerosols and Cloudiness</option>');
	document.write ('<option' + ChapterSelected(44,53,idp) + ' value="index.php?idp=44">Chapter 4 Modeling the Chemical Composition of the Future Atmosphere</option>');
	document.write ('<option' + ChapterSelected(54,62,idp) + ' value="index.php?idp=54">Chapter 5 Solar Ultraviolet Irradiance at the Ground</option>');
	document.write ('<option' + ChapterSelected(63,87,idp) + ' value="index.php?idp=63">Chapter 6 Potential Climate Change from Aviation</option>');
	document.write ('<option' + ChapterSelected(88,117,idp) + ' value="index.php?idp=88">Chapter 7 Aircraft Technology and Its Relation to Emissions</option>');
	document.write ('<option' + ChapterSelected(118,129,idp) + ' value="index.php?idp=118">Chapter 8 Air Transport Operations and Relation to Emissions</option>');
	document.write ('<option' + ChapterSelected(130,147,idp) + ' value="index.php?idp=130">Chapter 9 Aircraft Emissions: Current Inventories and Future Scenarios</option>');
	document.write ('<option' + ChapterSelected(148,156,idp) + ' value="index.php?idp=148">Chapter 10 Regulatory and Market-Based Mitigation Measures</option>');
	document.write ('<option' + ChapterSelected(157,157,idp) + ' value="index.php?idp=157">Annex A. Authors, Contributors, and Expert Reviewers</option>');
	document.write ('<option' + ChapterSelected(158,158,idp) + ' value="index.php?idp=158">Annex B. Glossary of Terms</option>');
	document.write ('<option' + ChapterSelected(159,159,idp) + ' value="index.php?idp=159">Annex C. Acronyms, Abbreviations, and Units</option>');
	document.write ('<option' + ChapterSelected(160,160,idp) + ' value="index.php?idp=160">Annex D. List of Major IPCC Reports</option>');
	document.write ('</select> ');
	//document.write ('<input class="field" type="button" name="Button1" value="Go" onClick="MM_jumpMenuGo(\'ChapterJumpMenu\',\'parent\',1)">');
}

function PrevNext(p_idp, p_lastpage) {
	var prevPage, nextPage;
	idp=parseInt(p_idp);
	lastpage=parseInt(p_lastpage);
	
	//if (isNaN(CurrentPageNumber())) { 
	if (isNaN(idp)) {
		document.write('Table of contents | <a href="index.php?idp=1" target="_top">Next page</a>');
		//document.write('Table of contents | <a href="001.htm">Next page</a>');
	} else {
		//if (CurrentPageNumber() == 1) { 
		if (idp == 1) { 
		//if (idp == 0) {
			//prevPage= -1; 
			prevPage= -1; 
			//prevPage='index';
		} else { 
			//prevPage=CurrentPageNumber() - 1; 
			 prevPage=idp - 1; 
			 //prevPage=idp - 2; 
		}
		/*
		if (prevPage < 10) { prevPage = '0' + prevPage; }
		if (prevPage < 100) { prevPage = '0' + prevPage; }	
		*/	
		if (prevPage >= 0) {
			document.write('<a href="index.php?idp=0" target="_top">Table of contents</a> | <a href=index.php?idp=' + prevPage + '>Previous page</a>');
		}
		//document.write('<a href="index.htm">Table of contents</a> | <a href=' + prevPage + '.htm>Previous page</a>');
		if (idp != lastpage) {
		//if (CurrentPageNumber() != LastPageOfReport) {
			//nextPage = CurrentPageNumber() + 1;
			nextPage = idp + 1;
			/*
			if (nextPage < 10) { nextPage = '0' + nextPage; }
			if (nextPage < 100){ nextPage = '0' + nextPage; } 
			*/
			document.write(' | <a href=index.php?idp=' + nextPage + '>Next page</a>');
			//document.write(' | <a href=' + nextPage + '.htm>Next page</a>');
		} else { 
			//if (CurrentPageNumber() == LastPageOfReport){
			if (idp == lastpage) {
			document.write(' | End of report');}
		}
	}
}

function showFootnote (chapter,name) {
	theURL = 'fn' + chapter + '.htm#' + name;
	window.open(theURL,'references_win','width=350,height=200,scrollbars,resizable'); 
}
