var akt_url='https://secure.ecomas.de/web22/navigation/';
var http_host= 'https://secure.ecomas.de/web22/';
function $(id)
{
	if (document.getElementById) return document.getElementById(id);
	else return false;
}
function addEvent(o,n,h)
{
	if(o.attachEvent) o.attachEvent("on"+n,h);
	else if (o.addEventListener) o.addEventListener(n,h,false);
}
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 MM_swapImage(img,d,src,d2)
{
	/*document.images["wk"].src = src;*/
}
var lastZInd = 1000;
function createLayer(namlay)
{
	if (typeof(namlay) == "undefined") return;
	if (!$(namlay))
	{
		b=document.createElement("div");
		var zI =  lastZInd + 1;
		b.style.cssText='visibility:hidden;position:absolute;z-index:' + zI.toString() + '';
		b.id = namlay;
		if (document.getElementsByTagName)
			document.getElementsByTagName("body")[0].appendChild(b);
		else if (document.all)
			document.all("body").parentNode.appendChild(b);
	}
}
function Webmerk()
{
	if ( WebmerkQueryA == "" ) WebmerkQueryA='PC-Systeme: Druecken Sie Strg + D; Apple-Macintosh-Systeme: Druecken Sie Befehlstaste + D';
	if ( WebmerkQueryB == "" ) WebmerkQueryB='PC-Systeme: Druecken Sie Strg + G; Apple-Macintosh-Systeme: Druecken Sie Befehlstaste + G';
	if ( WebmerkFavtext == "" ) WebmerkFavtext = document.title;
	if ( WebmerkQuery == "" ) WebmerkQuery = "Möchten Sie diese Webseite zu Ihren Favoriten hinzufügen?";
	if (document.all) // IE
	{
		if (confirm(WebmerkQuery)) window.external.addFavorite("http://" + window.location.host,WebmerkFavtext);
	}
	else if (document.layers) // NS 4
	{
		alert(WebmerkQueryA);
	} else if (!document.all && $) {
		if(navigator.appName == "Netscape") { // NS > 6
			alert(WebmerkQueryA );
		}
	}
}
/** CHECK FORMULAR **/
function CheckSendForm(formname) {
	if(typeof(formname) == "undefined") formname = "ecomasform";
	eval("var f = document." + formname);
	var dothis = true;
         var arrCheck = new Array();	
         var arrElements = new Array();
         var TMP = new Array();
	for (i = 0; i < f.elements.length; i++) 
         {
                  NameIndex="";
		if (f.elements[i].title != "") 
                  {
                      NameIndex=f.elements[i].name;
                      if(!TMP[NameIndex])                      
                      {
                        TMP[NameIndex]=1;
                        arrElements[arrElements.length]=NameIndex;
                        if(!arrCheck[NameIndex])arrCheck[NameIndex]=new Array();
                      } 
		       
                      if (f.elements[i].type == "text") 
                      {
                               if(f.elements[i].value == "")
				arrCheck[NameIndex]['check']=0;
                               else  arrCheck[NameIndex]['check']=1;
                      }
		    else if (f.elements[i].type == "checkbox" || f.elements[i].type == "radio")
		    {	
                                if( f.elements[i].checked == false && !arrCheck[NameIndex]['check'])
                                  arrCheck[NameIndex]['check']=0;
                                else if(f.elements[i].checked == true)
                                   arrCheck[NameIndex]['check']=1;
                       }
			
                       arrCheck[NameIndex]['title'] = f.elements[i].title;
                       arrCheck[NameIndex]['index'] = i;

		}
	}


         for(j=0;j< arrElements.length;j++)
         {            if(arrCheck[arrElements[j]]['check']==0)
            {
             dothis=false;
             alert(arrCheck[arrElements[j]]['title']);
             f.elements[arrCheck[arrElements[j]]['index']].focus();
             break;
            }
         }
	
         //if(dothis)alert('true');
         //else alert('false');

	return dothis;
} 
/*############## BEGIN Comment-functions ###################*/
/***   Editable: ***/
var backcolor	= '#ffffe1';		// Hintergrund
var bordercolor	= '#000';			// Ramenfarbe
var textcolor	= '#000';			// Textfarbe
var displaytime	= '30000';		// Zeit
var tablewidth	= '230';			// Tabellenbreite in px
var object	= 'Layer2';		// objekt - Ebene ID
/*******************/
var tipTimer = false;			// dHTML Toolltip Timer

