	function fn() 
	{
		var chapdir = document.location.pathname;
	var URL = "../../../../cgi-bin/NewSmartCompile.pl?code=orovalley&ext=html&key=10206&style=new&path=" + chapdir;
		document.location.href = URL;
	}

	function gn()
	{
		fn();
	}

	function init()
	{
		
		var e = document.getElementById('mainContent');
		var f = buildForm();
		//finds an h1 if the document has one
		//stick the form into the document at the end of <div id="mainContent">
		e.appendChild( f );
		var g = document.getElementsByTagName('input');
		//attach the fn() function to the form button
		g[0].onclick = function(){ fn(); };
		
	}
	
	//constructs the "compile chapter" form
	function buildForm()
	{
		var myForm = document.createElement( 'form' );
		var myPara = document.createElement( 'p' );
		myPara.className = 'show';
		var button = document.createElement('input');
		button.setAttribute('value', "Compile Chapter");
		button.setAttribute('type', "button");
		myPara.appendChild(button);
		myForm.appendChild(myPara);
		return myForm;
	
	}
	
	window.onload = function(){ init(); };