/*
  stripNL()           - Alle Newlines entfernen
  trim([true/false])  - alle Leerzeichen am Anfang und Ende entfernen m. Parame doppelte einfach machen
  ltrim()             - Leerzeichen Links entfernen
  rtrim()             - Leerzeichen Rechts entfernen

*/
String.prototype.trim = function (ws)
{
    if(!this.length) {
			return "";
		}
    var tmp = this.stripNL().ltrim().rtrim();
    if(ws) {
			return tmp.replace(/ +/g, ' ');
		}
    else {
			return tmp;
		}
};
String.prototype.rtrim = function ()
{
    if(!this.length) {
			return "";
		}
    return this.replace(/[\s|&nbsp;]+$/g, '');
};
String.prototype.ltrim = function ()
{
    if(!this.length) {
			return "";
		}
    return this.replace(/^[\s|&nbsp;]+/g, '');
};
String.prototype.stripNL = function ()
{
    if(!this.length) {
			return "";
		}
    return this.replace(/[\n\r]/g, '');
};



//________________________________________________________________________________________________________________________________
/*
v1.03 Copyright (c) 2006 Stuart Colville
http://muffinresearch.co.uk/archives/2006/04/29/getelementsbyclassname-deluxe-edition/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) {
		objColl = objContElm.all;
	}
  var arr = new Array();
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) {
			continue;
		}
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) {
					c++;
				}
        if ((delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}

// To cover IE 5 Mac lack of the push method
Array.prototype.push = function(value) {this[this.length] = value; };

//________________________________________________________________________________________________________________________________
/**/
var ortbyplzTime = '';
var unternehmenTO;
var MicrosoftModel=0;
var xplus=10,yplus=10;
var runnerobject;
var theFocus;

//________________________________________________________________________________________________________________________________
/**/
                          /* div-Sektion "runner" bewegen: */
function MouseAction(mausx,mausy)
{
  runnerobject.left=mausx+xplus;
  runnerobject.top=mausy+yplus;
}

                       /* das onMouseMove-event auswerten: */
function MouseMove(event)
{
  var mausx,mausy;
  if (typeof(event)!="object") {              /* kein event? */
		return;
	}
  if (MicrosoftModel) {                     /* MSIE: ------- */
    mausx=event.clientX;
    mausy=event.clientY;
    if (document.body.scrollLeft) {
    	mausx+=document.body.scrollLeft;
    }
    if (document.body.scrollTop) {
    	mausy+=document.body.scrollTop;
    }
  }
  else {                                    /* Netscape: --- */
    mausx=event.pageX;
    mausy=event.pageY;
  }
  MouseAction(mausx,mausy);
}

          /* Behandlung des Ereignisses und Objekt setzen: */
function MouseInit()
{
  if (document.all) {         /* MSIE, Konqueror, Opera: --- */
    MicrosoftModel=1;
    window.onmousemove=MouseMove;
    runnerobject=document.all.runner.style;
  }
  if (!(MicrosoftModel)) {                  /* Netscape: --- */
    if (typeof(document.addEventListener)=="function") {	/* Netscape6: --- */
      document.addEventListener("mousemove",MouseMove,true);
      runnerobject=document.getElementById("runner").style;
    }
    else
    if (document.runner) {                 /* Netscape4: --- */
      window.captureEvents(Event.MOUSEMOVE);
      window.onmousemove=MouseMove;
      runnerobject=document.runner;
    }
  }
}

//________________________________________________________________________________________________________________________________
//
	function buttonOver(button)
	{
		if(button.className == 'button') {
			button.style.color = "#005494";
			button.style.backgroundColor = "#D4D7E6";
		}
	}

	function buttonOut(button)
	{
		if(button.className == 'button') {
			button.style.color = "#195C8A";
			button.style.backgroundColor = "#EEEEEE";
		}
	}

//________________________________________________________________________________________________________________________________
//
	function proofNumeric(text)
	{
		text = text.replace(/,/, ".");
		text = text.replace(/[^\d\.]/g, "");
		
		var text3 = "";
		
		if(text.indexOf(".") != -1) {
			var temp = text.split(".");
			var text2 = "";
			var templen = temp.length;
			for(var i = 0; i < templen; i++) {
				text2 += temp[i];
			}
			text3 = text.substring(0, text.indexOf(".")+1) + text2.substr(text.indexOf("."));
			if(text.indexOf(".") === 0) {
				text3 = "0" + text3;
			}
		}
		else {
			text3 = text;
		}
		return text3;
	}

