function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

function FindObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function ShowHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=ShowHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=FindObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}

function show_subnav(id) {

	restore();
	ShowHideLayers('nav_restore','','show');
	ShowHideLayers('subnav_'+id,'','show');
	ShowHideLayers('nav_restore','','show');
}

function restore() {
	
	swapImage('n_dienstleistung','','/images/d/n_dienstleistung.gif',1);
	swapImage('n_stellen','','/images/d/n_stellen.gif',1);
	swapImage('n_karriere','','/images/d/n_karriere.gif',1);
	swapImage('n_ueberuns','','/images/d/n_ueberuns.gif',1);
	swapImage('n_news','','/images/d/n_news.gif',1);
	swapImage('n_links','','/images/d/n_links.gif',1);
	swapImage('n_kontakt','','/images/d/n_kontakt.gif',1);

	ShowHideLayers('subnav_dienstleistung','','hide','subnav_stellen','','hide','subnav_karriere','','hide','subnav_ueberuns','','hide','subnav_news','','hide','subnav_links','','hide','subnav_kontakt','','hide');

	ShowHideLayers('nav_restore','','hide');
}

function nav_preload_intro() {
	preloadImages('/images/button_arbeitgeber_intro_on.gif','/images/button_bewerber_intro_on.gif');
}

function nav_preload_intro_neu() {
	preloadImages('/images/but_arbeitgeber_intro_on.gif','/images/but_bewerber_intro_on.gif');
}


function nav_preload() {
	preloadImages('/images/d/n_dienstleistung_on.gif','/images/d/n_karriere_on.gif','/images/d/n_kontakt_on.gif','/images/d/n_kontakt_yellow_on.gif','/images/d/n_links_on.gif','/images/d/n_links_yellow_on.gif','/images/d/n_news_on.gif','/images/d/n_news_yellow_on.gif','/images/d/n_stellen_on.gif','/images/d/n_ueberuns_on.gif','/images/d/n_ueberuns_yellow_on.gif','/images/d/s_analyse_on.gif','/images/d/s_archiv_on.gif','/images/d/s_beratung_on.gif','/images/d/s_international_on.gif','/images/d/s_karriere_on.gif','/images/d/s_kontakt_on.gif','/images/d/s_news_on.gif','/images/d/s_partner_on.gif','/images/d/s_personal_on.gif','/images/d/s_presse_on.gif','/images/d/s_profil_on.gif','/images/d/s_referenzen_on.gif','/images/d/s_stellen_on.gif','/images/d/s_vermittlung_on.gif','/images/d/s_vorteile_on.gif','/images/d/s_weiterbildung_on.gif','/images/d/selector_arbeitgeber_on.gif','/images/d/selector_bewerber_on.gif');
}

function info(url,instance,width,height,xpos,ypos){

	if (xpos == -1 && ypos == -1) {
	xcenter=(screen.width/2)-(width/2);
	ycenter=(screen.height/2)-(height/2);
	window.open(url,instance,"toolbar=no,location=no,directories=no,scrollbars=no,status=no,menubar=no,resizable=no,width="+width+",height="+height+",left="+xcenter+",top="+ycenter+"")
	}
	else {
	window.open(url,instance,"toolbar=no,location=no,directories=no,scrollbars=no,status=no,menubar=no,resizable=no,width="+width+",height="+height+",left="+xpos+",top="+ypos+"")
	}
}
