	//----------------------------------------------------------------------------------
	// xmlhttprequest object
	//----------------------------------------------------------------------------------

	var xmlhttp=false;
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}

	//----------------------------------------------------------------------------------
	// vars
	//----------------------------------------------------------------------------------

	var ok_to_save = 'yes';
	var want_to_save = 'no';
	var assigning = false;
	var group_add_list;

	//----------------------------------------------------------------------------------
	// Supress Content
	//----------------------------------------------------------------------------------
    function SuppressContent(content_id,checkbox) {
	  var suppress = checkbox.checked ? 1 : 0;
	  var poststr = 'action=suppress&content_id='+content_id+'&suppress='+suppress;
      var params = {
				 method: 'get', 
				 parameters: poststr,
				 onComplete: function(response_obj) {

				 }
			 };
	  var doit = new Ajax.Request(jsconfig.site.root+"library/content_actions.php",params);
	}

	//----------------------------------------------------------------------------------
	// Set Info Bar Content
	//----------------------------------------------------------------------------------
		function SetInfoBar(html)
		{
			if (!$('window_info_bar')) return false;
			var info_bar = $('window_info_bar');
			info_bar.innerHTML = html;
		}

	function send_report_abuse_form()
	{
		var theform = $("report_abuse_form");
		var poststr = Form.serialize(theform);		
		Form.disable(theform);
		xmlhttp.open("POST", jsconfig.site.root+"library/mail_actions.php",true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if (xmlhttp.status == 200) {
					var response = JSON.parse(xmlhttp.responseText);
					if (response == false) { alert(xmlhttp.responseText); return false;};
					if (response.error != false)
					{
						alert(response.error);					
						Form.enable(theform);					
					}
					else
					{
						$('report_abuse_window_inner').innerHTML = response.html;
					}
				}
			}
		}
	}

	//----------------------------------------------------------------------------------
	// lesson
	//----------------------------------------------------------------------------------

	function SaveLesson()
	{
		var poststr = Form.serialize($("addedit_lesson"));
		Form.disable($("addedit_lesson"));
		xmlhttp.open("POST", jsconfig.site.root+"library/content_actions.php",true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if (xmlhttp.status == 200) {
					if (xmlhttp.responseText.substr(0,6) == '!error')
					{
						alert(xmlhttp.responseText.substr(6));					
						Form.enable($("addedit_lesson"));					
					}
					else
					{
						window.location.replace(jsconfig.site.root+'lessons/?lesson='+xmlhttp.responseText);
					}
				}
			}
		}
	}

	function DeleteLesson(lesson)
	{
		if (!confirm('Are you sure you wish to delete this lesson?')) return;
		sure = prompt('Please type the word YES to delete this lesson','');
		if (!sure) return false;
		if ((sure.toLowerCase()) != 'yes') return false;
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=deletelesson&lesson="+lesson,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				else
				{
					if (response.error != false) alert(response.error);
					else
					{
						alert("Lesson Successfully Deleted!");
						window.location.replace(jsconfig.site.root+'lessons/');
					}
				}
			}
		}
		xmlhttp.send(null)	
	}

	function SaveLessonRating(rating)
	{
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=saverating&lesson="+current_lesson.id+"&rating="+rating,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				else
				{
					// set average rating
					average_rating.votes = response.total_votes;
					average_rating.display_rating(response.average_rating);
					your_rating.display_changeable_rating(rating); // make stars clickable
					your_rating.has_set_rating = false;						 // allow to rate again
				}
			}
		}
		xmlhttp.send(null)
	}

	function ShowAddToGroupWindow(lesson)
	{
		lesson_to_add = lesson ? lesson : current_lesson;
		var id = 'add_to_group_window';
		if ($(id)) { Element.remove(id); }
		var add_group_window 		= new Window();
				add_group_window.id = id;
				add_group_window.title = 'Add to Course';
				add_group_window.loading = true;
				add_group_window.create();
				LoadAddToGroup(id,lesson_to_add);
	}

	function LoadAddToGroup(window_id,lesson)
	{
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=getmygroups&lesson="+lesson.id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				else if (response.error) {
					var display_in = $(window_id+'_inner');
					display_in.innerHTML = response.error;
				}
				else
				{
					group_add_list = new EJ_AddToGroup('group_add_list');
					group_add_list.window_id = window_id;
					group_add_list.lesson_id = lesson.id;
					group_add_list.instance_name = 'group_add_list';
					group_add_list.my_groups = response;
					group_add_list.lesson_name = lesson.name;				
					group_add_list.display_form();
					group_add_list.create_list();
				}
			}
		}
		xmlhttp.send(null)
	}

	function SaveAddToGroup(group)
	{
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=saveaddtogroup&group="+group+"&lesson="+group_add_list.lesson_id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false)
				{
					alert(xmlhttp.responseText);
					group_add_list.display_save_button();
				}
				else if (response.success == true)
				{
					group_add_list.successfully_added();										 
				}
				else
				{
					alert('error: '+response.error);
				}
			}
		}
		xmlhttp.send(null)
	}


	
