var enlargeAction=""
var noLesehilfe=0
var anzGalPics=0

function goTextEnlarge(index,subindex){
	if(noLesehilfe==0){
		if(typeof(m_TextEnlarge)!=="undefined"){
			if(m_TextEnlarge[2]>0){
				myWindowOpen("showtext.php?p=" + mainPart + "&m=" + mainSite +"&s=" + subSite + "&index=" + index + "&subindex=" + subindex,"","left=30px, top=30px, width=100px, height=100px, resizable")
			}
		}
	}
	else{
		alert("Für diese Darstellung steht keine Lesehilfe zur Verfügung.")
	}
}

function goPrintOut(index,subindex){
	myWindowOpen("printtext.php?p=" + mainPart + "&m=" + mainSite +"&s=" + subSite + "&index=" + index + "&subindex=" + subindex,"","left=30px, top=30px, width=420px, height=300px, scrollbars=1")
}

function setTextHead(){
	var HTMLstr=""
	if(sCon[2][1]!==""){
		HTMLstr+=drawDivPic("textHeadPic",m_TextHeadX,m_TextHeadY,m_TextHeadW,m_TextHeadH,'','',m_TextHeadBorderColor,m_TextHeadBorder,'','',"",0,'','','content/part' + mainPart + '/seite' + mainSite + '/bilder/' + sCon[2][1],"")
	}
	HTMLstr+=drawDiv("boxTextHead",m_TextHeadX,m_TextHeadY,m_TextHeadW,m_TextHeadH,'','',m_TextHeadBorderColor,m_TextHeadBorder,'',formatText(sCon[2][2]),'headText',1,'','overflow:hidden')
	return HTMLstr
}

function setTextBody(index){
	switch(index){
		case 0:return setTextBodyNorm();break
		case 1:return setTextBodyPiclist();break
		case 3:return setTextBodyLinklist();break
	}
}

