var eventX = 0, eventY = 0, aEv = true, oldTh = 330, ctimeout = false;

function setEvent(e)
{
	if (e.x)
	{
		eventX = e.x + document.body.scrollLeft;
		eventY = e.y + document.body.scrollTop;
	}
	else if (e.clientX)
	{
		eventX = e.clientX + window.pageXOffset;
		eventY = e.clientY + window.pageYOffset;
	}
}

function cancelEvent (e)
{
	try
	{
		if (typeof(e) == "undefined") e = window.event;
		if (typeof(e) == "undefined") return false;
		if(e.preventDefault)
		{
			e.preventDefault();
		}
		else
		{
			e.returnValue=false;
			e.cancelBubble=true;
		}
	}
	catch(e) {}
	return false;
}


function DoBild(BILD) {

    if (DoBildWindowClose == "") DoBildWindowClose = "Bitte klicken zum Verkleinern";
	
	x = 350;
	y = y1 = 270;
        
         var BW = BW1 = 1000;

       try
       {
	if (document.body.scrollTop) y = document.body.scrollTop + 20;
	else if (window.pageYOffset) y = window.pageYOffset + 20;
	if (y < y1) y = y1;
		
	if (document.body.offsetWidth) BW = document.body.offsetWidth
	else if (document.body.clientWidth) BW = document.body.clientWidth;
	if (BW < BW1) BW = BW1;
	x = (BW-BW1)/2 + x;
       }
       catch(e) {}
//alert(x+' '+BW+' '+BW1);
       if (eventY > y1 + 50) y = eventY - 50;

info1 = "<table border=0 cellspacing=0 cellpadding=3><tr><td bgcolor=#FFFFFF><a href=\"javascript:MM_showHideLayers('Layer1','','hide')\"><img src='" + BILD + "' alt='Bitte klicken zum Verkleinern' border=0></a></td></tr></table>";
	MM_showHideLayers('Layer1','','show');
	if(document.layers) {
		document.Layer1.left = x;
		document.Layer1.top = y;
		document.Layer1.document.write(info1);
		document.Layer1.document.close();
	} else {
		if (document.all) KL = Layer1;
		else KL = document.getElementById("Layer1");
		
		KL.style.left = x;
		KL.style.top = y;
		KL.innerHTML = info1;
	}

}

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 OpenFoto(BildURL, x, y) {
var win = "";
win = window.open("","bild",'height=' + y + ',width=' + x +',location=0,status=0,toolbar=no,resizable=0,scrollbar=no,top=0,left=0');
win.document.writeln('<html><head><title>Das Bild</title>');
win.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
win.document.writeln('</head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
win.document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">');
win.document.writeln('<tr><td align="center">');
win.document.writeln('<a href="javascript:window.close()">');
win.document.writeln('<img src="' + BildURL + '" border=0  alt="Fenster schließen">');
win.document.writeln('</a></td></tr></table></body></html>');
win.document.close();
//win.resizeTo(x,y);
win.focus();
}

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 ViewHersteller(arg) {
  var lwidth = (document.all) ? (document.body.clientWidth - 350) : (window.innerWidth - 350);
  if (document.all) { // IE
    if (document.all("Hersteller")) document.all("Hersteller").innerHTML = arg;
	document.all("Hersteller").style.width = lwidth;
  } else if (document.getElementById&&!document.all) { // Netsc. 6
    if (document.getElementById("Hersteller")) document.getElementById("Hersteller").innerHTML = arg;
    document.getElementById("Hersteller").style.width = lwidth;
  } else if (document.layers) { // Netsc. 4
    if (document.Hersteller) {
		document.Hersteller.document.write(arg);
		document.Hersteller.document.close();
		document.Hersteller.clip.width = lwidth;
	}
  }	
}
function MakeArray(n) {
    this.length = n
    for (var i = 0; i<=n; i++) {
	    this[i] = new Image()
    }
	return this
}

function BildDown(DownURL,winfeatures) {
	window.open(DownURL,'Filedown','top=0,left=0' + (winfeatures ? (','+winfeatures) : '') );
}

function Webmerk() {
	if (document.all) // IE
	{
		if (confirm('Möchten Sie die Brohler-Wellpappe Webseite zu Ihren Favoriten hinzufügen?')) window.external.addFavorite('http://www.brohler-wellpappe.de','Brohl Wellpappe');
	}
	else if (document.layers) // NS 4
	{
		alert("PC-Systeme:\nDrücken Sie Strg + D\n\nApple-Macintosh-Systeme:\nDrücken Sie Befehlstaste + D");
	} else if (!document.all && document.getElementById) {
		if(navigator.appName == "Netscape") { // NS > 6
			alert("PC-Systeme:\nDrücken Sie Strg + G\n\nApple-Macintosh-Systeme:\nDrücken Sie Befehlstaste + G");
		}
	}
}

var ISZero = 0;
function MakeFontSize(PLUSSize) {
	FontnameArr = new Array("xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large");
	if ( (ISZero <= -3 && PLUSSize > 0) || (ISZero >= 7 && PLUSSize < 0) || (ISZero < 7 && ISZero > -3) ) {
		ISZero += PLUSSize;
		for(i=0; i < document.styleSheets[0].rules.length; i++)
		{
			if (document.styleSheets[0].rules[i].style.fontSize != null) {
				FontString = new String(document.styleSheets[0].rules[i].style.fontSize);
				ISFONTNONAME = -1;
				for (j = 0; j < FontnameArr.length; j++) {
					if (FontString == FontnameArr[j]) {
						ISFONTNONAME = j;
						break;
					}
				}
				
				if (ISFONTNONAME == -1) {
					ClassFontSize = (FontString.substr(0, FontString.length-2)) * 1;
					ClassFontFormat = FontString.substr(FontString.length-2, 2);
					if (ClassFontSize > 1 ) {
						ClassFontSize += PLUSSize;
						document.styleSheets[0].rules[i].style.fontSize = (ClassFontSize +  ClassFontFormat);
					}
				} else {
					ISFONTNONAME += PLUSSize
					if (ISFONTNONAME > -1 && ISFONTNONAME < FontnameArr.length)
						document.styleSheets[0].rules[i].style.fontSize = FontnameArr[ISFONTNONAME];
				}
			}
		}
	}
}


/***   Editable: ***/
var backcolor	= '#FFFFFF';		// Hintergrund
var bordercolor	= '#000000';		// Ramenfarbe
var textcolor	= '#000000';		// Textfarbe
var displaytime	= '1000000';		// Zeit
var tablewidth	= '230';			// Tabellenbreite in px
var object		= 'Layer1';			// objekt - Ebene ID
/*******************/
var tipTimer;	// dHTML Toolltip Timer

function locateObject(n, d) { //v3.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=locateObject(n,d.layers[i].document); return x;
}

function hideKommentar() 
{	if (document.all) {
		locateObject(object).style.visibility="hidden";
		locateObject(object).style.left = 1;
		locateObject(object).style.top = 1;
		return false
	} else if (document.layers) {
		locateObject(object).visibility="hide";
		locateObject(object).left = 1;
		locateObject(object).top = 1;
		return false
	} else if (document.getElementById&&!document.all) {
		document.getElementById(object).style.visibility="hidden";
		document.getElementById(object).style.left = 1;
		document.getElementById(object).style.top = 1;
		return false;
	} else return true;
}

function showKommentar(e, tipContent)
{	window.clearTimeout(tipTimer);
	if (document.all)
	{		locateObject(object).style.top=document.body.scrollTop+event.clientY-10;
			locateObject(object).innerHTML='<table style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: '+backcolor+'" width="'+tablewidth+'" border="0" cellspacing="1" cellpadding="1"><tr><td><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table>';
			if ((e.x + locateObject(object).clientWidth) > (document.body.clientWidth + document.body.scrollLeft))
			{	locateObject(object).style.left = (document.body.clientWidth + document.body.scrollLeft) - locateObject(object).clientWidth-50;
			} else locateObject(object).style.left=document.body.scrollLeft+event.clientX+30;
		locateObject(object).style.visibility="visible";
		tipTimer=window.setTimeout("hideKommentar('"+object+"')", displaytime);
		return true;
	} else if (document.layers)
	{	locateObject(object).document.write('<table width="'+tablewidth+'" border="0" cellspacing="1" cellpadding="1"><tr bgcolor="'+bordercolor+'"><td><table width="100%" border="0" cellspacing="0" cellpadding="2"><tr bgcolor="'+backcolor+'"><td><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table></td></tr></table>')
		locateObject(object).document.close();
		locateObject(object).top=e.y-10;
		if ((e.x + locateObject(object).clip.width) > (window.pageXOffset + window.innerWidth)) locateObject(object).left = window.innerWidth - locateObject(object).clip.width-80;
		else locateObject(object).left=e.x+30;
		locateObject(object).visibility="show";
		tipTimer=window.setTimeout("hideKommentar('"+object+"')", displaytime);
		return true;
	} else if (document.getElementById&&!document.all)
	{	document.getElementById(object).style.top= window.pageYOffset + e.clientY-10;		
		document.getElementById(object).innerHTML='<table style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: '+backcolor+'" width="'+tablewidth+'" border="0" cellspacing="1" cellpadding="1"><tr><td><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table> ';
		if ((e.clientX + window.innerWidth - tablewidth - 80) > (window.pageXOffset + window.innerWidth)) document.getElementById(object).style.left = window.pageXOffset + e.clientX-tablewidth-50;
		else document.getElementById(object).style.left=window.pageXOffset + e.clientX+30;
		document.getElementById(object).style.visibility="visible";
		tipTimer=window.setTimeout("hideKommentar('"+object+"')", displaytime);
		return true;
	} else return true;
}

function animate()
{
 if(document.getElementById("e1_"+ ALinkE1))
 {
  document.getElementById("e1_"+ ALinkE1).className="e1_a";
  document.getElementById("td1_"+ ALinkE1).className="button1_a";
 }
 if(document.getElementById("e2_"+ ALinkE2))
 {
  document.getElementById("e2_"+ ALinkE2).className="e2_a";
 }
 if(document.getElementById("e3_"+ ALinkE3))
 {
  document.getElementById("e3_"+ ALinkE3).className="e3_a";
 }
 if(document.getElementById("e4_"+ ALinkE4))
 {
  document.getElementById("e4_"+ ALinkE4).className="e4_a";
  document.getElementById("td4_"+ ALinkE4).className="button4_a";
 }
}

function paint_e1td(e1_ID,modus)
{
 if(ALinkE1 != e1_ID && document.getElementById("td1_"+ e1_ID))
 {
   if(modus=="over")
     document.getElementById("td1_"+ e1_ID).className="button1_a";
   else document.getElementById("td1_"+ e1_ID).className="button";
 }
}
