var playerScript=null;
var tmpArguments=null;
var syllID=null;
var nextID=null;
var nextType=null;
lms = true;//var coordinates = new ToolMan.coordinates();
function build(){
	//loadCSS("webform.css","style");
	//alert(BrowserDetect.OS + " " + BrowserDetect.browser + " " + BrowserDetect.version);
	
	
				if(userID!=null){
					buildContainers();
				}else{
					login();
				}
				//document.getElementById("content").className="error";

	
	return null;
}
/*function loadNavBar(){
	var mainGoals=document.createElement("div");
	var deptGoals=document.createElement("div");
	var userGoals=document.createElement("div");
	
	mainGoals.id = "main_Goals";
	deptGoals.id = "dept_Goals";
	userGoals.id = "user_Goals";
	
	mainGoals.onclick = fireButton;
	deptGoals.onclick = fireButton;
	userGoals.onclick = fireButton;
	
	mainGoals.className = "navButton_dn";
	deptGoals.className = "navButton_up";
	userGoals.className = "navButton_up";	
	
	document.getElementById("nav_container").appendChild(mainGoals);
	document.getElementById("nav_container").appendChild(deptGoals);
	document.getElementById("nav_container").appendChild(userGoals);
	mainGoals.appendChild(document.createTextNode("All Goals"));
	deptGoals.appendChild(document.createTextNode("Department Goals"));
	userGoals.appendChild(document.createTextNode("My Goals"));
	
	mainGoals = null;
	deptGoals = null;
	userGoals = null;
	return null;
}*/

function buildContainers(){
	var titleContainer=document.createElement("div");
	//var contentHolder = document.createElement("div");
	var navContainer=document.createElement("div");
	var navButtonContainer = document.createElement("div");
	var hideNavButton = document.createElement("div");
	var navTitle = document.createElement("div");
	var copywrite=document.createElement("a");
	gBody().appendChild(titleContainer);
	gBody().appendChild(navContainer);
	navContainer.appendChild(navTitle);
	navContainer.appendChild(hideNavButton);
	navContainer.appendChild(navButtonContainer);
	navContainer.appendChild(copywrite);
	
	copywrite.innerHTML="Q-View LMS v12.0.0<div style='font-size:8px;'>&copy;2006 Q-MultiMedia Inc., Erie, PA</div>";
	copywrite.href="http://www.q-multimedia.com"
	copywrite.target="_blank";
	titleContainer.id = "appTitleContainer";
	//contentHolder.id = "appContentHolder";
	navContainer.id = "appNavContainer";
	navButtonContainer.id = "appNavButtonContainer";
	
	hideNavButton.id = "appHideNav";
	navTitle.id = "navTitle";
	copywrite.id="appCopyWrite";
	navContainer.style.height=clientHeight-38;
	/*navTitle.appendChild(document.createTextNode("Actions"));
	navButtonContainer.appendChild(document.createTextNode("Actions"));
	hideNavButton.appendChild(document.createTextNode("Actions"));*/	
	buildSyllabus();	
	//gBody().appendChild(contentHolder);	
	navTitle = null;
	hideNavButton = null;
	navContainer = null;
	conentHolder = null;
	titleContainer=null;
	navContainer=null;
	return null;
}
function createObject(objectID, objectTitle, objectType, width, height, left, top, closeAction){
	//alert(width + ", " + height);
	/*var box = document.createElement("div");
	var handle = document.createElement("div");
	var content = document.createElement("div");
	var btnContainer = document.createElement("div");
	var btnClose = document.createElement("img");
	var btnMax = document.createElement("img");
	var btnMin = document.createElement("img");
	var boxTitle = document.createElement("div");	
	//vars for dragging 
	var group;
	var drag = ToolMan.drag();
	
	//end vars for dragging
	*/
	if(!document.getElementById("window_" + objectID)){
		var target= gBody();
		var objWindow = document.createElement("div");
		target.appendChild(objWindow);
		objWindow.id="window_" + objectID;
		objWindow.className="dragWindow";
		
		var objHideFrame = document.createElement("iframe");
		objWindow.appendChild(objHideFrame);
		objHideFrame.className="hideFrame";
		objHideFrame.src="blank.htm";
		objHideFrame.setAttribute("frameBorder","no");
		//objHideFrame.style.display="none";
		objWindow.style.width=width;
		objWindow.style.height=height;
		objWindow.style.top=top;
		objWindow.style.left=left;
		//self.status=width + " " + height + " " + left + " " + top + " " 
		objWindow.style.position="absolute";
		
		var objHandle = document.createElement("div");
		objWindow.appendChild(objHandle);
		objHandle.id="Handle_" + objectID;
		//alert(objHandle.id);
		//alert(objHandle.id);
		objHandle.className="dragHandle";
		objHandle.onmousedown=startDrag;
		objHandle.onmouseup = clearDragging;
		//showMeHandle.ondblclick = maxWin;
		
		var btnClose = document.createElement("a");
		var btnMax = document.createElement("a");
		var btnMin = document.createElement("a");
		var btnAnchor = document.createElement("a");
		var handleTitle= document.createElement("div");
		handleTitle.id="HandleTitle_" + objectID;
		//alert(handleTitle.id);
		handleTitle.className = "dragHandleTitle";
		handleTitle.innerHTML="Loading...";
	
		objHandle.appendChild(btnAnchor);
		objHandle.appendChild(handleTitle);
		objHandle.appendChild(btnClose);
		objHandle.appendChild(btnMax);
		objHandle.appendChild(btnMin);	
		handleTitle=null;
		btnAnchor.href="#"
		btnAnchor.alt="Anchor";
		btnAnchor.onmousedown=anchorWin;
		
		btnClose.href="#";
		btnClose.alt="Close";
		btnClose.onmousedown=closeAction;
		
		btnMax.href="#";
		btnMax.alt="Maximize";
		btnMax.onmousedown=maxWin;
		
		btnMin.href="#";
		btnMin.alt="Minimize";
		btnMin.onmousedown=minWin;	
		
		btnClose.id = "objClose";
		btnMax.id = "showMeMax";
		btnMin.id = "showMeMin";
		btnAnchor.id = "showMeAnchor";
		
		btnAnchor.className="Anchor";
		btnClose.className = "Close";
		btnMax.className = "Max";
		btnMin.className = "Min";
		
		btnAnchor = null;
		btnClose=null;
		btnMax = null;
		btnMin = null;
		
		/*showItem = document.createElement("object");
		objWindow.appendChild(showItem);
		showItem.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
		showItem.codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0";
		showItem.className="showMeFile";
		showItem.setAttribute("movie",tmpStr);
		showItem.id="showMe";
		maximizeWin(showMeWindow);*/
		showItem = null;
		objWindow = null;
		target=null;
		objHandle=null;
	
		/*gBody().appendChild(box);
		box.appendChild(handle);
		box.id = "window_" + objectID;
		boxTitle.id ="winTitle_" + objectID; 
		handle.id = "handle_" + objectID;
		content.id = "content_" + objectID;
	
		btnClose.id = "btnClose_" + objectID;
		btnMax.id = "btnMax_" + objectID;
		btnMin.id = "btnMin_" + objectID;
		btnContainer.className="btnContain";	
		btnClose.className = "btnBox";
		
		btnMax.className = "btnBox";
		btnMin.className = "btnBox";
		btnClose.src = 'Consoles/v10_00/WinClose.gif';
		btnMax.src = "Consoles/v10_00/WinMax.gif";
		btnMin.src = "Consoles/v10_00/WinMin.gif";
		box.className = "box";
		boxTitle.className = "title";
		handle.className = "handle";
		content.className = "content";
		handle.appendChild(boxTitle);
		handle.appendChild(btnContainer);
		boxTitle.appendChild(document.createTextNode(objectTitle));
		btnContainer.appendChild(btnMin);
		btnContainer.appendChild(btnMax);
		btnContainer.appendChild(btnClose);	
		//alert(box.style.left);
		//alert(box.style.left  + ", " + box.style.top);
		box.lastSize=coordinates.create(width,height);
		box.lastLoc = coordinates.create(left,top); 
		if(closeAction){
			btnClose.onclick =closeAction;
		}else{
			btnClose.onclick = closeWin;
		}
		btnMax.onclick = maximizeWin;
		btnMin.onclick = minimizeWin;	
		
		content.className="content";
		
//		group = drag.createSimpleGroup(boxRegionConstraint, handle)
		group = drag.createSimpleGroup(document.getElementById("window_" + objectID), document.getElementById("handle_" + objectID))
		group.addTransform(transForm);
		
		box.style.width = width + "px";
		box.style.height = height + "px";
		box.style.left = left + "px";
		box.style.top = top + "px";
		
		//btnMax.onclick();
		//btnMax.onclick();
		switch(objectType){
			case "lesson":
			break;
			case "notes":
			break;		
		}
		//origin = null;
		//boxRegionConstraint = null;
	var box= null;
	var titleContainer=null;
	//var contentHolder = document.createElement("div");
	var navContainer=null;
	var navButtonContainer = null;
	var hideNavButton = null;
	var navTitle = null;
	*/
	}else{		
	}
	
	return "window_" + objectID;
}
/*function closeWin(){
	//this.parentNode.parentNode.parentNode.cleanup();
	clearElements(this.parentNode.parentNode.parentNode);
	return null;
}
function minimizeWin(){
	var prntObj = this.parentNode.parentNode.parentNode;
	if(stripPX(prntObj.style.height)==17){
		
		prntObj.style.height = prntObj.lastSize.y + "px";
	}else{
		prntObj.style.width = prntObj.lastSize.x + "px";
		prntObj.style.height = "17px";
	}
	prntObj=null;
	return null;
}
function maximizeWin(){									
	var prntObj = this.parentNode.parentNode.parentNode;
	if(stripPX(prntObj.style.left)!=0){
		prntObj.lastLoc = coordinates.create(stripPX(prntObj.style.left),stripPX(prntObj.style.top));
	}
	if(clientWidth==stripPX(prntObj.style.width)){
		prntObj.style.width = prntObj.lastSize.x + "px";
		prntObj.style.height = prntObj.lastSize.y + "px";
		prntObj.style.left = prntObj.lastLoc.x + "px";
		prntObj.style.top = prntObj.lastLoc.y + "px";
		prntObj.lastSize=coordinates.create(stripPX(prntObj.style.width),stripPX(prntObj.style.height));
		this.src = "Consoles/v10_00/WinMax.gif";
	}else{
		prntObj.style.width = clientWidth + "px";
		prntObj.style.height = clientHeight + "px";
		prntObj.style.left = "0px";
		prntObj.style.top = "0px";
		this.src = "Consoles/v10_00/WinRes.gif";
	}
	prntObj=null;
	return null;									
}*/
function transForm(coordinate, dragEvent,width, height) {				
/*	var scrollOffset = ;
	var tClientHeight = 
	var tClientWidth =;
	var boxHeight = ;
	var boxWidth = ;
	//return coordinate.constrainTo(origin, lowerBound)
//	scrollOffset =null;
	tClientHeight =null; 
	tClientWidth =null;
	boxHeight = null;
	boxWidth = null;*/
	//return coordinate.constrainTo(coordinates.create(0, 0), coordinates.create((coordinates.scrollOffset().x + clientWidth + 60) - stripPX(width), (coordinates.scrollOffset().y + clientHeight + 60) - stripPX(height)))
}
function addMenu(){
	return null;
}

