var myPopups
var windowNameDefault

function outLinks(){
	// setup link targets and link titles
	for (var i=0; i<=(document.links.length-1);i++){
		if((self.window.opener)&&(self.window.opener.name)&&(document.links[i].target=="")){
			if((document.links[i].className=="opener")||(document.links[i].href.indexOf(self.location.hostname)>-1)){
				document.links[i].target=self.window.opener.name
			}
		}else if((document.links[i].target=="")&&(document.links[i].href.indexOf(self.location.hostname)<0)){
			document.links[i].target="_blank"
		}
		if(document.links[i].title==""){
			if(document.links[i].href.indexOf("mailto:")>-1){
				document.links[i].title=document.links[i].href.split("?")[0].replace(/mailto:/g,"E-Mail an ")
			}else if((document.links[i].href.indexOf("http://")>-1)&&(document.links[i].href.indexOf(self.location.hostname)<0)){
				document.links[i].title="Externe Website"+(document.links[i].hostname!=""?": "+document.links[i].hostname:"")
			}
		}
	}
}

function replaceAll(theString,searchChar,newChar){
	return theString.split(searchChar).join(newChar)}

function deConfirm(msg){
	confBox=confirm(sChars(msg,"js"))
	return confBox}

function deAlert(msg){ 
	alert(sChars(msg,"js"))
}

function sChars(sct,mtyp){
	//	special character conversion for messages and javascript alerts
	aIn=new Array("(Oe)","(oe)","(Ae)","(ae)","(Ue)","(ue)","(Eg)","(eg)","(Ea)","(ea)","(Oc)","(oc)"," ")
	switch(mtyp){
		case "js":
		aOut=new Array("%d6","%f6","%c4","%e4","%dc","%fc","%c8","%e8","%c9","%e9","%d4","%f4"," ")
		break
		case "html":
		aOut=new Array("&Ouml;","&ouml;","&Auml;","&auml;","&Uuml;","&uuml;","&Egrave;","&egrave;","&Eacute;","&eacute;","&Ocirc;","&ocirc;"," ")
	}
	for(rL=0;rL<aIn.length;rL++){
		sct=replaceAll(sct,aIn[rL],aOut[rL])
	}
	if(mtyp=="js"){sct=unescape(sct)}
	return sct}


function p(ohref,fname,w,h,params){
	//	generic popup window launcher
	if((!self.window.name)&&(!self.window.opener)&&(windowNameDefault)){self.window.name=windowNameDefault}
	if(params==""){params=cWindows["options"][5]}
	h=h>(screen.availHeight*0.9)?screen.availHeight*0.9:h
	w=w>(screen.availWidth)?screen.availWidth:w
	windowPosition=centre_window(w,h)
	newWin=window.open(ohref,fname,params+',width='+Math.round(w)+',height='+Math.round(h)+",left="+windowPosition[0]+",top="+windowPosition[1])
	myPopups++
	return false
}

function centre_window(w,h){
	// calculate x,y positions for popup window to appear in the centre of the screen
	windims=new Array(
		Math.round((screen.availWidth-w)/2),
		Math.round(((screen.availHeight*0.9)-h)/2)
	)
	return windims
}

function popmedia(path,mediatype){
	w=(mediatype=="audio")?500:460
	h=(mediatype=="audio")?100:455
	options="menubar=0,location=0,toolbar=0,directories=0,status=1,resizable=1,scrollbars=0"
	return p(path,'zeitungmedia',w,h,options)
}

function eObj(oIn){
	//	mh 08/2004
	if(document.layers){return false}
	oBase=oIn?((typeof oIn).toLowerCase()=="object")?oIn:document.getElementById(oIn):new Object()
	if(oBase){
		oBase.path=oBase
		oBase.css=oBase.style	//	legacy compatibility
		//oBase.clip=clipIt
		//oBase.move=moveIt
		//oBase.moveto=moveTo
		//oBase.showhide=showHide
	}
	return oBase
}

function selValue(pField){
	return pField.options[pField.selectedIndex].value}

function dom_obj(id){
	//	abbreviated reference to element in document heirarchy by ID
	return document.getElementById(id)
}

function integer(n){
	//	avoid octal parsing
	//	(strings beginning with "0" are always parsed as octal numbers)
	return parseInt(n,10)
}

function getexpirydate(nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function getcookie(cookiename){
	var cookiestring=""+document.cookie;
	var index1=cookiestring.indexOf(cookiename);
	if(index1==-1 || cookiename==""){return "";}
	var index2=cookiestring.indexOf(';',index1);
	if(index2==-1){index2=cookiestring.length;}
	return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function setcookie(name,value,path,duration){
	cookiestring=name+"="+escape(value)+";PATH="+path+";EXPIRES="+getexpirydate(duration);
	document.cookie=cookiestring;
	if(!getcookie(name)){
		return false;
	}else{
		return true;
	}
}