//--------------------------------------


	function CreateALessonWizardWindow(course_id)
	{
		if ($('create_a_lesson_window')) { $('create_a_lesson_window').style.display = ''; return;}
		var course_id = course_id ? course_id : null;
		
		var calw 					= new Window();
				calw.id 			= 'create_a_lesson_window';
				calw.title 		= 'Create a Lesson Wizard'; 
				calw.bottom_color = '#c6def7';
				calw.create();
	
		var wizard = new create_a_lesson_wizard('wizard','create_a_lesson_window',course_id);
	}

	function AddQuestionWizardWindow()
	{
		if ($('add_question_window')) { $('add_question_window').style.display = ''; return;}
		
		if (current_lesson.tabset_id) eval('Tabset_'+current_lesson.tabset_id+'.select_tab_by_index(1)');
		
		var calw 					= new Window();
				calw.id 			= 'add_question_window';
				calw.title 		= 'Add a Question Wizard'; 
				calw.bottom_color = '#c6def7';
				calw.create();
	
		var wizard = new add_a_question_wizard('add_question_window');
	}

	function ShowClipboardWindow(el_id)
	{
		var id = 'clipboard_window';
		var skip = false;
		if ($(id)) { var win = $(id); if (win.style.display == 'none') win.parentNode.removeChild(win); else skip=true; }
		if (skip == false)
		{
			var clipboard_window 		= new Window();
					clipboard_window.id = id;
					clipboard_window.title = 'Clipboard';
					clipboard_window.loading = true;
					if (el_id)
					{
						var position 		= getAnchorPosition(el_id);							    				
						clipboard_window.x = position.x;
						clipboard_window.y = position.y;
					}
					clipboard_window.create();
		}		
				xmlhttp.open("GET",jsconfig.site.root+"library/content_actions.php?action=showclipboard",true);
				xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4) {
						$(id+'_inner').innerHTML = xmlhttp.responseText;
					}
				}
				xmlhttp.send(null)
	}


	function GenerateFactFromSource() { GenerateFromSource('question',get_selection('content_editor_source_textarea')); }
	function GenerateReadingFromSource() { GenerateFromSource('reading',get_selection('content_editor_source_textarea')); }
	
	function GenerateFromSource(type,text)
	{
		if (text.length == 0) return false;
		ShowContentEditorWindow(type,false,false,text);
	}

	function ShowContentEditorWindow(type,content_id,linked,text)
	{
		// displays window for content editor
		// use same window for reading and fact
		// use different window for source
		if (!content_id) var content_id = false;
		var window_id = 'content_editor_window_' + type;
		if (!$(window_id))
		{
			var w 							= new Window();
					w.id 						= window_id;
					w.title 				= 'Editor';
					w.bottom_color 	= '#c6def7';
					w.create();
		}
		if ($(window_id).style.display != '') { Effect.toggle(window_id); }
		// change window title based on content
		var title_text = (type == 'question') ? 'Fact' : type;
		$(window_id + '_title_text').innerHTML = ucfirst(title_text) + ' Editor';
		// load editor
		LoadContentEditor(window_id,type,content_id,linked,text);
	}

	function LoadContentEditor(window_id,type,content_id,linked,text)
	{
		if (content_id != false) poststr = "&action=editcontent&content=" + content_id;
		else poststr = "&action=newcontent&type=" + type;
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET",jsconfig.site.root+"library/content_actions.php?lesson=" + current_lesson.id + poststr,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var form_id = 'content_editor_' + type;
				$(window_id+'_inner').innerHTML = xmlhttp.responseText;
				$(window_id).className = linked > 1 ? 'popupwindow editor_linked' : 'popupwindow '+type+'_editor_not_linked';
				var editbar = new ToolBar(form_id+'_toolbar',form_id+'_textarea');
				/* for source editor only */
				if (type == 'source') {
				  editbar.addButton(jsconfig.site_image+'content_icon_question.gif','Generate Fact','','','',GenerateFactFromSource);
				  editbar.addButton(jsconfig.site_image+'content_icon_reading.gif','Generate Reading','','','',GenerateReadingFromSource);
					// editbar.addButton(jsconfig.site_image+'variable.gif','Mark Variable','[var]','[/var]','variable text');
				}
				/* for reading and question (fact) editors */
				if (type == 'reading' || type == 'question') {
				  editbar.addButton(jsconfig.site_image+'text_bold.gif','Bold text','[b]','[/b]','bold text');
				  editbar.addButton(jsconfig.site_image+'text_italic.gif','Italic text','[i]','[/i]','italic text');
				  editbar.addButton(jsconfig.site_image+'text_underline.gif','Underline text','[u]','[/u]','underlined text');
				  editbar.addButton(jsconfig.site_image+'text_letter_omega.gif','Special Characters','','','',SpecialCharactersWindow);
				  editbar.addButton(jsconfig.site_image+'image.gif','Image','[image=',']','x',InsertImageWindow);
				  editbar.addButton(jsconfig.site_image+'bell.gif','Audio','[audio=',']','x',InsertAudioWindow);
				}
				/* for question (fact) editor only */
				if (type == 'question') editbar.addButton(jsconfig.site_image+'variable.gif','Mark Variable','[var]','[/var]','variable text');
				editbar.mwSetupToolbar();
				ReplaceSelectBoxes();
				if (text) { $(form_id+'_textarea').value = text; }
				$(window_id).style.zIndex = highZ++;
			}
		}
		xmlhttp.send(null)
	}

	//----------------------------------------------------------------------------------
	// bbcode reference window
	//----------------------------------------------------------------------------------

	function SpecialCharactersWindow()
	{
		var id = 'special_characters_window';
		if ($(id))
		{
			var win = $(id);
			win.style.zIndex	= highZ++;
			win.style.display = '';
		}
		else
		{
			var special_characters_window 		= new Window();
					special_characters_window.id = id;
					special_characters_window.title = 'Special Characters';
					special_characters_window.loading = true;
					special_characters_window.create();
					xmlhttp.open("GET",jsconfig.site.root+"library/special_characters.php",true);
					xmlhttp.onreadystatechange=function() {
						if (xmlhttp.readyState==4) {
							$(id+'_inner').innerHTML = xmlhttp.responseText;
						}
					}
					xmlhttp.send(null)
		}
	}


	function ShowBBCodeReferenceWindow(mode,el_id)
	{
		if (!mode) var mode = 'normal';
		if (mode == 'normal')
		{
			// use help system
			var formatting_tips = new ShowHelpWindow({category:"Formatting",format:"faq"});
			return false;
		}
		var id = 'BBCodeReference_window'+mode;
		if ($(id))
		{
			var win = $(id);
			if (el_id)
			{
				var position = getAnchorPosition(el_id);							    				
				win.style.left = position.x;
				win.style.top  = position.y;
			}
			win.style.zIndex	= highZ++;
			win.style.display = '';
		}
		else
		{
			var BBCode_window 		= new Window();
					BBCode_window.id = id;
					BBCode_window.title = 'Formatting Tips';
					BBCode_window.loading = true;
					if (el_id)
					{
						var position = getAnchorPosition(el_id);							    				
						BBCode_window.x = position.x;
						BBCode_window.y = position.y;
					}
					BBCode_window.create();
					xmlhttp.open("GET",jsconfig.site.root+"library/bbcode_reference.php?mode="+mode,true);
					xmlhttp.onreadystatechange=function() {
						if (xmlhttp.readyState==4) {
							$(id+'_inner').innerHTML = xmlhttp.responseText;
						}
					}
					xmlhttp.send(null)
		}
	}

	function ShowReportAbuseWindow(params,el_id)
	{
		var id = 'report_abuse_window';
		var skip = false;
		if ($(id)) { var win = $(id); if (win.style.display == 'none') win.parentNode.removeChild(win); else skip=true; }
		if (skip == false)
		{
			var report_abuse_window 		= new Window();
					report_abuse_window.id = id;
					report_abuse_window.title = 'Inappropriate Content';
					report_abuse_window.loading = true;
					/* position better defaulting to center
					if (el_id)
					{
						var position 		= getAnchorPosition(el_id);							    				
						report_abuse_window.x = position.x;
						report_abuse_window.y = position.y;
					}
					*/
					report_abuse_window.create();
		}
				xmlhttp.open("GET",jsconfig.site.root+"library/report_abuse.inc.php?url="+window.location.href+'&'+params,true);
				xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4) {
						$(id+'_inner').innerHTML = xmlhttp.responseText;
						ReplaceSelectBoxes();
					}
				}
				xmlhttp.send(null)
	}

	function ShowWaysToStudyALessonWindow()
	{
		var id = 'ways_to_study_window';
		var skip = false;
		if ($(id)) { var win = $(id); if (win.style.display == 'none') win.parentNode.removeChild(win); else skip=true; }
		if (skip == false)
		{
			var ways_to_study_window 		= new Window();
					ways_to_study_window.id = id;
					ways_to_study_window.title = 'Ways to Study a Lesson';
					ways_to_study_window.loading = true;
					ways_to_study_window.create();
		}
				xmlhttp.open("GET",jsconfig.site.root+"library/ways_to_study_a_lesson.php",true);
				xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4) {
						$(id+'_inner').innerHTML = xmlhttp.responseText;
					}
				}
				xmlhttp.send(null)
	}



	//----------------------------------------------------------------------------------
	// certify lessons/groups
	//----------------------------------------------------------------------------------

	function CertifyUncertify(content_id,link_id,type)
	{
		thelink = $(link_id);
		thelink.old_onclick = thelink.onclick;
		thelink.onclick = null;
		type = type ? (type == 'group' ? 'group' : 'lesson') : 'lesson';
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=certifyuncertify&content="+content_id+"&type="+type,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				if (response.action == 'certify')
				{					
					thelink.title 		 = 'Uncertify ' + ucfirst(type);
					thelink.innerHTML = 'Uncertify';					
				}
				else
				{
					thelink.title 		 = 'Certify ' + ucfirst(type);
					thelink.innerHTML = 'Certify';
				}				
				thelink.onclick = thelink.old_onclick;
				thelink.old_onclick = null;
			}
		}
		xmlhttp.send(null)
	}

	//----------------------------------------------------------------------------------
	// Approve/Unapprove lessons/groups
	// combine similar AJAX calls
	//----------------------------------------------------------------------------------

	function ApproveUnapprove(content_id,link_id,type)
	{
		thelink = $(link_id);
		thelink.old_onclick = thelink.onclick;
		thelink.onclick = null;
		type = type ? (type == 'group' ? 'group' : 'lesson') : 'lesson';
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=approveunapprove&content="+content_id+"&type="+type,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				if (type == 'group') type = 'course';
				if (response.action == 'approve')
				{	
					thelink.title 		 = 'Disapprove ' + ucfirst(type);
					thelink.innerHTML = 'Disapprove';					
				}
				else
				{
					thelink.title 		 = 'Approve ' + ucfirst(type);
					thelink.innerHTML = 'Approve';
				}				
				thelink.onclick = thelink.old_onclick;
				thelink.old_onclick = null;
			}
		}
		xmlhttp.send(null)
	}	
	

	//----------------------------------------------------------------------------------
	// freeze/unfreeze accounts
	//----------------------------------------------------------------------------------

	function FreezeUnfreeze(user,link_id)
	{		
		thelink = $(link_id);
		if (thelink.innerHTML == 'Freeze Account' && 
				!commonjs.word_confirm('Please type the word "freeze" to confrim','freeze')) return false;
		thelink.old_onclick = thelink.onclick;
		thelink.onclick = null;
		xmlhttp.open("GET", jsconfig.site.root+"library/account_actions.php?action=freezeunfreeze&user="+user,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				if (response.action == 'freeze')
				{					
					thelink.title 		 = 'Unfreeze Account';
					thelink.innerHTML = 'Unfreeze Account';					
				}
				else
				{
					thelink.title 		 = 'Freeze Account';
					thelink.innerHTML = 'Freeze Account';
				}				
				thelink.onclick = thelink.old_onclick;
				thelink.old_onclick = null;
			}
		}
		xmlhttp.send(null)
	}
	

	//----------------------------------------------------------------------------------
	// assignments
	//----------------------------------------------------------------------------------

  function MoveToCompletedIfNeeded(link_id) {
		if (!$('assignments_completed')) return;
		if (!$('assignments_today')) return;
		if ($(link_id) && $(link_id).parentNode.id == 'assignments_today') {
			$('assignments_completed').appendChild($(link_id));
		}
	}

  function AddRemoveAssignment(info)
	{
		var linkId = 'assignment'+info.type+info.id;
		if (info.remove)	{
			if ($(linkId)) Element.remove(linkId);
		}
		else if ($('assignments_today')) {
			var name = info.name;
			var thelink = info.link;			
			var assignment = Builder.node('SPAN',{id:linkId},[
																												Builder.node('A',{href:thelink},[name]),
																												commonjs.br()
																												]);
			$('assignments_today').appendChild(assignment);
		}
	}

	function UpdateAssignmentList() {

	}

	function AssignUnassign1(resource_id,resource_type,link_id)
	{
		if (assigning == true) return;
		assigning = true;
		var params = {
			method: 'GET',
			parameters: 'action=assign&single_click=true&resource_id='+resource_id+'&resource_type='+resource_type,
			onComplete: function(responseObj) {
				var response = JSON.parse(responseObj.responseText);
				if ($(link_id) && response.text) $(link_id).innerHTML = response.text;
				AddRemoveAssignment(response.info);
				assigning = false;
			}
		}
		var assign = new Ajax.Request(jsconfig.ajax,params);
	}


  function AssignUnassign(lesson,link_id)
	{
		if (assigning == true) return;
		assigning = true;
		xmlhttp.open("GET", jsconfig.site.root+"library/lesson_actions.php?action=assignunassign&lesson="+lesson,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var response = JSON.parse(xmlhttp.responseText);
				if (response == false) alert(xmlhttp.responseText);
				$(link_id).innerHTML = response.text;
				AddRemoveAssignment(response.action,lesson,response.name);
				assigning = false;
			}
		}
		xmlhttp.send(null)
	}

	//----------------------------------------------------------------------------------
	// trophy room
	//----------------------------------------------------------------------------------

	function SaveTrophyHeader()
	{
		edit_trophy_header.onclick();
		var header = Form.serialize('trophy_header');
		var poststr = 'action=saveheader&'+header;
		xmlhttp.open("POST", jsconfig.site.root+"library/trophy_room_actions.php",true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if (xmlhttp.status == 200) {
					var response = JSON.parse(xmlhttp.responseText);
					if (response == false) alert(xmlhttp.responseText);
					else if (response.error) alert(response.error);
					else if (response.formatted_header) $('tr_header').innerHTML = response.formatted_header;
					else alert(xmlhttp.responseText);					
				}
			}
		}	
	}


	//----------------------------------------------------------------------------------
	// content editor
	//----------------------------------------------------------------------------------

	function ShowMedia(type)
	{	
		if (!type) return false;
		var window_id = 'media_window'+type;
		if ($(window_id)) { $(window_id).style.display = ''; highZ++; }
		else
		{
			var media_window 				 		= new Window();
					media_window.id 		 		= window_id;
					media_window.title 	 		= 'Insert '+type;
					media_window.loading 		= true;
					var position 				 		= getAnchorPosition('content_editor_placement');
					media_window.x			 		= position.x;
					media_window.y			 		= position.y;
					media_window.create();
					
					xmlhttp.open("GET", jsconfig.site.root+"library/content_actions.php?action=showmedia"+type,true);
					xmlhttp.onreadystatechange=function() 
					{  	
						if (xmlhttp.readyState==4) 
						{
							$(window_id+'_inner').innerHTML = xmlhttp.responseText;
						}
					}
					xmlhttp.send(null)
		}
	}

	function DeleteMedia(action)
	{	
		xmlhttp.open("GET", jsconfig.site.root+"library/content_actions.php?action=deletemedia&media_id="+media_id,true);
		xmlhttp.onreadystatechange=function() 
		{  	
			if (xmlhttp.readyState==4) 
			{
				// hmmm...
			}
		}
		xmlhttp.send(null)
	}

	function SaveContent(type,andclose)
	{
		// if source - then use different window and form
		var form_id   = 'content_editor_' + type;
		var window_id = 'content_editor_window_' + type;
		var no_response = function() {
			alert("There was no response from the server. Please check your Internet connection and try again."); 
			Form.enable($(form_id));
			return false;
		}
		var enable_timeout = setTimeout(no_response, 5000);		
		var poststr = Form.serialize($(form_id));		
		Form.disable($(form_id));
		xmlhttp = new XMLHttpRequest();		
		xmlhttp.open("POST", jsconfig.site.root+"library/content_actions.php",true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		poststr += '&action=savecontent_new';
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if (xmlhttp.status == 200) {
					clearTimeout(enable_timeout);
					var response = JSON.parse(xmlhttp.responseText);
					if (response == false) { return no_response();}; 
					if (response.error != false)
					{
						alert(response.error);					
						Form.enable($(form_id));					
					}
					else
					{
						list.add_content(response.content,{update:true});
						if (!andclose) Form.enable($(form_id));
						else Effect.toggle(window_id);
					}			
				}
			}
		}
	}
	
	function TextAreaGrowCheck(id,length,growth)
	{
		textarea = $(id);
		var temp = Math.ceil(textarea.value.length/length)*growth;
		if (temp < 2) temp = 2;
		textarea.style.height = temp+'em';
	}

	function ContentListActions(action,content_id)
	{
		if (!content_id)
		{
			var poststr = '';	
			// This is a hack to get around bug when only one checkbox and no array
			form = document.content_list;
			if (form.selected_content[0] == undefined)
			{
				if (form.selected_content.checked) poststr += '&selected_content[]='+form.selected_content.value;
			}
			else 
			{
				for (i=0;i<form.selected_content.length;i++)
				{
					if (form.selected_content[i].checked)
					{
						poststr += '&selected_content[]='+form.selected_content[i].value;		
					}
				}
			}		
		}
		else var poststr = "&content_id="+content_id;
		
		poststr += '&lesson_id=' + current_lesson.id;
		if (action == 'delete')
		{
			var sure = prompt('Please type the word DELETE to continue','');
			if (!sure || sure.toLowerCase() != 'delete') return false;			
		}
		if (action == 'deleteselected')
		{
			if (!confirm('Are you sure you want to DELETE all of the selected content?')) return;
			var sure = prompt('Please type the word DELETE to delete all of the selected content','');
			if (!sure || sure.toLowerCase() != 'delete') return false;			
		}	
		xmlhttp.open("GET", jsconfig.site.root+"library/content_actions.php?action="+action+poststr,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4)
			{		
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else 
				{
					if (action == 'copy' || action == 'remove')
					{
						ShowClipboardWindow();
					}
					else if (action == 'paste' || action == 'delete' || action == 'duplicate' || action == 'deleteselected')
					{
						var page_el = $('contentlist');
						page_el.innerHTML = xmlhttp.responseText;						
					}
				}
			}
		}
		xmlhttp.send(null);
	}


	function NewContentMenuSlide()
	{
		var menu = $('new_content_type_menu');
		var	cont = $('new_content_link');
		if (menu.style.display == '') { cont.className = 'nctc'; menu.style.display = 'none'; }
		else { cont.className = 'nctc_over'; menu.style.display = ''; }
	}

