overIconsLoaded=false

function preloadImages(){
    var myimages=new Array()
    for (i=0; i < preloadimages.arguments.length; i++){
    	
         myimages[i]=new Image()
         myimages[i].src=preloadimages.arguments[i]
    }
} 

function switchImgOn( name, path ) {
	if( isLoaded ){
		if( !document.images ) return null
		over_name=name+"_over"

		document.getElementById(name).src = path
	}
	return false
}

function switchImgOff( name, path ) {
	if( isLoaded ){
		if( !document.images ) return null
		over_name=name+"_over"

		document.getElementById(name).src = path
	}
	return false
}

function switchOn( name ) {
	if( isLoaded ){
		if( !document.images ) return null
		over_name=name+"_over"
		
		if( !document.getElementById(name) ) 
			name=name.substring( 0, name.length-1 )
		
		document.getElementById(name).src = document.getElementById(over_name).src
	}
	return false
}

function switchOff( name ) {
	if( isLoaded ){
	var pos, type, src, oSrc
	var x=0
	if( !document.images )
	return false
	
	if( !document.getElementById(name) ) {
		name=name.substring( 0, name.length-1 )
		x=1
	}
	
	src = document.getElementById(name).src
	
	if( src.lastIndexOf("over") == -1 )
	return false

	pos = src.lastIndexOf(".")
	type = src.substring(pos, src.length)
	pos	= src.lastIndexOf("_")
	oSrc = src.substring( 0, pos-x ) + type
	document.getElementById(name).src = oSrc
	}
	return false
}

function switchItOn( imgId ) {
	if( !overImgLoaded || !document.images ) return null
	over_name=imgId+"_over"
	overSrc=imgPreloadArr[over_name].src
	document.getElementById(imgId).src = overSrc

	return false
}
function switchItOff( name ) {
	if( !overImgLoaded || !document.images ) return null
	overSrc=imgPreloadArr[name].src
	document.getElementById(name).src = overSrc
	return false
}

var KWIN=null

function openForm( id ){
	if( id==18 ) id="meinung"
	var sc="yes"
	var x=590
	var y=427
	KWIN=window.open("formulare/form.php?id="+id+"&langID="+language, "KWIN", 'scrollbars='+sc+',resize=yes,status=no,toolbar=no,width='+x+',height='+y)
	KWIN.focus()
}
function openColoredForm( id, farbe ){
	if( id==18 ) id="meinung"
	var sc="yes"
	var x=590
	var y=427
	KWIN=window.open("formulare/form.php?color=" + farbe + "&id="+id+"&langID="+language, "KWIN", 'scrollbars='+sc+',resize=yes,status=no,toolbar=no,width='+x+',height='+y)
	KWIN.focus()
}
function openKontakt(id){
	if( id==18 ){
		openForm("meinung")
	}
	else{
	var sc="yes"
	var x=590
	var y=427
	KWIN=window.open("formulare/form.php?id=kontakt&kontaktID="+id+"&langID="+language, "KWIN", 'scrollbars='+sc+',resize=yes,status=no,toolbar=no,width='+x+',height='+y)
	KWIN.focus()
	}
}
function openOnbewerbung(id,d_id,init) {
	if(init==1) KWIN=window.open("templates/onlinebewerbung.php?id="+id+"&lang="+language+"&d_id="+d_id+"&initiative=1", "KWIN", 'scrollbars=yes,resize=no,status=yes,toolbar=no,width=611,innerWidth=591,height=600,innerHeight=600')
	else KWIN=window.open("templates/onlinebewerbung.php?id="+id+"&lang="+language+"&d_id="+d_id, "KWIN", 'scrollbars=yes,resize=no,status=yes,toolbar=no,width=611,innerWidth=591,height=600,innerHeight=600')
	if(KWIN) KWIN.focus()
}


var FPWIN=null
function oeffneFlugplan(mode){
	if (!mode) mode="D"
	var p="";
	
	if(typeof arguments[1]!="undefined")
		p=arguments[1];
	else p="";
	var sc="yes"
	var x=800
	var y=600
	var dat="preload"
	if (mode=="S") dat="index"
	FPWIN=window.open("flugplan/"+dat+".php?lang="+language+"&mode="+mode + p, "FPWIN", 'scrollbars='+sc+',resize=yes,status=no,toolbar=no,width='+x+',height='+y)
	FPWIN.focus()
}

var MFWIN=null
function oeffneMF(link,w,h,scroll,resize){
	var sc="yes"
	var rs="yes"
	if (!scroll) sc="no"
	if (!resize) rs="no"
	if (link.indexOf("http://")<0){
		if (link.indexOf("lang=")<0) {
			if (link.indexOf("?")<0) link+="?lang="+language
			else link+="&lang="+language
		}
	}
	MFWIN=window.open(link, "FPWIN", 'scrollbars='+sc+',resizable='+rs+',status=no,toolbar=no,width='+(w?w:640)+',height='+(h?h:480))
	MFWIN.focus()
}

function IDchange(el,ds) {

	if (document.getElementById) {
		var nodeObj = document.getElementById(el)
		nodeObj.style.display = ds;
	}
}

