// JavaScript Document

SEITEN_ID='nix';
SEITEN_NAME='nix';
aktuelleSeite='nix';

relativPath="http://www.borgers-industriebau.de/";
siteURL="http://www.borgers-industriebau.de/";

function tue_nichts() {}

function node(title,page,option) {
 
 relativPath="http://www.borgers-industriebau.de/";
 siteURL="http://www.borgers-industriebau.de/";
 
 tmp='';
 this.T=title;
 if(page)
 	this.P=page.toLowerCase();
	
 if(option)
 	this.O=option;
	
 for (i=0;i<title.length;i++) {
  if (title.substr(i,1) == ' ') {tmp += '_'}
  else if (title.substr(i,1) == 'ä') {tmp += 'a'}
  else if (title.substr(i,1) == 'ö') {tmp += 'o'}  
  else if (title.substr(i,1) == 'ü') {tmp += 'u'}    
  else                          {tmp += title.substr(i,1)}
 }
 this.F=tmp.toLowerCase();
 if(!this.P)this.P=this.F + ".html";
 this.N=0;
}

function betterTree() {
 // begin building the sitemap
 with(frames['core']['menu'].document) {
  open()
  
  writeln('<html><head>')
  writeln('<link rel=stylesheet type="text/css" href="'+siteURL+'style.css">')
  writeln('<link rel=stylesheet type="text/css" href="../style.css">')
  writeln('<style>body,th,td,a{font-face:Verdana;}</style>')
  writeln('</head>')
  writeln('<body background="'+siteURL+'gfx/menu5.jpg" bgcolor="#c8c8c8" text="#000000" link="#cccccc" vlink="#cccccc" alink="#ffffff" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">')
  writeln('<img src="'+siteURL+'gfx/0.gif" width="175" height="130"><br><font size="1">')
  betterRec('',0)
  writeln('</font></body></html>')

  close()
 }
}

function setSeitenID(d){
	aktuelleSeite=d;
	//alert(d);
}

function betterRec(tn,letterNum) {
 // this is the recursive part of the sitemap routine

 // while we're not out of letters
 while (menue[tn+alpha.charAt(letterNum)]) {
  c=alpha.charAt(letterNum)
  d=tn+c
  tmp=menue[tn+c]

  //horizontal placement
  
  if(tmp.O=="leerzeile"){
	  frames['core']['menu'].document.writeln('<img name="'+tmp.F+'" src="'+siteURL+'gfx/0.gif" width="220" height="8" alt="" style="margin-left:30px"><br clear=all>')
  }
  
  frames['core']['menu'].document.write('<img src="'+siteURL+'gfx/0.gif" width="'+ (35+((d.length-1)*10)) +'" height="1" alt="" align="absmiddle">')

  // The link
  frames['core']['menu'].document.write('<a href="'+siteURL+'htm/'+tmp.P+'" target="main"><font color="'+col[d.length]+'" class="menue" onclick="top.setSeitenID(\''+d+'\');" style=""><b>'+tmp.T+'</b></font></a><br clear=all>')

  if (d==idNOW) {frames['core']['menu'].document.writeln('<img name="'+tmp.F+'" src="'+siteURL+'gfx/menu_blueline.gif" width="220" height="1" alt="" style="margin-left:10px"><br clear=all>')}
  else          {frames['core']['menu'].document.writeln('<img name="'+tmp.F+'" src="'+siteURL+'gfx/0.gif" width="200" height="1" alt=""><br clear=all>')}
 


  // If node open, recurse on //
  if (tmp.N==1) {betterRec(tn+c,0)}

  letterNum++
 }
}

