var extractData = null;

function extractSetup() {
  	var f = document.forms['parameterForm'];
  	clearForm(f);
   	
  	var div = document.createElement('DIV');
  	f.appendChild(div);
   	   	
	var tb = createTable(div, 3);   	
	   	
  	tb.rows[0].appendChild(buildCell(1, buildLabel('Extract line #:')));
  	tb.rows[0].appendChild(buildCell(1, buildText('extractStart')));
  	tb.rows[1].appendChild(buildCell(1, buildLabel('and every:')));
  	tb.rows[1].appendChild(buildCell(1, buildText('extractIncrement'),
  	                                    buildLabel(' lines after')));
  	tb.rows[2].appendChild(buildCell(1, buildRunButton(extractRun)));  	
  	tb.rows[2].appendChild(buildCell(-1, buildButton('Help', extractHelp),
  	                                     buildButton('Example 1', extractExample1)));
	if (extractData) {  		                                     
		extractSet(extractData);
	}
	
	return extractTearDown;
}
   
function extractTearDown() {
	extractData = extractGet();
}

function extractGet() {
  	var o = new Object();
  	o.start = document.forms['parameterForm'].extractStart.value;
  	o.increment = document.forms['parameterForm'].extractIncrement.value;
  	return o;
}

function extractSet(o) {
  	document.forms['parameterForm'].extractStart.value = o.start;
  	document.forms['parameterForm'].extractIncrement.value = o.increment;
}
   
function extractRun() {
  	makeEditorRequest('extract', extractGet());
}
   
function extractHelp() {
	window.frames['docFrame'].document.location = "html/extract.html";
}
   
function extractExample1() {
	document.forms['parameterForm'].extractStart.value = '2';
	document.forms['parameterForm'].extractIncrement.value = '2';
	window.frames['docFrame'].document.location = "html/extractExample1.html";
	document.forms['inputForm'].inputText.value = 'May 15, 2006 8:18:56 PM org.apache.coyote.http11.Http11BaseProtocol init\n' +
                                                 'INFO: Initializing Coyote HTTP/1.1 on http-8080\n' +
                                                 'May 15, 2006 8:18:56 PM org.apache.catalina.startup.Catalina load\n' +
                                                 'INFO: Initialization processed in 875 ms\n' +
                                                 'May 15, 2006 8:18:56 PM org.apache.catalina.core.StandardService start\n' +
                                                 'INFO: Starting service Catalina\n' +
                                                 'May 15, 2006 8:18:56 PM org.apache.catalina.core.StandardEngine start\n' +
                                                 'INFO: Starting Servlet Engine: Apache Tomcat/5.5.15\n';
	document.forms['outputForm'].outputText.value = '';	
}   
   