/*function fireLesson(){
	return null;
}*/
/*function fireTest(){
	return null;
}*/
function fireNotes(objectID){
	createObject(objectID,"Notes", "notes",document.body.clientWidth-192,document.body.clientHeight-38,190,37);
	var contentWindow = document.getElementById("window_" + objectID);
	var newChild = document.createElement("iframe");
	contentWindow.appendChild(newChild);
	//newChild.src = "basePages/notes.asp";
	newChild.id = "notes_" + objectID;
	newChild.className = "notes";
	newChild.setAttribute("scrolling", "no"); 
	newChild.setAttribute("frameBorder", "no");	
	var contentWindow=null;
	var newChild=null;
	return null;
}
function addButtonGroup(btnGroupId, btnGroupTitle, display){
	var mainContainer = document.getElementById("appNavButtonContainer");
	var newBtnGroup = document.createElement("div");
	var newBtnGroupTitle = document.createElement("a");
	var newBtnGroupSubContain = document.createElement("div");
	newBtnGroupTitle.href="#";
	newBtnGroupTitle.setAttribute("alt",btnGroupTitle);
	newBtnGroup.id = "btnGroup_" + btnGroupId;
	newBtnGroupTitle.id = "btnGroupTitle_" + btnGroupId;
	newBtnGroupSubContain.id = "btnGroupSubContain_" + btnGroupId;
	newBtnGroupTitle.innerHTML=btnGroupTitle;
	newBtnGroup.className="btnGroup";
	newBtnGroupTitle.onclick=expand;
	switch(display){
		case 1:
		break;
		case 0:
			newBtnGroupSubContain.style.display="none";
		break;
	}	
	newBtnGroup.appendChild(newBtnGroupTitle);
	newBtnGroup.appendChild(newBtnGroupSubContain);
	mainContainer.appendChild(newBtnGroup);
	mainContainer = null;
	newBtnGroup = null;
	newBtnGroupTitle = null;
	newBtnGroupSubContain = null;	
	return null;
}
function addChildButtonGroup(prnt,btnGroupId, btnGroupTitle, display,action){
	var mainContainer = document.getElementById("btnGroupSubContain_" + prnt);
	var newBtnGroup = document.createElement("div");
	var newBtnGroupTitle = document.createElement("a");
	var newBtnGroupSubContain = document.createElement("div");
	newBtnGroupTitle.href = "#";	
	newBtnGroupTitle.setAttribute("alt",btnGroupTitle);
	newBtnGroup.id = "btnGroup_" + btnGroupId;
	newBtnGroupTitle.id = "btnGroupTitle_" + btnGroupId;
	newBtnGroupSubContain.id = "btnGroupSubContain_" + btnGroupId;
	//alert(newBtnGroupSubContain.id)
	newBtnGroupTitle.innerHTML=btnGroupTitle;
	if(action){
		newBtnGroupTitle.onclick=action;
	}else{
		newBtnGroupTitle.onclick=expand;
	}
	switch(display){
		case 1:
		break;
		case 0:
			newBtnGroupSubContain.style.display="none";
		break;
	}	
	newBtnGroup.appendChild(newBtnGroupTitle);
	newBtnGroup.appendChild(newBtnGroupSubContain);
	mainContainer.appendChild(newBtnGroup);
	if(prnt == "courseAdmin"){
		//alert(newBtnGroup.id);
	}
	mainContainer = null;
	newBtnGroup = null;
	newBtnGroupTitle = null;
	newBtnGroupSubContain = null;	
	return null;
}
function addActionButton(prnt,btnGroupId, btnGroupTitle, action){
	var mainContainer = document.getElementById("btnGroupSubContain_" + prnt);
	var newBtnGroup = document.createElement("div");
	var newBtnGroupTitle = document.createElement("a");
	newBtnGroupTitle.href="#";
	newBtnGroup.id = "btnGroup_" + btnGroupId;
	newBtnGroupTitle.id = "btnGroupTitle_" + btnGroupId;
	newBtnGroupTitle.innerHTML=btnGroupTitle;
	newBtnGroup.appendChild(newBtnGroupTitle);
	//alert(action);
	//alert(btnGroupId);
		//alert(action + "('" + btnGroupId + "')");
	newBtnGroup.onclick = function(){eval(action + "('" + btnGroupId + "')");};

	mainContainer.appendChild(newBtnGroup);
	mainContainer = null;
	newBtnGroup = null;
	newBtnGroupTitle = null;
	newBtnGroupSubContain = null;	
	return null;
}
function buildSyllabus(){
	newScriptElement("dynamicPages/buildSyllabus.asp");
	return null;
}
function buildTutor(){
	loadXMLDoc("dynamicPages/buildTutor.asp");
	return null;
}
function buildAdministration(){
	//alert("her");
	newScriptElement("dynamicPages/buildAdmin.asp");
	return null;
}
function expand(e){
	var expander = document.getElementById("btnGroupSubContain_"+getElementID(this.id));
	if(expander.style.display && expander.style.display=="none"){
		expander.style.display="";
	}else{
		if(!e){
		expander.style.display="none";
		}
	}	
	expander = null;
	return null;
}
function getElementID(id){
	var id = new String(id);
	return id.substr(id.indexOf("_")+1,id.length -1);		
}
function getObjID(id){
	var id = new String(id);
	return id.substr(id.lastIndexOf("_")+1,id.length -1);
}
function newSyllabusItems(){
	/***********************************************************************************************************
	Purpose: Build syllabus portion of navbar.
	Usage: 22 parameters are passes.
	Createdby: Joshua Boyce
	CreatedOn: 3/1/2006
	LastEdited: 1/10/2006
		*********************************************CHANGES*********************************************
		
	***********************************************************************************************************/
	if(!document.getElementById("btnGroup_syllabi")){		
		addButtonGroup("syllabi","My Courses",1);
	}
	if(arguments[2]=='Notes'){
		addActionButton("syllabi", arguments[0], arguments[0], "start" + arguments[2]);
	}else{
		if(!document.getElementById("btnGroup_" + arguments[0])){
			addChildButtonGroup("syllabi",arguments[0], arguments[16], 1)
		}
		if(!document.getElementById("btnGroup_continue_" + arguments[0])){
			addChildButtonGroup(arguments[0],"continue_" + arguments[0], "Continue<image file='Consoles/v12_00/next.gif>", 0, contCourse)
		}
		if(!document.getElementById("btnGroup_courseDocs_" + arguments[0])){
			addChildButtonGroup(arguments[0],"courseDocs_" + arguments[0], "Course Documents", 0, loadCourseDocs)
		}															 
		if(!document.getElementById("btnGroup_syllabus_" + arguments[0])){
			addChildButtonGroup(arguments[0],"syllabus_" + arguments[0], "Syllabus", 0)
			//addChildButtonGroup(arguments[0],"syllabus_" + arguments[0], arguments[7], 1)
		}
		if(!document.getElementById("btnGroup_" + arguments[2] + "_" + arguments[0])){
			addChildButtonGroup(arguments[0],arguments[2] + "_" + arguments[0], arguments[2], 0)
		}
		if(!document.getElementById("btnGroup_syllabus_" + arguments[2] + "_" + arguments[9] )){
			if(arguments[23]!=-1 && arguments[13]!='' && arguments[22]!='0'){
				addActionButton("syllabus_" + arguments[0], "syllabus_" + arguments[2] + "_" + arguments[9], arguments[7] + "<div class='syllGrade'>Grade "+ arguments[13]+ "/" + arguments[22] + " (" + Math.round(arguments[13]/arguments[22]*100) +"%)</div>", "start" + arguments[2])
			}else{
				addActionButton("syllabus_" + arguments[0], "syllabus_" + arguments[2] + "_" + arguments[9], arguments[7], "start" + arguments[2])
			}
			activateButton("btnGroupTitle_" + "syllabus_" + arguments[2] + "_" + arguments[9], arguments[21]);
			if(arguments[23]!=-1 && arguments[13]!=''){
				addActionButton(arguments[2] + "_" + arguments[0], arguments[2] + "_" + arguments[2] + "_" + arguments[9], arguments[7] + " <div class='syllGrade'>Grade:"+ arguments[13]+ "/" + arguments[22] + " ("+ Math.round(arguments[13]/arguments[22]*100) +"%)</div>", "start" + arguments[2])
			}else{
				addActionButton(arguments[2] + "_" + arguments[0], arguments[2] + "_" + arguments[2] + "_" + arguments[9], arguments[7], "start" + arguments[2])
			}
			activateButton("btnGroupTitle_" + arguments[2] + "_" + arguments[2] + "_" + arguments[9], arguments[21]);
		}
		
	}
	return null;
}
function newAdminItems(){
	if(!document.getElementById("btnGroup_courseAdmin")){
		addButtonGroup("courseAdmin","Course Admin.",1);
	}
	if(!document.getElementById("btnGroup_" + arguments[0] + "_admin")){		
		addChildButtonGroup("courseAdmin",arguments[0]+ "_admin",arguments[1] + " <br> -" + arguments[2] +"-",0);
		//alert(document.getElementById("btnGroup_" + arguments[0]));
	}	
	if(!document.getElementById("btnGroup_courseAdmin_" + arguments[0])){
		addActionButton(arguments[0]+ "_admin","editSyllabus_" + arguments[0],"Edit Syllabus","editSyllabus");
		
		addChildButtonGroup(arguments[0]+ "_admin","roster_" + arguments[0],"Student Roster",0);
		addActionButton("roster_" + arguments[0],"addStudent_" + arguments[0],"Add Students","addStudents");
		addActionButton("roster_" + arguments[0],"manageStudent_" + arguments[0],"Manage Students","manageStudents");
		
		addChildButtonGroup(arguments[0]+ "_admin","grading_" + arguments[0],"Student Grading",0);
		//addActionButton("grading_" + arguments[0],"gradeTest_" + arguments[0],"Grade Test","gradeTest");
		//addActionButton("grading_" + arguments[0],"gradeQuiz_" + arguments[0],"Grade Quiz","gradeQuiz");
		addActionButton("grading_" + arguments[0],"gradeAssignment_" + arguments[0],"Grade Assignment","gradeAssignment");
		
		addChildButtonGroup(arguments[0]+ "_admin","create_" + arguments[0],"Add Elements To Course",0);
		addActionButton("create_" + arguments[0],"addTest_" + arguments[0],"Add Test","addTest");
		addActionButton("create_" + arguments[0],"addQuiz_" + arguments[0],"Add Quiz","addQuiz");
		addActionButton("create_" + arguments[0],"addSurvey_" + arguments[0],"Add Survey","addSurvey");
		addActionButton("create_" + arguments[0],"addAssignment_" + arguments[0],"Add Assignment","addAssignment");
		addActionButton("create_" + arguments[0],"addCourseDocuments_" + arguments[0],"Add Course Documents","addCourseDocs");
		addChildButtonGroup(arguments[0]+ "_admin","tutor_" + arguments[0],"Tutor Management",0);
		addActionButton("tutor_" + arguments[0],"addTutors_" + arguments[0],"Add Tutors","addTutors");
		
	}													
}
function newTutorItems(){
	if(!document.getElementById("btnGroup_courseTutor")){
		addButtonGroup("courseTutor","Course Tutoring",1);
	}
	if(!document.getElementById("btnGroup_" + arguments[0] + "_tutor")){		
		addChildButtonGroup("courseTutor",arguments[0]+ "_tutor",arguments[1] + " <br> -" + arguments[2] +"-",0);
		//alert(document.getElementById("btnGroup_" + arguments[0]));
	}	
	if(!document.getElementById("btnGroup_coursetutor_" + arguments[0])){
		//addActionButton(arguments[0]+ "_tutor","editSyllabus_" + arguments[0],"Edit Syllabus","editSyllabus");		
		addActionButton(arguments[0]+ "_tutor","tutorSyllabus_" + arguments[0],"Course Syllabus","tutorCourseSyllabus");
		addChildButtonGroup(arguments[0]+ "_tutor","tutor_roster_" + arguments[0],"Student Roster",0);
		//addActionButton("roster_" + arguments[0],"addStudent_" + arguments[0],"Add Students","addStudents");
		addActionButton("tutor_roster_" + arguments[0],"tutorStudent_" + arguments[0],"Tutor Students","tutorStudents");
		
		//addChildButtonGroup(arguments[0]+ "_tutor","grading_" + arguments[0],"Student Grading",0);
		//addActionButton("grading_" + arguments[0],"gradeTest_" + arguments[0],"Grade Test","gradeTest");
		//addActionButton("grading_" + arguments[0],"gradeQuiz_" + arguments[0],"Grade Quiz","gradeQuiz");
		//addActionButton("grading_" + arguments[0],"gradeAssignment_" + arguments[0],"Grade Assignment","gradeAssignment");
		
		/*addChildButtonGroup(arguments[0]+ "_tutor","create_" + arguments[0],"Add Elements To Course",0);
		addActionButton("create_" + arguments[0],"addTest_" + arguments[0],"Add Test","addTest");
		addActionButton("create_" + arguments[0],"addQuiz_" + arguments[0],"Add Quiz","addQuiz");
		addActionButton("create_" + arguments[0],"addSurvey_" + arguments[0],"Add Survey","addSurvey");
		addActionButton("create_" + arguments[0],"addAssignment_" + arguments[0],"Add Assignment","addAssignment");
		addActionButton("create_" + arguments[0],"addCourseDocuments_" + arguments[0],"Add Course Documents","addCourseDocs");*/
	}													
}

function editSyllabus(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_"+ arguments[0])){
		clearElements(document.getElementById("window_"+ arguments[0]));
	}
																  
	createObject(arguments[0], document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML, "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_"+arguments[0]).appendChild(contentWindow);
	
	contentWindow.id= "window_" + getObjID(arguments[0]) + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= clientHeight-38-20; //"95%"
	contentWindow.style.width= "100%"//clientWidth-192;
	newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML.replace("<BR>","&nbsp;") + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML.replace("<BR>","&nbsp;"));
	//loadXMLDoc("dynamicpages/lms_build_edit_syllabus_tst.asp", "courseid=" + getObjID(arguments[0]));
}
function fireCloseEditWin(e){
	var objID=getObjID(this.parentNode.parentNode.id);
	var breakUp = this.parentNode.parentNode.id.split("_");
//	alert(breakUp[1]);
	switch(breakUp[1]){
		case "manageTest":
			currentTest.cleanup();
		break;
		case "manageQuiz":
			currentTest.cleanup();
		break;
		case "manageSurvey":
			currentTest.cleanup();
		break;
		case "test":
			currentTest.cleanup();
		break;
		case "quiz":
			currentTest.cleanup();
		break;
		case "survey":
			currentTest.cleanup();
		break;
		case "mngStudent":
			studentManagement.cleanupStudent(breakUp[3]);
		break;
	}
	//switch(breakUp)
	clearElements(this.parentNode.parentNode);
	
	objID=null;
}
function addStudents(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_addStudent_"+ arguments[0])){
		clearElements(document.getElementById("window_addStudent_"+ arguments[0]));
	}												  
	createObject("addStudent_" + arguments[0], document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML, "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_addStudent_"+arguments[0]).appendChild(contentWindow);
	
	contentWindow.id= "window_addStudent_" + getObjID(arguments[0]) + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	
	loadXMLDoc("dynamicpages/lms_load_Student_List.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].innerHTML.replace("<BR>","&nbsp;"));//.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	
}
function addTutors(){
	
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_addTutors_"+ arguments[0])){
		clearElements(document.getElementById("window_addTutors_"+ arguments[0]));
	}												  
	createObject("addTutors_" + arguments[0], document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML, "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_addTutors_"+arguments[0]).appendChild(contentWindow);
	
	contentWindow.id= "window_addTutors_" + getObjID(arguments[0]) + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	
	loadXMLDoc("dynamicpages/lms_load_course_tutor_List.asp", "courseid=" + getObjID(arguments[0]), "title=" +  escape(document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].innerHTML.replace("<BR>","&nbsp;")));//.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	
}
function assignStudents(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var tutorID= itm.id.substr(itm.id.lastIndexOf("_")+1);
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_assignStudents_"+ tutorID)){
		clearElements(document.getElementById("window_assignStudents_"+ tutorID));
	}
	createObject("assignStudents_" + tutorID, itm.innerHTML, "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_assignStudents_"+tutorID).appendChild(contentWindow);
	
	contentWindow.id= "window_assignStudents_" + tutorID + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
	contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	
	loadXMLDoc("dynamicpages/lms_load_course_tutor_student_List.asp", "courseid=" + courseID, "tutorID=" + tutorID, "title="+  escape("Assign Students to: " + itm.innerHTML));//.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	
}
function manageStudents(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_manageStudent_"+ arguments[0])){
		clearElements(document.getElementById("window_manageStudent_"+ arguments[0]));
	}												  
	createObject("manageStudent_" + arguments[0], document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML, "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_manageStudent_"+arguments[0]).appendChild(contentWindow);
	//alert(document.getElementById("window_manageStudent_"+arguments[0]).parentNode.childNodes[2].id)
	contentWindow.id= "window_manageStudent_" + getObjID(arguments[0]) + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	
	loadXMLDoc("dynamicpages/lms_load_Student_Manage_List.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].innerHTML.replace("<BR>","&nbsp;"));//.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	
}
function tutorStudents(){
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_tutorStudent_"+ arguments[0])){
		clearElements(document.getElementById("window_tutorStudent_"+ arguments[0]));
	}												  
	createObject("tutorStudent_" + arguments[0], document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML, "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_tutorStudent_"+arguments[0]).appendChild(contentWindow);
	//alert(document.getElementById("window_manageStudent_"+arguments[0]).parentNode.childNodes[2].id)
	contentWindow.id= "window_tutorStudent_" + getObjID(arguments[0]) + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
	contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	
	loadXMLDoc("dynamicpages/lms_load_Student_tutor_List.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].innerHTML.replace("<BR>","&nbsp;"));//.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	
}
function EditTestSurvey(){	
	if(currentTest==-1){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_manage" + arguments[1] + "_"+ arguments[0])){
		clearElements(document.getElementById("window_manage" + arguments[1] + "_"+ arguments[0]));
	}												  
	createObject("manage" + arguments[1] + "_" + arguments[0], arguments[2], "lesson", clientWidth-192,clientHeight-38,190,37,fireCloseEditWin);
	var contentWindow = document.createElement("div");
	document.getElementById("window_manage" + arguments[1] + "_"+arguments[0]).appendChild(contentWindow);
	//alert("window_manage" + arguments[1] + "_"+arguments[0])
	//alert(document.getElementById("window_manage" + arguments[1] + "_"+arguments[0]).childNodes[1].childNodes[1].id)
	contentWindow.id= "window_manage" + arguments[1] + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
	contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var target = document.createElement("div");
	var	accessContainer = document.createElement("div");
	var	accessContainerTitle = document.createElement("div");
		accessContainer.id =  "container_questions_" + arguments[0];
		accessContainerTitle.id=  "container_questionsTitle_" + arguments[0];
		accessContainer.className ="ManageQuestions";
		
		contentWindow.appendChild(target);
		target.appendChild(accessContainerTitle);	
		target.appendChild(accessContainer);
		
		accessContainerTitle.className="ManageStudentsTitle";
		accessContainerTitle.innerHTML=arguments[1] + ": " + arguments[2] + " questions";
		accessContainerTitle.onmousedown=fireContextMenu;	
	target.className="questionManage";
	loadXMLDoc("dynamicpages/lms_course_test_quiz_Question_List.asp", "itmID=" + arguments[0], "title=" + escape("Add Questions to " + arguments[1] + " " + arguments[2]), "handleTitle=HandleTitle_manage"+ arguments[1] + "_" + arguments[0]);//.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	target= null
	accessContainer = null;
	accessContainerTitle= null;
	}else{
		if(currentTest.id!=arguments[0]){
			alert("Please close " + currentTest.title);
		}else{
			alert("Already Open");
		}
	}
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);
	
}