function impressum(nr) {
	
	if (document.getElementById('impressum1').style.display!='block') IDchange('impressum','block')
	
	if (nr==1) {
		//if (document.getElementById('impressum1').style.display=='none') {
		IDchange('impressum3','none')
		IDchange('impressum2','none')
		IDchange('impressum1','block')
		//}
	}
	
	if (nr==2) {
			if (document.getElementById('impressum2').style.display=='none') {
			IDchange('impressum3','none')
			IDchange('impressum1','none')
			IDchange('impressum2','block')
			}
	}
	
	if (nr==3) {
			if (document.getElementById('impressum3').style.display=='none') {
			IDchange('impressum2','none')
			IDchange('impressum1','none')
			IDchange('impressum3','block')
			}
	}
	
	if ((top.main.document.body.clientHeight-134)<(top.main.document.getElementById('impressum').offsetHeight-134))
		top.main.document.getElementById("container").style.height=top.main.document.getElementById('impressum').offsetHeight-134
	else
		top.main.document.getElementById("container").style.height=top.main.document.body.clientHeight-154

}

function getInnerHeight() {
  var iHeight=0
  
  if( typeof( window.innerHeight ) == 'number' ) iHeight = window.innerHeight;
  else if( document.documentElement && document.documentElement.clientHeight ) iHeight = document.documentElement.clientHeight; //IE 6
  else if( document.body && document.body.clientHeight ) iHeight = document.body.clientHeight; //IE 4 compatible
    
  return iHeight;
}

function getInnerWidth() {
  var iWidth=0
  
  if( typeof( window.innerWidth ) == 'number' ) iWidth = window.innerWidth;
  else if( document.documentElement && document.documentElement.clientWidth ) iWidth = document.documentElement.clientWidth; //IE 6
  else if( document.body && document.body.clientWidth ) iWidth = document.body.clientHeight; //IE 4 compatible
    
  return iWidth;
}

function switchIconOff( name, farbe ){
	try{
	if( !document.images )
	return false
	
	var i

	pos=name.lastIndexOf('__')
	if( pos>0 )
		name=name.substring( 0, pos)
	
	src = document.getElementById(name).src
	
	pos_a=src.lastIndexOf('/')
	pos_b=src.lastIndexOf('_')
	
	newIcon=src.substring( pos_a+1, pos_b )+"_"+farbe
	src_new = iconPreloadArr[newIcon].src
	
	document.getElementById(name).src = src_new	
	
	i=1
	while( document.getElementById(name+"__"+i)!=null && i<50 ){
		
		src = document.getElementById(name+"__"+i).src
		
		pos_a=src.lastIndexOf('/')
		pos_b=src.lastIndexOf('_')
			
		newIcon=src.substring( pos_a+1, pos_b )+"_"+farbe
		src_new = iconPreloadArr[newIcon].src
		
		document.getElementById(name+"__"+i).src = src_new
		i++
	}
	}catch(e){}
	return false
}

function switchIconOn( name, farbe ){
	try{
	if( !document.images )
	return false
	
	var i
	
	pos=name.lastIndexOf('__')
	if( pos>0 )
		name=name.substring( 0, pos)

	src = document.getElementById(name).src
	
	pos_a=src.lastIndexOf('/')
	pos_b=src.lastIndexOf('_')
	
	newIcon=src.substring( pos_a+1, pos_b )+"_"+farbe
	
	src_new = iconPreloadArr[newIcon].src
	
	document.getElementById(name).src = src_new
	
	var i=1
	while( document.getElementById(name+"__"+i)!=null && i<50 ){
		src = document.getElementById(name+"__"+i).src

		pos_a=src.lastIndexOf('/')
		
		newIcon=src.substring( pos_a+1, pos_a+4 )+"_"+farbe
		src_new = iconPreloadArr[newIcon].src

		document.getElementById(name+"__"+i).src = src_new
		
		i++
	}
	}catch(e){}
	return false
}

function preloadOverImg( imgId ) {
	var overSrc
	var im
	var overName=imgId+"_over"
	
	im = new Image()
	im.name=overName
	
	overSrc=document.getElementById(imgId).src
	pos_a=overSrc.lastIndexOf('.')
	imgType=overSrc.substring( pos_a )
	sub_a=overSrc.substr( 0, pos_a )
	overSrc=sub_a+"_over"+imgType
	
	im.src=overSrc
	return true
}

function preloadIcon( iName, imgName ){
	var iName = new Image();
	iName.src = "data/files/icons/"+imgName+".gif"
	return true;
}

function preloadOverIcon( icon_id, farbe ){
	var iconSrc 
	iconSrc=document.getElementById(icon_id).src
	pos_a=iconSrc.lastIndexOf('.')
	imgType=iconSrc.substring( pos_a )
	sub_a=iconSrc.substr( 0, pos_a )
	iconSrc=sub_a+"_"+farbe+imgType
	
	var im = new Image();
	im.name=icon_id+"_over"
	im.src = iconSrc
	return true;
}