	useAjaxForList = 0;
	lastSelectedNodeCat=null;
	lastSelectedNode="";
	lastSelectedNode_2="";	
	lastSelectedNode_3="";
	lastSelectedNode_3_first=true;
	obxMMAlert = {
		"req_cat":"Du musst links eine Kategorie auswhlen!",
		"req_title":"Du musst einen Titel eingeben!",
		"req_text":"Du hast keinen Text geschrieben!"		
	};
	obxMMConfirm = {
		"block_post": "Die Anzeige dieses Beitrags verhindern?",
		"lock_post": "Die Bearbeitung dieses Beitrages sperren?",
		"unlock_post": "Post will be unlocked?"
	};
	function init_obxMMAlert(s){
		for (var i in s)
			obxMMAlert[i] = s[i];
	}
	function init_obxMMConfirm(s){
		for (var i in s)
			obxMMConfirm[i] = s[i];
	}
	
	
	function checkMandatoryFields(){
		var z=document.forms.myForm;
		if (z.editMode.value!='comment' && z.editMode.value!='continue' && (z.textCat.value=="" || z.textCat.value=="0")) { alert(obxMMAlert.req_cat); return false; }
		if (ValidationAPI.trim(z.title.value)=="") { alert(obxMMAlert.req_title); z.title.focus(); return false; }
		if (ValidationAPI.trim(z.bigEdit.value).replace(/<[^>]*>|&nbsp;/gi,"")=="") { alert(obxMMAlert.req_text); if (editor) editor.focusEditor(); return false; }
		return true;
		}	
	// like radiobutton	
	function setCheck(node,postfix,required){
		if (!postfix)  postfix=""; 
		if (lastSelectedNode_3_first && postfix=="_3"){
			var zValue=node.getAttribute("value");
			if (parseInt(zValue.split("^")[1])==1)
				lastSelectedNode_3 = node.parentNode.parentNode.nextSibling.childNodes[0].childNodes[0];
			else	
				lastSelectedNode_3 = node.parentNode.parentNode.previousSibling.childNodes[0].childNodes[0];
			lastSelectedNode_3_first = false;	
		}
		
		lastSelectedNodeName="lastSelectedNode"+postfix;
		if (required && window[lastSelectedNodeName]==node) return;
		
		if (node.getAttribute("status")==0){
			node.src="myGfx/checkOn"+postfix+".gif";
			node.setAttribute("status",1);
			if (window[lastSelectedNodeName]!="") setCheck(window[lastSelectedNodeName],postfix);			
								
			var zValue=node.getAttribute("value");
			if (zValue) document.forms.myForm[zValue.split("^")[0]].value=zValue.split("^")[1];
			window[lastSelectedNodeName]=node;
		}else{
			var zValue=node.getAttribute("value");
			if (zValue) document.forms.myForm[zValue.split("^")[0]].value="";
			node.src="myGfx/checkOff"+postfix+".gif";
			node.setAttribute("status",0);	
			window[lastSelectedNodeName]="";		
		}
	}
	// like checkbox
	function setCheckT(node,postfix){			
		if (!postfix)  postfix=""; 
		lastSelectedNodeName="lastSelectedNode"+postfix;
		if (node.getAttribute("status")==0)	{
			node.src="myGfx/checkOn"+postfix+".gif";
			node.setAttribute("status",1);
					
			var zValue=node.getAttribute("value"); 
			if (zValue) document.forms.myForm[zValue.split("^")[0]].value+=(zValue.split("^")[1]+",");
			window[lastSelectedNodeName]=node;
		}else{
			var zValue=node.getAttribute("value");
			var str="";
			if (zValue) a=(document.forms.myForm[zValue.split("^")[0]].value).split(",");
			for (var i=0; i<a.length-1; i++)
				if (a[i] != zValue.split("^")[1])
					str+=(a[i]+",");				
			
			if (zValue) document.forms.myForm[zValue.split("^")[0]].value=str;
			node.src="myGfx/checkOff"+postfix+".gif";
			node.setAttribute("status",0);	
			window[lastSelectedNodeName]="";	
		}
	}
	//also like  radios
	function setCheckA(node){
			if (lastSelectedNodeCat == node) return;
			if(lastSelectedNodeCat)
				lastSelectedNodeCat.src="myGfx/checkOff.gif";
			lastSelectedNodeCat = node;	
			
			node.src="myGfx/checkOn.gif";
			var zValue=node.getAttribute("value");
			if (zValue) document.forms.myForm[zValue.split("^")[0]].value=zValue.split("^")[1];
			if (!useAjaxForList)
				document.forms.myForm.submit();
			else {
				if (document.forms.myForm.pky.value=="0"){
					//load rows
					document.forms.myForm.search.value='';
					TableInstance.loadRows();
				}else{	
					//load details
					TableInstance.loadDetails();
				}	
			}	
	}
	function enableLeftArea(){
		document.getElementById("bgCategories").style.display="";		
		document.getElementById("infoCategories").style.display="";
	}
	function enableRightArea(){
		document.getElementById("bgEditor").style.display="";		
		document.getElementById("infoEditor").style.display="";
	}
	function enableCoolButton(){
		document.getElementById("coolButton").style.display="";		
	}
	function blockPost(n,k){
		if (!k) k=0;
		if (confirm(obxMMConfirm.block_post))
			window.frames.actionFrame.document.location.href="obxMyMoment.cfm?realAction=block&id="+n+"&wid="+k;
	}
	function lockPost(n){
		if (confirm(obxMMConfirm.lock_post))
			window.frames.actionFrame.document.location.href="obxMyMoment.cfm?realAction=lock&id="+n;
	}
	function unlockPost(n){
		if (confirm(obxMMConfirm.unlock_post))
			window.frames.actionFrame.document.location.href="obxMyMoment.cfm?realAction=unlock&id="+n;
	}
	
	
	
