/***************************************************************************

	Author 			:Charles B. Cossé 
	
	Email			:ccosse@gmail.com
					
	Copyright		:(C) 2001-2007 Asymptopia Software.
	
	Package			:Asymptopia Math Crossword Builder
	
	Version			:2.6
	
	License			:Gnu Public License (GPL)
	
	
 ***************************************************************************/

var W_help=null;
var H_help=null;
var TITLE_COLOR="5555FF";
var DESC_COLOR="FF6600";
var BULLET_COLOR="006600";

if(navigator.appName=="Microsoft Internet Explorer"){
	var W_help=400;
	var H_help=280;
}
else{
	var W_help=500;
	var H_help=500;
}
function setup_help_table(){
	
	ContactTable=document.createElement("table");
	ContactTable.cellPadding=10;
	ContactTable.cellSpacing=1;
	ContactTable.style.color=DESC_COLOR;
	ContactTable.style.backgroundColor="FFFFFF";
	ContactTable.style.fontSize="12px";
	
	title_row=ContactTable.insertRow(-1);
	title_cell=title_row.insertCell(0);
	title_cell.style.width=W_help;
	title_cell.align="center";
	txt="ASYMPTOPIA CROSSWORD BUILDER INSTRUCTIONS";
	title_node=document.createTextNode(txt);
	underline=document.createElement("b");
	underline.appendChild(title_node);
	underline.style.color=TITLE_COLOR;
	title_cell.appendChild(underline);
	
	
	/**/
	steps_row=ContactTable.insertRow(-1);
	steps_cell=steps_row.insertCell(0);
	steps_cell.style.width=W_help;
	steps_cell.align="left";
	desc=document.createElement("b");
	desc.style.color=DESC_COLOR;
	desc.appendChild(document.createTextNode("These steps should be done in order:"));
	steps_cell.appendChild(desc);
	list=document.createElement("ul");
	steps=new Array();
	steps.push("Step 1: Enter Word:Hint pairs into left text area. Alternatively, you can use the buttons to generate math problems, 10 problems per push. The toggles provide expanded functionality.");
	steps.push("Step 2: Load the entries by pushing the \"Add\" button");
	steps.push("Step 3: Generate Key");
	steps.push("Step 4: Generate Puzzle");
	steps.push("Step 5: Generate Hints");
	steps.push("Step 6: Print via browser built-in print function");
	for(var idx=0;idx<steps.length;idx++){
		bullet=document.createElement("li");
		bullet.style.color=BULLET_COLOR;
		bullet_txt=document.createTextNode(steps[idx]);
		bullet.appendChild(bullet_txt);
		list.appendChild(bullet);
	}
	steps_cell.appendChild(list);
	
	/**/
	steps_row=ContactTable.insertRow(-1);
	steps_cell=steps_row.insertCell(0);
	steps_cell.style.width=W_help;
	steps_cell.align="left";
	desc=document.createElement("b");
	desc.style.color=DESC_COLOR;
	desc.appendChild(document.createTextNode("Fixing Timeout Problems:"));
	steps_cell.appendChild(desc);
	list=document.createElement("ul");
	steps=new Array();
	steps.push("Firefox default settings need to be changed as follows: In Firefox, type \"about:config\" in your url bar, then change (by double clicking) the line for \"dom.max_script_run_time\" to read 500. Now Firefox will run javascripts for 500 seconds so the algorithm can finish.");
	for(var idx=0;idx<steps.length;idx++){
		bullet=document.createElement("li");
		bullet.style.color=BULLET_COLOR;
		bullet_txt=document.createTextNode(steps[idx]);
		bullet.appendChild(bullet_txt);
		list.appendChild(bullet);
	}
	steps_cell.appendChild(list);
	
	/**/
	steps_row=ContactTable.insertRow(-1);
	steps_cell=steps_row.insertCell(0);
	steps_cell.style.width=W_help;
	steps_cell.align="left";
	desc=document.createElement("b");
	desc.style.color=DESC_COLOR;
	desc.appendChild(document.createTextNode("Important Notes:"));
	steps_cell.appendChild(desc);
	list=document.createElement("ul");
	steps=new Array();
	steps.push("Fontsize should be 12pt for proper layout");
	steps.push("For best results use Mozilla Firefox browser");
	steps.push("Supply extra words since not all will get fit");
	steps.push("The toggle on GenerateKey panel allows disconnected words");
	steps.push("Solution to script timeout problems described above");
	steps.push("A fast way to wipe everything and start over is to reload (Ctrl-R)");
	steps.push("Allowable characters are: English A-Z,a-z and dash \"-\"");
	for(var idx=0;idx<steps.length;idx++){
		bullet=document.createElement("li");
		bullet.style.color=BULLET_COLOR;
		bullet_txt=document.createTextNode(steps[idx]);
		bullet.appendChild(bullet_txt);
		list.appendChild(bullet);
	}
	steps_cell.appendChild(list);
	
	var winwidth = window.document.width || window.document.body.clientWidth;
	
	help_container=document.createElement("div");
	help_container.style.backgroundColor=BG_COLOR;
	help_container.style.position="absolute";
	help_container.style.width=W_help+5;
	help_container.style.height=H_help+5;
	help_container.style.left=(winwidth-W_help)/2.;
	help_container.style.top=TOP;
	
	help_bg_div=document.createElement("div");
	help_bg_div.style.backgroundColor="000000";
	help_bg_div.style.position="absolute";
	help_bg_div.style.width=W_help
	help_bg_div.style.height=H_help
	help_bg_div.style.top=5;
	help_bg_div.style.left=5;
	
	help_div=document.createElement("div");
	help_div.style.backgroundColor="FFFFFF";
	help_div.style.position="absolute";
	help_div.style.width=W_help;
	help_div.style.height=H_help;
	help_div.appendChild(ContactTable);
	help_div.style.top=0;
	help_div.style.left=0;
	
	help_container.appendChild(help_bg_div);
	help_container.appendChild(help_div);
	
	return(help_container);
}