function setTextBodyNorm(){
	var HTMLstr=""
	if(typeof(m_TextEnlarge)!=="undefined"){if(m_TextEnlarge[2]>0){
		HTMLstr=drawDivPic("textEnlargeBut",m_TextEnlarge[0],m_TextEnlarge[1],m_TextEnlarge[2],m_TextEnlarge[3],'','','',0,'hand','',"",0,'onclick="goTextEnlarge(0,0)"','','content/bilder/' + m_TextEnlarge[4],"Lesehilfe")
	}}		
	var durchschuss=""
	if(sCon[3][1]!==""){
		HTMLstr+=drawDivPic("textBodyPic",m_TextBodyX,m_TextBodyY,m_TextBodyW,m_TextBodyH,'','','',0,'','',"",0,'','','content/part' + mainPart + '/seite' + mainSite + '/bilder/' + sCon[3][1],"")
	}
	bH=m_TextBodyH
	isTab=0
	if(sCon[3][2]!==""){
		tabTest=sCon[3][2].split(/<br>/)
		if(tabTest[0].substr(0,8)=="§Tabelle"){isTab=1;abstand=16;bH=Math.floor(m_TextBodyH/abstand)*abstand}
	}	
	HTMLstr+=drawDiv("boxTextBodyBack",m_TextBodyX,m_TextBodyY,m_TextBodyW,bH,'','',m_TextBodyBorderColor,m_TextBodyBorder,'','',"",0,'','overflow:auto')
		anzGalPics=sCon[4].length
		if(anzGalPics>0 && (m_TextBodyGalAbst*1)!==0){
			w=((m_TextBodyW*1)-20-(m_TextBodyGalW*1)-(m_TextBodyGalAbst*1))
			if(m_TextBodyGalStand=="r"){x=0;picX=w+(m_TextBodyGalAbst*1)}else{x=(m_TextBodyGalW*1)+(m_TextBodyGalAbst*1);picX=0}
		}
		else{x=0;w=m_TextBodyW-20}
		if(w<31){vis="visibility:hidden"}else{vis=""}
		if(isTab==1){
			tabt=sCon[3][2].replace(/<br><br>/g,"<br> <br>");tabt=tabt.replace(/\~\~/g,"~ ~");tabtt=tabt.replace(/<br>/g,"|")
			tabTest=tabtt.split(/\|/)
			noLesehilfe=1
			ausr=["left","right","center"];padd=[";padding-left: 3px",";padding-right: 3px",""]
			tabSpalte=tabTest[0].split(/\~/);anzSpalten=tabSpalte.length-1
			var spaltenBreite=new Array;var spaltenAusrichtung=new Array;var spaltenPadding=new Array
			for(n=1;n<tabSpalte.length;n++){
				tabSpWert=tabSpalte[n].split(/\,/)
				spaltenBreite[n-1]=(tabSpWert[0]*1);spaltenAusrichtung[n-1]=ausr[(tabSpWert[1]*1)];spaltenPadding[n-1]=padd[(tabSpWert[1]*1)]
			}
			yy=0
			for(n=1;n<tabTest.length;n++){
				if(tabTest[n].substr(0,1)=="§"){
					xx=0
					tabT=tabTest[n].substr(1);tabText=tabT.split(/\~/)
					for(m=1;m<tabSpalte.length;m++){
						if(m==(tabSpalte.length-1)){bord=""}else{bord="border-right: 1px solid " + m_contentBodyPLHeadBackColor + ";"}
						HTMLstr+=drawDiv("tabItem" + n + "," + m,xx,yy,spaltenBreite[m-1],abstand,'',m_TextBodyFontColor,'',0,'',formatText(tabText[m-1],1,1,1,1,1,m_TextBodyFontColor),"bodyText",1,'',bord + 'text-align:' + spaltenAusrichtung[m-1] + spaltenPadding[m-1])
						xx=xx+spaltenBreite[m-1]
					}
					yy=yy+abstand
				}
				else{
					if(tabTest[n]!==" "){
						HTMLstr+=drawDiv("tabItem" + n,0,yy,m_TextBodyW-20,abstand,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'',formatText(tabTest[n],1,1,1,1,1,m_contentBodyPLHeadTextColor),"bodyText",1,'','font-weight: bold; padding-left: 3px')
					}
					yy=yy+abstand
				}
			}
		}
		else{
			HTMLstr+=drawDiv("boxTextBody",x,0,w-20,m_TextBodyH,'',m_TextBodyFontColor,'',0,'',formatText(sCon[3][2],1,1,1,1,m_TextBodyFontColor),"bodyText",1,'',durchschuss + ";" + vis)
			pfad="content/part" + mainPart + "/seite" + mainSite + "/bilder/"
			y=0
			if((m_TextBodyGalAbst*1)>0){
				for(n=0;n<anzGalPics;n++){
					y=y+(sCon[4][n][9]*1)
					HTMLstr+=drawPicEnlarge(picX,y,pfad,sCon[4][n][1],m_TextBodyGalW,sCon[4][n][8],sCon[4][n][3],sCon[4][n][6],sCon[4][n][5],0,'')
					y=y+(sCon[4][n][8]*1)
				}
				galPicH=y
			}
		}
	HTMLstr+="</div>"
			
	return HTMLstr
}