function betterRec2(t0,letterNum) {
 // this is the recursive part of the sitemap routine

 // while we're not out of letters
 while (menue[t0+alpha.charAt(letterNum)]) {
  c=alpha.charAt(letterNum)
  d=t0+c
  tmp=menue[t0+c]

  //horizontal placement

  frames['core']['menu'].document.write('<img src="'+siteURL+'gfx/0.gif" width="'+ (64+((d.length-1)*10)) +'" height="1" alt="" align="absmiddle">')

  // The link
  frames['core']['menu'].document.write('<a href="'+siteURL+'htm/'+tmp.P+'" target="main"><font color="'+col[d.length]+'"><b>'+tmp.T+'</b></font></a><br clear=all>')

  if (d==idNOW) {frames['core']['menu'].document.writeln('<img name="'+tmp.F+'" src="'+siteURL+'gfx/menu_blueline.gif" width="330" height="1" alt=""><br clear=all>')}
  else          {frames['core']['menu'].document.writeln('<img name="'+tmp.F+'" src="'+siteURL+'gfx/0.gif" width="330" height="1" alt=""><br clear=all>')}

  // If node open, recurse on //
  if (tmp.N==1) {betterRec(t0+c,0)}

  letterNum++
 }
}

function betterTreeRedraw(x,n) {
 if (n) {
  // set node x and all it's parents OPEN
  for (i=1; i<=x.length; i++) {
   menue[x.substring(0,i)].N=1
  }
 } else {
  // CLOSE only node x
  menue[x].N=0
 }
 betterTree()
}

function identify2(tn,ln,rd) {
 // get me the info where we are (recursive)
// if(aktuelleSeite!='nix'){
	while ((menue[tn+alpha.charAt(ln)])&&(idSTOP==false)) {
	  if(tn+alpha.charAt(ln) == rd) {
	   idSTOP=true
	   idNOW=tn+alpha.charAt(ln)
	  }
	  else {identify(tn+alpha.charAt(ln),0,rd)}
	  ln++
	 }
// }
 //else idNOW=aktuelleSeite;
}
function identify(t0,l0,rd) {
 // get me the info where we are (recursive)

	while ((menue[t0+alpha.charAt(l0)])&&(idSTOP==false)) {
	  if(menue[t0+alpha.charAt(l0)].T == rd) {
	   idSTOP=true
	   idNOW=t0+alpha.charAt(l0)
	  }
	  else {identify(t0+alpha.charAt(l0),0,rd)}
	  l0++
	 }


}

function initseite(SEITEN_ID,SEITEN_NAME){
	if(top.length<5){
		//alert('Framset laden');
		top.location.href="../index.html";
	}	
	
	aktuelleSeite=SEITEN_ID;
	indiana(SEITEN_NAME);
	//alert(idNOW);

}

function indiana(x) {
 // the pathfinder function
 
 // this makes the 'I'm here!' marker disappear when redrawn
 rdNOW=x
 menue[idNOW].N=0
 for (i=1;i<=idNOW.length;i++) {menue[idNOW.substring(0,i)].N=0}

 // tell me where in the menu tree we are
 if(aktuelleSeite!='nix'){
	 idNOW=aktuelleSeite
 }
 else {
	 idSTOP=false
	 //identify('',0,rdNOW)
	 identify('',0,rdNOW)
 }
 // be sure to have all parents' nodes of the current page open
 for (i=1;i<=idNOW.length;i++) {menue[idNOW.substring(0,i)].N=1}

 // Is the sitemap visible and set to auto mode? Then redraw
 if (autoMode) {betterTree()}
}

function zoom() {
 fullvis2=window.open('zoom3.htm','zoom','width=480,height=320,status=yes')
 //alert(fullvis2.document.getElementById("bigimg").src);

}

function zoom_breit() {
 fullvis2=window.open('zoom3.htm','zoom','width=960,height=320,status=yes')
 //alert(fullvis2.document.getElementById("bigimg").src);

}

function zoom_hoch() {
 fullvis2=window.open('zoom3.htm','zoom','width=320,height=480,status=yes')
 //alert(fullvis2.document.getElementById("bigimg").src);

}

function zoomIt1(which) {
 img = which
 var pre1='';
 /*
 if(String(which).charAt(0)=='1'){	 
	 which=String(which).substr(1);
	 //alert(which);
	 pre1='1';
 }
 */
 if(which>100 && which <200){	 
	 which=String(which).substr(1);
	 //alert(which);
	 pre1='1';
 }
 SEITEN_BILDER=getImageRefName(which,1);
 //img_url='../gfx/xl/i_'+menue[idNOW].F+'_'+which+'_xl.jpg'
 img_url='../gfx/xl/i_'+SEITEN_BILDER+'_'+pre1+which+'_xl.jpg'
 fullvis=window.open('zoom.htm','zoom'+img,'width=480,height=320,status=yes')
}