function ChangeSaveTrophyOrder(link_id)
{
	if ($(link_id).innerHTML == 'change order')
	{
		 Sortable.create("trophylist",{tag:'div',dropOnEmpty:false,containment:["trophylist"],constraint:false});
	}
	else 
	{
		SaveTrophyOrder(Sortable.serialize('trophylist'));
		Sortable.destroy("trophylist");
	}
}

function CreateDraggableContent(el,revert)
{
	if (revert) new Draggable(el.id,{revert:true,ghosting:true});
	else new Draggable(el.id);			
}
function CreateDroppableContent(el)
{
	Droppables.add("test1",{accept:['test'],hoverclass:'clipboard_hover',onDrop:function(){alert('drop!')}});
}

function SaveTrophyOrder(order)
{
	var poststr = 'action=trophyorder&' + order;
	xmlhttp.open("POST", jsconfig.site.root+"library/trophy_room_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			}
  	}
 	}	
}

function AutoFormEdit(name)
{
	$(name+"_save").innerHTML = '<img src="/images/site/autoform_edit.png">';
}

function SaveCheck()
{
	if (ok_to_save == 'yes') window.location.replace(jsconfig.site.root+'profile/');
	else want_to_save = 'yes';	
}

function ShowGroupMembers(group_id)
{
	Effect.toggle('group'+group_id,'appear');
	if ($('group'+group_id).style.display == 'none')
	{
	xmlhttp.open("GET", jsconfig.site.root+"library/groups_get_info.php?group_id="+group_id,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) 
		{
			$('group'+group_id).innerHTML = xmlhttp.responseText;
  	}
	}
 	xmlhttp.send(null)
	}
}

