// JavaScript Document

var xmlHttp;
var lsub

function showPage(myfile, npages)
{
var ctext = ""

if (npages<2) {document.getElementById("pagepart").innerHTML="";return true}
else 
{
	for (var k = 1;k<=npages;k++)
		{
		ctext = ctext + '<a href="#" onClick="showContent(' + "'" + myfile + k + ".htm',false,true,false" + 
					')">Page&nbsp;' + k + "</a>&nbsp;&nbsp;&nbsp;" 
		document.getElementById("pagepart").innerHTML = ctext 
		}
}
}

function showContent(cfile,luse,lpages,lnoborder)	 
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }

lsub = luse
if (lsub)
	{document.getElementById("mycontent").style.visibility = "hidden"
	 document.getElementById("mycontent").style.display = "none"
	 document.getElementById("mainpart").style.visibility = "visible"
	 document.getElementById("mainpart").style.display = ""
	}
	else 
	{document.getElementById("mainpart").style.visibility = "hidden"
 	 document.getElementById("mainpart").style.display = "none"
	 document.getElementById("mycontent").style.visibility = "visible"	
	 document.getElementById("mycontent").style.display = ""
	if (lnoborder==true) {document.getElementById("mycontent").style.border = "thin none"} 
	else {document.getElementById("mycontent").style.border = "thin solid" } 
	}

if (lpages==true)
{
document.getElementById("mycontent").style.width = "auto" ;
document.getElementById("mycontent").style.padding = "20px" ;
}
else {document.getElementById("pagepart").innerHTML=""}

var url=cfile;
xmlHttp.onreadystatechange= function() {stateChanged(lsub);};
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged(lshowsub) 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if (lshowsub)
	 {document.getElementById("subpart").innerHTML=xmlHttp.responseText}
 else {document.getElementById("mycontent").innerHTML=xmlHttp.responseText}
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