function hideKommentar() 
{
	if ($(object))
	{
		if (tipTimer) window.clearTimeout(tipTimer);
		tipTimer = false;
		$(object).style.visibility="hidden";
		$(object).style.left = -200;
		$(object).style.top = -200;
		return false;
	}
	else return true;
}
function showKommentar(e, tipContent)
{
	if (!$(object)) return true;
	if (tipTimer) window.clearTimeout(tipTimer);
	$(object).innerHTML='<div style="text-align:left; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: 1px solid '+bordercolor+'; background-color: '+backcolor+'; padding:4px; width:'+tablewidth+'px; max-width:'+tablewidth+'px; color: '+textcolor+';">'+unescape(tipContent)+'</div>';
	var top = 0, left = 0;

	if (typeof window.pageXOffset != 'undefined')
	{
		left = window.pageXOffset;
		top = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
	{
		left = document.documentElement.scrollLeft;
		top = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined')
	{
		left = document.body.scrollLeft;
		top = document.body.scrollTop;
	}
	left = parseInt(left);
	top = parseInt(top);
	if (e.x)
	{
		left += e.x;
		top += e.y;
	}
	else if (e.clientX)
	{
		left += e.clientX;
		top += e.clientY;
	}
	left = parseInt(left) - 10;
	top = parseInt(top) + 20;

	$(object).style.top = top.toString()+"px";
	$(object).style.left = left.toString()+"px";
	$(object).style.visibility="visible";
	tipTimer = window.setTimeout("hideKommentar('"+object+"')", displaytime);
	return true;
}
function BildDown(DownURL,winfeatures) {
	window.open(DownURL,'Filedown','top=0,left=0' + (winfeatures ? (','+winfeatures) : '') );
}
function getAttrib(selEl, nm, default_value)
{
	if(typeof(default_value) == "undefined") default_value = "";
	var v = default_value;
	if (selEl.getAttribute)
	{
		if (selEl.getAttribute(nm,0) != null) v = selEl.getAttribute(nm,0);
	}
	else if (selEl.attributes)
	{
		var oAttrColl = selEl.attributes;
		var oAttr = oAttrColl.getNamedItem(nm);
		if(oAttr != null) v = oAttr.value;
	}
	if (nm == "noWrap") v = selEl.noWrap;
	if (nm == "class") v = selEl.className;
	return '' + 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.focus();
}

var cssHref = "";
function MakeFontSize(s)
{
	if ($)
	{
		var Dt = new Date();
		if (cssHref == "") cssHref = $("cssLink").href;
		if ($("cssLink")) $("cssLink").href = cssHref+"?t=" + Dt.getTime() + "&s="+s;
	}
}

function in_array(needle, arr)
{
	var CurStr = new String("," + arr + ",");
	if (CurStr.indexOf("," + needle + ",") == -1) return false;
	else return true;
}
function getTitle(node)
{
	if (typeof(node) == "undefined") return "";
	if (node.childNodes.length == 0) return "";
	for (var i = 0; i < node.childNodes.length; i++)
	{
		if (typeof(node.childNodes[i].tagName) == "undefined") continue;
		if (node.childNodes[i].tagName.toLowerCase() == "img")
		{
			if (node.childNodes[i].title != "") return node.childNodes[i].title.substr(0,90);
			else if (node.childNodes[i].alt != "")
			{
				if(node.childNodes[i].alt == "Bitte klicken zum Vergrößern" || node.childNodes[i].alt == "Bitte klicken zum Vergößern") return document.title.substr(0,90);
				else return node.childNodes[i].alt.substr(0,90);
			}
		}
	}
	return "";
}
var allCollection = new Array();
var allImgTitles = new Array();
var curPos = 0;
var setLoupe = false;
function getDoBildImgs(BILD)
{
	allCollection = new Array();
	if (document.getElementsByTagName)
		var elements=document.getElementsByTagName('a');
	else if (document.all)
		var elements=document.all('a');
	var txt;
	if(elements.length > 0)
	{
		var re=new RegExp("[ \t\n\r\f]","gi");
		for (var i = 0; i < elements.length; i++)
		{
			txt = new String(elements[i].href);
			if (txt.toLowerCase().indexOf("javascript:") == -1)
			{
				txt = new String(getAttrib(elements[i],"onclick"));
				if (txt.indexOf("DoBild(") != -1) txt = "javascript:"+txt;
			}
			txt = txt.replace(re, "");
			if (txt.toLowerCase().indexOf("javascript:") != -1 && txt.indexOf("DoBild(") != -1)
			{
				txt = txt.substring(txt.indexOf("'")+1, txt.lastIndexOf("'"));
				if (!setLoupe)
				{
					//addEvent(elements[i], "mousemove", addLoupe);
					//addEvent(elements[i], "mouseover", addLoupe);
elements[i].style.cursor = "url('"+http_host+"navigation/loupe.png'), url("+http_host+"navigation/loupe.cur), default";
				}
				if (!in_array(txt, allCollection))
				{
					if (txt == BILD) curPos = allCollection.length;
					allCollection.push(txt);
					allImgTitles[allCollection.length-1] = getTitle(elements[i]);
				}
			}
		}
	}
	setLoupe = true;
}
var currentSize = {w:320,h:128};
function DoBild(BILD)
{
	getDoBildImgs(BILD);
	if (DoBildWindowClose == "") DoBildWindowClose = "Bitte klicken zum Verkleinern";
	var x = 0;
	var y = 0;

	if (typeof window.pageXOffset != 'undefined')
	{
		x = window.pageXOffset;
		y = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined')
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}

	if (!document.getElementById("sashadow"))
	{
		var b = document.createElement("div");
		b.id = "sashadow";
		b.style.display = "none";
		b.innerHTML = "&nbsp;";
		addEvent(b, "click", HideImage);
		document.getElementsByTagName("body")[0].appendChild(b);
	}
	if (!document.getElementById("imagelayer"))
	{
		var b = document.createElement("div");
		b.id = "imagelayer";
		b.style.display = "none";
		document.getElementsByTagName("body")[0].appendChild(b);
	}
	
	var b_g = document.getElementById("sashadow");
	var b_i = document.getElementById("imagelayer");

	b_i.style.left = x+"px";
	b_i.style.top = y+"px";

	var h = 0, w = 0;
	if (document.documentElement) h = parseInt(document.documentElement.scrollHeight);
	if (document.body.scrollHeight > h) h = parseInt(document.body.scrollHeight);
	if (document.body.clientHeight > h) h = parseInt(document.body.clientHeight);
	if (h > 0)
	{
		if (!document.all) h += 20;
		b_g.style.height = h+"px";
	}

	if (document.documentElement) w = parseInt(document.documentElement.scrollWidth);
	if (w == 0) h = parseInt(document.body.scrollWidth);
	if (document.body.clientWidth > w) w = parseInt(document.body.clientWidth);
	if (w > 0) b_g.style.width = w+"px";


	b_i.innerHTML = "<table border=0 cellspacing=0 cellpadding=1 style='width:100%;height:100%;'><tr><td align='center' valign='middle'><table border=0 cellspacing=0 cellpadding=8 bgcolor=#FFFFFF><tr><td bgcolor=#FFFFFF><div style='text-align:center;clear:both;height:26px;'><img src='" +  http_host + "navigation/img_close.gif' border='0' style='cursor:pointer;float:right;' onclick='HideImage();'><span id='ecomasImageTitle' style='line-height:26px;'>&nbsp;</span></div><div style='clear:both;'><img src='" +  http_host + "navigation/pixel.gif' border='0' width='1' height='1'></div><a href='#' onclick='HideImage();return false;' id='ecomasResizedLink'><img src='" + BILD + "' alt='" + DoBildWindowClose + "' title='" + DoBildWindowClose + "' onLoad='resizeImage()' width='1' height='1' id='ecomasResizedImage' style='display:none;'><img src='" +  http_host + "navigation/pixel.gif' id='ecomasLoadImage' style='width:" + currentSize.w + "px;height:" + currentSize.h + "px;background-image:url(" +  http_host + "navigation/img_load.gif);background-position: center;background-repeat:no-repeat;' border='0' onClick='HideImage();'></a><div id='ArraowsLayer' style='padding-top:3px;'><img src='" +  http_host + "navigation/pixel.gif' style='width:150px;height:26px;' align='right'><img src='" +  http_host + "navigation/pixel.gif' style='width:150px;height:26px;' align='left'></div></td></tr></table></td></tr></table>";

	b_g.style.display = "";
	b_i.style.display = "";
}
function HideImage()
{
	var b_g = document.getElementById("sashadow");
	var b_i = document.getElementById("imagelayer");
	b_g.style.display = "none";
	b_i.style.display = "none";
	currentSize = {w:128,h:128};
}
var cS = 10;
function resizeImage()
{
	var ibj = document.getElementById("ecomasResizedImage");
	var img = new Image();
	img.src = ibj.src;
	var sta = (img.width - currentSize.w)/cS;
	var stb = (img.height - currentSize.h)/cS;
	document.getElementById("ecomasLoadImage").style.backgroundImage = "";
	
	dynamicImage(currentSize.w,currentSize.h,img.width,img.height,sta, stb);
}
function dynamicImage(wc,hc,w,h,sta,stb, curCS)
{
	var ibj = document.getElementById("ecomasLoadImage");
	if (typeof(curCS) == "undefined") curCS = 0;
	curCS++;
	wc = Math.round(wc + sta);
	hc = Math.round(hc + stb);
	ibj.style.width = wc.toString()+"px";
	ibj.style.height = hc.toString()+"px";
	if (curCS >= cS)
	{
		ibj.style.backgroundImage = "url(" + document.getElementById("ecomasResizedImage").src + ")";
		currentSize.w = w;
		currentSize.h = h;

		document.getElementById("ecomasImageTitle").innerHTML = allImgTitles[curPos] == "" ? "&nbsp;" :  allImgTitles[curPos];

		var  HTML = "";
		if (curPos < (allCollection.length -1))
			HTML = "<img src='" +  http_host + "navigation/img_arrow_r.gif' style='width:150px;height:26px;cursor:pointer;' align='right' onClick='DoBild(\"" + allCollection[parseInt(curPos)+1] + "\");'>";
		else
			HTML = "<img src='" +  http_host + "navigation/pixel.gif' style='width:150px;height:26px;' align='right'>";
		if (curPos > 0)
			HTML += "<img src='" +  http_host + "navigation/img_arrow_l.gif' style='width:150px;height:26px;cursor:pointer;' align='left' onClick='DoBild(\"" + allCollection[parseInt(curPos)-1] + "\");''>";
		else
			HTML += "<img src='" +  http_host + "navigation/pixel.gif' style='width:150px;height:26px;' align='left'>";
		document.getElementById("ArraowsLayer").innerHTML = HTML;

		return;
	}
	window.setTimeout("dynamicImage(" + wc + ","+ hc +"," + w + "," + h + "," + sta + "," + stb + "," + curCS + ")", 0);
}


function loadScript(url)
{
	if (document.createElementNS)
		var se=document.createElementNS('http://www.w3.org/1999/xhtml','script');
	else if (document.createElement)
		var se=document.createElement('script');

	if (typeof (se) != "undefined")
	{
		se.setAttribute('language','javascript');
		se.setAttribute('type','text/javascript');
		se.setAttribute('src', url );

		if (document.getElementsByTagName)
			document.getElementsByTagName("head")[0].appendChild(se);
		else if (document.all)
			document.all("head").parentNode.appendChild(se);

		return true;
	}
	else return false;
}

function getParam(nm) {
var cons = nm + '=';
var ps = window.location.search;
 if (ps.length > 0) {
     var start = ps.indexOf(cons);
	 if (start != -1) {
	     start += cons.length;
		 var end = ps.indexOf('&',start);
		 if (end == -1) end = ps.length;
		  return unescape(ps.substring(start,end));
	}
}
   return null;
}

function str_replace(in_str, reg_exp, replace_str, opts)
{
	if(in_str==null) return in_str;
	if(typeof(opts)=="undefined") opts='g';
	var re=new RegExp(reg_exp,opts);
	return in_str.replace(re,replace_str);
}

// Animation der Navigation
function ShowHighLights()
{
	if (!document.getElementById) return;
	if (typeof(Ebene1) == "undefined") return;
	if (Ebene1 != "")
	{
		document.getElementById('e'+Ebene1).className="e1_a";
               
	}
	if (Ebene2 != "") 
	{	
		document.getElementById('e'+Ebene2).className="e2_a";   
		document.getElementById('ee'+Ebene2).style.backgroundImage = "url("+akt_url+"arrow_" + (Ebene3 != "" ? "u" : "r") + ".gif)";
        }
	if (Ebene3 != "") 
	{	
		document.getElementById('e'+Ebene3).className="e3_a";
		document.getElementById('ee'+Ebene3).style.backgroundImage = "url("+akt_url+"arrow_" + (Ebene4 != "" ? "u" : "r") + ".gif)";
        }                
	if (Ebene4 != "") 
        {
                document.getElementById('e'+Ebene4).className="e4_a";
		document.getElementById('ee'+Ebene4).style.backgroundImage = "url("+akt_url+"arrow_" + (Ebene4 != "" ? "r" : "r") + ".gif)";
        }
	getDoBildImgs("");
}

addEvent(window,"load",ShowHighLights);