function update_counter() 
{
	var form = document.mail;
	var limit = 1500;
	form.counter.value = limit - form.message.value.length;
	if(form.counter.value < 0) 
	{
		form.counter.value = 0;
		alert('Maximux '+limit+' characters for invitation messages, sorry!');
	}
}

function ShowHide(element_id,link_id,toggle_state)
{
	// if toggle_state is set - remember for that type
	// Toggle display of element
	if ($(link_id).innerHTML == 'please wait...') return;
	if ($(element_id).style.display == 'none')
	{
		$(element_id).style.display = '';
		if(toggle_state)RememberToggleState(toggle_state,1,link_id);
		else if (link_id)
		{
			var temp = $(link_id).innerHTML;
			$(link_id).innerHTML = $(link_id).title;
			$(link_id).title = temp;
		}
	}
	else
	{
		$(element_id).style.display = 'none';
		if(toggle_state)RememberToggleState(toggle_state,0,link_id);		
		else if (link_id)
		{
			var temp = $(link_id).innerHTML;
			$(link_id).innerHTML = $(link_id).title;
			$(link_id).title = temp;
		}
	}
}

function RememberToggleState(type,value,link_id)
{
	var temp = $(link_id).innerHTML;
	$(link_id).innerHTML = 'please wait...';
	xmlhttp.open("GET", jsconfig.site.root+"library/groups_actions.php?action=togglestate&type="+type+'&value='+value,true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{		
			$(link_id).innerHTML = $(link_id).title;
			$(link_id).title = temp;
		}
	}
xmlhttp.send(null);
}

