var isPraCode
var preFix
var sendActive=0

if(b_type!==1){
	document.captureEvents(Event.KEYUP)
	document.onkeyup = editTestKey
}

function setEdit(){
	if(s_contentType==15){isPraCode=1;preFix="~client_"}else{isPraCode=0;preFix=""}
	reText=""
	if(typeof a_exEditor == 'undefined'){a_exEditor=1}
	reText+=drawDivPic("editBut",m_editX,m_editY,m_editW,m_editH,"",'','',1,'hand','','',1,'onClick="goEdit()" onmouseover="activateSend(1)" onmouseout="activateSend(0)"','','content/bilder/' + m_edit,"")
	vis=["visibility: hidden",""]
	reText+=drawDiv("keyWord",m_editInX,m_editInY,100,16,"",'','',1,"","","",0,"",vis[isPraCode])
		reText+='<input type="password" name="pass" id="pass" class="normTextBold" style="font-family: Small Fonts; font-size: 6pt; font-weight: bold; width: 100px; height: 14px; border: 1px solid #000000; background-color: #ffffff; color: #000000; " maxlength="16" onkeyup="editTestKey(window.event)" onblur="closeEdit()">'
	reText+='</div>'
	return reText
}

function activateSend(index){
	sendActive=index
}

function closeEdit(){
	document.getElementById('keyWord').style.visibility="hidden"
	isPraCode=sendActive
}

function goEdit(){
	if(isPraCode==0){
		document.getElementById('keyWord').style.visibility="visible"
		isPraCode=1
		if(typeof clientCookieCheck !== 'undefined'){
			if(ret){
				document.getElementById("pass").value=ret
			}
		}		
		document.getElementById('pass').focus()
	}
	else{
		if(document.getElementById('pass').value==""){
			document.getElementById('pass').value=""
			isPraCode=0
			document.getElementById('keyWord').style.visibility="hidden"
		}
		else{
			kw=document.getElementById('pass').value
			if(preFix==""){
				if(kw.substr(0,1)=="#"){
					kw=kw.substr(1)
					cursorAllWait()
					self.location="seite.php?p=" + mainPart + "&m=" + mainSite + "&s=" + subSite + "&clEx1=" + clEx1 + "&clEx2=" + kw
					return false
				}
				else{
					closeAllWins()
					closeWin(winEdit)

					if(typeof clientCookieCheck !== 'undefined'){
						if(!ret){
							if(confirm("Wenn Sie möchten, dass Ihr Passwort als Cookie auf Ihrem Rechner gespeichert wird" + crlf + "und Sie damit beim nächsten Aufruf dieser Seite keine Passwort-Eingabe mehr machen brauchen," + crlf + "klicken Sie auf \"OK\".")){
								setCookie("mwClientPW",document.getElementById("pass").value)
							}
						}
						else{
							setCookie("mwClientPW",document.getElementById("pass").value)
						}						
					}
					winEdit=myWindowOpen("edit.php?me=" + kw,"","left=" + (screen.width-350)/2 + "px, top=" + (screen.height-250)/2 + "px, width=350px, height=250px, resizable")
					document.getElementById('pass').value=""
					isPraCode=0
					return false
				}
			}
			else{
				cursorAllWait()
				self.location='seite.php?p=' + mainPart + '&m=' + mainSite + '&s=' + subSite + '&me=' + preFix + kw + "&exAct=" + language
			}			
		}
	}
}

function editTestKey(ekey){
	if (ekey.keyCode == 13){goEdit()}
}

