var crlf=String.fromCharCode(13,10)
var lookBackColor="e7e7e7";var lookForeColor="000000";var lookBoxBackColor="666666";var lookBoxForeColor="ffffff";
var picEnlargeNr=0
var bodyOverflowEx="";if(b_sys==0){if(b_type==1){bodyOverflowEx="overflow: auto;"}}
var mw_rot="#D55E61"
var mw_gruen="#8BB57D"
var mw_blau="#6B75C7"
var mw_dklblau="#394980"
var mw_gelb="#FF9933"
var mw_oliv="#C2C76B"
var mw_grau="#CCCCCC"

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function drawDiv(name,x,y,w,h,backCol,foreCol,borderCol,bordW,cur,t,fontFam,cl,ext,styleEx){
	if(b_sys==100){
		if (b_type!==1){
			pos=styleEx.indexOf("padding")
			if(pos>-1){
				tmpStr=styleEx.substr(pos);	pos=tmpStr.length;pos2=tmpStr.indexOf("\;");
				pEnd=pos;if(pos2>-1){if(pos2<pos){pEnd=pos2}};tmpStr=tmpStr.substr(0,pEnd)
				tPart=tmpStr.split("-");tP=tPart[1].split(":")
				if(tP[0]=="left" || tP[0]=="right"){tP[1]=tP[1].replace(/px/,"");offsetW=(tP[1]*1);w=w-offsetW}
			}
		}
	}
	
	if (cur!==""){
		if(b_sys==0){
			if(b_type!==1){if(cur=="hand"){cur="cursor: pointer;"}}
			else{cur="cursor: " + cur + ";"}
		}
		else{if(cur=="hand"){cur="cursor: pointer;"}}
	}
	else{cur="cursor: default;"}
	
	if(backCol!==""){
		if(backCol.substr(0,1)=="#"){backC="background-color: " + backCol + ";"}
		else{backC="background-image: url(" + backCol + ");"}
	}
	else{backC=""}
	if(b_sys==0){
		if ((b_type!==1) &&  borderCol!==""){w=w-(bordW*2);h=h-(bordW*2);}
	}
	
	if(borderCol!==""){bord='border: ' + bordW + 'px solid ' + borderCol + ';'}else{bord=''}
	if(cl==1){clTag="</div>"}else{clTag=""}
	re='<div id="' + name + '" class="' + fontFam + '" style="position:absolute; margin: 0px; width:' + w + 'px; height:' + h + 'px; z-index:3; left: ' + x + 'px; top: ' + y + 'px; color: ' + foreCol + '; ' + bord + cur + backC + styleEx + '" ' + ext + '>' + t + clTag
	return re
}

function drawDivPic(name,x,y,w,h,backCol,foreCol,borderCol,bordW,cur,t,fontFam,cl,ext,styleEx,pic,alt){
	if (cur!==""){
		if(b_sys==0){
			if(b_type!==1){if(cur=="hand"){cur="cursor: pointer;"}}
			else{cur="cursor: " + cur + ";"}
		}
		else{if(cur=="hand"){cur="cursor: pointer;"}}
	}
	else{cur="cursor: default;"}	
	
	
	var re=""
	re+=drawDiv(name,x,y,w,h,backCol,foreCol,borderCol,bordW,cur,t,fontFam,0,ext,styleEx)
	if(borderCol!==""){w=w-(bordW*2);h=h-(bordW*2)}
	re+='<img name="pic' + name + '" id="pic' + name + '" src="' + pic + '" width="' + w + 'px" height="' + h + 'px" galleryimg="no" style="position: absolute; left: 0px; top:0px; ' + cur + ' " alt="' + alt + '">'
	re+='</div>'
	return re
}