function activateButton(sylID,type){

	if(type=="Disabled"){
		document.getElementById(sylID).disabled=true
	}else{
		document.getElementById(sylID).disabled=false
	}
	return null;
}
function startLesson(){
	if(!document.getElementById("btnGroupTitle_" + arguments[0]).disabled){			
			newScriptElement("dynamicPages/loadLesson.asp","syllabusID=" + getObjID(arguments[0]));
	}
	return null;
}
function tutorLesson(){		
	newScriptElement("dynamicPages/loadLesson.asp","syllabusID=" + arguments[0]);
	return null;
}
function startNotes(){
	fireNotes("tst")
}
function fireLesson(companyID,courseID,MediaVersions,LessonID,id,Description){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_player.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	if(document.getElementById("window_Player")){
		fireCloseLesson();
	}
	createObject("Player", Description, "Lesson",clientWidth-192,clientHeight-38,190,37,fireCloseLesson);
//	createObject("Player", Description, "Lesson",790,450,190,37,fireCloseLesson);
	var contentWindow = document.createElement("div");
	document.getElementById("window_Player").appendChild(contentWindow);
	contentWindow.id= "window_Player_content";
	contentWindow.style.height=clientHeight-38-20;// "95%" //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	contentWindow=null;
	//activateButton("btnGroupTitle_Lesson_Lesson_" + id,"Disabled")
	if(!playerScript){
		tmpArguments = arguments;
		playerScript = newScriptElement("scripts/player.js");	
		//lsnPlayers.NextLessonURL.push('LMS');
	}else{
		removeScriptElement(playerScript);
		playerScript = newScriptElement("scripts/player.js");
		//alert("here");
		//lsnPlayers.push(new player(companyID,courseID,MediaVersions,LessonID,id,Description));
		lsnPlayers= null;
		
		lsnPlayers= new player(companyID,courseID,MediaVersions,LessonID,id,Description);
		//lsnPlayers.NextLessonURL.push('LMS');
		createPlayer(lsnPlayers)
		//createPlayer(lsnPlayers.length-1);
	}	
	syllID=id;
	return null;
}
function fireCloseLesson(){
//	StopPlayer();
	try{	
		shutDown();	
		lsnPlayers.cleanup();
		lsnPlayers=null;
		
		
		clearInterval(playerEngineFire[0]);
		playerEngineFire.pop();
		for(i=document.getElementById("window_Player_content").childNodes.length-1;i>-1;i--){
			if(document.getElementById("window_Player_content").childNodes[i].childNodes.length>0){
				for(var z=document.getElementById("window_Player_content").childNodes[i].childNodes.length-1; z>-1;z--){
					if(document.getElementById("window_Player_content").childNodes[i].childNodes[z].childNodes.length>0){
						for(var x=document.getElementById("window_Player_content").childNodes[i].childNodes[z].childNodes.length-1; x>-1;x--){
							clearElements(document.getElementById("window_Player_content").childNodes[i].childNodes[z].childNodes[x])
						}
					}
					clearElements(document.getElementById("window_Player_content").childNodes[i].childNodes[z]);
				}																			   
			}
			clearElements(document.getElementById("window_Player_content").childNodes[i]);
		}
		clearElements(document.getElementById("window_Player_content"));
		
		document.title="Q-View LMS 12.0";
		self.status="Q-View LMS 12.0";
		playerEngineFire = new Array();
		bitrate=null;
		tests = 0;
		tempVolY = 0;
		CurrentSlide=0;
		CurrentAnim=0;
		CurrentPoll=null;
		CurrentScript=null;
		CurrentJump=null;
		CurrentStill=null;
		LastStatus=null;
		motionItem=null;
		Jumped=null;
		animCounter=0;
		resizeX=null;
		resizeY=null;
		removeScriptElement(playerScript);
		playerScript=null;	
		clearElements(document.getElementById("window_Player"));//.style.display="none";
		//endLesson();
	}catch(error){alert(error.description)};
	return null;
}
function markComplete(){
	try{
	//try{
		newScriptElement("dynamicpages/lms_finish_syllabusItem.asp", "syllID=" + syllID)
	//}catch(error){}
	}catch(error){alert(error.description + "\n in End Lesson Function")};
}
function fireNextItem(id,type){
	//alert(type + " " + id);
	if(id && type){
	document.getElementById("btnGroupTitle_syllabus_" + type + "_" + id).click();	
	}
}
function endLesson(){
	fireCloseLesson();
	fireNextItem(nextID, nextType);	
	nextID=null;
	nextType=null;
	//newScriptElement("dynamicpages/lms_next_syllabusItem", "syllID=" + syllID);
}
/**************************************CourseAdminFunctions***************************************************************/
function newEditSyllabusItems(CourseID,SyllabusOrder,Description,tblName,keyCol,SyllabusItemId,SyllDescr,Directions,id,SyllabusItemPreRequisite, ItemType){
	var syllabusContainer
	var lessonContainer
	var quizContainer
	var testContainer
	var surveyContainer
	var assignmentContainer
	var syllabusContainerTitle
	var lessonContainerTitle
	var quizContainerTitle
	var testContainerTitle
	var surveyContainerTitle
	var assignmentContainerTitle
	var targetContainer
	var newItem
	if(document.getElementById("window_" + CourseID + "_content")){
		targetContainer=document.getElementById("window_" + CourseID + "_content");
		if(!document.getElementById("container_lesson_" + CourseID)){
				syllabusContainer=document.createElement("div");
				lessonContainer=document.createElement("div");
				quizContainer=document.createElement("div");
				testContainer=document.createElement("div");
				surveyContainer=document.createElement("div");
				assignmentContainer=document.createElement("div");
				
				syllabusContainerTitle=document.createElement("div");
				lessonContainerTitle=document.createElement("div");
				quizContainerTitle=document.createElement("div");
				testContainerTitle=document.createElement("div");
				surveyContainerTitle=document.createElement("div");
				assignmentContainerTitle=document.createElement("div");
				
				syllabusContainer.className="EditSyllabus";
				lessonContainer.className="EditSyllabusItems";
				quizContainer.className="EditSyllabusItems";
				testContainer.className="EditSyllabusItems";
				surveyContainer.className="EditSyllabusItems";
				assignmentContainer.className="EditSyllabusItems";
				
				syllabusContainerTitle.className="EditSyllabusItemsTitle";
				lessonContainerTitle.className="EditSyllabusItemsTitle";
				quizContainerTitle.className="EditSyllabusItemsTitle";
				testContainerTitle.className="EditSyllabusItemsTitle";
				surveyContainerTitle.className="EditSyllabusItemsTitle";
				assignmentContainerTitle.className="EditSyllabusItemsTitle";
				
				syllabusContainer.id="container_syllabus_" + CourseID;
				lessonContainer.id="container_lesson_" + CourseID
				quizContainer.id="container_quiz_" + CourseID
				testContainer.id="container_test_" + CourseID
				surveyContainer.id="container_survey_" + CourseID
				assignmentContainer.id="container_assignment_" + CourseID
				
				syllabusContainerTitle.id="container_syllabusTitle_" + CourseID;
				lessonContainerTitle.id="container_lessonTitle_" + CourseID
				quizContainerTitle.id="container_quizTitle_" + CourseID
				testContainerTitle.id="container_testTitle_" + CourseID
				surveyContainerTitle.id="container_surveyTitle_" + CourseID
				assignmentContainerTitle.id="container_assignmentTitle_" + CourseID
				
				syllabusContainerTitle.innerHTML = "Syllabus";
				lessonContainerTitle.innerHTML = "Lessons";
				quizContainerTitle.innerHTML= "Quizzes";
				testContainerTitle.innerHTML= "Tests";
				surveyContainerTitle.innerHTML= "Surveys";
				assignmentContainerTitle.innerHTML= "Assignments";				
				
				syllabusContainer.appendChild(syllabusContainerTitle);
				lessonContainer.appendChild(lessonContainerTitle);
				quizContainer.appendChild(quizContainerTitle);
				testContainer.appendChild(testContainerTitle);
				surveyContainer.appendChild(surveyContainerTitle);
				assignmentContainer.appendChild(assignmentContainerTitle);
				
				syllabusContainerTitle.onmousedown=fireContextMenu;	
				lessonContainerTitle.onmousedown=fireContextMenu;	
				quizContainerTitle.onmousedown=fireContextMenu;	
				testContainerTitle.onmousedown=fireContextMenu;	
				surveyContainerTitle.onmousedown=fireContextMenu;	
				assignmentContainerTitle.onmousedown=fireContextMenu;	
				
				targetContainer.appendChild(syllabusContainer);
				targetContainer.appendChild(lessonContainer);
				targetContainer.appendChild(quizContainer);
				targetContainer.appendChild(testContainer);
				targetContainer.appendChild(surveyContainer);
				targetContainer.appendChild(assignmentContainer);
		}else{
				syllabusContainer=document.getElementById("container_syllabus_" + CourseID)
				lessonContainer=document.getElementById("container_lesson_" + CourseID)
				quizContainer=document.getElementById("container_quiz_" + CourseID)
				testContainer=document.getElementById("container_test_" + CourseID)
				surveyContainer=document.getElementById("container_survey_" + CourseID)
				assignmentContainer=document.getElementById("container_assignment_" + CourseID)
		}		
		if(!document.getElementById("itm_" + ItemType + "_" + SyllabusItemId)){
			newItem = document.createElement("div");
			newItem.id="itm_" + ItemType + "_" + SyllabusItemId;
			newItem.className="edit_syllabus_inactive";
			newItem.onmouseover=highlight;
			newItem.onmouseout=nohighlight;
			newItem.onmousedown=fireContextMenu;	
			newItem.innerHTML=Description;
		}else{
			newItem=document.getElementById("itm_" + ItemType + "_" + SyllabusItemId);
		}
		if(SyllabusOrder>-1){
			syllabusContainer.appendChild(newItem);
			//alert(syllabusContainer.id);
		}else{			
			switch(ItemType){
				case "Lesson":
					lessonContainer.appendChild(newItem);
					break;
				case "Quiz":
					quizContainer.appendChild(newItem);
					break;
				case "Test":
					testContainer.appendChild(newItem);
					break;
				case "Survey":
					surveyContainer.appendChild(newItem);
					break;
				case "Assignment":
					assignmentContainer.appendChild(newItem);
					break;
			}
		}		
	}
	
	newItem=null;
	targetWindow=null;
	lessonContainer=null;
	quizContainer=null;
	testContainer=null;
	surveyContainer=null;
	assignmentContainer=null;
}
function removeSyllabusItem(eid){
	//alert(eid.substr(eid.indexOf("_")+1));
	var itm = document.getElementById(eid.substr(eid.indexOf("_")+1));
	eid=eid.substr(eid.indexOf("_")+1)
	var prnt = itm.parentNode;
	var itmArry = eid.split("_");
	var prntArry =new String(prnt.id)
	prntArry = prntArry.split("_");
	var target = document.getElementById("container_" + itmArry[1].toLowerCase() + "_" + prntArry[2])

	target.appendChild(itm);
	for(var i=target.childNodes.length-2; i>0;i--){
		if(itm!=itm.parentNode.childNodes[1] && itm.innerHTML<itm.previousSibling.innerHTML){
			moveUp("_" + itm.id);
		}else{
			break;
		}
	}
	setState(itm.id,"inactive");
	clearConActive(eid,prntArry[2]);
	target = null;
	itm = null;
	prnt = null;
	itmArry = null;
	prntArry=null;
}
function appendToSyllabusEnd(eid){
	var itm = document.getElementById(eid.substr(eid.indexOf("_")+1));
	eid=eid.substr(eid.indexOf("_")+1)
	var prnt = itm.parentNode;
	var prntArry =new String(prnt.id)
	prntArry = prntArry.split("_");
	var target = document.getElementById("container_syllabus_" + prntArry[2])
	target.appendChild(itm);
	clearConActive(eid,prntArry[2]);
	target = null;
	itm = null;
	prnt = null;
	itmArry = null;
	prntArry=null;
}
function insertBefore(eid){
	eid=eid.substr(eid.indexOf("_")+1)
	var itm = document.getElementById(eid);
	var prnt = itm.parentNode;
	var prntArry =new String(prnt.id)
	prntArry = prntArry.split("_");
	var target = document.getElementById("container_syllabus_" + prntArry[2])
	
	var activeItmID = findActive(target.id);
	var activeItm = document.getElementById(activeItmID);
	target.insertBefore(itm,activeItm);
	setState(itm.id,"inactive");

	target = null;
	itm = null;
	prnt = null;
	itmArry = null;
	prntArry=null;
}
function insertAfter(eid){
	eid=eid.substr(eid.indexOf("_")+1)
	var itm = document.getElementById(eid);
	var prnt = itm.parentNode;
	var prntArry =new String(prnt.id)
	prntArry = prntArry.split("_");
	var target = document.getElementById("container_syllabus_" + prntArry[2])
	
	var activeItmID = findActive(target.id);
	var activeItm = document.getElementById(activeItmID);
	if(target.childNodes[target.childNodes.length-1]!=itm && activeItm){
		target.insertBefore(itm,activeItm.nextSibling);
	}else{
		target.appendChild(itm);	
	}
	setState(itm.id,"inactive");

	target = null;
	itm = null;
	prnt = null;
	itmArry = null;
	prntArry=null;
}
function moveUp(eid){
	eid=eid.substr(eid.indexOf("_")+1)
	var itm = document.getElementById(eid);
	if(itm.parentNode.childNodes[1]!=itm){
		itm.parentNode.insertBefore(itm,itm.previousSibling);
	}
}
function moveDown(eid){
	eid=eid.substr(eid.indexOf("_")+1)
	var itm = document.getElementById(eid);
	if(itm.parentNode.childNodes[itm.parentNode.childNodes.length-2]!=itm){
		if(itm.parentNode.childNodes[itm.parentNode.childNodes.length-1]!=itm){
			itm.parentNode.insertBefore(itm,itm.nextSibling.nextSibling);
		}
	}else{
		itm.parentNode.appendChild(itm);	
	}
}
function findActive(elemID){
	var elem = document.getElementById(elemID);
	var fnd = -1;
	if(elem.childNodes.length>1){
		for(var i=1;i<elem.childNodes.length;i++){
			if(getState(elem.childNodes[i].id)=="active"){
				fnd = elem.childNodes[i].id;
				break;
			}
		}
	}
	return fnd;
	
}
function clearSyllabus(eid){
	eid=eid.substr(eid.lastIndexOf("_")+1)
	var itm = document.getElementById("container_syllabus_" + eid);
	for(var i=itm.childNodes.length-1;i>0;i--){
		removeSyllabusItem("_" + itm.childNodes[i].id);
	}
	itm = null;
}
function moveAllToSyllabus(eid){
	eid=eid.substr(eid.indexOf("_")+1)
	var prnt = document.getElementById(eid).parentNode;
/*	alert(prnt.id);
	prnt = prnt.parentNode*/
	for(var i=prnt.childNodes.length-1;i>0;i--){
		appendToSyllabusEnd("_" + prnt.childNodes[1].id);
	}
	prnt = null;
}
function saveSyllabus(eid){
	eid=document.getElementById(eid.substr(eid.indexOf("_")+1))
	eid = eid.parentNode;
	var idArray="";
	var typeArray="";
	var tmpArray;
	var crseid=eid.id.split("_");
	var val="";
	//loadXMLDoc("dynamicpages/","courseid");
	for(var i=1;i<eid.childNodes.length;i++){
		tmpArray=eid.childNodes[i].id.split("_");
		val+="&syllOrder" + i +"="+i + "&type" + i +"=" + tmpArray[1]+ "&id" + i +"=" + tmpArray[2]+ "&description" + i +"=" + escape(eid.childNodes[i].innerHTML)	
	}
	loadXMLDoc("dynamicpages/lms_save_edit_syllabus.asp", "syllLength=" + eid.childNodes.length,"courseid=" + crseid[2]+val);
	eid = null;
}
function clearSyllabusError(){
	alert("Sorry, you cannot edit the syllabus once a student has begun the course. Please clear their progress under the manage student portion of your Course Admin.");
}
function newStudentObject(courseID,studentID,studentName,studentlevel,access){
	var studentContainer;
	var accessContainer;
	var newItem;
	targetContainer=document.getElementById("window_addStudent_" + courseID + "_content");
	//alert(courseID +" " + studentID + " " + studentName);
	if(!document.getElementById("container_studentList_" + courseID)){
		studentContainer = document.createElement("div");
		accessContainer = document.createElement("div");
		studentContainerTitle = document.createElement("div");
		accessContainerTitle = document.createElement("div");
		
		studentContainer.id = "container_studentList_" + courseID;
		accessContainer.id =  "container_studentAccess_" + courseID;
		studentContainerTitle.id= "container_studentListTitle_" + courseID;
		accessContainerTitle.id=  "container_studentAccessTitle_" + courseID;
		
		
		studentContainer.className="EditSyllabusItemsLong";
		studentContainer.style.float="right";
		accessContainer.className ="EditSyllabus";
		
		targetContainer.appendChild(accessContainer);
		targetContainer.appendChild(studentContainer);
		
		studentContainer.appendChild(studentContainerTitle);
		accessContainer.appendChild(accessContainerTitle);
		studentContainerTitle.onmousedown=fireContextMenu;	
		accessContainerTitle.onmousedown=fireContextMenu;	
		studentContainerTitle.className="EditSyllabusItemsTitle";
		accessContainerTitle.className="EditSyllabusItemsTitle";
		
		studentContainerTitle.innerHTML="Students Without Access";
		accessContainerTitle.innerHTML="Students With Access";
	}else{
		studentContainer = document.getElementById("container_studentList_" + courseID);
		accessContainer = document.getElementById("container_studentAccess_" + courseID)
	}
	if(!document.getElementById("itm_student_" + studentID)){
		newItem = document.createElement("div");
		newItem.id="itm_student_" + studentID;
		newItem.className="edit_syllabus_inactive";
		newItem.onmouseover=highlight;
		newItem.onmouseout=nohighlight;
		newItem.onmousedown=fireContextMenu;	
		newItem.innerHTML=studentName;
	}else{
		newItem=document.getElementById("itm_student_" + studentID);
	}
	
	if(access==''){
		studentContainer.appendChild(newItem);
	}else{
		accessContainer.appendChild(newItem);
	}
	//alert(newItem.parentNode.id);
	studentContainer=null;
	accessContainer=null;
	newItem=null;
}
function newManageStudentObject(courseID,studentID,studentName,studentlevel,access,currentElement,elementOrder,complete,startdate,completedate){
	var studentContainer;

	targetContainer=document.getElementById("window_manageStudent_" + courseID + "_content");
	if(!document.getElementById("container_studentManage_" + courseID)){
		//studentContainer = document.createElement("div");
		accessContainer = document.createElement("div");
		//studentContainerTitle = document.createElement("div");
		accessContainerTitle = document.createElement("div");
		
		//studentContainer.id = "container_studentManage_" + courseID;
		accessContainer.id =  "container_studentManage_" + courseID;
		//studentContainerTitle.id= "container_studentManageTitle_" + courseID;
		accessContainerTitle.id=  "container_studentManageTitle_" + courseID;
		
		
		//studentContainer.className="EditSyllabusItemsLong";
		//studentContainer.style.float="right";
		accessContainer.className ="ManageStudents";
		
		targetContainer.appendChild(accessContainer);
		//targetContainer.appendChild(studentContainer);
		
		//studentContainer.appendChild(studentContainerTitle);
		accessContainer.appendChild(accessContainerTitle);
		//studentContainerTitle.onmousedown=fireContextMenu;	
		accessContainerTitle.onmousedown=fireContextMenu;	
		//studentContainerTitle.className="EditSyllabusItemsTitle";
		accessContainerTitle.className="ManageStudentsTitle";
		
		//studentContainerTitle.innerHTML="Students Without Access";
		accessContainerTitle.innerHTML="Students To Manage";
	}else{
		//studentContainer = document.getElementById("container_studentManage_" + courseID);
		accessContainer = document.getElementById("container_studentManage_" + courseID)
	}
	if(!document.getElementById("itm_student_" + studentID)){
		newItem = document.createElement("div");
		newItemDescrip = document.createElement("div");
		newItem.id="itm_student_" + studentID;
		newItem.className="edit_syllabus_inactive";
		newItem.onmouseover=highlight;
		newItem.onmouseout=nohighlight;
		newItem.onmousedown=fireContextMenu;	
		newItem.innerHTML=studentName;
		newItem.appendChild(newItemDescrip);
		if(currentElement!=''){
		newItemDescrip.innerHTML = currentElement + ', Order # ' + elementOrder + ' Started:' +startdate;
			if(completedate==''){
				newItemDescrip.innerHTML += ' In Progress'
			}else{
				newItemDescrip.innerHTML += ' Completed:' + completedate;
			}
		}else{
			newItemDescrip.innerHTML = 'Not Started';
		}
		newItemDescrip.className='ManageStudentsDescrip'
	}else{
		newItem=document.getElementById("itm_student_" + studentID);
	}
	accessContainer.appendChild(newItem);
	accessContainer=null;
	newItem=null;
}
function newTutorStudentObject(courseID,studentID,studentName,studentlevel,access,currentElement,elementOrder,complete,startdate,completedate){
	var studentContainer;

	targetContainer=document.getElementById("window_tutorStudent_" + courseID + "_content");
	if(!document.getElementById("container_studentTutor_" + courseID)){
		//studentContainer = document.createElement("div");
		accessContainer = document.createElement("div");
		//studentContainerTitle = document.createElement("div");
		accessContainerTitle = document.createElement("div");
		
		//studentContainer.id = "container_studentManage_" + courseID;
		accessContainer.id =  "container_studentTutor_" + courseID;
		//studentContainerTitle.id= "container_studentManageTitle_" + courseID;
		accessContainerTitle.id=  "container_studentTutorTitle_" + courseID;
		
		
		//studentContainer.className="EditSyllabusItemsLong";
		//studentContainer.style.float="right";
		accessContainer.className ="TutorStudents";
		
		targetContainer.appendChild(accessContainer);
		//targetContainer.appendChild(studentContainer);
		
		//studentContainer.appendChild(studentContainerTitle);
		accessContainer.appendChild(accessContainerTitle);
		//studentContainerTitle.onmousedown=fireContextMenu;	
		accessContainerTitle.onmousedown=fireContextMenu;	
		//studentContainerTitle.className="EditSyllabusItemsTitle";
		accessContainerTitle.className="TutorStudentsTitle";
		
		//studentContainerTitle.innerHTML="Students Without Access";
		accessContainerTitle.innerHTML="Students To Tutor";
	}else{
		//studentContainer = document.getElementById("container_studentManage_" + courseID);
		accessContainer = document.getElementById("container_studentTutor_" + courseID)
	}
	if(!document.getElementById("itm_student_" + studentID)){
		newItem = document.createElement("div");
		newItemDescrip = document.createElement("div");
		newItem.id="itm_student_" + studentID;
		newItem.className="edit_syllabus_inactive";
		newItem.onmouseover=highlight;
		newItem.onmouseout=nohighlight;
		newItem.onmousedown=fireContextMenu;	
		newItem.innerHTML=studentName;
		newItem.appendChild(newItemDescrip);
		if(currentElement!=''){
		newItemDescrip.innerHTML = currentElement + ', Order # ' + elementOrder + ' Started:' +startdate;
			if(completedate==''){
				newItemDescrip.innerHTML += ' In Progress'
			}else{
				newItemDescrip.innerHTML += ' Completed:' + completedate;
			}
		}else{
			newItemDescrip.innerHTML = 'Not Started';
		}
		newItemDescrip.className='TutorStudentsDescrip'
	}else{
		newItem=document.getElementById("itm_student_" + studentID);
	}
	accessContainer.appendChild(newItem);
	accessContainer=null;
	newItem=null;
}
function newTutorObject(courseID,studentID,studentName,studentlevel,access){
	var tutorContainer;
	var accessContainer;
	var newItem;
	targetContainer=document.getElementById("window_addTutors_" + courseID + "_content");
	//alert(courseID +" " + studentID + " " + studentName);
	if(!document.getElementById("container_tutorList_" + courseID)){
		tutorContainer = document.createElement("div");
		accessContainer = document.createElement("div");
		tutorContainerTitle = document.createElement("div");
		accessContainerTitle = document.createElement("div");
		
		tutorContainer.id = "container_tutorList_" + courseID;
		accessContainer.id =  "container_tutorAccess_" + courseID;
		tutorContainerTitle.id= "container_tutorListTitle_" + courseID;
		accessContainerTitle.id=  "container_tutorAccessTitle_" + courseID;
		
		
		tutorContainer.className="EditSyllabusItemsLong";
		tutorContainer.style.float="right";
		accessContainer.className ="EditSyllabus";
		
		targetContainer.appendChild(accessContainer);
		targetContainer.appendChild(tutorContainer);
		
		tutorContainer.appendChild(tutorContainerTitle);
		accessContainer.appendChild(accessContainerTitle);
		tutorContainerTitle.onmousedown=fireContextMenu;	
		accessContainerTitle.onmousedown=fireContextMenu;	
		tutorContainerTitle.className="EditSyllabusItemsTitle";
		accessContainerTitle.className="EditSyllabusItemsTitle";
		
		tutorContainerTitle.innerHTML="Non-Tutors";
		accessContainerTitle.innerHTML="Tutors";
	}else{
		tutorContainer = document.getElementById("container_tutorList_" + courseID);
		accessContainer = document.getElementById("container_tutorAccess_" + courseID)
	}
	if(!document.getElementById("itm_tutor_" + studentID)){
		newItem = document.createElement("div");
		newItem.id="itm_tutor_" + studentID;
		newItem.className="edit_syllabus_inactive";
		newItem.onmouseover=highlight;
		newItem.onmouseout=nohighlight;
		newItem.onmousedown=fireContextMenu;	
		newItem.innerHTML=studentName;
	}else{
		newItem=document.getElementById("itm_tutor_" + studentID);
	}
	
	if(access=='' || access=='1'){
		tutorContainer.appendChild(newItem);
	}else{
		accessContainer.appendChild(newItem);
	}
	//alert(newItem.parentNode.id);
	tutorContainer=null;
	accessContainer=null;
	newItem=null;
}
function newTutorStudentAssignmentObject(courseID,studentID,studentName,studentlevel,access,tutorID){
	if(access!="-1"){
	var tutorContainer;
	var accessContainer;
	var newItem;
	targetContainer=document.getElementById("window_assignStudents_" + tutorID + "_content");
	//alert(targetContainer);
	//alert(courseID +" " + studentID + " " + studentName);
	if(!document.getElementById("container_tutorStudentList_" + courseID)){
		tutorContainer = document.createElement("div");
		accessContainer = document.createElement("div");
		tutorContainerTitle = document.createElement("div");
		accessContainerTitle = document.createElement("div");
		
		tutorContainer.id = "container_tutorStudentList_"  + courseID;
		accessContainer.id =  "container_tutorStudentAccess_"  +  courseID;
		tutorContainerTitle.id= "container_tutorStudentListTitle_"  +courseID;
		accessContainerTitle.id=  "container_tutorStudentAccessTitle_"  + courseID;
		
		
		tutorContainer.className="EditSyllabusItemsLong";
		tutorContainer.style.float="right";
		accessContainer.className ="EditSyllabus";
		
		targetContainer.appendChild(accessContainer);
		targetContainer.appendChild(tutorContainer);
		
		tutorContainer.appendChild(tutorContainerTitle);
		accessContainer.appendChild(accessContainerTitle);
		tutorContainerTitle.onmousedown=fireContextMenu;	
		accessContainerTitle.onmousedown=fireContextMenu;	
		tutorContainerTitle.className="EditSyllabusItemsTitle";
		accessContainerTitle.className="EditSyllabusItemsTitle";
		
		tutorContainerTitle.innerHTML="Available Student List";
		accessContainerTitle.innerHTML="Tutor's Students";
	}else{
		tutorContainer = document.getElementById("container_tutorStudentList_"  + courseID);
		accessContainer = document.getElementById("container_tutorStudentAccess_" + courseID)
	}
	if(!document.getElementById("itm_tutorStudent_" + studentID)){
		newItem = document.createElement("div");
		newItem.id="itm_tutorStudent_" + studentID +"_" + tutorID;
		newItem.className="edit_syllabus_inactive";
		newItem.onmouseover=highlight;
		newItem.onmouseout=nohighlight;
		newItem.onmousedown=fireContextMenu;	
		newItem.innerHTML=studentName;
	}else{
		newItem=document.getElementById("itm_tutorStudent_" + studentID +"_" + tutorID);
	}
	
	if(access=='' || access=='1'){
		tutorContainer.appendChild(newItem);
	}else{
		accessContainer.appendChild(newItem);
	}
	//alert(newItem.parentNode.id);
	tutorContainer=null;
	accessContainer=null;
	newItem=null;
	}
}
function grantAccessToAll(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 

	var prnt = itm.parentNode
	
	for(var i=1;i<prnt.childNodes.length;i++){
		grantAccessToStudent("_" + prnt.childNodes[i].id);
	}
	//processed();
}
function grantAccessToStudent(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var studentID= itm.id.substr(itm.id.lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_student_grant_access.asp","courseID="+courseID,"studentID="+studentID,"itmID="+arguments[0]);
}

function accessGranted(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var trgt = document.getElementById("container_studentAccess_" + itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1))
	if(trgt.childNodes.length>1){
		clearActive(trgt.id);
	}
	trgt.appendChild(itm);
	for(var i=trgt.childNodes.length-1;i>1;i--){
		if(itm.previousSibling.innerHTML>itm.innerHTML){
			trgt.insertBefore(itm,itm.previousSibling);
		}
	}
}
function grantAccessToTutor(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var studentID= itm.id.substr(itm.id.lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_tutor_grant_access.asp","courseID="+courseID,"studentID="+studentID,"itmID="+arguments[0]);
}
function accessGrantedToTutor(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var trgt = document.getElementById("container_tutorAccess_" + itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1))
	if(trgt.childNodes.length>1){
		clearActive(trgt.id);
	}
	trgt.appendChild(itm);
	for(var i=trgt.childNodes.length-1;i>1;i--){
		if(itm.previousSibling.innerHTML>itm.innerHTML){
			trgt.insertBefore(itm,itm.previousSibling);
		}
	}
}
function assignStudentToTutor(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var itmID = itm.id.split("_");
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var studentID= itmID[2];
	var tutorID=itmID[3];
	loadXMLDoc("dynamicpages/lms_course_tutor_student_assign.asp","courseID="+courseID,"studentID="+studentID,"tutorID="+tutorID,"itmID="+arguments[0]);
}
function studentAssignedToTutor(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var trgt = document.getElementById("container_tutorStudentAccess_" + itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1))
	if(trgt.childNodes.length>1){
		clearActive(trgt.id);
	}
	trgt.appendChild(itm);
	for(var i=trgt.childNodes.length-1;i>1;i--){
		if(itm.previousSibling.innerHTML>itm.innerHTML){
			trgt.insertBefore(itm,itm.previousSibling);
		}
	}
}
function removeAccessToStudent(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var studentID= itm.id.substr(itm.id.lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_student_remove_access.asp","courseID="+courseID,"studentID="+studentID,"itmID="+arguments[0]);
}
function accessRemoved(){
	try{
		
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	
	var trgt = document.getElementById("container_studentList_" + itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1))
	if(trgt.childNodes.length>1){
		clearActive(trgt.id);
	}
	trgt.appendChild(itm);
	for(var i=trgt.childNodes.length-1;i>1;i--){
		if(itm.previousSibling.innerHTML>itm.innerHTML){
			trgt.insertBefore(itm,itm.previousSibling);
		}
	}
	}catch(error){}
}
function removeAccessFromTutor(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var studentID= itm.id.substr(itm.id.lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_tutor_remove_access.asp","courseID="+courseID,"studentID="+studentID,"itmID="+arguments[0]);
}
function accessRemovedFromTutor(){
	try{
		
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	
	var trgt = document.getElementById("container_tutorList_" + itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1))
	if(trgt.childNodes.length>1){
		clearActive(trgt.id);
	}
	trgt.appendChild(itm);
	for(var i=trgt.childNodes.length-1;i>1;i--){
		if(itm.previousSibling.innerHTML>itm.innerHTML){
			trgt.insertBefore(itm,itm.previousSibling);
		}
	}
	}catch(error){}
}
function removeStudentFromTutor(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	var itmID = itm.id.split("_");
	var courseID = itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1);
	var studentID= itmID[2];
	var tutorID=itmID[3];
	loadXMLDoc("dynamicpages/lms_course_tutor_student_remove.asp","courseID="+courseID,"studentID="+studentID,"tutorID="+tutorID,"itmID="+arguments[0]);
}
function studentRemovedFromTutor(){
	//try{
		
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 
	
	var trgt = document.getElementById("container_tutorStudentList_" + itm.parentNode.id.substr(itm.parentNode.id.lastIndexOf("_")+1))
	if(trgt.childNodes.length>1){
		clearActive(trgt.id);
	}
	trgt.appendChild(itm);
	for(var i=trgt.childNodes.length-1;i>1;i--){
		if(itm.previousSibling.innerHTML>itm.innerHTML){
			trgt.insertBefore(itm,itm.previousSibling);
		}
	}
	//}catch(error){}
}
function removeAccessToAll(){
	var itm = document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)); 

	var prnt = itm.parentNode
	//for(var i=prnt.childNodes.length-1;i>0;i--){
	for(var i=1;i<prnt.childNodes.length;i++){
		removeAccessToStudent("_" + prnt.childNodes[i].id);
	}
}
function newStudent(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var baseElem=document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
	arguments[0]= baseElem.id.substr(baseElem.id.lastIndexOf("_"));
	if(document.getElementById("window_newStudent_"+ arguments[0])){
		clearElements(document.getElementById("window_newStudent_"+ arguments[0]));
	}												  
	createObject("newStudent" + arguments[0], "New Student", "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_newStudent"+arguments[0]).appendChild(contentWindow);
	
	contentWindow.id= "window_newStudent_" + getObjID(arguments[0]) + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");
	var cityStateZip = document.createElement("div");
	var userName = document.createElement("div");
	userName.id = "userName";
	userName.className = "elemGrp_NewLineLeft";
	userName.style.width ="95%";
	cityStateZip.id = "cityStateZip";
	cityStateZip.className = "elemGrp_NewLineLeft";
	cityStateZip.style.width="95%";
	frm.id = "newStudentForm_" + getObjID(arguments[0]);
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_student_add.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"txtFirstName","left","First Name","top",null,null,"txt",null,null,null,null,null,25,100);
	document.getElementById("txtFirstName").focus();
	createFormElem(frm.id,"txtMInitial","left","M.Initial","top",null,null,"txt",null,null,null,null,null,5,2);
	createFormElem(frm.id,"txtLastName","left","Last Name","top",null,null,"txt",null,null,null,null,null,25,100);
	createFormElem(frm.id,"txtPhone","newLineLeft","Phone Number","top",null,null,"txt",null,null,null,null,null,30,15);
	createFormElem(frm.id,"txtAddress","newLineLeft","Address","top",null,null,"txt",null,null,null,null,null,55,250);
	createFormElem(frm.id,"txtAddress2","newLineLeft","Address2","top",null,null,"txt",null,null,null,null,null,55,250);
	frm.appendChild(cityStateZip);
	createFormElem("cityStateZip","txtZip","left","Zip","top",null,null,"txt",null,lookupCityState,null,null,null,12,10);
	createFormElem("cityStateZip","txtCity","left","City","top",null,null,"txt",null,null,null,null,null,25,250);
	createFormElem("cityStateZip","txtState","left","State","top",null,null,"txt",null,null,null,null,null,5,2);
	
	frm.appendChild(userName);
	createFormElem("userName","txtEmail","left","Email Address <br> (user id)","top",null,null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","txtPassword","left","<br>Password","top",rndmPassword(),null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","btnSubmit","newLineLeft","Create User","none",null,null,"btn",submitForm,null,null,null,null,30,200);
	
	//alert("HandleTitle_newStudent_" + getObjID(arguments[0]));
	document.getElementById("HandleTitle_newStudent_" + getObjID(arguments[0])).innerHTML = "New Student";
	
	frm = null;
	cityStateZip = null;
}
function editStudent(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	//alert(this.id.split("_")[1]);alert(courseId+","+stntID);
	var courseId=this.id.split("_")[1]
	var stntID=this.id.split("_")[2]
	
	var student=studentManagement.stdnts[studentManagement.findStudent(this.id.split("_")[2])]
	loadCSS("default_course_editor.css");
	var baseElem=this.parentNode.parentNode.parentNode.parentNode;
	this.id= baseElem.id.substr(baseElem.id.lastIndexOf("_"));
	if(document.getElementById("window_editStudent_"+ this.id)){
		clearElements(document.getElementById("window_editStudent_"+ this.id));
	}												  
	createObject("editStudent" + this.id, "Edit Student", "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_editStudent"+this.id).appendChild(contentWindow);
	
	contentWindow.id= "window_editStudent_" + getObjID(this.id) + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");
	var cityStateZip = document.createElement("div");
	var userName = document.createElement("div");
	userName.id = "userName";
	userName.className = "elemGrp_NewLineLeft";
	userName.style.width ="95%";
	cityStateZip.id = "cityStateZip";
	cityStateZip.className = "elemGrp_NewLineLeft";
	cityStateZip.style.width="95%";
	frm.id = "editStudentForm_" + getObjID(this.id);
	contentWindow.appendChild(frm);
	
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_student_edit.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnStudentID","left","","none",stntID,null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnCourseID","left","","none",courseId,null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"txtFirstName","left","First Name","top",student.getAttribute("user_fName"),null,"txt",null,null,null,null,null,25,100);
	document.getElementById("txtFirstName").focus();
	createFormElem(frm.id,"txtMInitial","left","M.Initial","top",student.getAttribute("user_mInitial"),null,"txt",null,null,null,null,null,5,2);
	createFormElem(frm.id,"txtLastName","left","Last Name","top",student.getAttribute("user_lName"),null,"txt",null,null,null,null,null,25,100);
	createFormElem(frm.id,"txtPhone","newLineLeft","Phone Number","top",student.getAttribute("user_phone"),null,"txt",null,null,null,null,null,30,15);
	createFormElem(frm.id,"txtAddress","newLineLeft","Address","top",student.getAttribute("user_address1"),null,"txt",null,null,null,null,null,55,250);
	createFormElem(frm.id,"txtAddress2","newLineLeft","Address2","top",student.getAttribute("user_address2"),null,"txt",null,null,null,null,null,55,250);
	frm.appendChild(cityStateZip);
	createFormElem("cityStateZip","txtZip","left","Zip","top",student.getAttribute("user_zipCode"),null,"txt",null,lookupCityState,null,null,null,12,10);
	createFormElem("cityStateZip","txtCity","left","City","top",student.getAttribute("user_city"),null,"txt",null,null,null,null,null,25,250);
	createFormElem("cityStateZip","txtState","left","State","top",student.getAttribute("user_state"),null,"txt",null,null,null,null,null,5,2);
	
	frm.appendChild(userName);
	createFormElem("userName","txtEmail","left","Email Address <br> (user id)","top",student.getAttribute("user_email"),null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","txtPassword","left","<br>Password","top","",null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","btnSubmit","newLineLeft","Edit User","none",null,null,"btn",submitForm,null,null,null,null,30,200);
	
	//alert("HandleTitle_newStudent_" + getObjID(this.id));
	document.getElementById("HandleTitle_editStudent_" + getObjID(this.id)).innerHTML = "Edit Student";
	
	frm = null;
	cityStateZip = null;
}

