var columnShuffleData = null;

function columnShuffleSetup() {
  	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('Output:')));
  	tb.rows[0].appendChild(buildCell(1, buildText('columnShuffleOutput')));
  	tb.rows[1].appendChild(buildCell(1, buildRunButton(columnShuffleRun)));
  	tb.rows[1].appendChild(buildCell(-1, buildButton('Help', columnShuffleHelp),
  	                                     buildButton('Example 1', columnShuffleExample1),
  	                                     buildButton('Example 2', columnShuffleExample2)));
	if (columnShuffleData) {  		                                     
		columnShuffleSet(columnShuffleData);
	}
	
	return columnShuffleTearDown;
}
   
function columnShuffleTearDown() {
	columnShuffleData = columnShuffleGet();
}

function columnShuffleGet() {
  	var o = new Object();
  	o.output = document.forms['parameterForm'].columnShuffleOutput.value;
  	return o;
}

function columnShuffleSet(o) {
  	document.forms['parameterForm'].columnShuffleOutput.value = o.output;
}
   
function columnShuffleRun() {
  	makeEditorRequest('columnShuffle', columnShuffleGet());
}
   
function columnShuffleHelp() {
	window.frames['docFrame'].document.location = "html/columnShuffle.html";
}
   
function columnShuffleExample1() {
	document.forms['parameterForm'].columnShuffleOutput.value = '13-26, - ,1-12';
	window.frames['docFrame'].document.location = "html/columnShuffleExample1.html";
	document.forms['inputForm'].inputText.value = 
			'Sirius      Canis Major   A0   -1.42\n' +
	      'Canopus     Carina        F0   -0.72\n' +
	      'Rigil Kent  Centaurus     G0   -0.27\n' +
	      'Arcturus    Bootes        K0   -0.06\n' +
	      'Vega        Lyra          A0    0.04\n';
	document.forms['outputForm'].outputText.value = '';	
}   

function columnShuffleExample2() {
	document.forms['parameterForm'].columnShuffleOutput.value = '13-,: ,1-12';
	window.frames['docFrame'].document.location = "html/columnShuffleExample2.html";
	document.forms['inputForm'].inputText.value = 'Sirius      Canis Major\n' +
	                                              'Canopus     Carina\n' +
	                                              'Rigil Kent  Centaurus\n' +
	                                              'Arcturus    Bootes\n' +
	                                              'Vega        Lyra\n';
	document.forms['outputForm'].outputText.value = '';	
}   

   