function RemoveMemberFromGroup(link_id,page_element_id,group_id,user_id)
{
	if (!confirm("Are you sure you want to remove " + user_id + " from this group?")) return;
	$(link_id).innerHTML = 'please wait...';
	xmlhttp.open("GET", jsconfig.site.root+"library/groups_actions.php?action=removemember&group_id="+group_id+'&user='+user_id,true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{	
			if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			else $('groupmemlist'+group_id).removeChild($(page_element_id));
		}
	}
xmlhttp.send(null);
}

var dg = 0;
// fork until switch
function DeleteCourse(group_id,url)
{
	if (dg == 1) return;
	if (!confirm("Are you sure you want to delete the course?")) return;
	sure = prompt('Please type the word YES to delete this course','');
	if (!sure) return false;
	if ((sure.toLowerCase()) != 'yes') return false;	
	dg = 1;
	xmlhttp.open("GET", jsconfig.site.root + "courses/group_actions.php?action=delete&group_id="+group_id+'&group_url='+url,true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{	
			dg = 0;
			if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			else
			{
				alert('Course Was Deleted');
						window.location.replace(jsconfig.site.root+'courses/');
			}
		}
	}
xmlhttp.send(null);
}

function DeleteGroup(group_id,url)
{
	if (dg == 1) return;
	if (!confirm("Are you sure you want to delete the group?")) return;
	sure = prompt('Please type the word YES to delete this group','');
	if (!sure) return false;
	if ((sure.toLowerCase()) != 'yes') return false;	
	dg = 1;
	xmlhttp.open("GET", "/groups/group_actions.php?action=delete&group_id="+group_id+'&group_url='+url,true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{	
			dg = 0;
			if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			else
			{
				alert('Group Was Deleted');
						window.location.replace(jsconfig.site.root+'groups/');
			}
		}
	}
xmlhttp.send(null);
}