/* Table with ajax features in go by pages and submit of the form to get details */
function TableObject(id,ajaxPath){
	this.table = document.getElementById(id);
	this.ajaxPath = ajaxPath;
	this.fromPage = 1;
	this.toPage = 1;
	this.Reszier = null;
	var self = this;
	
	
	this.currentRowsObject = null;
	this.currentDetailsObject = null;
	
	
	this.getRowCount = null;
	this.loadRows = function(){
		this.removeRows();
	
		var post_vars = "ajax=load&";
		var f = document.forms.myForm;
		if (typeof this.getRowCount == 'function') f.recordsCount.value = this.getRowCount();
		for (var i=0; i<f.elements.length;i++)
			post_vars+=f.elements[i].name+"="+escape(f.elements[i].value)+"&";
		var xmlObject={};
		xmlObject.obj = this;
		xmlObject.oXmlLoader=new dtmlXMLLoaderObject(this.loadRows_callback,xmlObject,true,true);
		if (top.supermegadebuginformation)
			open(this.ajaxPath+"?"+post_vars);
		this.currentRowsObject = xmlObject;
		xmlObject.oXmlLoader.loadXML(this.ajaxPath+"?"+post_vars);
	};
	this.loadRows_callback=function(object){
		if (object.obj.currentRowsObject != object) return;
		
		var topnn = object.oXmlLoader.getXMLTopNode("data");
		
		var fromPage = parseInt(topnn.getAttribute("fromPage"));
		var toPage = parseInt(topnn.getAttribute("toPage"));
		var pageCount = parseInt(topnn.getAttribute("pageCount"));
		var srcPages = topnn.getAttribute("srcPages");
		var dsplBk = topnn.getAttribute("dsplBk");
		var dsplFf = topnn.getAttribute("dsplFf");
		var titleClick = topnn.getAttribute("titleClick");
		var titleSrc = topnn.getAttribute("titleSrc");
		if (titleSrc!="" && document.getElementById("smallBtnPrevLbl")) document.getElementById("smallBtnPrevLbl").src = "myGfx/onTheFly/"+titleSrc;
		if (document.getElementById("smallBtnPrev")) document.getElementById("smallBtnPrev").onclick=function(){eval(titleClick)};
		if (document.getElementById("smallLblPages")) document.getElementById("smallLblPages").src = "myGfx/onTheFly/"+srcPages;
		if (document.getElementById("smallBtnBack")) document.getElementById("smallBtnBack").style.display=dsplBk;
		if (document.getElementById("smallBtnForward")) document.getElementById("smallBtnForward").style.display=dsplFf;
		if (document.getElementById("topTitleRow")) document.getElementById("topTitleRow").style.display=(titleSrc==""?"none":"");
		
		var f = document.forms.myForm;
		f.fromPage.value =  fromPage;
		
		var items = topnn.getElementsByTagName("i");
		for (var i=0; i<items.length; i++){
			var node = items.item(i);
			var type = node.getAttribute("t");
			switch(type){
				case "rec":
					// v1, src2
					object.obj.addRow(type,node.getAttribute("v1"),node.getAttribute("src2"),node.getAttribute("checked"),node.getAttribute("alt"));
				break;
				case "title":
					//src1, src2
					object.obj.addRow(type,node.getAttribute("src1"),node.getAttribute("src2"),null,node.getAttribute("alt"));
				break;
			}
		}	

		self.currentRowsObject = null;
		object.obj.loadDetails();
	};
	this.addRow = function(type,param1,param2,checked,alt){
		var tr = this.table.insertRow(this.table.rows.length);
		alt = alt||"";
		switch(type){
				case "rec":
					// v1, src2
					var v1 = param1;
					var src2 = param2;
					tr.appendChild(document.createElement("TD"));
					tr.appendChild(document.createElement("TD"));	
					tr.childNodes[0].width="31px";
					tr.childNodes[0].innerHTML='<img class="myCheckBox" src="myGfx/checkOff.gif" width="26" height="20" value="'+v1+'" onclick="setCheckA(this)" status="0" alt="'+alt+'" title="'+alt+'">';
					tr.childNodes[1].align="left";
					tr.childNodes[1].style.textAlign="left";
					tr.childNodes[1].style.paddingTop="0px";
					tr.childNodes[1].width="100%";
					tr.childNodes[1].innerHTML='<img class="myCheckBox" src="myGfx/onTheFly/'+src2+'" onclick="setCheckA(this.parentNode.previousSibling.childNodes[0])" alt="'+alt+'" title="'+alt+'">';
					if (checked) setCheckA(tr.childNodes[0].firstChild);
				break;
				case "title":
					//src1, src2
					tr.appendChild(document.createElement("TD"));
					var src1 = param1;
					var src2 = param2;
					tr.childNodes[0].colSpan="2";
					if (src1!="")
						tr.childNodes[0].innerHTML='<img src="myGfx/onTheFly/'+src1+'" style="margin-left: 10px;margin-top: 0px;" border="0">';
					if (src2!="")	
						tr.childNodes[0].innerHTML+='<img src="myGfx/onTheFly/'+src2+'">';
				break;
		}
		
	};
	this.removeRows = function(){
		for (var i=this.table.rows.length-1; i>=0; i--)
			this.table.deleteRow(i);
	};
	
	this.addLoadingLayer = function(d){
		// create layer
		/*
		var div = document.createElement("DIV");
		div.style.position="absolute";
		div.style.zIndex=10000;
		div.style.width=d.offsetWidth+"px";
		div.style.height=d.offsetHeight+"px";;
		div.style.overflow="hidden";
		div.style.backgroundColor="black";
		div.style.filter="alpha(opacity=50)";
		div.style.MozOpacity="0.1";
		div.style.opacity="0.1";
		div.style.textAlign="center";
		*/
		d.innerHTML = '<div style="text-align:center"><img style="margin-top:20px" src="/sysModules/obxMyMoment/myGfx/loading.gif"/></div>'; 
		/*
		if (d.firstChild)
			d.insertBefore(div,d.firstChild);// = '<div style="width:100%;text-align:center;"><img src="/sysModules/obxMyMoment/myGfx/loading.gif"/></div>';
		else
			d.appendChild(div);
		*/	
	}
	this.currentDetail = 0;
	this.loadDetails = function(type,params){
		type=type||"";	
		params = params||{};
		var postfix = [];
		for (var i in params)
			postfix[postfix.length] = i+"="+params[i];
		var post_vars = "ajax=details&type="+type+"&";
		if (postfix.length)
			post_vars += postfix.join("&")+"&";
		var f = document.forms.myForm;
		if (type=="" && f.pky.value==this.currentDetail) return;
		this.currentDetail = f.pky.value;
		
		
		for (var i=0; i<f.elements.length;i++)
			post_vars+=f.elements[i].name+"="+escape(f.elements[i].value)+"&";
		var xmlObject=new Object();
		xmlObject.obj = this;
		this.currentDetailsObject = xmlObject;
		xmlObject.oXmlLoader=new dtmlXMLLoaderObject(this.loadDetails_callback,xmlObject,true,true);
		//open(this.ajaxPath+"?"+post_vars);
		
		this.addLoadingLayer(document.getElementById("mainTableDivRight"));
		xmlObject.oXmlLoader.loadXML(this.ajaxPath+"?"+post_vars);
	};
	this.loadDetails_callback = function(object){
		if (object.obj.currentDetailsObject != object) return;
		var topnn = object.oXmlLoader.getXMLTopNode("data");
		var content = topnn.firstChild.data||"";
		
		//execute the scripts inisde the content
		content = content.replace(/<script[^>]*>((\w|\W)*?)<\/script>/gi,function($1,$2){
			setTimeout(function(){try{eval($2);}catch(e){}},10);
			return "";
		});
		document.getElementById("mainTableDivRight").innerHTML = content;
		
	};
}



/////////////////////////////////////////
function hide(id){
	var d = document.getElementById(id);
	if (d) d.style.display='none';
	return false;
}
function showLastComments(){
	if (typeof TableInstance != "undefined") TableInstance.loadDetails("comments");
	return false;	
}
function showLastCommentsTeacher(){
	if (typeof TableInstance != "undefined") TableInstance.loadDetails("comments_teacher");
	return false;	
}
function showLastContinues(){
	if (typeof TableInstance != "undefined") TableInstance.loadDetails("continues");
	return false;	
}
function showTeacherNotes(onlyUnread){
	if (onlyUnread==undefined) onlyUnread = 0;
	var unread = parseInt(onlyUnread)?1:0;	
	if (typeof TableInstance != "undefined") TableInstance.loadDetails("teacher_notes",{unread:unread});
	return false;	
}
function readTeacherNotes(commentId){
	window.frames.actionFrame.document.location.href="obxMyMoment.cfm?realAction=readComment&id="+commentId;
}