var al_w = 400;
var al_h = 460;

function write_about () {
	var state = null;
	var use_opener = false;
	if (window._help_state) {
		state = window._help_state;
	} else if (top.opener) {
		if (top.opener._help_state){
			state = top.opener._help_state;
		}
	}
	if (state == null) {
	  alert("Help state not set");
	} else {
		var xml = '<help><stageNumber lesson_type_id=\'' + state.lt + '\' location=\'\' >' + state.sn + '</stageNumber><lang study=\'' + state.s_l + '\' user=\'' + state.u_l + '\' /></help>';
		var ft = new FlashTag('about_lessons.swf', al_w, al_h, '6,0,65,0');
		ft.setId('about_lessons');
		ft.addFlashVars("XMLDATA=" + xml);
		ft.write(document);
	}
}

function set_about_state (s_l, u_l, location, l_type_id, s_number, s_type_id, p_number) {
	window._help_state = {};
	window._help_state.s_l = s_l?s_l:0;
	window._help_state.u_l = u_l?u_l:0;
	window._help_state.location = location?location:"";
	window._help_state.lt = l_type_id?l_type_id:2;
	window._help_state.sn = s_number?s_number:1;
	window._help_state.s_type_id = s_type_id?s_type_id:1;
	window._help_state.p_number = p_number?p_number:1;
}

function open_help_popup (s_l, u_l, common_dir, l_type_id, s_number, s_type_id, p_number) {
	set_about_state (s_l, u_l, common_dir, l_type_id, s_number, s_type_id, p_number);
  var location = common_dir + "/help/writing/about_lessons/";
	set_about_state(s_l, u_l, location, l_type_id, s_number, s_type_id, p_number);
  w = window.open(location + 'about_lessons.html','about_lessons','scrollbars=no,resizable=no,width=' + al_w + ',height=' + al_h);
}

function write_about_lessons (s_l, u_l) {
	var ft_about = new FlashTag('about_course.swf', al_w, al_h, '6,0,65,0');
	ft_about.setId('about_course');
	ft_about.addFlashVars("XMLDATA=<help><lang study='" + s_l + "' user='" + u_l + "' />");
	ft_about.write(document);
}
