function can_I_continue(username,assignment_completed) {

	/* If student has correctly answered all the questions on the page he may
           continue to the next page (or stop if it is the last page).
	   Otherwise he is given a warning message and remains on the page */
	
	all_correct = true;
	if (no_of_questions > 0) {
		for (k=0;k<no_of_questions;k++) {
		
			all_correct = all_correct && q_correct[k];
		}
	}
	if (no_of_questions == 1) {
		warning_title = "Warning: Incorrect Answer";
		warning_message = "You must correctly answer the question on this"+
		 " page to continue.<br><br>"+
		 "Hint: Remember to push the submit button after selecting an answer.";
	} else {
		warning_title = "Warning: Incorrect or missing answers";
		warning_message = "You must correctly answer all questions on this"+
		 " page to continue.<br><br>"+
		 "Hint: Remember to push the submit button after selecting an answer.";
	} 

		
	if (all_correct) {
		return true;
	} else {
		create_small_popup(warning_title," ",warning_message);
			return false;
	}

	}
		

	function header(college) {

	/* writes header including LANGURE tree link, course name, module and assignment
        as well as NCSU brick link */
	
	 document.write("<img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/green_block.JPG' width='50' height='720' "+
	 " align='left' alt='Research Ethics' hspace='5'>"); 
	
	document.write("<fieldset>");
	document.write("<a href='http://www.ncsu.edu'>");
	document.write("<img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/blackLogo.GIF' align='right' width='70' "+
	 "height='11' alt='North Carolina State University' hspace='5'>");
	document.write("</a>");
        
	if(college == "NCAT") {
	document.write("<a href='http://www.ncat.edu'>");
	document.write("<img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/A&Tlogo.JPG' align='right' width='50' "+
	 "height='50' alt='NC A&T' hspace='5'>");
	document.write("</a>");
	}

	document.write("<a href='http://openseminar.org/ethics'>");
	document.write("<img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/research-ethics.jpg'"+
 	 " width='30' align='left' alt='Research Ethics' hspace='5'>");
	document.write("</a>");
	document.write("<span class='page_title'>"+ "<font color=green>Research Ethics | </span>");
	document.write("<span class='page_subtitle'>"+module_name + " | "+assignment_name+"</font></span><br>");
	document.write("</fieldset><br>");
	}
	
	function create_popup(title_text,a_string,body_text) {
	/* creates a popup window with title and text as specified in the parameters */
	/* popup  = window.open('','test',
 	left=200,top=200,width=520,height=310,toolbar=0,resizable=0,location=0,status=0,menubar=0,directories=0');
	*/
	popup = window.open();
	popup.focus();
	popup.document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>");
	popup.document.write("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>");
	popup.document.write("<head><title>"+title_text+"</title>");
	popup.document.write("<link rel='stylesheet' type='text/css' href='http://www.chass.ncsu.edu/langure/ethics/php816/common/assignment_style.css'></head>");
	popup.document.write("<body><img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/green_block.JPG' width='50' height='720' align='left' alt='spacer' hspace='5'>");
	popup.document.write("<fieldset>");
	popup.document.write("<img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/research-ethics.jpg' width='30' align='left' alt='Research Ethics' hspace='5'>");
	popup.document.write("<span class='page_single_title'>"+title_text+"</span>&nbsp;&nbsp;&nbsp;&nbsp;"+a_string+"</fieldset>");
	popup.document.write("<span class='answer_review'>");
	popup.document.write(body_text+"</span>");
	popup.document.write("<br><br><input type=button value='Return' onClick='javascript:window.close();'></body></html>");
	popup.document.close();	
	}

	function create_small_popup(title_text,a_string,body_text) {
	/* creates a popup window with title and text as specified in the parameters */
	popup  = window.open('','test',
 	'left=200,top=200,width=520,height=310,toolbar=0,resizable=0,location=0,status=0,menubar=0,directories=0');
	popup.focus();
	popup.document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>");
	popup.document.write("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>");
	popup.document.write("<head><title>"+title_text+"</title>");
	popup.document.write("<link rel='stylesheet' type='text/css' href='http://www.chass.ncsu.edu/langure/ethics/php816/common/assignment_style.css'></head>");
	popup.document.write("<body><img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/green_block.JPG' width='50' height='720' align='left' alt='spacer' hspace='5'>");
	popup.document.write("<fieldset>");
	popup.document.write("<img src='http://www.chass.ncsu.edu/langure/ethics/php816/common/research-ethics.jpg' width='30' align='left' alt='Research Ethics' hspace='5'>");
	popup.document.write("<span class='page_subtitle'>"+title_text+"</span><br>"+a_string+"</fieldset>");
	popup.document.write("<span class='answer_review'><br>");
	popup.document.write(body_text+"</span>");
	popup.document.write("<br></body></html>");
	popup.document.close();	
	}

	function answer(atext,acorrect,aresponse) {
	/*Definition of class answer*/
		this.atext = atext;
		this.acorrect = acorrect;
		this.aresponse = aresponse;
	}

	function question(qtext,qno_of_answers,qanswers) {
	/*Definition of class question*/

		this.qtext = qtext;
		this.qno_of_answers = qno_of_answers;
		this.qanswers = new Array(qno_of_answers);
		for(i=0;i<qno_of_answers;i++) {
			this.qanswers[i] = qanswers[i];
		}

	}

	function show_question(all_questions,question_no,first_q_no,popup_type) {
	/* Displays question and possible answers in radio button format */
	document.write("<fieldset><legend><span class='fieldset_legend'>Question "+
	 (question_no+first_q_no)+"</span></legend>");
	document.write("<form name='submit_answer' onsubmit='return answer_review(this);'><input name='form_qno' type='hidden' value='"+question_no+"'><input name='form_ptype' type='hidden' value='"+popup_type+"'>"+
        all_questions[question_no].qtext+"<br>");
	for (m=0;m<all_questions[question_no].qno_of_answers;m++) {
		document.write("<br><input name='qq' type ='radio' value="+m+">"+
	 	 all_questions[question_no].qanswers[m].atext);
	} 
	document.write("<br><br><input type='submit' value='submit'></form></fieldset>"); 
	}

	function show_true_false_question(all_questions,question_no,first_q_no,popup_type) {
	/* Displays question and possible answers in radio button format */
	document.write("<fieldset><legend><span class='fieldset_legend'>Question "+
	 (question_no+first_q_no)+"</span></legend>");
	document.write("<form name='submit_answer' onsubmit='return answer_review(this);'><input name='form_qno' type='hidden' value='"+question_no+"'><input name='form_ptype' type='hidden' value='"+popup_type+"'>"+
        all_questions[question_no].qtext);
	for (m=0;m<all_questions[question_no].qno_of_answers;m++) {
		document.write("&nbsp;&nbsp;&nbsp;<input name='qq' type ='radio' value="+m+">"+
	 	 all_questions[question_no].qanswers[m].atext);
	} 
	document.write("&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' value='submit'></form></fieldset>"); 
	}

	function show_multiple_choice_question(all_questions,question_no,first_q_no,popup_type) {
	/* Displays question and possible answers in radio button format */
	document.write("<fieldset><legend><span class='fieldset_legend'>Question "+
	 (question_no+first_q_no)+"</span></legend>");
	document.write("<form name='submit_answer' onsubmit='return answer_review(this);'><input name='form_qno' type='hidden' value='"+question_no+"'><input name='form_ptype' type='hidden' value='"+popup_type+"'>"+
        all_questions[question_no].qtext+"<br><br>");
	for (m=0;m<all_questions[question_no].qno_of_answers;m++) {
		if (m==3 || m==6) document.write("<br>");
		document.write("<input name='qq' type ='radio' value="+m+">"+
	 	 all_questions[question_no].qanswers[m].atext+"&nbsp;&nbsp;&nbsp;");
	} 
	document.write("<br><br><input type='submit' value='submit'></form></fieldset>"); 
	}

	function answer_review(answer_form) {
	/* Displays popup window which informs student if he has answered the question corectly */
	answer_selected = -1;
	answer_string = "<span class='single_title'><span class='highlight_red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your answer was incorrect.</span></span>"
	for (j=0;j<answer_form.qq.length;j++) {
		if(answer_form.qq[j].checked) {
			answer_selected = j;
			if(questions[answer_form.form_qno.value].qanswers[j].acorrect == "true") {
				 q_correct[answer_form.form_qno.value] = true;
				 answer_string = "<span class='single_title'><span class='highlight_green'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your answer was correct!</span></span>"
			}
			else q_correct[answer_form.form_qno.value] = false;		
		}
	}

	if (answer_selected > -1 && answer_form.form_ptype.value == "large") {
		create_popup("Answer Review",answer_string,
				questions[answer_form.form_qno.value].qanswers[answer_selected].aresponse);
	} else if (answer_selected > -1 && answer_form.form_ptype.value == "small") {
		create_small_popup("Answer Review",answer_string,
				questions[answer_form.form_qno.value].qanswers[answer_selected].aresponse);
	} else {
		create_small_popup("Warning: Question has not been answered"," ",
				"Sorry, you must select one of the answers.");
	}

	return false;			

	} 

	function show_progress_bar(p_number,p_in_assignment,a_number,a_in_module) {

	}

	