function setTextBodyPiclist(){
	if(typeof(a_randomList)=="undefined"){a_randomList=0}
	HTMLstr=""
	if(typeof(m_TextEnlarge)!=="undefined"){
		if(m_TextEnlarge[2]>0){
			HTMLstr=drawDivPic("textEnlargeBut",m_TextEnlarge[0],m_TextEnlarge[1],m_TextEnlarge[2],m_TextEnlarge[3],'','','',0,'hand','',"",0,'onclick="goTextEnlarge(1,0)"','','content/bilder/' + m_TextEnlarge[4],"Lesehilfe")
		}
	}	
	if(sCon[3][1]!==""){
		HTMLstr+=drawDivPic("textBodyPic",m_TextBodyX,m_TextBodyY,m_TextBodyW,m_TextBodyH,'','',m_TextBodyBorderColor,m_TextBodyBorder,'','',"",0,'','','content/part' + mainPart + '/seite' + mainSite + '/bilder/' + sCon[3][1],"")
	}	
	
	sh=m_contentBodyPLH+m_contentBodyPLAbstand
	anzPics=Math.floor((m_TextBodyH+m_contentBodyPLAbstand)/sh)
	h=anzPics*(m_contentBodyPLH+m_contentBodyPLAbstand)	
	
	if(orgPart==0 && orgMain==1 && orgSub==1){
		HTMLstr+=drawDiv("boxTextBodyAll",m_TextBodyX,m_TextBodyY,m_TextBodyW,h,'','#000000','',0,'','',"",0,'','overflow: auto')
			w=m_TextBodyW-20
			HTMLstr+=drawDiv("boxInnerText",0,0,w-2,100,'','#000000','',0,'','',"",0,'','')
				//lAnz=sCon[6].length
				lAnz=termin.length
				
				pfad="content/part" + mainPart + "/seite" + mainSite + "/bilder/"
				y=0;w=m_TextBodyW
				lTH=Math.floor((m_contentBodyPLH-18)/12)*12+2
				lTY=16+((m_contentBodyPLH-16)-lTH)/2;picW=0;		
				for(n=0;n<lAnz;n++){
					picW=0
					nr=n
					//if(a_randomList==1){nr=shuffleList[n]}else{nr=n}
					//if(sCon[6][nr][1]!==""){picW=65;tx=(m_contentBodyPLPicW*1+5);tw1=w-75-(m_contentBodyPLPicW*1)}else{tx=0;tw1=w-70}
					//tw2=tw1
					//if(sCon[6][nr][12]>0){tw1=tw1-30}				
					ww=450
					HTMLstr+=drawDiv("recBack" + n,0,y,ww,m_contentBodyPLH,'','','',1,"",'',"",0,'',"")
						//if(termin[nr][7]>0){tw2=tw2-62}
						if(sCon[6][n][1]!==""){
							HTMLstr+=drawPicEnlarge(0,0,pfad,sCon[6][n][1],m_contentBodyPLPicW,m_contentBodyPLH,sCon[6][n][3],sCon[6][n][6],sCon[6][n][5],0,'')
							picW=65
						}
						ww=450-picW
						HTMLstr+=drawDiv("recHead" + n,picW,0,ww,16,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'',sCon[6][n][10],'normTextBold',0,'',"padding-left: 3px; padding-right: 3px; padding-top: 1px; overflow: hidden; text-overflow: elippsis;")
						HTMLstr+='</div>'
						HTMLstr+=drawDiv("recBody" + n,picW,lTY,320-picW,lTH,"",m_TextBodyFontColor,'',1,"",formatText(sCon[6][n][11],1,1,1,1,m_TextBodyFontColor),'normText',1,'',"overflow:auto")
						
						if(termin[nr][7]==1){
							HTMLstr+=drawDivPic("osPoster" + n,400,lTY,44,62,'','','',0,'','','',1,'',"",'content/bilder/os_poster_klein.gif',"")
						}
						if(termin[nr][7]==2){
							HTMLstr+=drawDivPic("msWimpel" + n,400,lTY,44,62,'','','',0,'hand','','',1,'onclick="goStammtisch()"',"",'content/bilder/wimpel_klein.gif',"")
						}
						if(termin[nr][7]!=2){
							if(termin[nr][4]==""){
								HTMLstr+=drawDivPic("noMos" + n,320,1,76,44,'','','',0,'','','',1,'',"",'content/bilder/nomoos.gif',"")
							}
						}
						
					HTMLstr+='</div>'
					y=y+sh
				}
			HTMLstr+='</div>'
		HTMLstr+='</div>'
	}
	else{
		HTMLstr+=drawDiv("boxTextBodyAll",m_TextBodyX,m_TextBodyY,m_TextBodyW,h,'','#000000','',0,'','',"",0,'','overflow: auto')
			w=m_TextBodyW-20
			HTMLstr+=drawDiv("boxInnerText",0,0,w-2,100,'','#000000','',0,'','',"",0,'','')
				lAnz=sCon[6].length
				pfad="content/part" + mainPart + "/seite" + mainSite + "/bilder/"
				y=0;w=m_TextBodyW-20
				lTH=Math.floor((m_contentBodyPLH-18)/12)*12+2
				lTY=16+((m_contentBodyPLH-16)-lTH)/2			
				for(n=0;n<lAnz;n++){
					if(a_randomList==1){nr=shuffleList[n]}else{nr=n}
					if(sCon[6][nr][1]!==""){tx=(m_contentBodyPLPicW*1);tw1=w-(m_contentBodyPLPicW*1)}else{tx=0;tw1=w}
					tw2=tw1
					if(sCon[6][nr][12]>0){tw1=tw1-30}				
					HTMLstr+=drawDiv("recBack" + n,0,y,w-2,m_contentBodyPLH,'','','',1,"",'',"",0,'',"")
						if(sCon[6][nr][1]!==""){
							HTMLstr+=drawPicEnlarge(0,0,pfad,sCon[6][nr][1],m_contentBodyPLPicW,m_contentBodyPLH,sCon[6][nr][3],sCon[6][nr][6],sCon[6][nr][5],0,'')
						}
						HTMLstr+=drawDiv("recHead" + n,tx,0,tw1-2,16,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'',sCon[6][nr][10],'normTextBold',0,'',"padding-left: 3px; padding-right: 3px; padding-top: 1px; overflow: hidden; text-overflow: elippsis;")
							if(sCon[6][nr][13]!==""){
								if(sCon[6][nr][13].substr(0,4)=="http"){
									HTMLstr+=drawDiv("recHeadBut" + n,tw1-42,1,40,14,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'hand','www','normTextBold',1,'onclick="goListLink(\'' + sCon[6][nr][13] + '\')"',"text-align: center")
								}
								if(sCon[6][nr][13].substr(0,7)=="mailto:"){
									HTMLstr+=drawDiv("recHeadBut" + n,tw1-42,1,40,14,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'hand','@EMail','normTextBold',1,'onclick="goListEmail(\'' + sCon[6][nr][13].substr(7) + '\')"',"text-align: center")
								}							
							}
						HTMLstr+='</div>'
						HTMLstr+=drawDiv("recBody" + n,tx+3,lTY,tw2-3,lTH,"",m_TextBodyFontColor,'',1,"",formatText(sCon[6][nr][11],1,1,1,1,m_TextBodyFontColor),'normText',1,'',"overflow:auto")
						if(sCon[6][nr][12]>0){
							tText=["","mail","web"]
							if(sCon[6][nr][12]==1){action='onclick="goListEmail(\'' + sCon[6][nr][13]+ '\')"'}
							if(sCon[6][nr][12]==2){action='onclick="goListLink(\'' + sCon[6][nr][13]+ '\')"'}
							
							HTMLstr+=drawDiv("recAction" + n,tx+tw1+1,0,29,16,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'hand',tText[sCon[6][nr][12]],'normTextBold',1,action,"padding-top: 1px; text-align:center")
							
						}				
					HTMLstr+='</div>'
					y=y+sh
				}
			HTMLstr+='</div>'
		HTMLstr+='</div>'				
	}
	return HTMLstr
}