function rndmPassword(){
	var arry1 = new Array(0,1,2,3,4,5,6,7,8,9);
	var arry2 = new Array('a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z');
	var pword='';
	//alert(arry1.length);
	//alert(arry2.length);
	for(var i=0;i<6;i++){
		if(i%2==0){
			pword+=arry1[Math.ceil(Math.random(Date())*arry1.length)-1].toString()
		}else{
			pword+=arry2[Math.ceil(Math.random(Date())*arry2.length)-1].toString()
		}
	}
	return pword;
}
function createFormElem(trgtID,id,elemOrient,lbl,lblOrient,dflt,fill,type,onclick,onblur,onmouseover,onmousedown,onkeypress,width,limit,elemWidth){
	var trgt = document.getElementById(trgtID);
	var elemGrp = document.createElement("div");
	var lblElem = document.createElement("div");
	var itmElem = document.createElement("div");
	var elem;
	//if(!document.getElementById("elem_" + id)){
		trgt.appendChild(elemGrp);
		elemGrp.id = "elem_" + id;
		lblElem.id = "lbl_" + id;
		itmElem.id = "itm_" + id;
		switch(elemOrient){
			case "newLineLeft":
				elemGrp.className = "elemGrp_NewLineLeft";
			break;
			case "newLineRight":
				elemGrp.className = "elemGrp_NewLineRight";
			break;
			case "left":
				elemGrp.className = "elemGrp_Left";
			break;
			case "right":
				elemGrp.className = "elemGrp_Right";
			break;
			case "center":
				elemGrp.className = "elemGrp_Center";
				elemGrp.align='center';
			break;
		}
		if(elemWidth){
			elemGrp.style.width=elemWidth;
		}
		switch(type){
			case "txt":
				elem=document.createElement("input")
				elem.className = "formInput";
				if(width!=null){
					elem.size = width;
				}
				if(limit!=null){
					elem.maxLength=limit;
				}
				if(dflt!=null){
					elem.value = dflt;
				}
				lblElem.innerHTML = lbl;
			break;
			case "dd":
				elem=document.createElement("select")
				elem.className = "formSelect";
				lblElem.innerHTML = lbl;
			break;
			case "chk":
				elem=document.createElement("input")
				elem.type="checkbox";
				elem.className = "formCheckbox";
				lblElem.innerHTML = lbl;
			break;
			case "btn":
				elem=document.createElement("a")
				elem.href="#";
				elem.className="formButton";
				elem.innerHTML=lbl;
			break;
			case "rad":
				//alert("here " + id + " " + dflt);
				elem=document.createElement("<input type='radio' id='" + id + "' name='" + id + "' value='" + dflt + "'>");
				elem.type="radio";
				lblElem.innerHTML = lbl;
			break;
			case "hdn":
				elem=document.createElement("input");
				elem.type ="hidden";
				elem.value=dflt;
			break;
			case "txtArea":
				elem=document.createElement("textArea");
				lblElem.innerHTML = lbl;
				elem.cols = width;
				elem.rows = limit;
			break;
		}
		switch(lblOrient){
			case "top":
				elemGrp.appendChild(lblElem);
				elemGrp.appendChild(itmElem);
				lblElem.className="formLabel_top";
				itmElem.className="formElem_top";
			break;
			case "left":
				elemGrp.appendChild(lblElem);
				elemGrp.appendChild(itmElem);
				lblElem.className="formLabel_left";
				itmElem.className="formElem_left";
			break;
			case "right":
				elemGrp.appendChild(itmElem);
				elemGrp.appendChild(lblElem);			
				lblElem.className="formLabel_right";
				itmElem.className="formElem_right";
			break;
			case "none":
				elemGrp.appendChild(itmElem);
				itmElem.className="formElem_right";
			break;
			default:
				elemGrp.appendChild(lblElem);
				elemGrp.appendChild(itmElem);
				lblElem.className="formLabel_left";
				itmElem.className="formElem_left";
			break;
		}
		
		itmElem.appendChild(elem);
		elem.id = id;
		if(onclick!=null){
			if(onclick==submitForm){
				//alert("here2");
			}
			elem.onclick = onclick;
		}
		if(onblur!=null){
			elem.onblur = onblur;
		}
		if(onmouseover!=null){
			elem.onmouseover = onmouseover;
		}
		if(onmousedown!=null){
			elem.onmousedown = onmousedown;
		}
		if(onkeypress!=null){
			elem.onkeypress = onkeypress;
		}
		
		/*
		trgt
		elemGrp
		lblElem
		itmElem
		*/
		if(fill!=null){
			eval(fill + "('" + id + "')");
		}
	//}
	elem=null;
	trgt= null;
	elemGrp= null;
	lblElem= null;
	itmElem= null;
	onclick= null;
	onblur= null;
	onmouseover= null;
	onkeypress= null;
}
function lookupCityState(){
	var zip = document.getElementById("txtZip")
	loadXMLDoc("dynamicPages/findCityState.asp","zip=" + zip.value);
}
function setCityState(city,state){
	var txtCity = document.getElementById("txtCity");
	var txtState = document.getElementById("txtState");
	txtCity.value=city;
	txtState.value=state;
	txtCity=null;
	txtState=null;
}
function submitForm(e){
	
	var firer
	if(!e){
		firer=this;
	}else{
		firer=e;
	}
	
	var elems = document.getElementsByTagName("Form");
	var fnd = 0;
	
	for(i=0;i<elems.length;i++){
		if(firer.parentNode==elems[i]){
			fnd = 1;
			break;
		}
	}
	if(fnd!=1){
		if(firer.parentNode!=gBody()){
			submitForm(firer.parentNode);
		}
	}else{
		//process form
		var elemList = '';
		for(i=1;i<firer.parentNode.elements.length;i++){
			switch(firer.parentNode.elements[i].type){
				case "checkbox":
					elemList +=	firer.parentNode.elements[i].id +"=" + convertTrueFalse(firer.parentNode.elements[i].checked) +"&"
					break;
				default:
					elemList +=	firer.parentNode.elements[i].id +"=" + escape(firer.parentNode.elements[i].value) +"&"
					break;
			}	
		}
		elemList += "courseID=" + firer.parentNode.id.substr(firer.parentNode.id.lastIndexOf("_")+1);
		loadXMLDoc(firer.parentNode.elements[0].value,elemList);
		clearElements(firer.parentNode.parentNode.parentNode);
	}
}
function addQuiz(){
	editSyllabus("editSyllabus_" + arguments[0].substr(arguments[0].lastIndexOf("_")+1));
	newTestQuiz(arguments[0],2);
}
function addTest(){
	editSyllabus("editSyllabus_" + arguments[0].substr(arguments[0].lastIndexOf("_")+1));
	newTestQuiz(arguments[0],1);
}
function addSurvey(){
	editSyllabus("editSyllabus_" + arguments[0].substr(arguments[0].lastIndexOf("_")+1));
	newTestQuiz(arguments[0],3);
}
function newTestQuiz(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type;
	switch(arguments[1]){
		case 1:
			type="Test"		
		break;
		case 2:
			type="Quiz"
		break;
		case 3:
			type="Survey"
		break;
	}
	//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
	//var q
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");
	/*var cityStateZip = document.createElement("div");
	var userName = document.createElement("div");
	userName.id = "userName";
	userName.className = "elemGrp_NewLineLeft";
	userName.style.width ="95%";
	cityStateZip.id = "cityStateZip";
	cityStateZip.className = "elemGrp_NewLineLeft";
	cityStateZip.style.width="95%";*/
	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_test_quiz_add.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnCrseID","left","","none",arguments[0],null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnTstType","left","","none",arguments[1],null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"txtTestTitle","newLineleft",type + " Title","top",null,null,"txt",null,null,null,null,null,25,100);
	document.getElementById("txtTestTitle").focus();
	//createFormElem(frm.id,"txtMInitial","left","M.Initial","top",null,null,"txt",null,null,null,null,null,5,2);
	createFormElem(frm.id,"txtTestInstructions","newLineleft","Instructions","top",null,null,"txtArea",null,null,null,null,null,35,5);
	//createFormElem(frm.id,"txtPhone","newLineLeft","Phone Number","top",null,null,"txt",null,null,null,null,null,30,15);
	if(arguments[1]!=3){
		createFormElem(frm.id,"txtPoints","newLineLeft","Total Points Available","top",null,null,"txt",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","Points To Pass","top",null,null,"txt",null,null,null,null,null,55,250);
	}else{
		createFormElem(frm.id,"txtPoints","newLineLeft","","none","0",null,"hdn",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","","none","0",null,"hdn",null,null,null,null,null,55,250);
	}
	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
//createFormElem(frm.id,"txtAddress2","newLineLeft","Address2","top",null,null,"txt",null,null,null,null,null,55,250);
	/*frm.appendChild(cityStateZip);
	createFormElem("cityStateZip","txtZip","left","Zip","top",null,null,"txt",null,lookupCityState,null,null,null,12,10);
	createFormElem("cityStateZip","txtCity","left","City","top",null,null,"txt",null,null,null,null,null,25,250);
	createFormElem("cityStateZip","txtState","left","State","top",null,null,"txt",null,null,null,null,null,5,2);
	
	frm.appendChild(userName);
	createFormElem("userName","txtEmail","left","Email Address <br> (user id)","top",null,null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","txtPassword","left","<br>Password","top",rndmPassword(),null,"txt",null,null,null,null,null,30,200);*/
	
	//alert("HandleTitle_newQuiz" + arguments[0]);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New " + type ;
	
	frm = null;
	cityStateZip = null;
	//baseElem=null;
}
function EditTestInfo(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	//alert(arguments[0] + "|" + arguments[1]+ "|" + arguments[2]);
	var type;
	switch(arguments[1]){
		case 1:
			type="Test"		
		break;
		case 2:
			type="Quiz"
		break;
		case 3:
			type="Survey"
		break;
	}
	//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
	//var q
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");
	/*var cityStateZip = document.createElement("div");
	var userName = document.createElement("div");
	userName.id = "userName";
	userName.className = "elemGrp_NewLineLeft";
	userName.style.width ="95%";
	cityStateZip.id = "cityStateZip";
	cityStateZip.className = "elemGrp_NewLineLeft";
	cityStateZip.style.width="95%";*/
	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_test_info_update.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnTestID","left","","none",arguments[0],null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnTstType","left","","none",arguments[1],null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"txtTestTitle","newLineleft",type + " Title","top",null,null,"txt",null,null,null,null,null,25,100);
	document.getElementById("txtTestTitle").focus();
	//createFormElem(frm.id,"txtMInitial","left","M.Initial","top",null,null,"txt",null,null,null,null,null,5,2);
	createFormElem(frm.id,"txtTestInstructions","newLineleft","Instructions","top",null,null,"txtArea",null,null,null,null,null,35,5);
	//createFormElem(frm.id,"txtPhone","newLineLeft","Phone Number","top",null,null,"txt",null,null,null,null,null,30,15);
	if(arguments[1]!=3){
		createFormElem(frm.id,"txtPoints","newLineLeft","Total Points Available","top",null,null,"txt",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","Points To Pass","top",null,null,"txt",null,null,null,null,null,55,250);
	}else{
		createFormElem(frm.id,"txtPoints","newLineLeft","","none","0",null,"hdn",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","","none","0",null,"hdn",null,null,null,null,null,55,250);
	}
	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	loadXMLDoc("dynamicPages/lms_course_test_info_edit.asp","testid=" + arguments[0]);
//createFormElem(frm.id,"txtAddress2","newLineLeft","Address2","top",null,null,"txt",null,null,null,null,null,55,250);
	/*frm.appendChild(cityStateZip);
	createFormElem("cityStateZip","txtZip","left","Zip","top",null,null,"txt",null,lookupCityState,null,null,null,12,10);
	createFormElem("cityStateZip","txtCity","left","City","top",null,null,"txt",null,null,null,null,null,25,250);
	createFormElem("cityStateZip","txtState","left","State","top",null,null,"txt",null,null,null,null,null,5,2);
	
	frm.appendChild(userName);
	createFormElem("userName","txtEmail","left","Email Address <br> (user id)","top",null,null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","txtPassword","left","<br>Password","top",rndmPassword(),null,"txt",null,null,null,null,null,30,200);*/
	
	//alert("HandleTitle_newQuiz" + arguments[0]);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = currentTest.getEnglishType() + ": " + currentTest.title ;
	
	frm = null;
	cityStateZip = null;
	//baseElem=null;
}
function createQuestion(){
	var tstID = arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type="Question";
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");

	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_test_question_add.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnTstID","left","","none",tstID,null,"hdn",null,null,null,null,null,25,100);
	//alert(document.getElementById("container_questions_" + tstID).childNodes.length)
	if(currentTest.questions){
		createFormElem(frm.id,"hdnQuestionOrder","newLineleft","","none",currentTest.questions.length,null,"hdn",null,null,null,null,null,50,100);	
	}else{
		createFormElem(frm.id,"hdnQuestionOrder","newLineleft","","none",0,null,"hdn",null,null,null,null,null,50,100);	
	}
	createFormElem(frm.id,"cmbQuestionType","newLineleft",type + " Type","top",null,"qType","dd",null,null,null,null,null,25,100);
	document.getElementById("cmbQuestionType").focus();
	createFormElem(frm.id,"txtQuestionText","newLineleft","Question Text","top",null,null,"txtArea",null,null,null,null,null,50,15);	
	createFormElem(frm.id,"txtQuestionValue","newLineleft","Points For Correct","top",0,null,"txt",null,null,null,null,null,5,100);	

	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New Question";
	
	frm = null;
	cityStateZip = null;
}
function editQuestion(){
	var tstID = arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	
	var type="Question";
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	//alert(arguments[0]);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");

	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_test_question_update.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnQuestionID","left","","none",tstID,null,"hdn",null,null,null,null,null,25,100);
	//alert(document.getElementById("container_questions_" + tstID).childNodes.length)
	if(currentTest.questions){
		createFormElem(frm.id,"hdnQuestionOrder","newLineleft","","none",currentTest.questions.length,null,"hdn",null,null,null,null,null,50,100);	
	}else{
		createFormElem(frm.id,"hdnQuestionOrder","newLineleft","","none",0,null,"hdn",null,null,null,null,null,50,100);	
	}
	createFormElem(frm.id,"cmbQuestionType","newLineleft",type + " Type","top",null,"qType","dd",null,null,null,null,null,25,100);
	document.getElementById("cmbQuestionType").focus();
	createFormElem(frm.id,"txtQuestionText","newLineleft","Question Text","top",null,null,"txtArea",null,null,null,null,null,50,15);	
	createFormElem(frm.id,"txtQuestionValue","newLineleft","Points For Correct","top",0,null,"txt",null,null,null,null,null,5,100);	

	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New Question";
	loadXMLDoc("dynamicpages/lms_course_test_question_edit.asp","questionid=" + arguments[0]);
	frm = null;
	cityStateZip = null;
}
function qType(){
	loadXMLDoc("dynamicpages/lms_load_question_type.asp","itmid=" + arguments[0]);
}


function createAnswer(){
	var tstID = arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type="Answer";

	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");

	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_test_question_answer_add.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnQstnID","left","","none",tstID,null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnAnswerOrder","newLineleft","","none",document.getElementById("container_questionAnswers_" + tstID).childNodes.length,null,"hdn",null,null,null,null,null,50,100);	

	createFormElem(frm.id,"txtAnswerText","newLineleft","Answer Text","top",null,null,"txt",null,null,null,null,null,50,100);	
	createFormElem(frm.id,"chkAnswerCorrect","right","Correct","right","correct",null,"chk",null,null,null,null,null,5,100);		//createFormElem(frm.id,"txtTestInstructions","newLineleft","Instructions","top",null,null,"txtArea",null,null,null,null,null,35,5);

	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New Answer";

	frm = null;
	cityStateZip = null;
}
function editAnswer(){
	var tstID = arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type="Answer";

	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");

	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_test_question_answer_update.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnanswerID","left","","none",tstID,null,"hdn",null,null,null,null,null,25,100);
	//createFormElem(frm.id,"hdnAnswerOrder","newLineleft","","none",document.getElementById("container_questionAnswers_" + tstID).childNodes.length,null,"hdn",null,null,null,null,null,50,100);	

	createFormElem(frm.id,"txtAnswerText","newLineleft","Answer Text","top",null,null,"txt",null,null,null,null,null,50,100);	
	createFormElem(frm.id,"chkAnswerCorrect","right","Correct","right","correct",null,"chk",null,null,null,null,null,5,100);		//createFormElem(frm.id,"txtTestInstructions","newLineleft","Instructions","top",null,null,"txtArea",null,null,null,null,null,35,5);

	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New Answer";
	loadXMLDoc("dynamicPages/lms_course_test_question_answer_edit.asp","answerID=" + arguments[0]);
	frm = null;
	cityStateZip = null;
}
function setCorrect(){
	var elem = arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_test_question_answer_correct.asp","answerID=" + elem,"tutor=" + arguments[1]);
	elem = null;
}
function setCorrectStyle(id,correctAnswer,tutor,corrected){	
	currentTest.graded=false;
	currentTest.setCorrectAnswer(id,correctAnswer,tutor,corrected);

//	document.getElementById("container_answerCorrect_" + id).className = "container_answerCorrect_" + correctAnswer;
}
function moveQuestion(id,direction){
	var elem = 	id.substr(id.lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_test_question_move.asp","qID=" + elem,"dir=" + direction);
	elem = null;
}
/*function swapQuestions(q1,q2){
	var elem1 //= document.getElementById("container_question_" + q1);
	var elem2 //= document.getElementById("container_question_" + q2);
	/*var parent = elem1.parentNode;
	parent.insertBefore(elem1,elem2);
	if(currentTest.questions.length>1){
		elem1=-1;
		elem2=-1;
		for(i=0;i<currentTest.questions.length;i++){
			if(currentTest.questions[i].id==q1){
				elem1=i;
			}
			if(currentTest.questions[i].id==q2){
				elem2=i;
			}
		}

		if(elem1!=-1 && elem2!=-1){
			//alert(currentTest.questions[elem1].text + "->" + currentTest.questions[elem2].text);
			var tmp = currentTest.questions[elem1]
			currentTest.questions[elem1]=currentTest.questions[elem2];
			currentTest.questions[elem2]=tmp;
			tmp=null;
			//alert(currentTest.questions[elem1].text + "->" + currentTest.questions[elem2].text);
		}
		layoutEditTest()
	}
	elem1 = null;
	elem2 = null;
	parent = null;
}*/
function moveAnswer(id,direction){
	var elem = 	id.substr(id.lastIndexOf("_")+1);
	loadXMLDoc("dynamicpages/lms_course_test_question_answer_move.asp","aID=" + elem,"dir=" + direction);
	elem = null;
}

function deleteAnswer(id){
	if(confirm("Are you sure you want to delete this answer?")){
		var elem = 	id.substr(id.lastIndexOf("_")+1);
		loadXMLDoc("dynamicpages/lms_course_test_question_answer_delete.asp","aID=" + elem);
	}
}
function deleteQuestion(id){
	if(confirm("Are you sure you want to delete this question?")){
		
		var elem = 	id.substr(id.lastIndexOf("_")+1);
		loadXMLDoc("dynamicpages/lms_course_test_question_delete.asp","qID=" + elem);
		
	}
}
function deleteTest(id,type){
	if(confirm("Are you sure you want to delete this " + type + "?")){
		var elem = 	id.substr(id.lastIndexOf("_")+1);
		loadXMLDoc("dynamicpages/lms_course_test_delete.asp","tID=" + elem, "itmType="+type);
	}
}
function deleteAssignment(id){
	if(confirm("Are you sure you want to delete this assignment?")){
		var elem = 	id.substr(id.lastIndexOf("_")+1);
		loadXMLDoc("dynamicpages/lms_course_assignment_delete.asp","aID=" + elem);
	}
}
function editFire(){
	var elem = arguments[0].split("_");
	switch(elem[1]){
		case "Quiz":
			EditTestSurvey(elem[2],elem[1],document.getElementById(arguments[0]).innerHTML)
		break;
		case "Test":
			EditTestSurvey(elem[2],elem[1],document.getElementById(arguments[0]).innerHTML)
		break;
		case "Survey":
			EditTestSurvey(elem[2],elem[1],document.getElementById(arguments[0]).innerHTML)
		break;
		case "Assignment":
			EditAssignment(elem[2],elem[1],document.getElementById(arguments[0]).innerHTML)
		break;
	}
	elem = null;
}
/*function setActive(id){
	var elem= document.getElementById(id)

	if(elem.type=="radio"){
		var tmp = elem.length;
		alert(tmp);
		if(tmp!=undefined){
			alert(elem.id);
			elem[elem.length-1].checked=true;
		}else{
			elem.checked=true;
		}
	}
	elem = null;
}*/
function setActive(id) {
	var radioObj=document.getElementById(id);
	var parentObj = radioObj.parentNode.parentNode.parentNode;
	if(!radioObj)
		return;
	var radioLength = parentObj.elements.length;
	//alert(parentObj.elements[0].type);
	for(var i = 0; i < radioLength; i++) {
		if(parentObj.elements[i].type=="radio"){
			parentObj.elements[i].checked = true;			
		}
	}
}
function addAssignment(){
	editSyllabus("editSyllabus_" + arguments[0].substr(arguments[0].lastIndexOf("_")+1));
	newAssignment(arguments[0],2);
}
function newAssignment(){
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type="Assignment";
	//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
	//var q
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");
	/*var cityStateZip = document.createElement("div");
	var userName = document.createElement("div");
	userName.id = "userName";
	userName.className = "elemGrp_NewLineLeft";
	userName.style.width ="95%";
	cityStateZip.id = "cityStateZip";
	cityStateZip.className = "elemGrp_NewLineLeft";
	cityStateZip.style.width="95%";*/
	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_assignment_add.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnCrseID","left","","none",arguments[0],null,"hdn",null,null,null,null,null,25,100);
	//alert(document.getElementById("hdnCrseID").value);
	createFormElem(frm.id,"txtAssignmentTitle","newLineleft",type + " Title","top",null,null,"txt",null,null,null,null,null,25,100);
	document.getElementById("txtAssignmentTitle").focus();
	//createFormElem(frm.id,"txtMInitial","left","M.Initial","top",null,null,"txt",null,null,null,null,null,5,2);
	createFormElem(frm.id,"txtAssignmentInstructions","newLineleft","Instructions","top",null,null,"txtArea",null,null,null,null,null,35,5);
	//createFormElem(frm.id,"txtPhone","newLineLeft","Phone Number","top",null,null,"txt",null,null,null,null,null,30,15);
	if(arguments[1]!=3){
		createFormElem(frm.id,"txtPoints","newLineLeft","Total Points Available","top",null,null,"txt",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","Points To Pass","top",null,null,"txt",null,null,null,null,null,55,250);
	}else{
		createFormElem(frm.id,"txtPoints","newLineLeft","","none","0",null,"hdn",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","","none","0",null,"txt",null,null,null,null,null,55,250);
	}
	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
//createFormElem(frm.id,"txtAddress2","newLineLeft","Address2","top",null,null,"txt",null,null,null,null,null,55,250);
	/*frm.appendChild(cityStateZip);
	createFormElem("cityStateZip","txtZip","left","Zip","top",null,null,"txt",null,lookupCityState,null,null,null,12,10);
	createFormElem("cityStateZip","txtCity","left","City","top",null,null,"txt",null,null,null,null,null,25,250);
	createFormElem("cityStateZip","txtState","left","State","top",null,null,"txt",null,null,null,null,null,5,2);
	
	frm.appendChild(userName);
	createFormElem("userName","txtEmail","left","Email Address <br> (user id)","top",null,null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","txtPassword","left","<br>Password","top",rndmPassword(),null,"txt",null,null,null,null,null,30,200);*/
	
	//alert("HandleTitle_newQuiz" + arguments[0]);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New " + type ;
	
	frm = null;
	cityStateZip = null;
}
function EditAssignment(){	
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type="Assignment";
	//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
	//var q
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.5,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	contentWindow.style.height= "95%"
	//contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");
	/*var cityStateZip = document.createElement("div");
	var userName = document.createElement("div");
	userName.id = "userName";
	userName.className = "elemGrp_NewLineLeft";
	userName.style.width ="95%";
	cityStateZip.id = "cityStateZip";
	cityStateZip.className = "elemGrp_NewLineLeft";
	cityStateZip.style.width="95%";*/
	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_assignment_update.asp",null,"hdn",null,null,null,null,null,25,100);
	//createFormElem(frm.id,"hdnCrseID","left","","none",arguments[0],null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnAssignmentID","left","","none",arguments[0],null,"hdn",null,null,null,null,null,25,100);
	//alert(document.getElementById("hdnCrseID").value);
	createFormElem(frm.id,"txtAssignmentTitle","newLineleft",type + " Title","top",null,null,"txt",null,null,null,null,null,25,100);
	document.getElementById("txtAssignmentTitle").focus();
	//createFormElem(frm.id,"txtMInitial","left","M.Initial","top",null,null,"txt",null,null,null,null,null,5,2);
	createFormElem(frm.id,"txtAssignmentInstructions","newLineleft","Instructions","top",null,null,"txtArea",null,null,null,null,null,35,5);
	//createFormElem(frm.id,"txtPhone","newLineLeft","Phone Number","top",null,null,"txt",null,null,null,null,null,30,15);
	if(arguments[1]!=3){
		createFormElem(frm.id,"txtPoints","newLineLeft","Total Points Available","top",null,null,"txt",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","Points To Pass","top",null,null,"txt",null,null,null,null,null,55,250);
	}else{
		createFormElem(frm.id,"txtPoints","newLineLeft","","none","0",null,"hdn",null,null,null,null,null,55,250);
		createFormElem(frm.id,"txtPointsPass","newLineLeft","","none","0",null,"txt",null,null,null,null,null,55,250);
	}
	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	loadXMLDoc("dynamicPages/lms_course_assignment_load_edit.asp","assignmentID=" + arguments[0]);
//createFormElem(frm.id,"txtAddress2","newLineLeft","Address2","top",null,null,"txt",null,null,null,null,null,55,250);
	/*frm.appendChild(cityStateZip);
	createFormElem("cityStateZip","txtZip","left","Zip","top",null,null,"txt",null,lookupCityState,null,null,null,12,10);
	createFormElem("cityStateZip","txtCity","left","City","top",null,null,"txt",null,null,null,null,null,25,250);
	createFormElem("cityStateZip","txtState","left","State","top",null,null,"txt",null,null,null,null,null,5,2);
	
	frm.appendChild(userName);
	createFormElem("userName","txtEmail","left","Email Address <br> (user id)","top",null,null,"txt",null,null,null,null,null,30,200);
	createFormElem("userName","txtPassword","left","<br>Password","top",rndmPassword(),null,"txt",null,null,null,null,null,30,200);*/
	
	//alert("HandleTitle_newQuiz" + arguments[0]);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New " + type ;
	
	frm = null;
	cityStateZip = null;
	//newScriptElement("dynamicpages/lms_build_edit_syllabus.asp", "courseid=" + getObjID(arguments[0]), "title=" +  document.getElementById("btnGroupTitle_" + arguments[0]).parentNode.parentNode.parentNode.childNodes[0].innerHTML + " " + document.getElementById("btnGroupTitle_" + arguments[0]).innerHTML);	
}
function popExistData(elem,val){
	if(elem.substr(0,3)=="chk"){
		//alert("here");
		//alert(document.getElementById(elem).value + " " + val);
		if(val=="True"){
			
			document.getElementById(elem).checked=val;
		}
	}else{
		document.getElementById(elem).value=formQuoteReplace(val);
	}
}
function popAssignmentData(){
					document.getElementById('txtAssignmentTitle').value=formQuoteReplace(arguments[0]);
					document.getElementById('txtAssignmentInstructions').value=formQuoteReplace(arguments[1]);
					document.getElementById('txtPoints').value=formQuoteReplace(arguments[2]);
					document.getElementById('txtPointsPass').value=arguments[3].replace("&#39;","'");
}
function formQuoteReplace(val){
	var retval=val
	do {
		retval=retval.replace("&#39;","'");
	}while(retval.indexOf("&#39;")>-1)
	do {
		retval=retval.replace("<br>","\n");
	}while(retval.indexOf("<br>")>-1)
	return retval
}
function startAssignment(){
	if(!document.getElementById("btnGroupTitle_" + arguments[0]).disabled){		
		/*var head = document.getElementsByTagName('head').item(0);
		url="CSS/default_course_editor.css"
		q = document.getElementById("style");
		if(q){
			head.removeChild(q)
		}
		var s=document.createElement('link');
		sid = 'style'
		void(s.id = sid );
		void(s.rel='stylesheet');
		void(s.href=url +"?" + Date());
		void(s.type="text/css");
		void(head.appendChild(s));
		s = null;
		q=null;
		head = null;*/
		loadCSS("default_course_editor.css");
		var type="Assignment";
		//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
		//var q
		arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
		if(document.getElementById("window_ftp")){
			clearElements(document.getElementById("window_ftp"));
		}												  
		createObject("ftp", "New " + type, "lesson",  clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
		var contentWindow = document.createElement("div");
		document.getElementById("window_ftp").appendChild(contentWindow);
		//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
		contentWindow.id= "window_ftp" + "_content";
		contentWindow.className= "window_Editor_content";
		//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
		contentWindow.style.width= "100%"//clientWidth-192;
		var syllNum = arguments[0].toString();
		
		syllNum=syllNum.substr(syllNum.lastIndexOf("_")+1);
		loadXMLDoc("dynamicpages/lms_course_assignment_load.asp", "syllID=" + syllNum,"trgt=" + "window_ftp" + "_content","title=" + "HandleTitle_ftp");	
		syllID=syllNum;
	}
}
function tutorAssignment(){
	//if(!document.getElementById("btnGroupTitle_" + arguments[0]).disabled){		
		/*var head = document.getElementsByTagName('head').item(0);
		url="CSS/default_course_editor.css"
		q = document.getElementById("style");
		if(q){
			head.removeChild(q)
		}
		var s=document.createElement('link');
		sid = 'style'
		void(s.id = sid );
		void(s.rel='stylesheet');
		void(s.href=url +"?" + Date());
		void(s.type="text/css");
		void(head.appendChild(s));
		s = null;
		q=null;
		head = null;*/
		loadCSS("default_course_editor.css");
		var type="Assignment";
		//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
		//var q
		//arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
		if(document.getElementById("window_ftp")){
			clearElements(document.getElementById("window_ftp"));
		}												  
		createObject("ftp", "New " + type, "lesson",  clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
		var contentWindow = document.createElement("div");
		document.getElementById("window_ftp").appendChild(contentWindow);
		//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
		contentWindow.id= "window_ftp" + "_content";
		contentWindow.className= "window_Editor_content";
		//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
		contentWindow.style.width= "100%"//clientWidth-192;
		var syllNum = arguments[0].toString();
		
		syllNum=syllNum.substr(syllNum.lastIndexOf("_")+1);
		loadXMLDoc("dynamicpages/lms_course_assignment_load.asp", "syllID=" + syllNum,"trgt=" + "window_ftp" + "_content","title=" + "HandleTitle_ftp");	
		syllID=syllNum;
	//}
}
function findWindow(elemId){
	var elem = document.getElementById(elemId);
	var foundID;
	if(elem.parentNode.className!="dragWindow"){
		foundID=findWindow(elem.parentNode.id);
	}else{
		foundID = elem.parentNode.id;
	}
	return foundID;
}
function putFile(elemID){
	/*var head = document.getElementsByTagName('head').item(0);
		url="CSS/default_course_editor.css"
		q = document.getElementById("style");
		if(q){
			head.removeChild(q)
		}
		var s=document.createElement('link');
		var details;
		sid = 'style'
		void(s.id = sid );
		void(s.rel='stylesheet');
		void(s.href=url +"?" + Date());
		void(s.type="text/css");
		void(head.appendChild(s));
		s = null;
		q=null;
		head = null;*/
		loadCSS("default_course_editor.css");
		var type="Assignment";
		//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
		//var q
		details= arguments[0].split("|");
		if(document.getElementById("window_ftp")){
			clearElements(document.getElementById("window_ftp"));
		}												  
		createObject("ftp", "New " + type, "lesson",  clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
		var contentWindow = document.createElement("div");
		document.getElementById("window_ftp").appendChild(contentWindow);
		//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
		contentWindow.id= "window_ftp" + "_content";
		contentWindow.className= "window_Editor_content";
		//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
		contentWindow.style.width= "100%"//clientWidth-192;
		//alert(details[1]);
		if(details.length>9){
			//alert("here");
			loadXMLDoc("dynamicpages/lms_course_assignment_load_grade.asp", "courseID=" + details[1],"assignmentID=" + details[2],"fileName="+details[3],"trgt=" + "window_ftp" + "_content","title=" + "HandleTitle_ftp","close=1");
		}else{
			loadXMLDoc("dynamicpages/lms_course_assignment_load_grade.asp", "courseID=" + details[1],"assignmentID=" + details[2],"fileName="+details[3],"trgt=" + "window_ftp" + "_content","title=" + "HandleTitle_ftp","close=");	
		}
		//(target,uploadDir,fileName,x1,y1,w1,h1,title,directions,syllID,expected,gradePossible,dateCompleted)
		//syllID=syllNum;
}
function contCourse(){
	var elem =this.id.split("_")[2]
	document.getElementById("btnGroupTitle_syllabus_"+elem).onclick(1);
	for(var i=0;i<document.getElementById("btnGroupSubContain_syllabus_" +elem).childNodes.length;i++){
		if(document.getElementById("btnGroupSubContain_syllabus_" +elem).childNodes[i].childNodes[0].disabled){
			document.getElementById("btnGroupSubContain_syllabus_" +elem).childNodes[i-1].onclick();
			break;
		}
	//document.getElementById("btnGroupSubContain_syllabus_" +elem).childNodes[1].onclick();
	}
}
function addCourseDocs(){
	//alert("Kim this is comming soon...");
	/*var head = document.getElementsByTagName('head').item(0);
		url="CSS/default_course_editor.css"
		q = document.getElementById("style");
		if(q){
			head.removeChild(q)
		}
		var s=document.createElement('link');
		var details;
		sid = 'style'
		void(s.id = sid );
		void(s.rel='stylesheet');
		void(s.href=url +"?" + Date());
		void(s.type="text/css");
		void(head.appendChild(s));
		s = null;
		q=null;
		head = null;*/
		loadCSS("default_course_editor.css");
		var type="CourseDoc";
		//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
		//var q
		//alert(arguments[0]);
		details= arguments[0].split("|");
		if(document.getElementById("window_cdoc")){
			alert("Closing all file transfer sessions.");
			clearElements(document.getElementById("window_cdoc"));			
		}												  
		createObject("cdoc", "New " + type, "lesson",  clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
		var contentWindow = document.createElement("div");
		document.getElementById("window_cdoc").appendChild(contentWindow);
		//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
		contentWindow.id= "window_cdoc" + "_content";
		contentWindow.className= "window_Editor_content";
		//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
		contentWindow.style.width= "100%"//clientWidth-192;
		addCourseDoc(1,arguments[0].split("_")[1]);
		loadXMLDoc("dynamicpages/lms_course_document_manage.asp","courseID=" + arguments[0].split("_")[1]);

}
function addCourseDoc(editList,courseID,docID,fileName,dcNme,description){
	var mainContainer = document.getElementById("container_courseDocList");
	var parent = document.getElementById("window_cdoc" + "_content");
	if(!mainContainer){
		mainContainer=document.createElement("div");
		mainContainer.id = "container_courseDocList";
		parent.appendChild(mainContainer);		
		mainContainer.style.width=clientWidth-230 + "px";
		mainContainer.style.height=clientHeight-80 + "px";
		mainContainer.className="courseDoc_List";
		
		if(editList==1){
			var actionContainer = document.getElementById("courseDocActions" +courseID);
			if(!actionContainer){
				actionContainer= document.createElement("div");
				actionContainer.id="courseDocActions_"  + courseID
				actionContainer.className="courseDoc_Actions";
				actionContainer.onmousedown=fireContextMenu;
				mainContainer.appendChild(actionContainer);
				actionContainer.innerHTML="Course Documents (right click on this bar to add a new document).";
			}
		}else{
			var actionContainer = document.getElementById("courseDocActions" + courseID);
			var downloader = document.createElement("iframe")
			downloader.id="downLoader_" + courseID
			mainContainer.appendChild(downloader);
			downloader.className="downLoader";
			if(!actionContainer){
				actionContainer= document.createElement("div");
				actionContainer.id="courseDocActions_" + courseID
				actionContainer.className="courseDoc_Actions";
				mainContainer.appendChild(actionContainer);
				actionContainer.innerHTML="Course Documents (click any document to download).";
			}
		}
	}
	if(docID){
		var doc= document.getElementById("document_" + docID + "_" + fileName)
		if(!doc){
			doc= document.createElement("a");
			doc.id= "document_" + docID+ "_" + courseID + "_" + fileName;
			doc.href="#";
			doc.className="fileDoc";
			if(editList==1){
				doc.onmousedown=fireContextMenu;
			}else{
				doc.onmousedown=downloadDocument;
			}
			mainContainer.appendChild(doc);			
		}else{
			doc.innerHTML="";
		}
		var docName=document.createElement("div");
		docName.id="docName_" + courseID;
		docName.className="docName";
		docName.innerHTML=dcNme;
		doc.appendChild(docName);
		var dcDscrp=document.createElement("div");
		dcDscrp.id="docDescription_" + courseID;
		dcDscrp.innerHTML=description;
		doc.appendChild(dcDscrp);
		dcDscrp.className="docDescription";
		
	}	
	mainContainer=null;
	parent=null;
}
function downloadDocument(){
	//alert(this.id);
	var filePath= this.id.substr(this.id.indexOf("_")+1)//.substr(this.id.indexOf("_"))
	alert(filePath);
	filePath=filePath.substr(filePath.indexOf("_")+1);
	var courseID=filePath.substr(0,filePath.indexOf("_"));
	filePath="\\" + filePath.substr(filePath.indexOf("_")+1);
	alert(filePath +" " + courseID);
	var elem = document.getElementById("downLoader_" + courseID);
	alert(elem);
	elem.src="dynamicPages/downloadfile.asp?file="+ escape(filePath);
}
function fireAddDoc() {

    var course = arguments[0].split("_")[1]

    var companyID = document.getElementById("btnGroupTitle_" + course + "_admin");
    
    var newStr = companyID.innerHTML.split("-")
	companyID = companyID.innerHTML.split("-")[newStr.length-2].split("-")[0];
	//alert(companyID);
	var tstID =  arguments[0].split("_")[1];
	/*var head = document.getElementsByTagName('head').item(0);
	url="CSS/default_course_editor.css"
	q = document.getElementById("style");
	if(q){
		head.removeChild(q)
	}
	var s=document.createElement('link');
	sid = 'style'
	void(s.id = sid );
	void(s.rel='stylesheet');
	void(s.href=url +"?" + Date());
	void(s.type="text/css");
	void(head.appendChild(s));
	s = null;
	q=null;
	head = null;*/
	loadCSS("default_course_editor.css");
	var type="Document";
	arguments[0]= arguments[0].substr(arguments[0].lastIndexOf("_")+1);
	if(document.getElementById("window_new" + type + "_"+ arguments[0])){
		clearElements(document.getElementById("window_new" + type + "_"+ arguments[0]));
	}												  
	createObject("new" + type +  arguments[0], "New " + type, "lesson", clientWidth*.5,clientHeight*.6,200,60,fireCloseEditWin)
	var contentWindow = document.createElement("div");
	document.getElementById("window_new" + type + arguments[0]).appendChild(contentWindow);
	contentWindow.id= "window_new" + type + "_" + arguments[0] + "_content";
	contentWindow.className= "window_Editor_content";
	//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
	contentWindow.style.width= "100%"//clientWidth-192;
	var frm = document.createElement("form");

	frm.id = "newQuizForm_" + arguments[0];
	contentWindow.appendChild(frm);
	createFormElem(frm.id,"hdnTrgt","left","","none","dynamicpages/lms_course_document_add.asp",null,"hdn",null,null,null,null,null,25,100);
	createFormElem(frm.id,"hdnCourseID","left","","none",tstID,null,"hdn",null,null,null,null,null,25,100);

	createFormElem(frm.id,"txtFileName","newLineleft","File Name","top",null,null,"txt",null,null,null,null,null,50,500);	
	document.getElementById("txtFileName").focus();
	createFormElem(frm.id,"txtFileDescription","newLineleft","Description of file","top",0,null,"txtArea",null,null,null,null,null,50,10);	

	//createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Create " + type,"none",null,null,"btn",submitForm,null,null,null,null,30,200);
	document.getElementById("HandleTitle_new" + type +  arguments[0]).innerHTML = "New File";
	ftpInitCourseDoc(frm.id,companyID + "\\" + course + "\\courseDocs","",0,0,'80%','20%','','','','','','')
	createFormElem(frm.id,"btnSubmit"+ arguments[0],"newLineLeft","Upload " + type,"none",null,null,"btn",uploadCourseDoc,null,null,null,null,30,200);
	frm = null;
	cityStateZip = null;
}
function finishDocUpload(){
	alert("File Uploaded, close the form or upload another file.");
	document.getElementById("ftp").style.border="";
	document.getElementById("txtFileName").value="";
	document.getElementById("txtFileDescription").value="";
	loadXMLDoc("dynamicpages/lms_course_document_manage.asp","courseID=" + document.getElementByID("hdnCourseID"));
}
function uploadCourseDoc(){
	var ftpFrame=document.getElementById("ftp").contentWindow.document
	
	var uploadForm=ftpFrame.getElementById("file_upload");
	var uploadFile=ftpFrame.getElementById("File1");
	if(uploadFile.value!=""){
		if(document.getElementById("txtFileName").value!=""){
			var fileType=uploadFile.value.substr(uploadFile.value.lastIndexOf("."));
			var fileName=uploadForm.action.substr(uploadForm.action.indexOf("fileName=")+9);
			if(fileName==""){
				uploadForm.action+=document.getElementById("txtFileName").value + fileType;
			}
			//alert(uploadForm.action);
			var companyID= document.getElementById("btnGroupTitle_" + document.getElementById("hdnCourseID").value + "_admin");
			companyID=companyID.innerHTML.split("-")[1].split("-")[0];
			loadXMLDoc(document.getElementById("hdnTrgt").value,"hdnCrseID="+escape(document.getElementById("hdnCourseID").value),"fileName="+escape(companyID + "\\" + document.getElementById("hdnCourseID").value+ "\\courseDocs\\" +document.getElementById("txtFileName").value+ fileType),"docName="+escape(document.getElementById("txtFileName").value),"description=" +  escape(document.getElementById("txtFileDescription").value));
		}else{
			alert("You must enter a file name");
		}
		
	}else{
		alert("You must select a file to upload.")
		uploadFile.focus();
	}
}
function uploadFile(){
	var ftpFrame=document.getElementById("ftp")
	ftpFrame.style.border="5px solid red";
	var uploadForm=ftpFrame.contentWindow.document.getElementById("file_upload");
	var uploadFile=ftpFrame.contentWindow.document.getElementById("File1");
	uploadForm.submit();
}
function loadCourseDocs(){
	//alert("Kim this is comming soon...");
	arguments[0]=this.id
	/*var head = document.getElementsByTagName('head').item(0);
		url="CSS/default_course_editor.css"
		q = document.getElementById("style");
		if(q){
			head.removeChild(q)
		}
		var s=document.createElement('link');
		var details;
		sid = 'style'
		void(s.id = sid );
		void(s.rel='stylesheet');
		void(s.href=url +"?" + Date());
		void(s.type="text/css");
		void(head.appendChild(s));
		s = null;
		q=null;
		head = null;*/
		loadCSS("default_course_editor.css");
		var type="CourseDoc";
		//var baseElem=gBody();//document.getElementById(arguments[0].substr(arguments[0].indexOf("_")+1)).parentNode;
		//var q
		//alert(arguments[0]);
		details= arguments[0].split("|");
		if(document.getElementById("window_cdoc")){
			alert("Closing all file transfer sessions.");
			clearElements(document.getElementById("window_cdoc"));			
		}												  
		createObject("cdoc", "New " + type, "lesson",  clientWidth-192,clientHeight-38,190,37,fireCloseEditWin)
		var contentWindow = document.createElement("div");
		document.getElementById("window_cdoc").appendChild(contentWindow);
		//alert(document.getElementById("window_newQuiz"+arguments[0]).childNodes[1].childNodes[1].id);
		contentWindow.id= "window_cdoc" + "_content";
		contentWindow.className= "window_Editor_content";
		//contentWindow.style.height= "95%"
contentWindow.style.height=clientHeight-38-20; //clientHeight-38-15;
		contentWindow.style.width= "100%"//clientWidth-192;
		//addCourseDoc(1,arguments[0].split("_")[1]);
		//alert(arguments[0].split("_")[2])
		loadXMLDoc("dynamicpages/lms_course_document_load.asp","courseID=" + arguments[0].split("_")[2]);
}
function setGrade(){
	var mainargs= arguments[0].split("|");
	var courseID= mainargs[1];
	var syllId=mainargs[2];
	var userId=mainargs[3];

	userId=userId.split("_")[2];

	userId=userId.substr(0,userId.lastIndexOf("."));
	//alert(arguments[0]);
	//alert(syllID);
	//alert(userId);
	var grade = prompt("Please enter the grade for this file.",0);
	if(isNaN(parseInt(grade))){
	do {
		grade = prompt("We're sorry the grade must be a number. \n Please enter the grade for this file.",0);
	}while(isNaN(parseInt(grade)))
	}
	//alert(arguments[2]);
	/*alert(params[2]);
	alert(user[3]);*/
	loadXMLDoc("dynamicPages/lms_course_assignment_grade.asp","courseID=" + courseID,"assignmentID=" + syllId,"userEmail="+userId,"grade="+grade);
	//loadXMLDoc("dynamicPages/lms_course_assignment_grade.asp","courseID=" + params[1],"assignmentID=" + params[2],"userEmail="+user[3],"grade="+grade);
}
function getAnim(){
    switch(this.id){
        case "fireTrustedSites":
            fireAnim("gedforme/fileUpload/QMMTrustedSites.swf");
        break;
    }
}
function fireAnim(url){
	if(document.getElementById("animWindow")){
	    clearElements(document.getElementById("animWindow"));
	}
		//alert(slideNum);
		var tmpStr=new String(url);
		if(tmpStr.substr(0,4)!="http" && tmpStr.substr(0,4)!="ftp:" && tmpStr.substr(0,4)!="mail"){
			//tmpStr = "http://www.q-multimedia.com/" + lsnPlayers.params[0] + "/" + lsnPlayers.params[1] + "/" + lsnPlayers.params[3] + "/showme/" + tmpStr;
			tmpStr="http://www.q-multimedia.com/qview13_lms/consoles/flash/showme.swf?mvieURL=" + escape(tmpStr = "http://www.q-multimedia.com/" +  tmpStr) + "&" + new Date();
		}
		var target= gBody();
		var showMeWindow = document.createElement("div");
		target.appendChild(showMeWindow);
		showMeWindow.id="animWindow";
		//showMeWindow.style.display="none";
		showMeWindow.className="dragWindow";
		showMeWindow.style.position="absolute";
		/*
		var showMeHideFrame = document.createElement("iframe");
		showMeWindow.appendChild(showMeHideFrame);
		showMeHideFrame.className="hideFrame";
		showMeHideFrame.setAttribute("frameBorder","no");
		*/
		var showMeHandle = document.createElement("div");
		showMeWindow.appendChild(showMeHandle);
		showMeHandle.id="showMeHandle";
		showMeHandle.className="dragHandle";
		/*showMeHandle.onmousedown=startDrag;
		showMeHandle.onmouseup = clearDragging;*/
		//showMeHandle.ondblclick = maxWin;
		
		var btnClose = document.createElement("a");
		//var btnMax = document.createElement("a");
		//var btnMin = document.createElement("a");
		//var btnAnchor = document.createElement("a");
		var handleTitle= document.createElement("div");
		
		handleTitle.className = "dragHandleTitle";
		handleTitle.innerHTML="Show Me :: When you are finished click the close button to return to the presentation -->";
	
		//showMeHandle.appendChild(btnAnchor);
		showMeHandle.appendChild(handleTitle);
		showMeHandle.appendChild(btnClose);
		//showMeHandle.appendChild(btnMax);
		//showMeHandle.appendChild(btnMin);	
		handleTitle=null;
		//btnAnchor.href="#"
		//btnAnchor.alt="Anchor showMe";
		//btnAnchor.onmousedown=anchorWin;
		
		btnClose.href="#";
		btnClose.alt="Close showMe";
		btnClose.onmousedown=closeWin;
		
		//btnMax.href="#";
		//btnMax.alt="Maximize showMe";
		//btnMax.onmousedown=maxWin;
		
		//btnMin.href="#";
		//btnMin.alt="Minimize showMe";
		//btnMin.onmousedown=minWin;	
		
		btnClose.id = "showMeClose";
		//btnMax.id = "showMeMax";
		//btnMin.id = "showMeMin";
		//btnAnchor.id = "showMeAnchor";
		
		//btnAnchor.className="Anchor";
		btnClose.className = "Close";
		//btnMax.className = "Max";
		//btnMin.className = "Min";
		
		//btnAnchor = null;
		btnClose=null;
		//btnMax = null;
		//btnMin = null;
		
		showItem = document.createElement("object");
		showMeWindow.appendChild(showItem);
		showItem.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
		showItem.codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0";
		showItem.className="animFile";
		showItem.setAttribute("movie",tmpStr);
		showItem.id="showMe";
		
		maximizeWin(showMeWindow);
		showItem = null;
		showMeWindow = null;
		target=null;
		showMeHandle=null;

}