var mnm = 0;
function MakeNewModerator(group_id,user_id,url)
{
	if (mnm == 1) return;
	if (!confirm("Are you sure you want to make " + user_id + " the new moderator?")) return;
	if (!confirm("All privileges will be given to " + user_id + ".\nYou will remain a member of this course.")) return;
	mnm = 1;
	xmlhttp.open("GET", jsconfig.site.root+"library/groups_actions.php?action=makemoderator&group_id="+group_id+'&user='+user_id,true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{	
			mnm = 0;
			if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			else window.location.replace(jsconfig.site.root+"groups/"+url+"/");
		}
	}
xmlhttp.send(null);
}

function ShowEditGroup(group_id)
{
	Effect.toggle('group'+group_id,'appear');
	if ($('group'+group_id).style.display == 'none')
	{
	xmlhttp.open("GET", "/groups/edit_a_group.php?group_id="+group_id,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4)
		{
			$('group'+group_id).innerHTML = xmlhttp.responseText;
  	}
	}
 	xmlhttp.send(null);
	}
}

function FriendActions(action,user,link_id,block_link_id,list_id,div_id)
{
	if ($(link_id).innerHTML == 'please wait...') return;
	$(link_id).innerHTML = 'please wait...';
	xmlhttp.open("GET", jsconfig.site.root+"library/user_actions.php?action="+action+"&user="+user,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) 
		{
			if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			else
			{
				if (div_id) $(div_id).innerHTML = '<span style="color: #CCC;">This is your friend!</span>';
				else if (xmlhttp.responseText == 'addfriend')
				{
					$(link_id).innerHTML = 'Remove as Friend';
					if ($(block_link_id)) $(block_link_id).innerHTML = 'Block';
				}
				else if (xmlhttp.responseText == 'removefriend') 
				{
					if (list_id) $('friendslist').removeChild($(list_id));
					else $(link_id).innerHTML = 'Add as Friend';
				}
			}
  	}
	}
 	xmlhttp.send(null);	
}