function setTextBodyLinklist(){
	if(typeof(a_randomList)=="undefined"){a_randomList=0}
	HTMLstr=""
	if(sCon[3][1]!==""){
		HTMLstr+=drawDivPic("textBodyPic",m_TextBodyX,m_TextBodyY,m_TextBodyW,m_TextBodyH,'','',m_TextBodyBorderColor,m_TextBodyBorder,'','',"",0,'','','content/part' + mainPart + '/seite' + mainSite + '/bilder/' + sCon[3][1],"")
	}	
	sh=m_contentBodyPLH+m_contentBodyPLAbstand
	anzPics=Math.floor(m_TextBodyH/sh)
	h=anzPics*(m_contentBodyPLH+m_contentBodyPLAbstand)
	HTMLstr+=drawDiv("boxTextBodyAll",m_TextBodyX,m_TextBodyY,m_TextBodyW,h,'','#000000','',0,'','',"",0,'','overflow: auto')
		w=m_TextBodyW-20
		HTMLstr+=drawDiv("boxInnerText",0,0,w,100,'','#000000','',0,'','',"",0,'','')
			lAnz=sCon[6].length
			pfad="content/part" + mainPart + "/seite" + mainSite + "/bilder/"
			y=0;w=m_TextBodyW-20
			lTH=Math.floor((m_contentBodyPLH-18)/12)*12+2
			lTY=16+((m_contentBodyPLH-16)-lTH)/2			
			for(n=0;n<lAnz;n++){
				if(a_randomList==1){nr=shuffleList[n]}else{nr=n}
				if(sCon[6][nr][1]!==""){tx=(m_contentBodyPLPicW*1);tw1=w-(m_contentBodyPLPicW*1)}else{tx=0;tw1=w}
				tw2=tw1
				if(sCon[6][nr][12]>0){tw1=tw1-30}				
				HTMLstr+=drawDiv("recBack" + n,0,y,w,m_contentBodyPLH,'','','',1,"",'',"",0,'',"")
					if(sCon[6][nr][1]!==""){
						HTMLstr+=drawPicEnlarge(0,0,pfad,sCon[6][nr][1],m_contentBodyPLPicW,m_contentBodyPLH,sCon[6][nr][3],'',sCon[6][nr][13],0,'')
					}
					action='onclick="goListLink(\'' + sCon[6][nr][13]+ '\')"'
					HTMLstr+=drawDiv("recHead" + n,tx,0,tw1,16,m_contentBodyPLHeadBackColor,m_contentBodyPLHeadTextColor,'',0,'hand',sCon[6][nr][10],'normTextBold',1,action,"padding-left: 3px; padding-right: 3px; padding-top: 1px; overflow: hidden; text-overflow: elippsis;")
					HTMLstr+=drawDiv("recBody" + n,tx+3,lTY,tw2-3,lTH,"",m_TextBodyFontColor,'',1,"hand",formatText(sCon[6][nr][11],1,1,1,1,m_TextBodyFontColor),'normText',1,action,"overflow:auto")

				HTMLstr+='</div>'
				y=y+sh
			}
		HTMLstr+='</div>'
	HTMLstr+='</div>'		
	return HTMLstr
}