function drawPicEnlarge(x,y,pfad,normPic,w,h,largePic,t,a,b,bColor,behav){
	HTMLstr=""
	ex="";cur=""
	a=a.toLowerCase()
	if(largePic==""){
		if(a.substr(0,5)=="http:"){
			ex='onClick="goPicWebSite(\'' + a + '\')"';cur="hand";a="Link zu " + a
		}
		else if(a.substr(0,7)=="mailto:"){
			a=a.substr(7);ad=a.replace(/@/,"qpßqp");b=a.split(/@/);a=b[0]
			ex='onClick="goPicEMail(\'' + ad + '\')"';cur="hand";a="EMail an " + a
		}
		else if(a.substr(0,7)=="gosite:"){
			a=a.substr(7);b=a.split(/\,/)
			b[0]=((b[0]-1)*1);b[1]=((b[1])*1)
			if(b[0]<1){b[0]=0};if(b[1]<1){b[1]=0}
			ex='onClick="goSelfSite(' + b[0] + ',' + b[1] + ')"';cur="hand";a="Zur Seite " + (b[0]+1) + "," + (b[1])
		}
		else if(a.substr(0,6)=="gowin:"){
			a=a.substr(6);
			ex='onClick="goPicWebWin(\'' + a + '\')"';cur="hand";a="Link zu " + a
		}
	}
	else{
		t=t.replace(/'/g,"\\'");a=a.replace(/'/g,"\\'")
		ex='onClick="goPicView(\'' + pfad + largePic + '\',\'' + t + '\',\'' + a + '\')"';cur="hand";a="Zum Vergrössern anklicken"
	}
	if(b>0){borderColor=bColor;divWidth=w+(b*2);divHeight=h+(b*2)}else{borderColor="";divWidth=w;divHeight=h}
	HTMLstr+=drawDiv("picEnlarge" + picEnlargeNr,x,y,divWidth,divHeight,"",'',borderColor,b,cur,"","",0,ex + " " + behav,"")
		HTMLstr+='<img src="' + pfad + normPic + '" width="' + w + '" height="' + h + '" galleryImg="no" alt="' + a + '">'
	HTMLstr+='</div>'
	picEnlargeNr++
	return HTMLstr
}

function goPicView(p,t,a){
	if(t!==""){t="&pictext=" + t}
	if(a!==""){a="&picauthor=" + a}
	//closeAllWin()
	pictureWindow=myWindowOpen("showpicture.php?c1=" + lookBackColor + "&c2=" + lookForeColor + "&c3=" + lookBoxBackColor + "&c4=" + lookBoxForeColor + "&picPath=" + p + t + a,"","width=100px , height=100px, left=50px, top=50px, scrollbar=none")
}
function goPicWebSite(url){
	myWindowOpen(url,"","")
}
function goPicWebWin(url){
	myWindowOpen(url,"","left=10px, top=10px, width=300px, height=300px")
}
function goPicEMail(adr){
	emPic=myWindowOpen("email.php?emAd=" + adr,"","left=50px, top=50px, width=300px, height=400px")
}
function goSelfSite(m,s){
	self.location="seite.php?p=" + mainPart + "&m=" + m  + "&s=" + s
}
function drawInputBox(n,x,y,w,t,l,val,ex){
	HTMLst=""
	if(b_sys==0 && b_type!==1){y=y+1}
	if(t!==""){
		HTMLst+='<div id="' + n + 'Text" class="normTextBold" style="font-weight: bold; position:absolute; width:' + w + 'px; height:16px; z-index:0; left: ' + x + 'px; top: ' + y + 'px;">' + t + '</div>'
		y=y+12
	}
	HTMLst+='<div id="' + n + 'Back" style="position:absolute; width: ' + w + 'px; height: 19px; left: ' + x + 'px; top: ' + y + 'px; z-index:10"><input type="text" name="' + n + '" id="' + n + '" class="normTextBold" style="border: 1px solid #000000; background-color: #ffffff; color: #000000;  width: ' + w + 'px; height: 18px;" maxlength="' + l + '" value="' + val + '" ' + ex + '></div>'
	return HTMLst
}

function centerStartDiv(ex,w,h){
	obj=document.getElementById("allBack")
	allX=0
	if(ex==1 || ex==3){
		if(window.innerWidth){allX = (window.innerWidth - w) / 2}
		else{
			allX=(document.body.offsetWidth-w-4)/2
		}
		if(allX<0){allX=0};allX=Math.floor(allX)
	}
	allY=0
	if(ex==2 || ex==3){	
		if(window.innerHeight){allY = (window.innerHeight - h) / 2}
		else{
			allY=(document.body.offsetHeight-h-4)/2
		}
		if(allY<0){allY=0};allY=Math.floor(allY)		
	}
	obj.style.left=allX;obj.style.top=allY;//obj.style.height=hoehe+20
	obj.style.visibility="visible"
	privateResize()
}

function resizeMyWin(innerW,innerH,doCenter){
	if(b_sys==0){
		window.resizeTo(300,300)
		if(b_type!==1){xOff=300-window.innerWidth;yOff=300-window.innerHeight}
		else{xOff=304-document.body.offsetWidth;yOff=304-document.body.offsetHeight}
		window.resizeTo(innerW+xOff,innerH+yOff)
		if(doCenter==1){window.moveTo((screen.width-(innerW+xOff))/2,(screen.height-(innerH+yOff))/2)}
	}
	else{
		window.resizeTo(300,300)
		if(window.innerWidth){xOff=300-window.innerWidth;yOff=300-window.innerHeight}
		else{xOff=16;yOff=30}
		//else{xOff=304-document.body.offsetWidth;yOff=304-document.body.offsetHeight;alert("offsetWidth=" + document.body.offsetWidth)}
		window.resizeTo(innerW+xOff,innerH+yOff)
		if(doCenter==1){window.moveTo((screen.width-(innerW+xOff))/2,(screen.height-(innerH+yOff))/2)}			
	}
}

function myWindowOpen(target,titel,params){
	winEx=""
	if(aol_type==1 && params!=""){winEx=" scrollbars=yes, resizable=yes"}
	winRet=window.open(target,"",params + winEx)
	return winRet
}

function closeWin(win){
	if(win){if(!win.closed){win.close()}}
}

function cursorAllWait(){
	if(b_sys==0){if(b_type==1){
		for(n=0;n<document.all.length;n++){
			document.all(n).style.cursor="wait"
		}
	}}
}

function getCookie(name){
	var arg = name + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;
	while (i < clen) {
   		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
    		i = document.cookie.indexOf(" ", i) + 1;
    		if (i == 0)
       			break;
		}
	return null;
}

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
    	if (endstr == -1)
     		endstr = document.cookie.length;
     		return unescape(document.cookie.substring(offset, endstr));
}