// need to start cleaning up this ajax stuff - combine functions
function BlockUnblock(user,link_id,friend_link_id)
{
	$(link_id).innerHTML = 'please wait...';
	xmlhttp.open("GET", jsconfig.site.root+"library/user_actions.php?action=blockunblock&user="+user,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) 
		{
			if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
			else
			{
				if (xmlhttp.responseText == 'unblock') 
				{
					$(link_id).innerHTML = 'Unblock';
					if(friend_link_id) $(friend_link_id).innerHTML = 'Add As Friend';					
				}
				else if (xmlhttp.responseText == 'block') $(link_id).innerHTML = 'Block';

			}
  	}
	}
 	xmlhttp.send(null);	
}

function ShowMoreGroupMembers(group_id,page)
{
	xmlhttp.open("GET", jsconfig.site.root+"library/groups_get_info.php?group_id="+group_id+'&page='+page,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) 
		{
			$('group'+group_id).innerHTML = xmlhttp.responseText;
  	}
	}
 	xmlhttp.send(null);
}


function WatchForum(forum_id,watch_forum)
{
	watch_forum = watch_forum ? 1 : 0;
	xmlhttp.open("GET", jsconfig.site.root+"library/forum_actions.php?action=watchforum&forum_id="+forum_id+'&watch='+watch_forum,true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var response = JSON.parse(xmlhttp.responseText);
			$('watch_forum').checked  = response.checked;			
			$('watch_forum').disabled = false;
		}
	}
 	xmlhttp.send(null);
}

function ForumAddTopic(forum_id)
{
	var new_topic  = urlencode($("newtopic").value);
	var first_post = $('first_topic_post') ? urlencode($("first_topic_post").value) : ''; 
	var poststr = 'action=addtopic&forum_id=' + forum_id + '&new_topic=' + new_topic + '&first_post=' + first_post;
	xmlhttp.open("POST", jsconfig.site.root+"library/forum_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else $('forum'+forum_id).innerHTML = xmlhttp.responseText;
				ReplaceSelectBoxes(); // we shouldn't have to load this all over again
			}
  	}
 	}	
}

function ShowMoreForumTopics(forum_id,page)
{
	xmlhttp.open("GET", jsconfig.site.root+"library/forum_actions.php?action=topicpagination&forum_id="+forum_id+'&page='+page,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) 
		{
			$('forum'+forum_id).innerHTML = xmlhttp.responseText;
  	}
	}
 	xmlhttp.send(null);
}

function JoinLeaveGroup(group_id,action)
{
	xmlhttp.open("GET", jsconfig.site.root+"library/groups_actions.php?group_id="+group_id+'&action='+action,true);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) 
		{
			if (xmlhttp.responseText == 0) window.location.href= jsconfig.site.root+"groups/";
			else window.location.href = jsconfig.site.root+"groups/"+xmlhttp.responseText+'/';
  	}
	}
 	xmlhttp.send(null);
}

function MailActions(action,delete_redirect)
{
	// upgrade this function to use scriptaculous Form.serialize instead of stepping through form
	if (action != 'deletemessage')
	{
		var form = document.mail;
		var folder = form.folder.value;
		var poststr = 'action=' + urlencode(action);
		poststr += '&folder=' + urlencode(form.folder.value);
	}
	else {
		var poststr = 'action=delete&messages=' + urlencode($('message').value);
		var folder = urlencode($('folder').value);		
		poststr += '&folder=' + folder;
	}
	if (action == 'delete')
	{
		poststr += '&messages=';
		// This is a hack to get around bug when only one checkbox and no array
		if (form.selected_messages[0] == undefined)
		{
			if (form.selected_messages.checked) poststr += form.selected_messages.value;
		}
		else 
		{
			for (i=0;i<form.selected_messages.length;i++)
			{
				if (form.selected_messages[i].checked)
				{
					poststr += form.selected_messages[i].value;
					if (i < (form.selected_messages.length - 1)) poststr += '#';			
				}
			}
		}
	}
	else if (action == 'send')
	{
		poststr += '&to=' 		 + urlencode(form.to.value);
		poststr += '&subject=' + urlencode(form.subject.value);		
		poststr += '&message=' + urlencode(form.message.value);
		if (folder == 'invite')
		{
			poststr += '&group_name=' + urlencode(form.group_name.value);
			poststr += '&group_url=' + 	urlencode(form.group_url.value);
			poststr += '&group_id=' + 	urlencode(form.group_id.value);			
		}
	}
	var redirect = "/mail/?folder="+folder;
	/*
	// this will redirect user to next message in inbox
	// I found it too confusing
	if (delete_redirect)
	{
		if (delete_redirect != '') redirect += '&view=' + delete_redirect;
	}
	*/
	xmlhttp.open("POST", jsconfig.site.root+"library/mail_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {		
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else { window.location.replace(redirect); }
			}
  	}
 	}	
}


