/************************************************************************************************
  Rollover Images:
************************************************************************************************/

function swapImage(doc, imgName, imgUrl, imgText) {

	if(imgText!="") { window.status = imgText; }
  	if(doc.images) {
		if(doc.images [imgName].src) {
			doc.images [imgName].srcORG = doc.images [imgName].src;
			doc.images [imgName].src = imgUrl;
		}	
	  }	 
  }
  
  function swapImageRestore(doc, imgName) {
	  window.status = '';
	  if(doc.images) {
	  	if(doc.images [imgName].srcORG) {
			doc.images [imgName].src = doc.images [imgName].srcORG;
		} 
	  }	 
  }
  
  function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/************************************************************************************************
  Browser check:
************************************************************************************************/

function getBrowser() {
/*  Autor, Entwicklung 8/2002 Kristof Lipfert Duesseldorf    */
/*  Version 4.3g 2004-02-24                                  */

	if(document.ids)x='nc4';
	else if(document.all && !document.getElementById) x='ie4';
	else if(window.opera && !document.createElement) x='op5';
	else if(window.opera && window.getComputedStyle)  {
	              if(window.navigate) x='op7.5';
                  else x='op7.2';
	}
	else if(window.opera && document.compatMode) x='op7';
	else if(window.opera && document.releaseEvents) x='op6';
	else if(document.contains && !window.opera) x='kq3';
	else if(window.getSelection && window.atob) x='nn7';
	else if(window.getSelection && !document.compatMode) x='nn6';
	else if(window.clipboardData && document.compatMode) x='ie6';
	else if(window.clipboardData){ x='ie5';
	     if(!document.createDocumentFragment) x+='.5';
	     if(document.doctype && !window.print) x+='m';
	}
	else if(document.getElementById && !document.all) x='op4';
	else if(document.images && !document.all) x='nn3';
	else x='???';
	return x;
}

/*
function checkBrowser() {
	browser = getBrowser();
	browservers = browser.substring(2,3);
	browsername = browser.substring(0,2);
	switch(browsername) {
		case 'nn': if(browservers<6) document.location.href='browsercheck.html'; break;
		case 'ie': if(browservers<5) document.location.href='browsercheck.html'; break;
		default: document.location.href='browsercheck.html'; break;
	}
}
*/

/************************************************************************************************
  Class wechsel Navigation:
************************************************************************************************/
function changeClass(id,classe){
	if (document.getElementById) document.getElementById(id).className = classe;
}

/************************************************************************************************
  Div schreiben und Bildwechsel:
************************************************************************************************/
function change(id) {
	//alert('nav_'+id);
	//if(activeWahl!="") { swapImage(document, 'karte', url,''); }
	if(activeWahl!="") { changeClass(activeWahl, 'vertretung'); }	
	activeWahl = id;
	if(document.images) {
		document.images['karte'].src = url[id];
	  }	 
	writeDiv(id);
	//alert(activeWahl);
}

function changeAUS(id,land) {
	//alert('nav_'+id);
	//if(activeWahl!="") { swapImage(document, 'karte', url,''); }
	if(activeWahl!="") { changeClass(activeWahl, 'vertretung'); }	
	activeWahl = id;
	/*writeDiv map*/
	if(activeLand!=land){
	browser = getBrowser();
		browservers = browser.substring(2,3);
		browsername = browser.substring(0,2);
		switch(browsername) {
			case 'nn': 
				if(browservers<6) {
					document.layers['map'].document.open()
				    document.layers['map'].document.write(bild[land])
				  	document.layers['map'].document.close()
				}
				if(browservers>=6){
					document.getElementById('map').innerHTML = bild[land];
				}
				break;
			case 'ie': document.all['map'].innerHTML = bild[land]; break;
			default: document.getElementById('map').innerHTML = bild[land];	
		}	
	}
	activeLand = land;
	
	if(document.images) {
		document.images['karte'].src = url[id];
	  }	 
	writeDiv(id);
	//alert(activeWahl);
}

function show(id,classe) {
	//alert('id:'+id+'act:'+activeWahl);
	changeClass(id,classe);
	if(activeWahl != id) { document.images['karte'].src = url[id]; }
	else { document.images['karte'].src = url[activeWahl]; }
	//activeWahl = id;
	
	//alert(activeWahl);
}

function hide(id,classe) {
	//alert('id:'+id+'act:'+activeWahl);
	if(activeWahl=="") { 
	//alert('id:'+id+'act:'+activeWahl);
		changeClass(id,classe);
		document.images['karte'].src = url[0]; 
	}else { 
		changeClass(id,'vertretung');
		changeClass(activeWahl,'vertretung_u')
		document.images['karte'].src = url[activeWahl]; 
		
	}
	//activeWahl = id;
	
	//alert(activeWahl);
}
	
function writeDiv(id) {
		browser = getBrowser();
		browservers = browser.substring(2,3);
		browsername = browser.substring(0,2);
		switch(browsername) {
			case 'nn': 
				if(browservers<6) {
					document.layers['content'].document.open()
				    document.layers['content'].document.write(text[id])
				  	document.layers['content'].document.close()
				}
				if(browservers>=6){
					document.getElementById('content').innerHTML = text[id];
				}
				break;
			case 'ie': document.all['content'].innerHTML = text[id]; break;
			default: document.getElementById('content').innerHTML = text[id];	
		}		
	}
	
/************************************************************************************************
  neues Fenster oeffnen:
************************************************************************************************/

function openWinCenter(url,name,breite,hoehe,x,y){
  var MyWindow =0;
  MyWindow = window.open(url,name,'toolbar=0,location=0,directories=0,statusbar=0,menubar=0,scrollbars=auto,resizable=no,width='+breite+',height='+hoehe);
  if (MyWindow){
    if(screen.width && screen.height && MyWindow.moveTo) { 
		MyWindow.moveTo(screen.width/2-(breite/2+x),screen.height/2-(hoehe/2+y));
    }
	if(MyWindow.window.focus) {
		MyWindow.window.focus();
	}	
  }
}	

function openNews(url,name,breite,hoehe,x,y){
  var MyWindow =0;
  MyWindow = window.open(url,name,'toolbar=0,location=0,directories=0,statusbar=0,menubar=0,scrollbars=auto,resizable=no,width='+breite+',height='+hoehe);
  if (MyWindow){
    
	if(MyWindow.window.focus) {
		MyWindow.window.focus();
	}	
  }
}

function openNewsScroll(url,name,breite,hoehe,x,y){
  var MyWindow =0;
  MyWindow = window.open(url,name,'toolbar=0,location=0,directories=0,statusbar=0,menubar=0,scrollbars=yes,resizable=no,width='+breite+',height='+hoehe);
  if (MyWindow){
    
	if(MyWindow.window.focus) {
		MyWindow.window.focus();
	}	
  }
}	