function setCookie (name, value) {  
        //alert (value)
	var argv =setCookie.arguments;
        var argc = setCookie.arguments.length;

	var expires = new Date();
	expires.setTime(expires.getTime() + (24*60*60*365*1000));       
	var path = (argc > 3) ? argv[3] : null;  
        var domain = (argc > 4) ? argv[4] : null;  
        var secure = (argc > 5) ? argv[5] : false;  
        
	document.cookie = name + "=" + escape (value) + 
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
        ((path == null) ? "" : ("; path=" + path)) +  
        ((domain == null) ? "" : ("; domain=" + domain)) +    
        ((secure == true) ? "; secure" : "");
}
function deleteCookie (name, value) {  
        //alert (value)
	var argv =deleteCookie.arguments;
        var argc = deleteCookie.arguments.length;

	var expires = new Date();
	expires.setTime(expires.getTime() - 1);       
	var path = (argc > 3) ? argv[3] : null;  
        var domain = (argc > 4) ? argv[4] : null;  
        var secure = (argc > 5) ? argv[5] : false;  
        
	document.cookie = name + "=" + escape (value) + 
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
        ((path == null) ? "" : ("; path=" + path)) +  
        ((domain == null) ? "" : ("; domain=" + domain)) +    
        ((secure == true) ? "; secure" : "");
}

function trim(t){
	v=0
	for(nn=0;nn<t.length;nn++){if(t.charAt(nn)==" "){v++}else{break}}
	if(v>0){t=t.substr(v)}
	v=0
	for(nn=(t.length-1);nn>-1;nn--){if(t.charAt(nn)==" "){v++}else{break}}	
	if(v>0){t=t.substr(0,(t.length-v))}
	return t
}

function checkUrl(t){
	t=t.toLowerCase()
	if(t.indexOf("http://")!==0 && t.indexOf("https://")!==0){
		if(t.indexOf("ww")<0){
			t="www." + t
		}
		t="http://" + t
	}
	return t
}


function checkEmail(emailStr){
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	
	if(matchArray==null){return false;}
	var user=matchArray[1];
	var domain=matchArray[2];
	
	for(i=0; i<user.length; i++){if(user.charCodeAt(i)>127){return false;}}
	for(i=0; i<domain.length; i++){if(domain.charCodeAt(i)>127){return false;}}
	if(user.match(userPat)==null){return false;}
	var IPArray=domain.match(ipDomainPat);
	if(IPArray!=null){for(var i=1;i<=4;i++){if(IPArray[i]>255){return false;}}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for(i=0;i<len;i++){if (domArr[i].search(atomPat)==-1){return false;}}
	if(checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1){return false;}
	if(len<2){return false;}
	return true;
}

function getFileName(t){
	pos=t.lastIndexOf("\/")
	if(pos>-1){t=t.substr(pos+1);if(t=="trans.gif"){t=""};t=testedFileName(t);return t}
	pos=t.lastIndexOf("\\")
	if(pos>-1){t=t.substr(pos+1);if(t=="trans.gif"){t=""};t=testedFileName(t);return t}
	t=testedFileName(t);return t	
}

function goWebmaster(){
	alert("Noch nicht eingebaut.")
}
function goMediworkx(){myWindowOpen("http://www.mediworkx.de","","")}

function goSponsors(url){if(url!==""){myWindowOpen(url,"","")}}

function goWebEx(url){if(url!==""){myWindowOpen(url,"","")}}

function testedFileName(fN){
	fN=fN.toLowerCase()
	fN=fN.replace(/ /g,"_")
	fN=fN.replace(/\ä/g,"ae")
	fN=fN.replace(/\ö/g,"oe")
	fN=fN.replace(/\ü/g,"ue")
	fN=fN.replace(/\ß/g,"ss")
	return fN
}

function setObj(oN,oENr,oWNr,oE,oW){
	var objE=[oE,"style.visibility","style.left","style.top","style.width","style.height","style.backgroundColor","style.color","innerText"]
	var objW=[oW,"visible","hidden"]
	eval('document.getElementById("' + oN + '").' + objE[oENr] + "=" + objW[oWNr])
	
}