function zoomIt2() {
 with(fullvis.document) {
  open()
  writeln('<html>\n<head><title>Borgers</title>\n</head>\n'+
          '<body bgcolor="#ffffff" background="'+siteURL+'gfx/gfx_load_d.gif" marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">\n'+
          '<div align="center"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="javascript:window.close()">'+
          '<img src="'+img_url+'" width="480" height="320" border="0" alt="Klicken zum Schliessen des Fensters"></a></td></tr></table>'+
          '</div>\n</body>\n</html>\n')
  close()
 }
}
function zoomIt3() {
 with(fullvis2.document) {
  open()
  writeln('<html>\n<head><title>Borgers</title>\n</head>\n'+
          '<body bgcolor="#ffffff" background="'+top.siteURL+'gfx/gfx_load_d.gif" marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">\n'+
          '<div align="center"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="javascript:window.close()">'+
          '<img src="'+img_url+'" border="0" alt="Klicken zum Schliessen des Fensters"></a></td></tr></table>'+
          '</div>\n</body>\n</html>\n')
  close()
 }
}

SEITEN_BILDER='nix';

function getImageRefName(which,withtree){

	if(withtree==1){
		//alert(top.frames['core']['main'].document.images.length);
		imgSrc=top.frames['core']['main'].document.images['i'+which].src;
		//imgSrc=top.frames['core']['main'].document.images['i'+which].src;
		//var docobj=top.frames['core']['main'].document;
		//var docobj=
		//alert(docobj.getElementById('i'+which));
	}
	else
		imgSrc=document.images['i'+which].src;
	
	
	pos1=imgSrc.lastIndexOf("/");
	imgFileName=imgSrc.substr(pos1+1);
	//alert(imgFileName);
	pos2=imgFileName.lastIndexOf("_");
	refName=imgFileName.substr(0,pos2);
	pos3=refName.lastIndexOf("_");
	refName=refName.substr(0,pos3);	
	pos4=refName.indexOf("_");
	refName=refName.substr(pos4+1,pos3);		
	//alert(refName);
	return refName;
}

function flip(which,what) {
	flipImage(which,what,SEITEN_NAME,SEITEN_BILDER)
}

function flipImage(which,what,SEITEN_NAME,SEITEN_BILDER) {

	//if(SEITEN_BILDER=='nix')
	 SEITEN_BILDER=getImageRefName(which);
	//alert(SEITEN_BILDER);
	 var pre1='1';
	
	if(SEITEN_BILDER=='news'){	 
		 pre1='';
	 }	
	 
	if (document.images && SEITEN_BILDER!='NOFLIP') {
		document.images['i'+which].src = '../gfx/s'+what+'/i_'+SEITEN_BILDER.toLowerCase()+'_'+pre1+which+'_s'+what+'.jpg'
	}
}
/* neue Bildfunktionen */

function setImage(obj,what){
	imgSrc=obj.src;
	pos1=imgSrc.lastIndexOf("/");
	imgFileName=imgSrc.substr(pos1+1);
	//alert(imgFileName);
	pos2=imgFileName.lastIndexOf(".");
	imgName=imgFileName.substr(0,pos2);
	//alert(imgName);
	//alert(obj.onmousedown);
	//obj.title=imgName;
	
	img_url="../gfx/bilder_gross/"+imgName+".jpg";
	top.img_url=img_url;
	if(what==2){
	 o=1;
	 //img_url="../gfx/bilder_gross/"+imgName+".jpg";
	 //fullvis=window.open('zoom2.htm','zoom'+imgName,'width=480,height=320,status=yes')
	 //alert(imgName);
	}
	if(what==1)
	 newSrc="../gfx/bilder_normal/"+imgName+".jpg";
	if(what==0)
	 newSrc="../gfx/bilder_mit_effekt/"+imgName+".jpg";
	//alert(newSrc);
	if(newSrc)
	 obj.src=newSrc;
}
/*  MM Functions */
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 MM_findObj(n, d) { //v4.0
  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=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_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 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_menue[j]=new Image; d.MM_menue[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