function setTextPrivate(){
	var HTMLstr=""
	HTMLstr+=drawDiv("boxTextHeadBack",m_TextHeadX,m_TextHeadY,m_TextHeadW,m_TextHeadH,'','','',0,'','',"",0,'','border-bottom: 1px solid ' + m_TextHeadFontColor + '; overflow:hidden')
		HTMLstr+=drawDiv("boxTextHead",0,0,m_TextHeadW,m_TextHeadH,'',m_TextHeadFontColor,'',0,'',"Kundenbereich: " + cl_name,"normTextBold",1,'','')
	HTMLstr+="</div>"	
	if(s_contentSubType>10){
		return HTMLstr+=setEx()
	}
	HTMLstr+=drawDiv("boxTextBodyBack",m_TextBodyX,m_TextBodyY,m_TextBodyW,m_TextBodyH,'','','',0,'','',"",0,'','overflow:auto')
		y=0
		if(p_Text!==""){
			HTMLstr+=drawDiv("boxTextBodyLg0",0,y,m_TextBodyW-20,14,'',m_TextBodyFontColor,'',0,'','Nachricht:',"normTextBold",1,'','')
			HTMLstr+=drawDiv("boxTextBodyNews",0,y+16,m_TextBodyW-20,58,'',m_TextBodyFontColor,m_TextBodyFontColor,1,'',formatText(p_Text,1,1,1,1,m_TextBodyFontColor),"normTextBold",1,'','overflow:auto; padding-left:2px;')
			y=y+77	
		}
		if(p_Windows.length>0){
			HTMLstr+=drawDiv("boxTextBodyLg1",0,y,m_TextBodyW-20,14,'',m_TextBodyFontColor,'',0,'','Ihre persönlichen Seiten:',"normTextBold",1,'','')
			HTMLstr+=drawDiv("boxTextBodyWindows",0,y+16,m_TextBodyW-20,58,'',m_TextBodyFontColor,m_TextBodyFontColor,1,'','',"",0,'','overflow:auto;')
				y2=0
				for(n=0;n<p_Windows.length;n++){
					pL=p_Windows[n].split("\#")
					HTMLstr+=drawDiv("boxTextGoWin" + n,2,y2,m_TextBodyW-46,14,'',m_TextBodyFontColor,'',0,'hand',pL[0],"normTextBold",1,'onclick="goNewWin(\''+ pL[1] + '\')"','')
					y2=y2+14
				}
			HTMLstr+='</div>'
			y=y+77		
		}
		if(p_Downloads.length>0){
			HTMLstr+=drawDiv("boxTextBodyLg2",0,y,m_TextBodyW-20,14,'',m_TextBodyFontColor,'',0,'','Ihre persönlichen Downloads:',"normTextBold",1,'','')
			HTMLstr+=drawDiv("boxTextBodyWindows",0,y+16,m_TextBodyW-20,58,'',m_TextBodyFontColor,m_TextBodyFontColor,1,'','',"",0,'','overflow:auto;')
				y2=0
				for(n=0;n<p_Downloads.length;n++){
					pL=p_Downloads[n].split("\#")
					HTMLstr+=drawDiv("boxTextGoDownload" + n,2,y2,m_TextBodyW-46,14,'',m_TextBodyFontColor,'',0,'',pL[0],"normTextBold",1,'','')
					y2=y2+14
				}
			HTMLstr+='</div>'
		}		
	HTMLstr+='</div>'
	return HTMLstr
}

function goNewWin(url){
	myWindowOpen("client/" + cl_Dir + "/windows/" + url,"","")
}

function goListLink(url){
	myWindowOpen(url,"","")
}

function goListEmail(adr){
	emPic=myWindowOpen("email.php?emAd=" + adr,"","left=50px, top=50px, width=300px, height=400px")
}

function goListUpload(url){
}

