var myImage;

function showDiv(div, value)
{
	if (value == true)
		document.getElementById(div).style.display = "inline";
	else
		document.getElementById(div).style.display = "none";
}

function showPrint(url)
{
	var w = 805; 
	var h = 620; 
	x = (screen.width / 2) - (w / 2);
	y = (screen.height / 2) - (h / 2);
	windowHandle = window.open(url, '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
}

function createImagePopup(imagePath)
{
  myImage = new Image();
  myImage.src = imagePath;
  __windowLauncher(imagePath);
}

function __windowLauncher(imagePath){
	if((myImage.width != 0) && (myImage.height != 0)) {
		__createImageWindow(imagePath, myImage.width + 20, myImage.height + 20);
	} else {
		myCallback = "__windowLauncher('"+imagePath+"')";
    	interval = setTimeout(myCallback, 50);
	}
}

function __createImageWindow(url, w, h)
{
	x = (screen.width / 2) - (w / 2);
	y = (screen.height / 2) - (h / 2);
	windowHandle = window.open(url, '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
}

function telefonAnlagenKommentar(path, id)
{
	window.open(path+'/telefonanlagen_popup.php?id='+id, '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300');
}

function checkFormAndRedirect(id)
{
	document.newsletterformular.newsletterformular_id.value = id;
	document.newsletterformular.submit();
}

/*
Cross browser Marquee II- ?? Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Credit MUST stay intact
*/
//Specify the marquee's width (in pixels)
var marqueewidth="160px"
//Specify the marquee's height
var marqueeheight="90px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=1
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1
//Specify the marquee's content
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):
////NO NEED TO EDIT BELOW THIS LINE////////////
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate(){
	if (iedom){
		cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
		cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
		cross_marquee.innerHTML=marqueecontent
		actualheight=cross_marquee.offsetHeight
	}
	lefttime=setInterval("scrollmarquee()",40)
}

function scrollmarquee(){
	if (iedom){
		if (parseInt(cross_marquee.style.top)> -actualheight) cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
		else cross_marquee.style.top=(parseInt(marqueeheight))+"px"
		if (parseInt(cross_marquee.style.top)>parseInt(marqueeheight)) cross_marquee.style.top=-actualheight-copyspeed+"px"
	}
}
function neues_fenster(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}

function checkNumeric(objName, minval, maxval, comma, period, hyphen)
{
	var numberfield = objName;
	if (chkNumeric(objName, minval, maxval, comma, period, hyphen) == false) {
		numberfield.select();
		numberfield.focus();
		return false;
	} else
		return true;
}

function chkNumeric(objName, minval, maxval, comma, period, hyphen)
{
	// only allow 0-9 be entered, plus any values passed
	// (can be in any order, and don't have to be comma, period, or hyphen)
	// if all numbers allow commas, periods, hyphens or whatever,
	// just hard code it here and take out the passed parameters
	var checkOK = "0123456789" + comma + period + hyphen;
	var checkStr = objName;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";

	for (i = 0;  i < checkStr.value.length;  i++) {
		ch = checkStr.value.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length) {
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid) {	
		alertsay = "Bitte nur folgenden Zahlen eingeben: \""
		alertsay = alertsay + checkOK + "\""
		alert(alertsay);
		return (false);
	}

	// set the minimum and maximum
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval)) {
		alertsay = "Bitte geben Sie nur Zahlen "
		alertsay = alertsay + " >= \"" + minval + "\" in dieses Feld ein."
//		alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
		alert(alertsay);
		return (false);
	}
}