// Enter here the last page number of this report
var LastPageOfReport = 563;

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 ((idp >= lo) && (idp <= hi)) {
		return(' selected');
	} else {
		return('');
	}
}
/*
function ChapterSelected(lo,hi) {
	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.htm">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,2,idp) + ' value="index.php?idp=1">Summary</option>');
	document.write ('<option' + ChapterSelected(1,2,idp) + ' value="index.php?idp=1">Summary</option>');
	document.write ('<option' + ChapterSelected(3,3,idp) + ' value="index.php?idp=3">Foreword</option>');
	document.write ('<option' + ChapterSelected(4,4,idp) + ' value="index.php?idp=4">Preface</option>');
	document.write ('<option' + ChapterSelected(5,9,idp) + ' value="index.php?idp=5">Summary for Policymakers</option>');
	document.write ('<option' + ChapterSelected(10,37,idp) + ' value="index.php?idp=10">Technical Summary</option>');
	document.write ('<option' + ChapterSelected(38,47,idp) + ' value="index.php?idp=38">Chapter 1. The Climate System: an Overview</option>');
	document.write ('<option' + ChapterSelected(48,94,idp) + ' value="index.php?idp=48">Chapter 2. Observed Climate Variability and Change</option>');
	document.write ('<option' + ChapterSelected(95,126,idp) + ' value="index.php?idp=95">Chapter 3. The Carbon Cycle and Atmospheric Carbon Dioxide</option>');
	document.write ('<option' + ChapterSelected(127,159,idp) + ' value="index.php?idp=127">Chapter 4. Atmospheric Chemistry and Greenhouse Gases</option>');
	document.write ('<option' + ChapterSelected(160,211,idp) + ' value="index.php?idp=160">Chapter 5. Aerosols, their Direct and Indirect Effects</option>');
	document.write ('<option' + ChapterSelected(212,259,idp) + ' value="index.php?idp=212">Chapter 6. Radiative Forcing of Climate Change</option>');
	document.write ('<option' + ChapterSelected(260,307,idp) + ' value="index.php?idp=260">Chapter 7. Physical Climate Processes and Feedbacks</option>');
	document.write ('<option' + ChapterSelected(308,337,idp) + ' value="index.php?idp=308">Chapter 8. Model Evaluation</option>');
	document.write ('<option' + ChapterSelected(338,372,idp) + ' value="index.php?idp=338">Chapter 9. Projections of Future Climate Change</option>');
	document.write ('<option' + ChapterSelected(373,407,idp) + ' value="index.php?idp=373">Chapter 10. Regional Climate Information – Evaluation and Projections</option>');
	document.write ('<option' + ChapterSelected(408,438,idp) + ' value="index.php?idp=408">Chapter 11. Changes in Sea Level</option>');
	document.write ('<option' + ChapterSelected(439,473,idp) + ' value="index.php?idp=439">Chapter 12. Detection of Climate Change and Attribution of Causes</option>');
	document.write ('<option' + ChapterSelected(474,499,idp) + ' value="index.php?idp=474">Chapter 13. Climate Scenario Development</option>');
	document.write ('<option' + ChapterSelected(500,517,idp) + ' value="index.php?idp=500">Chapter 14. Advancing Our Understanding</option>');
	document.write ('<option' + ChapterSelected(518,518,idp) + ' value="index.php?idp=518">Appendix I Glossary</option>');
	document.write ('<option' + ChapterSelected(519,557,idp) + ' value="index.php?idp=519">Appendix II SRES Tables</option>');
	document.write ('<option' + ChapterSelected(558,558,idp) + ' value="index.php?idp=558">Appendix III Contributors to the IPCC WGI Third Assessment Report</option>');
	document.write ('<option' + ChapterSelected(559,559,idp) + ' value="index.php?idp=559">Appendix IV Reviewers of the IPCC WGI Third Assessment Report</option>');
	document.write ('<option' + ChapterSelected(560,560,idp) + ' value="index.php?idp=560">Appendix V Acronyms and Abbreviations</option>');
	document.write ('<option' + ChapterSelected(561,561,idp) + ' value="index.php?idp=561">Appendix VI Units</option>');
	document.write ('<option' + ChapterSelected(562,562,idp) + ' value="index.php?idp=562">Appendix VII Some Chemical Symbols used in this Report</option>');
	document.write ('<option' + ChapterSelected(563,563,idp) + ' value="index.php?idp=563">Appendix VIII Figures and Tables in this Report</option>');
	document.write ('</select> ');
	//document.write ('<input type="button"  class="field" name="Button1" value="Go" onClick="MM_jumpMenuGo(\'ChapterJumpMenu\',\'parent\',1)">');
}

function PrevNext(p_idp, p_lastpage) {
	var prevPage, nextPage;
	/*
	idp=<?php print($idp); ?>;
	lastpage=<?php print($nb_file); ?>;
	*/
	
	idp=parseInt(p_idp);
	lastpage=parseInt(p_lastpage);

	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" target="_top">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>Table of contents</a> | <a href="index.php?idp=' + prevPage + '">Previous page</a>');
		}
		
		//document.write('<a href="index.htm" target="_top">Table of contents</a> | <a href=' + prevPage + '.htm target="_top">Previous page</a>');
		if (idp != lastpage) {
		//if (CurrentPageNumber() != LastPageOfReport) {
			//nextPage = CurrentPageNumber() + 1;
			//nextPage = idp; // + 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 target="_top">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'); 
}