//________________________________________________________________________________________________________________________________
//Prüft Datumsgültigkeit
function checkDate(fieldname)
{
	var tag = document.getElementById(fieldname + "_tag");
	var monat = document.getElementById(fieldname + "_monat");
	var jahr = document.getElementById(fieldname + "_jahr");
	
	tag.value = tag.value.replace(/\D+/g, '');
	monat.value = monat.value.replace(/\D+/g, '');
	jahr.value = jahr.value.replace(/\D+/g, '');
	
	if(jahr.value != '') {
		if(jahr.value.length <= 2) {
			if(jahr.value < 100 && jahr.value > 38) {jahr.value = parseInt(jahr.value) + 1900;}
			else if(jahr.value >= 0 && jahr.value <= 38) {jahr.value = parseInt(jahr.value) + 2000;}
		}
		if(jahr.value.length == 3)
		{
			if(jahr.value < 100 && jahr.value > 38) {jahr.value = parseInt(jahr.value) + 1900;}
			else if(jahr.value >= 0 && jahr.value <= 38) {jahr.value = parseInt(jahr.value) + 2000;}
			else if(jahr.value < 300) {jahr.value = parseInt(jahr.value) + 1800;}
			else if(jahr.value > 300) {jahr.value = parseInt(jahr.value) + 1000;}
		}
	}

	if(tag.value == 0) {tag.value = 1;}
	if(monat.value == 0) {monat.value = 1;}

	if(monat.value != "")
	{
		if(monat.value > 12) {monat.value = 12;}

		if(monat.value == 4 || 
			 monat.value == 6 || 
			 monat.value == 9 || 
			 monat.value == 11)
		{
			if(tag.value > 30) tag.value = 30;
		}
		else if
			(monat.value == 1 || 
			 monat.value == 3 || 
			 monat.value == 5 || 
			 monat.value == 7 || 
			 monat.value == 8 || 
			 monat.value == 10 || 
			 monat.value == 12)
		{
			if(tag.value > 31) tag.value = 31;
		}
		else if (monat.value == 2)
		{
			if(jahr.value == '' || (jahr.value % 4) == 0)
			{
				if(tag.value > 29) tag.value = 29;
			}
			else
			{
				if(tag.value > 28) tag.value = 28;
			}
		}
	}

	if(tag.value < 10 && tag.value > 0 && tag.value.length == 1) {tag.value = "0" + tag.value;}
	if(monat.value < 10 && monat.value > 0 && monat.value.length == 1) {monat.value = "0" + monat.value;}
}

//________________________________________________________________________________________________________________________________
//
	function markStandort(standort)
	{
		var so = getElementsByClassName('standort');
		
		for(var i = 0; i < so.length; i++) {
			if(so[i].id == 'standort_' + standort) {
				so[i].style.fontWeight = 'bold';
			}
			else {
				so[i].style.fontWeight = 'normal';
			}
		}
		return true;
	}

//________________________________________________________________________________________________________________________________
//
function hideUnternehmen()
{
	document.getElementById('submenu_unternehmen').style.display = 'none';
}
function hideSubmenu(mainmenu)
{
	unternehmenTO = setTimeout(hideUnternehmen, 500);
}

//________________________________________________________________________________________________________________________________
//
function setOpacity(obj, opacity, force)
{
	if(force === true || obj.focus !== true) {
		if(document.all) {
			if(opacity <= 1) {
				opacity = opacity * 100;
			}
			obj.style.filter = 'alpha(opacity: ' + opacity + ')';
		}
		else {
			if(typeof opacity == 'string') {
				opacity = '';
			}

			if(opacity > 1) {
				opacity = opacity / 100;
			}
			obj.style.opacity = opacity;
		}
		return true;
	}
}

//________________________________________________________________________________________________________________________________
//
function getPosLeft(oid)
{
	var elem;
	if(typeof(oid) == "object") {
		elem = oid;
	}
	else {
		elem = document.getElementById(oid);
	}
	
  var tagname="",x=0,y=0;
  
	/* solange elem ein Objekt ist und die Eigenschaft offsetTop enthaelt wird diese Schleife fuer das Element und all seine Offset-Eltern ausgefuehrt */
  while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined")) {
    y+=elem.offsetTop;     /* Offset des jeweiligen Elements addieren */
    x+=elem.offsetLeft;    /* Offset des jeweiligen Elements addieren */
    tagname=elem.tagName.toUpperCase(); /* tag-Name ermitteln, Grossbuchstaben */

		/* wenn beim Body-tag angekommen elem fuer Abbruch auf 0 setzen */
    if (tagname=="BODY") {
      elem=0;
    }

		/* wenn elem ein Objekt ist und offsetParent enthaelt Offset-Elternelement ermitteln */
    if (typeof(elem)=="object") {
      if (typeof(elem.offsetParent)=="object") {
        elem=elem.offsetParent;
      }
    }
  }

	return x;
}

//________________________________________________________________________________________________________________________________
//
function getPosTop(oid)
{
	var elem;
	if(typeof(oid) == "object") {
		elem = oid;
	}
	else {
		elem = document.getElementById(oid);
	}
	
  var tagname="",x=0,y=0;
  
	/* solange elem ein Objekt ist und die Eigenschaft offsetTop enthaelt wird diese Schleife fuer das Element und all seine Offset-Eltern ausgefuehrt */
  while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined")) {
    y+=elem.offsetTop;     /* Offset des jeweiligen Elements addieren */
    x+=elem.offsetLeft;    /* Offset des jeweiligen Elements addieren */
    tagname=elem.tagName.toUpperCase(); /* tag-Name ermitteln, Grossbuchstaben */

		/* wenn beim Body-tag angekommen elem fuer Abbruch auf 0 setzen */
    if (tagname=="BODY") {
      elem=0;
    }

		/* wenn elem ein Objekt ist und offsetParent enthaelt Offset-Elternelement ermitteln */
    if (typeof(elem)=="object") {
      if (typeof(elem.offsetParent)=="object") {
        elem=elem.offsetParent;
      }
    }
  }

	return y;
}

//________________________________________________________________________________________________________________________________
//
var img = new Image();
img.src = "../includes/images/logoprint.gif";