function ForumModeratorActions(forum_id)
{	
	var form = document.forum;
	var action = $('moderator_options').value;
	if (action == '') return;
	if (action == 'deletetopics' && !confirm("Delete Selected Topics?")) return;
	var poststr = 'action=' + action;
	poststr += '&forum_id=' + forum_id;
	poststr += '&topics=';
	// This is a hack to get around bug when only one checkbox and no array
	if (form.selected_topics[0] == undefined)
	{
		if (form.selected_topics.checked) poststr += form.selected_topics.value;
	}
	else 
	{
		for (i=0;i<form.selected_topics.length;i++)
		{
			if (form.selected_topics[i].checked)
			{
				poststr += form.selected_topics[i].value;
				if (i < (form.selected_topics.length - 1)) poststr += '#';			
			}
		}
	}
	xmlhttp.open("POST", jsconfig.site.root+"library/forum_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else { $('forum'+forum_id).innerHTML = xmlhttp.responseText; }
				ReplaceSelectBoxes();
			}
  	}
 	}	
}

function UnSend(message)
{
	var poststr = 'action=unsend&message=' + message;
	xmlhttp.open("POST", jsconfig.site.root+"library/mail_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else { window.location.replace(jsconfig.site.root+"mail/?folder=sent"); }
			}
  	}
 	}	
}

function ForumPost(comment,topic_id,parent)
{
	if (!parent)
	{
		comment = $('newthread').value;
		parent = '';
	}
	else
	{
		comment = 'comment'+comment;
		comment = $(comment).value;
	}
	var poststr = 'action=post&comment=' + comment + '&parent=' + parent +'&topic_id=' + topic_id;
	xmlhttp.open("POST", jsconfig.site.root+"library/forum_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else {  window.location.reload(true); }
			}
  	}
 	}	
}

function ForumDeletePost(post_id)
{
	if (!confirm("Delete Post?")) return;
	var poststr = 'action=deletepost&post_id=' + post_id;
	xmlhttp.open("POST", jsconfig.site.root+"library/forum_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else { window.location.reload(true); }
			}
  	}
 	}	
}

// fork group code until we make switch
function AddEditCourse(addedit)
{
	if (addedit=='add'){if (!confirm('The course url cannot be changed.\nPlease verify that this is the URL you want\nhttp://www.studytag.com/courses/'+document.addedit_group.group_url.value+'/')) return; }
	var form = document.addedit_group;
	var poststr = 'name=' + urlencode(form.name.value);
	poststr += '&action=' + urlencode(form.action.value);
	poststr += '&tags=' + urlencode(form.tags.value);
	poststr += '&description=' + urlencode(form.description.value);
	poststr += '&group_url=' + urlencode(form.group_url.value);
	if(addedit == 'edit') poststr += '&group_id=' + urlencode(form.group_id.value);
	for (i=0;i<form.group_type.length;i++)
	{
    if (form.group_type[i].checked) poststr += '&group_type=' + form.group_type[i].value;
	}
	for (i=0;i<form.post_topics.length;i++)
	{
    if (form.post_topics[i].checked) poststr += '&post_topics=' + form.post_topics[i].value;
	}
	xmlhttp.open("POST", jsconfig.site.root + "courses/group_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else { window.location.href = jsconfig.site.root + 'courses/' + xmlhttp.responseText; }
			}
  	}
 	}	
}




function AddEditGroup(addedit)
{
	if (addedit=='add'){if (!confirm('The group url cannot be changed.\nPlease verify that this is the URL you want\nhttp://www.studytag.com/groups/'+document.addedit_group.group_url.value+'/')) return; }
	var form = document.addedit_group;
	var poststr = 'name=' + urlencode(form.name.value);
	poststr += '&action=' + urlencode(form.action.value);
	poststr += '&tags=' + urlencode(form.tags.value);
	poststr += '&description=' + urlencode(form.description.value);
	poststr += '&group_url=' + urlencode(form.group_url.value);
	if(addedit == 'edit') poststr += '&group_id=' + urlencode(form.group_id.value);
	for (i=0;i<form.group_type.length;i++)
	{
    if (form.group_type[i].checked) poststr += '&group_type=' + form.group_type[i].value;
	}
	for (i=0;i<form.post_topics.length;i++)
	{
    if (form.post_topics[i].checked) poststr += '&post_topics=' + form.post_topics[i].value;
	}
	xmlhttp.open("POST", "/groups/group_actions.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) {
				if (xmlhttp.responseText.substr(0,6) == '!error') alert(xmlhttp.responseText.substr(6));
				else { window.location.href = '/groups/' + xmlhttp.responseText + '/'; }
			}
  	}
 	}	
}


function SaveProfileData(field,data)
{
	ok_to_save = 'no';
  $(field+'_save').innerHTML = '<img src="/images/site/autoform_save.png">';
	var poststr = 'field=' + field + '&data=' + urlencode(data);
	xmlhttp.open("POST", jsconfig.site.root+"library/update_profile.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 	xmlhttp.send(poststr);
 	xmlhttp.onreadystatechange=function() {
  	if (xmlhttp.readyState==4) {
			if (xmlhttp.status == 200) 	{
					$(field+'_save').innerHTML = '<img src="/images/site/autoform_saved.png">';
					ok_to_save = 'yes';
					if(want_to_save == 'yes')SaveCheck();
			}
  	}
 	}
}
