var joinBlocksData = null;

function joinBlocksSetup() {
  	var f = document.forms['parameterForm'];
  	clearForm(f);
   	
  	var div = document.createElement('DIV');
  	f.appendChild(div);

	var tb = createTable(div, 2);   	
	   	
  	tb.rows[0].appendChild(buildCell(1, buildLabel('Line count:')));
  	tb.rows[0].appendChild(buildCell(1, buildText('joinBlocksCount')));
  	tb.rows[1].appendChild(buildCell(2, buildRunButton(joinBlocksRun)));  	
  	tb.rows[1].appendChild(buildCell(-1, buildButton('Help', joinBlocksHelp),
  	                                     buildButton('Example 1', joinBlocksExample1)));
	if (joinBlocksData) {  		                                     
		joinBlocksSet(joinBlocksData);
	}
	
	return joinBlocksTearDown;
}
   
function joinBlocksTearDown() {
	joinBlocksData = joinBlocksGet();
}

function joinBlocksGet() {
  	var o = new Object();
  	o.count = document.forms['parameterForm'].joinBlocksCount.value;
  	return o;
}

function joinBlocksSet(o) {
  	document.forms['parameterForm'].joinBlocksCount.value = o.count;
}
   
function joinBlocksRun() {
  	makeEditorRequest('joinBlocks', joinBlocksGet());
}
   
function joinBlocksHelp() {
	window.frames['docFrame'].document.location = "html/joinBlocks.html";
}
   
function joinBlocksExample1() {
	document.forms['parameterForm'].joinBlocksCount.value = '2';
	window.frames['docFrame'].document.location = "html/joinBlocksExample1.html";
	document.forms['inputForm'].inputText.value = 
		'Name        Type      Len\n' +
		'gth\n' +
		'----        ----      ---\n' +
		'---\n' +
		'id          int          \n' +
		'  8\n' +
		'surname     varchar     1\n' +
		'024	\n' +
		'address     varchar     1\n' +
		'024\n';
	document.forms['outputForm'].outputText.value = '';	
}   
   
