var MouseSupport
// Calendar start
var WelchesFeld
var NameVomFeld
function positionInfo(object) {
	var p_elm = object;
  this.getElementLeft = getElementLeft;
  function getElementLeft() {
    var x = 0;
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    while (elm != null) {
      x+= elm.offsetLeft;
      elm = elm.offsetParent;
    }
    return parseInt(x);
  }

  this.getElementWidth = getElementWidth;
  function getElementWidth(){
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    return parseInt(elm.offsetWidth);
  }

  this.getElementRight = getElementRight;
  function getElementRight(){
    return getElementLeft(p_elm) + getElementWidth(p_elm);
  }

  this.getElementTop = getElementTop;
  function getElementTop() {
    var y = 0;
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    while (elm != null) {
      if(elm.id) {
        if(elm.id!='syncon') 
            y += elm.offsetTop;
      } 
      else 
            y += elm.offsetTop;
      elm = elm.offsetParent;
    }
    return parseInt(y);
  }

  this.getElementHeight = getElementHeight;
  function getElementHeight(){
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    return parseInt(elm.offsetHeight);
  }

  this.getElementBottom = getElementBottom;
  function getElementBottom(){
    return getElementTop(p_elm) + getElementHeight(p_elm);
  }
}

function CalendarControl() {

  var calendarId = 'CalendarControl';
  var currentYear = 0;
  var currentMonth = 0;
  var currentDay = 0;

  var selectedYear = 0;
  var selectedMonth = 0;
  var selectedDay = 0;

  var months = ['Januar','Februar','M&auml;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'];
  var dateField = null;
  


  function getProperty(p_property){
    var p_elm = calendarId;
    var elm = null;

    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    if (elm != null){
      if(elm.style){
        elm = elm.style;
        if(elm[p_property]){
          return elm[p_property];
        } else {
          return null;
        }
      } else {
        return null;
      }
    }
  }

  function setElementProperty(p_property, p_value, p_elmId){
    var p_elm = p_elmId;
    var elm = null;

    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    if((elm != null) && (elm.style != null)){
      elm = elm.style;
      elm[ p_property ] = p_value;
    }
  }

  function setProperty(p_property, p_value) {
    setElementProperty(p_property, p_value, calendarId);
  }

  function getDaysInMonth(year, month) {
    return [31,((!(year % 4 ) && ( (year % 100 ) || !( year % 400 ) ))?29:28),31,30,31,30,31,31,30,31,30,31][month-1];
  }

function getDayOfWeek(year, month, day) {
    var date = new Date(year,month-1,day-1)
    return date.getDay();
  }

  this.setDate = setDate;
  function setDate(year, month, day) {
    if (dateField) {
      if (month < 10) {month = "0" + month;}
      if (day < 10) {day = "0" + day;}	
      if (WelchesFeld == "zeit") {var dateString = day+"."+month+"."+year + " 00:00:00";}
      if (WelchesFeld == "datum") {var dateString = day+"."+month+"."+year;}
      WelchesFeld=""
      try {
      eval('document.SPDBForm.'+dateFieldText+'.value = dateString');
      eval('onChangeOf'+dateFieldText+'()');
      } catch(e) {}
      hide();
    }
    return;
  }

  this.changeMonth = changeMonth;
  function changeMonth(change) {
  if(currentMonth=='01'){currentMonth=1}
  if(currentMonth=='02'){currentMonth=2}
  if(currentMonth=='03'){currentMonth=3}
  if(currentMonth=='04'){currentMonth=4}
  if(currentMonth=='05'){currentMonth=5}
  if(currentMonth=='06'){currentMonth=6}
  if(currentMonth=='07'){currentMonth=7}
  if(currentMonth=='08'){currentMonth=8}
  if(currentMonth=='09'){currentMonth=9}
  if(currentMonth==10){currentMonth=10}
  if(currentMonth==11){currentMonth=11}
  if(currentMonth==12){currentMonth=12}
  
    currentMonth =currentMonth*1+1*change;
    currentDay = 0;
    if(currentMonth > 12) {
      currentMonth = 1;
      currentYear++;
    } else if(currentMonth < 1) {
      currentMonth = 12;
      currentYear--;
    }

    calendar = document.getElementById(calendarId);
    calendar.innerHTML = calendarDrawTable();
  }

  this.changeYear = changeYear;
  function changeYear(change) {
    currentYear = currentYear*1+1*change;
    currentDay = 0;
    calendar = document.getElementById(calendarId);
    calendar.innerHTML = calendarDrawTable();
  }

  function getCurrentYear() {
    var year = new Date().getYear();
	if(year < 1900) year += 1900;
	var str = document.getElementById(NameVomFeld).value;
	str = str.substring(6,10);	
	if(str!=year && str!=''){
		year = str;
	}
	else
	{
		if(year < 1900) year += 1900;
	}    
    return year;
  }

  function getCurrentMonth() {
	if(document.getElementById(NameVomFeld).value!=''){
		var str = document.getElementById(NameVomFeld).value;
		str = str.substring(3,5);	
	}  
	else
	{
		str = new Date().getMonth() + 1;
	}
    return str;
  } 

  function getCurrentDay() {
	if(document.getElementById(NameVomFeld).value!=''){
		var str = document.getElementById(NameVomFeld).value;
		str = str.substring(0,2);	
	}
	else
	{
		str = new Date().getDate();
	}
    return str; 
  }

  function calendarDrawTable() {
    var dayOfMonth = 1;
    var validDay = 0;
    var startDayOfWeek = getDayOfWeek(currentYear, currentMonth, dayOfMonth);
    var daysInMonth = getDaysInMonth(currentYear, currentMonth);
    var css_class = null; //CSS class for each day

    var table = "<table cellspacing='0' cellpadding='0' border='0'>";
	NameVomFeld='';

    table = table + "<tr class='header'>";
    table = table + "  <td colspan='2' class='previous' style='padding: 3px;font-size:10pt;'><a href='javascript:changeCalendarControlMonth(-1);' title='Monat - 1'>&lt;&lt;</a><br /><a href='javascript:changeCalendarControlYear(-1);' title='Jahr - 1'>&laquo&laquo;</a></td>";
    table = table + "  <td colspan='3' class='title'>" + months[currentMonth-1] + "<br />" + currentYear + "</td>";
    table = table + "  <td colspan='2' class='next' style='padding: 3px;font-size:10pt;'><a href='javascript:changeCalendarControlMonth(1);' title='Monat + 1'>&gt;&gt;</a><br 7><a href='javascript:changeCalendarControlYear(1);' title='Jahr + 1'>&raquo;&raquo;</a></td>";
    table = table + "</tr>";
    table = table + "<tr><th>M</th><th>D</th><th>M</th><th>D</th><th>F</th><th>S</th><th>S</th></tr>";

    for(var week=0; week < 6; week++) {
      table = table + "<tr>";
      for(var dayOfWeek=0; dayOfWeek < 7; dayOfWeek++) {
        if(week == 0 && startDayOfWeek == dayOfWeek) {
          validDay = 1;
        } else if (validDay == 1 && dayOfMonth > daysInMonth) {
          validDay = 0;
        }

        if(validDay) {
          if (dayOfMonth == selectedDay && currentYear == selectedYear && currentMonth == selectedMonth) {
            css_class = 'current';
          } else if (dayOfWeek == 5 || dayOfWeek == 6) {
            css_class = 'weekend';
          } else {
            css_class = 'weekday';
          }

          table = table + "<td><a class='"+css_class+"' href=\"javascript:setCalendarControlDate("+currentYear+","+currentMonth+","+dayOfMonth+")\">"+dayOfMonth+"</a></td>";
          dayOfMonth++;
        } else {
          table = table + "<td class='empty'>&nbsp;</td>";
        }
      }
      table = table + "</tr>";
    }

    table = table + "<tr class='header'><th colspan='7' style='padding: 3px;'><a href='javascript:hideCalendarControl();'>Schlie&szlig;en</a></td></tr>";
    table = table + "</table>";

    return table;
  }

  this.show = show;
  function show(field) {
    if (dateField == field) {
      return;
    } else {
      dateField = field;
    }

    if(dateField) {
      try {
        var dateString = new String(dateField.value);
        var dateParts = dateString.split("-");
        
        selectedMonth = parseInt(dateParts[0],10);
        selectedDay = parseInt(dateParts[1],10);
        selectedYear = parseInt(dateParts[2],10);
      } catch(e) {}
    }

    if (!(selectedYear && selectedMonth && selectedDay)) {
      selectedMonth = getCurrentMonth();
      selectedDay = getCurrentDay();
      selectedYear = getCurrentYear();
    }

    currentMonth = selectedMonth;
    currentDay = selectedDay;
    currentYear = selectedYear;

    if(document.getElementById){

      calendar = document.getElementById(calendarId);
      calendar.innerHTML = calendarDrawTable(currentYear, currentMonth);

      setElementProperty('display', 'block', 'CalendarControlIFrame');
      setProperty('display', 'block');

      var fieldPos = new positionInfo(dateField);
      var calendarPos = new positionInfo(calendarId);

      var x = fieldPos.getElementLeft();
      var y = fieldPos.getElementBottom();

      setProperty('left', x + "px");
      setProperty('top', y + "px");
      setElementProperty('left', x + "px", 'CalendarControlIFrame');
      setElementProperty('top', y + "px", 'CalendarControlIFrame');
      setElementProperty('width', calendarPos.getElementWidth() + "px", 'CalendarControlIFrame');
      setElementProperty('height', calendarPos.getElementHeight() + "px", 'CalendarControlIFrame');
    }
  }

  this.hide = hide;
  function hide() {
    if(dateField) {
      setProperty('display', 'none');
      setElementProperty('display', 'none', 'CalendarControlIFrame');
      dateField = null;
      NameVomFeld='';
    }
  }
}

var calendarControl = new CalendarControl();

function showCalendarControl(textField, field, WelchesFeldKommt) {
	NameVomFeld='';
	dateFieldText = field;
	WelchesFeld = WelchesFeldKommt
	NameVomFeld = document.getElementById(field).name;
	calendarControl.show(textField);
}

function hideCalendarControl() {
	WelchesFeld=""
	calendarControl.hide();
}

function setCalendarControlDate(year, month, day) {
  calendarControl.setDate(year, month, day);
}

function changeCalendarControlYear(change) {
  calendarControl.changeYear(change);
}

function changeCalendarControlMonth(change) {
  calendarControl.changeMonth(change);
}

document.write("<iframe id='CalendarControlIFrame' src='javascript:false;' frameBorder='0' scrolling='no' style='display:none'></iframe>");
document.write("<div id='CalendarControl'></div>");

// Calendar ende

function changeImages() {if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];}}}
var preloadFlag = false;
var canPreloadFlag = false;
var AktiverVordergrund;
var AktiverHintergrund;
var AktivesFeld;
var AktivePfeile;
var hilfe

function BtnDown() {	window.event.srcElement.style.borderStyle = "inset"; }
function BtnUp() {window.event.srcElement.style.borderStyle = "outset";}
function Toggle()
{
	var s;
	text = window.event.srcElement.innerText;
	if (text=="B") document.execCommand("Bold");
	else if (text=="I") document.execCommand("Italic");
	else if (text=="U") document.execCommand("Underline");
	else if (text=="1.2.") document.execCommand("InsertOrderedList");
	else if (text=="1") document.execCommand("FontSize",false,"1");
	else if (text=="2") document.execCommand("FontSize",false,"2");
	else if (text=="3") document.execCommand("FontSize",false,"3");
	else if (text=="4") document.execCommand("FontSize",false,"4");
	else if (text=="5") document.execCommand("FontSize",false,"5");
	else if (text=="6") document.execCommand("FontSize",false,"6");
	else if (text=="7") document.execCommand("FontSize",false,"7");
	else if (text=="R") document.execCommand("JustifyRight");
	else if (text=="C") document.execCommand("JustifyCenter");
	else if (text=="L") document.execCommand("JustifyLeft");
	else if (text==">") document.execCommand("Indent");
	else if (text=="<") document.execCommand("Outdent");
	else if (text=="Arial") document.execCommand("FontName",false,"Arial");
	else if (text=="Times") document.execCommand("FontName",false,"Times");
	else if (text=="Courier") document.execCommand("FontName",false,"Courier");
	else if (text=="N") document.execCommand("RemoveFormat");
	else if (text=="...") document.execCommand("InsertUnorderedList");
	else if (text=="IMG"){
		if(! document.activeElement) {
			alert('Bitte setzen Sie den Cursor zunächst an die Stelle, an der das Bild eingefügt werden soll!');
		} else {
			if (document.activeElement.contentEditable=='true')
			{
				document.execCommand("InsertImage",true,"/synway/");
				s=document.activeElement.innerHTML;
				document.activeElement.innerHTML=s.replace('file://','');
			}
			else
			{
				alert('Bitte setzen Sie den Cursor zunächst an die Stelle, an der das Bild eingefügt werden soll!');
			}
		}
		}
	else if (text=="Link") document.execCommand("CreateLink",true)
	window.event.srcElement.style.borderStyle = "outset";
}
function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
	datefield.focus();
	datefield.select();
	alert("Hier bitte ein Datum in einem korrekten Format eingeben!")
	return false;}
else {return true;}
}

function checkfirst(objName) {
var textfield = objName;
var inhalt,Anfang;

inhalt=textfield.value;
Anfang=inhalt.substr(0,1);
Anfang=Anfang.toUpperCase();
inhalt=inhalt.substr(1,inhalt.length-1);
inhalt=Anfang.concat(inhalt);
if(textfield.value!=inhalt) textfield.value=inhalt;
return true;
}

function chkdate(objName) {
	var strDate,strTime,strDateArray,strTimeArray;
	var strDay,strMonth,strYear,strHour,strMinute,strSecond;
	var intday,intMonth,intYear,intHour,intMinute,intSecond;
	var booFound = false;
	var datefield = objName;
	var strSeparatorArray = new Array("."," ","/","-",",");
	var intElementNr;
	var err = 0;
	var strMonthArray = new Array(12);
	var aktuellesDatum = new Date();
	var aktuellesJahr = aktuellesDatum.getFullYear();
		
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "Mai";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Okt";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dez";
	strDate = datefield.value;
	strTime="";
	if (strDate.indexOf(" ") != -1){
		var i;
		i=strDate.indexOf(" ");
		strTime=strDate.substr(i+1,strDate.length-i-1);
		strDate=strDate.substr(0,i);
			
	}
	if (strDate.length < 1){
		return true;
	}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
	{
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
		{
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) 
			{
				err = 1;
				return false;
			}
			else 
			{
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
	   }
	}
	if (booFound == false) 
	{
		if (strDate.length>5) 
		{
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
		}
	}
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) 
	{
		err = 2;
		return false;
	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) 
	{
		for (i = 0;i<12;i++) 
		{
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) 
			{
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
			}
		}
		if (isNaN(intMonth)) 
		{
			err = 3;
			return false;
		}
	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) 
	{
		err = 4;
		return false;
	}

	if(intYear<aktuellesJahr-1995) intYear=intYear+2000;
	else	if(intYear<100) intYear=intYear+1900;
		
	if(intYear<1800 || intYear>2199)
	{
		err = 11;
		return false;
	}
	if (intMonth>12 || intMonth<1) 
	{
		err = 5;
		return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) 
	{
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) 
	{
		err = 7;
		return false;
	}
	if (intMonth == 2) 
	{
		if (intday < 1) 
		{
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) 
		{
			if (intday > 29) 
			{
				err = 9;
				return false;
			}
		}
		else 
		{
			if (intday > 28) 
			{
				err = 10;
				return false;
			}
		}
	}
	if (strTime!="")
	{
		booFound = false;
			
		 if (strTime.indexOf(":") != -1) 
		 {
		 	strTimeArray = strTime.split(":");
		 	if ((strTimeArray.length) < 2 || (strTimeArray.length > 3)) 
		 	{
		 		err = 11;
		 		return false;
		 	}
		 	else 
		 	{
		 		strHour = strTimeArray[0];
		 		strMinute = strTimeArray[1];
		 		if (strTimeArray.length==3) 
		 			strSecond = strTimeArray[2];
		 		else
		 			strSecond = "00";
		 	}
		 	booFound = true;
		}
		if (booFound == false) 
		{
			if (strTime.length>3) 
			{
				strHour = strTime.substr(0, 2);
				strMinute = strTime.substr(2, 2);
				if (strTime.length>5)
				{
					strSecond = strTime.substr(4,2);
				}
				else
				{
					strSecond = "00";
				}
			}
		}
		intHour = parseInt(strHour, 10);
		if (isNaN(intHour)) 
		{
			err = 12;
			return false;
		}
		intMinute = parseInt(strMinute, 10);
		if (isNaN(intMinute)) 
		{
			if (isNaN(intMinute)) 
			{
				err = 13;
				return false;
			}
		}
		intSecond = parseInt(strSecond, 10);
		if(isNaN(intSecond)){
			err = 14;
			return false;
		}
		if(intHour<0 || intHour>23){
			err = 15;
			return false;
		}
		if(intMinute>59 || intMinute<0) {
			err = 16;
			return false;
		}
		if(intSecond>59 || intSecond<0) {
			err = 17;
			return false;
		}
		strDay=""+intday;
		if (strDay.length==1) strDay="0"+strDay;
		strMonth=""+intMonth;
		if (strMonth.length==1) strMonth="0"+strMonth;
		strMinute=""+intMinute;
		if (strMinute.length==1) strMinute="0"+strMinute;
		strHour=""+intHour;
		if (strHour.length==1) strHour="0"+strHour;
		strSecond=""+intSecond;
		if (strSecond.length==1) strSecond="0"+strSecond;
		datefield.value = strDay + "." + strMonth + "." + intYear+" "+strHour + ":" + strMinute + ":" + strSecond;
	}
	else {
		strDay=""+intday;
		if (strDay.length==1) strDay="0"+strDay;
		strHour=""+intHour;
		if (strMonth.length==1) strMonth="0"+strMonth;
		datefield.value = strDay + "." + strMonth + "." + intYear;
	}
	return true;
}
	
function LeapYear(intYear) 
{
	if (intYear % 100 == 0) 
	{
		if (intYear % 400 == 0) { return true; }
	}
	else 
	{
		if ((intYear % 4) == 0) { return true; }
	}
	return false;
}
	
function doDateCheck(from, to) 
{
	if (Date.parse(from.value) <= Date.parse(to.value)) 
	{
		//alert("The dates are valid.");
	}
	else 
	{
		if (from.value == "" || to.value == "") 
			alert("Beide Datumsangaben müssen angegeben werden!");
		else 
			alert("Das BIS-Datum muß nach dem VON-Datum liegen!");
	}
}

// Jetzt zu den Popups
function setupDescriptions() 
{
	var x = navigator.appVersion;
	y = x.substring(0,4);
	if (y>=4) setVariables();
	if(canPreloadFlag)	eval('preloadImages()');
    try {
      eval('SetupLayout();');
      } catch(e) {}
}

var x,y,a,b,nx,ny,oPopup;
	
function setVariables(){
	if (navigator.appName == "Netscape") 
	{
		h=".left=";
		v=".top=";
		dS="document.";
		sD="";
	}
	else 
	{
		h=".pixelLeft=";
		v=".pixelTop=";
		dS="";
		sD=".style";
	}
}

var isNav = (navigator.appName.indexOf("Netscape") !=-1);
if(!isNav)
{
	if((navigator.appVersion.indexOf("MSIE 6")!=-1) || (navigator.appVersion.indexOf("MSIE 7")!=-1) ||
		(navigator.appVersion.indexOf("MSIE 8")!=-1) || (navigator.appVersion.indexOf("MSIE 5.5")!=-1)) {
		oPopup=window.createPopup();		
	} 
}
	
function popLayer(Text)
{
	var breite
		
	breite=200
	if(Text.length>300) breite=400
	if(isNav) {
		desc = "<table cellpadding=2 cellspacing=0 border=1 bordercolor=#1111aa bgcolor=#FFFFdd width="+breite+"><tr><td><font face=arial size=1>";
		desc += Text;
		desc += "</font></td></tr></table>";
		document.PopupLayer.document.write(desc);
		document.PopupLayer.document.close();
		document.PopupLayer.left=x+10;
		document.PopupLayer.top=y;
	}
	else 
	{
		if(oPopup) {
			var oPopupBody=oPopup.document.body;
			var b,h;
			
			b=String(Text).length*10;
			h=15;
			if(Text.substring(0,6)=='<table') {
				if(b>600) {
					h=h+15*(b/600);
					b=600;}
				if(h>700) h=700;
			} else {
				if(b>400) {
					h=h+15*(b/400);
					b=400;}
				if(h>600) h=600;
			}
			oPopupBody.style.backgroundColor = "lightyellow";
			oPopupBody.style.fontSize = 10;
			oPopupBody.style.fontFamily = "Arial";
			oPopupBody.style.border = "solid black 2px";
			oPopupBody.innerHTML = Text;
			oPopup.show(x,y,b, h, document.body);
		} else {
			if(x+breite>document.body.clientWidth-document.body.scrollLeft)
				nx=-breite-10;
			else
				nx=10;
			if(y+200>document.body.clientHeight+document.body.scrollTop)
				ny=-200+document.body.clientHeight-y+document.body.scrollTop;
			else			
				ny=10;
			desc = "<table cellpadding=2 cellspacing=0 border=1 bordercolor=#1111aa bgcolor=#FFFFdd width="+breite+"><tr><td><font face=arial size=1>";
			desc += Text;
			desc += "</font></td></tr></table>";
			PopupLayer.innerHTML=desc;
			eval(dS+"PopupLayer"+sD+h+(x+nx));
			eval(dS+"PopupLayer"+sD+v+(y+ny));
		}
	}
}

function HideNav()
{
if(divLinkespalte.style.display=="none") {
divLinkespalte.style.display="inline";
divPlatzhalter.style.display="none";
} else {
divLinkespalte.style.display="none";
divPlatzhalter.style.display="inline";
}
}

function DoNoCheck()
{
document.SPDBForm.onsubmit = DoNoCheck;
return true;
}

function newImage(arg) {if (document.images) {rslt = new Image();
rslt.src = arg;	return rslt;}}
	
function hideLayer(a)
{
	if(isNav) 
	{
		eval(document.PopupLayer.top=a);
	}
	else 
		PopupLayer.innerHTML="";
	if(oPopup) oPopup.hide();
}


function CheckProzent(o,feldname,ReiterZahl)
{
if(o.value!='')	{
	if(isNaN(o.value)) {
		alert('Bitte geben Sie bei '+feldname+' eine gültige Prozentzahl ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
	if((Number(o.value)>100) || Number(o.value)<0)	{
		alert('Bitte geben Sie bei '+feldname+' eine gültige Prozentzahl zwischen 0 und 100 ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
}
return true;
}

function CheckProzentOpen(o,feldname,ReiterZahl)
{
if(o.value!='')	{
	if(isNaN(o.value)) {
		alert('Bitte geben Sie bei '+feldname+' eine gültige Prozentzahl ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
}
return true;
}
		
function CheckPromille(o,feldname,ReiterZahl)
{
if(o.value!='')	{
	if(isNaN(o.value))	{
		alert('Bitte geben Sie bei '+feldname+' eine gültige Promillezahl ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
	if((Number(o.value)>1000) || Number(o.value)<0)	{
		alert('Bitte geben Sie bei '+feldname+' eine gültige Promillezahl zwischen 0 und 1000 ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
}
return true;
}

function CheckPromilleOpen(o,feldname,ReiterZahl)
{
if(o.value!='')	{
	if(isNaN(o.value))	{
		alert('Bitte geben Sie bei '+feldname+' eine gültige Promillezahl ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
}
return true;
}

function CheckZahlMitNullen(o,feldname,ReiterZahl,laenge)
{
if(o.value!='') {
	var s=o.value;
	s=s.replace(' ','');
	s=s.replace('+','');
	s=s.replace('-','');
	s=s.replace('E','');
	s=s.replace('e','');
	s=s.replace('g','');
	s=s.replace('G','');
	o.value=s;
	if(isNaN(o.value)) {
		alert('Bitte geben Sie bei '+feldname+' eine korrekte Zahl mit maximal '+laenge+' Ziffern ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}
	while (String(o.value).length<laenge)
		o.value='0'+o.value;}
return true;
}

function CheckInt(o,feldname,ReiterZahl)
{
if(o.value!='') { var ss;
	ss=String(o.value);
	ss=ss.replace('.',',');
	if(isNaN(ss)) {
		alert('Bitte geben Sie bei '+feldname+' eine gültige ganze Zahl ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}}
return true;
}

function CheckNum(o,feldname,ReiterZahl)
{
if(o)
if(o.value!='')	{ 
	var ss;
	ss=String(o.value);
	ss=ss.replace('.','');
	ss=ss.replace('.','');
	ss=ss.replace('.','');
	ss=ss.replace('.','');
	ss=ss.replace(',','.');
	if(isNaN(ss)) {
		alert('Bitte geben Sie bei '+feldname+' eine gültige Zahl ein!');
		if(ReiterZahl>0) ReiterSelect(ReiterZahl);
		o.focus();
		return false;}}
return true;
}

function ReturnFalse() {return false;};
function ReturnTrue() {return true;};

function WeiterClicked() {
	if (document.SPDBForm.DoRefresh.value=='') {
		if (DoCheck) {
			if(DoCheck()) {
				document.SPDBForm.DoRefresh.value='1';
				document.SPDBForm.NaechsterSchritt.value=parseInt(document.SPDBForm.LetzterSchritt.value)+1;
				Refreshvorbereitung();
				document.SPDBForm.synwayscrollx.value=0;
				document.SPDBForm.synwayscrolly.value=0;
				document.SPDBForm.submit();}
			else {
			    document.SPDBForm.onsubmit=ReturnFalse;
                setTimeout("document.SPDBForm.onsubmit=DoCheck;",99);
			    return false;}}
		else {
			document.SPDBForm.DoRefresh.value='1';
			document.SPDBForm.NaechsterSchritt.value=parseInt(document.SPDBForm.LetzterSchritt.value)+1;
			Refreshvorbereitung();
			document.SPDBForm.synwayscrollx.value=0;
			document.SPDBForm.synwayscrolly.value=0;
			document.SPDBForm.submit();}
	}
}

function ZurueckClicked() {
	if (document.SPDBForm.DoRefresh.value=='') {
//		if (DoCheck) {
//			if(DoCheck()) {
//				document.SPDBForm.DoRefresh.value='1';
//				document.SPDBForm.NaechsterSchritt.value=parseInt(document.SPDBForm.LetzterSchritt.value)-1;
//				Refreshvorbereitung();
//				document.SPDBForm.synwayscrollx.value=0;
//				document.SPDBForm.synwayscrolly.value=0;
//				document.SPDBForm.submit();}}
//		else {
				document.SPDBForm.DoRefresh.value='1';
				document.SPDBForm.NaechsterSchritt.value=parseInt(document.SPDBForm.LetzterSchritt.value)-1;
				Refreshvorbereitung();
				document.SPDBForm.synwayscrollx.value=0;
				document.SPDBForm.synwayscrolly.value=0;
				document.SPDBForm.onsubmit=ReturnTrue;
				document.SPDBForm.submit();}
//	}
}

function PrintAuftrag()
{
    try {
	    if(document.frmAuswertung.Auswertung.value=='') 
	    {
		    alert('Bitte suchen Sie zuvor aus, was zu erzeugen ist!');
		    document.frmAuswertung.Auswertung.focus();
		    return false;
	    }
    } catch(e) {}
}

function handlerMM(e)
{
x = ((isNav) ? e.pageX+window.pageXOffset : event.clientX+document.body.scrollLeft) ;
y = ((isNav) ? e.pageY+window.pageYOffset : event.clientY+document.body.scrollTop) ;
}

function DelAllCheck(u)
{
	if(confirm('Die loescht alle auf dieser Seite der Liste zu sehenden Datensaetze!\n\nWollen Sie das wirklich?')) 
	{
		window.location.href=u;
	}
}

if (isNav)
{
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;



AktivePfeile=0;

function ZeileLoeschenJN()
{
return confirm('Wollen Sie die Zeile und die darauf befindlichen Diagrammelemente wirklich löschen?');
}

function SpalteLoeschenJN()
{
return confirm('Wollen Sie die Spalte und die darauf befindlichen Diagrammelemente wirklich löschen?');
}

function VordergrundClick(bild)
{
if(AktiverVordergrund) AktiverVordergrund.style.borderColor="#999999";
bild.style.borderColor="darkred";
AktiverVordergrund=bild;
myForm.Vordergrund.value=bild.name;
}

function HintergrundClick(bild)
{
if(AktiverHintergrund) AktiverHintergrund.style.borderColor="#999999";
bild.style.borderColor="darkred";
AktiverHintergrund=bild;
myForm.Hintergrund.value=bild.name;
}

function PfeilClick(pfeil)
{
PfeilDarstellung(AktivePfeile^pfeil);

}

function PfeilDarstellung(pfeil)
{

if( ((pfeil&1)==0)) myForm.Pfeil_1.style.borderColor="#999999";
if( ((pfeil&2)==0)) myForm.Pfeil_2.style.borderColor="#999999";
if( ((pfeil&4)==0)) myForm.Pfeil_4.style.borderColor="#999999";
if( ((pfeil&8)==0)) myForm.Pfeil_8.style.borderColor="#999999";

if((pfeil&1)>0) myForm.Pfeil_1.style.borderColor="darkred";
if((pfeil&2)>0) myForm.Pfeil_2.style.borderColor="darkred";
if((pfeil&4)>0) myForm.Pfeil_4.style.borderColor="darkred";
if((pfeil&8)>0) myForm.Pfeil_8.style.borderColor="darkred";

AktivePfeile=pfeil;
myForm.Pfeil.value=pfeil;
}

function editExpSel(dictname,nr,id) {
var d,alt,hidden;
hidden=document.getElementById(dictname+'_NR');
d=document.getElementById(dictname+'bag'+nr);
alt=document.getElementById(dictname+'bag'+hidden.value);
if(d) {
d.style.backgroundColor="#dddddd";
d.style.fontWeight="bold";
if(alt) {
alt.style.backgroundColor="";
alt.style.fontWeight="normal";
}
hidden.value=nr;
hidden=document.getElementById(dictname);
hidden.value=id;
try {
eval('onChangeOf'+dictname+'()');
} catch(e)
{
nr=nr;
}
}}

function RasterClick(feldname,z,s)
{
var feld,vordergrund,hintergrund;

feld=document.getElementById(feldname);

if(AktivesFeld) AktivesFeld.style.backgroundColor="#eeeeee";
feld.style.backgroundColor="#ffffdd";
AktivesFeld=feld;
myForm.Zeile.value=z;
myForm.Spalte.value=s;
vordergrund=eval('document.myForm.V'+z+'_'+ s);
if(!vordergrund)	{
vordergrund=document.getElementById('BILDB26A9537_DAC4_4B3B_AB5A_C820132ABDC7');
} else {
vordergrund=eval('document.myForm.V'+z+'_'+ s+'.value');
vordergrund=eval('myForm.'+vordergrund);
};
VordergrundClick(vordergrund);

hintergrund=eval('document.myForm.H'+z+'_'+ s);
if(!hintergrund)	{
hintergrund=document.getElementById('BILD71745431_A989_484D_A4DF_8EFAC743D7C6');
} else {
hintergrund=eval('document.myForm.H'+z+'_'+ s+'.value');
hintergrund=eval('myForm.'+hintergrund); 
};
HintergrundClick(hintergrund);

text=eval('document.myForm.T'+z+'_'+s);
if(!text)	{
document.myForm.Beschriftung.value='';

} else {
text=eval('document.myForm.T'+z+'_'+s+'.value');
document.myForm.Beschriftung.value=text;
};
pfeil=eval('document.myForm.PF'+z+'_'+s);
if(!pfeil)	{
pfeil=0;
} else {
pfeil=eval('document.myForm.PF'+z+'_'+s+'.value');
};
PfeilDarstellung(pfeil);
}

function RasterStyle()
{
if (document.all.RasterDiv.style.width == '70%') {
document.all.RasterDiv.style.width = '100%';
document.all.HilfeDiv.style.visibility = 'hidden';
} else {
document.all.RasterDiv.style.width = '70%';
document.all.HilfeDiv.style.visibility = 'visible';
}
}

function popDiaHilfe()
{
if (document.all.diaHilfe.style.display == '')
{
document.all.diaHilfe.style.display = 'none';
document.all.popDia.innerHTML = '[+]';
} else {
document.all.diaHilfe.style.display = '';
document.all.popDia.innerHTML = '[-]';
}
}

function popErstellenHilfe()
{
if (document.all.erstellenHilfe.style.display == '')
{
document.all.erstellenHilfe.style.display = 'none';
document.all.popErstellen.innerHTML = '[+]';
} else {
document.all.erstellenHilfe.style.display = '';
document.all.popErstellen.innerHTML = '[-]';
}
}

function popErstellenHilfe()
{
if (document.all.erstellenHilfe.style.display == '')
{
document.all.erstellenHilfe.style.display = 'none';
document.all.popErstellen.innerHTML = '[+]';
} else {
document.all.erstellenHilfe.style.display = '';
document.all.popErstellen.innerHTML = '[-]';
}
}

function popBearbeitenHilfe()
{
if (document.all.bearbeitenHilfe.style.display == '')
{
document.all.bearbeitenHilfe.style.display = 'none';
document.all.popBearbeiten.innerHTML = '[+]';
} else {
document.all.bearbeitenHilfe.style.display = '';
document.all.popBearbeiten.innerHTML = '[-]';
}
}

function popLeerenHilfe()
{
if (document.all.leerenHilfe.style.display == '')
{
document.all.leerenHilfe.style.display = 'none';
document.all.popLeeren.innerHTML = '[+]';
} else {
document.all.leerenHilfe.style.display = '';
document.all.popLeeren.innerHTML = '[-]';
}
}

function popAusgebenHilfe()
{
if (document.all.ausgebenHilfe.style.display == '')
{
document.all.ausgebenHilfe.style.display = 'none';
document.all.popAusgeben.innerHTML = '[+]';
} else {
document.all.ausgebenHilfe.style.display = '';
document.all.popAusgeben.innerHTML = '[-]';
}
}

function popAnsichtHilfe()
{
if (document.all.ansichtHilfe.style.display == '')
{
document.all.ansichtHilfe.style.display = 'none';
document.all.popAnsicht.innerHTML = '[+]';
} else {
document.all.ansichtHilfe.style.display = '';
document.all.popAnsicht.innerHTML = '[-]';
}
}
function RadioClick(dictname,v)
{
    var cbs,i,pe;
    cbs=document.getElementsByName(dictname);
    i=0;
    if(cbs) {
        while (cbs[i]) {
            if(cbs[i].value==v) {
                pe=cbs[i].parentElement.parentElement.parentElement.parentElement;
                break;
            }   
            i++;   
        }
        if(pe) {
            if(pe.id!='') {
                i=0;
                while (cbs[i]) {
                    if(pe==cbs[i].parentElement.parentElement.parentElement.parentElement) {
                        cbs[i].checked= (cbs[i].value==v);
                    }   
                    i++;   
                }
            }       
        }
    }
}
function baumClick(dictname,z,spalten)
{
	var d,i,s,p;
	
	d=document.getElementById(dictname+"BD"+z);
	i=document.getElementById(dictname+"BDI"+z);
	s=i.src
	p=s.lastIndexOf("/");
	s=s.substr(p+1,6);
	if(s=="me.gif") {
		d.style.display='none';
		i.src="images/baum/pe.gif";
		for(i=1;i<=spalten;i++) {
			d=document.getElementById(dictname+"BD"+z+"S"+i);
			d.style.display='none';}
	}
	else
	{
		if(s=="mc.gif") {
			d.style.display='none';
			i.src="images/baum/pc.gif";
			for(i=1;i<=spalten;i++) {
				d=document.getElementById(dictname+"BD"+z+"S"+i);
				d.style.display='none';}
		}
		else
		{
			if(s=="pc.gif") {
				d.style.display='block';
				i.src="images/baum/mc.gif";
				for(i=1;i<=spalten;i++) {
					d=document.getElementById(dictname+"BD"+z+"S"+i);
					d.style.display='block';}
			}
			else
			{
				if(s=="pe.gif") {
					d.style.display='block';
					i.src="images/baum/me.gif";
					for(i=1;i<=spalten;i++) {
						d=document.getElementById(dictname+"BD"+z+"S"+i);
						d.style.display='block';}
				}
			}
		}
	}
	
}

function AuswahlClick(dictname,nr,id) {
var d,alt,hidden;
	hidden=document.getElementById(dictname+'_NR');
	if(!hidden && document.getElementsByName(dictname+'_NR').length>0)
		hidden = (document.getElementsByName(dictname+'_NR'))[0];
	d=document.getElementById(dictname+'_'+nr);
if(d.style.borderStyle=="outset"){
	alt=document.getElementById(dictname+'_'+hidden.value);
	if(d) {
		d.style.borderStyle="inset";
		if(alt) {
			alt.style.borderStyle="outset";
		}
		hidden.value=nr;
		hidden=document.getElementById(dictname);
		if(!hidden && document.getElementsByName(dictname).length>0)
			hidden = (document.getElementsByName(dictname))[0];
		hidden.value=id;
		try {
			eval('onChangeOf'+dictname+'()');
		} catch(e){
			nr=nr;
		}
	}
}
if(d.style.borderStyle=="solid" || d.style.borderStyle=="solid solid solid solid"){
	alt=document.getElementById(dictname+'_'+hidden.value);
	if(d) {
		d.style.borderColor="black";
		if(alt) {
			alt.style.borderColor="white";
		}
		hidden.value=nr;
		hidden=document.getElementById(dictname);
		if(!hidden && document.getElementsByName(dictname).length>0)
			hidden = (document.getElementsByName(dictname))[0];
		hidden.value=id;
		try {
			eval('onChangeOf'+dictname+'()');
		} catch(e){
			nr=nr;
		}
	}
}
}

// ---------------------------------------- DropDown -------------------------------------------
function groesse(name){
document.getElementById(name).style.width=document.getElementById(name+'_LIST').style.width
}
function EnterAuswahl(name)
{
var d;

d=document;	
var nr = ((d.getElementById(name+'_LIST').selectedIndex));	
d.getElementById(name).value = d.getElementById(name+'_LIST').options[nr].title;
d.getElementById(name+'_DIV').style.display="none";
       try {
      eval('onChangeOf'+name+'()');
       } catch(e) {}
       try {
       d.getElementById(name).focus();
       } catch(e) {}

}
function NavVorwaerts(name)
{
d=document;	
if (document.getElementById(name+'_DIV').style.display=='none'){
showDropDown(name);}
var nr = ((d.getElementById(name+'_LIST').selectedIndex) + 1);
if (nr!=d.getElementById(name+'_LIST').options.length){
d.getElementById(name).value = d.getElementById(name+'_LIST').options[nr].title;
d.getElementById(name+'_LIST').options[nr].selected = true;
} else {
nr = ((d.getElementById(name+'_LIST').options.length) - 1);
d.getElementById(name).value = d.getElementById(name+'_LIST').options[nr].title;
d.getElementById(name+'_LIST').options[nr].selected = true;
}
}
function NavRueckwaerts(name)
{
//	alert(d.getElementById('TextField_DIV').style.width);

if (document.getElementById(name+'_DIV').style.display=='none') {
showDropDown(name);}
if (document.getElementById(name+'_LIST').selectedIndex>0){
var nr = ((document.getElementById(name+'_LIST').selectedIndex) - 1);
document.getElementById(name).value = document.getElementById(name+'_LIST').options[nr].title;	
document.getElementById(name+'_LIST').options[nr].selected = true;
} else {
document.getElementById(name).value = document.getElementById(name+'_LIST').options[0].title;	
document.getElementById(name+'_LIST').options[0].selected = true;
}
}
function Enter(name)
{
Ereignis = window.event; 
Tastencode = Ereignis.keyCode;	
if (document.getElementById(name).value != document.getElementById(name+'_LIST').options.title) {
document.getElementById(name).value = document.getElementById(name+'_LIST').options.title;
}
//Tastencode 13 = enter
if (Tastencode == 13) {
CloseDropDown(name);
} 
}
function Navigieren(WelcheTaste,name)
{
//Tastencode 40 = Pfeil runter
if (WelcheTaste == 40) 
{
NavVorwaerts(name);
//Tastencode 38 = Pfeil hoch
} else if (WelcheTaste == 38)
{
NavRueckwaerts(name);
}
}
var a,DropDownEdited;
DropDownEdited=0;
a=100;
function Buchstabeneingabe(Wert,name)
{
Ereignis = window.event; 
Tastencode = Ereignis.keyCode;	
//Tastencode 38 = Pfeil hoch | Tastencode 40 = Pfeil runter | Tastencode 13 = Enter	| Tastencode 16 = Shift
if ((Tastencode!=38) && (Tastencode !=40) && (Tastencode != 13) && (Tastencode != 16)&& (Tastencode != 9)){
DropDownEdited=1;
if (document.getElementById(name+'_DIV').style.display=='none') {
showDropDown(name);}
for(i=0; i<document.getElementById(name+'_LIST').options.length; i++)
{
if(Wert.substr(0, Wert.length).toLowerCase()==document.getElementById(name+'_LIST').options[i].title.substr(0, Wert.length).toLowerCase() && Wert.length!=0 && Wert.length<document.getElementById(name+'_LIST').options[i].title.length)
{	document.getElementById(name+'_LIST').options[i].selected = true;		
// Tastencode 8 = Backspace
if (Tastencode != 8) {
var iStart = Wert.length
var iLength = document.getElementById(name+'_LIST').options[i].length
var oRange = document.getElementById(name).createTextRange(); 

if (oRange) {
document.getElementById(name).value = document.getElementById(name+'_LIST').options[i].title;
oRange.moveStart("character", iStart); 
oRange.moveEnd("character", iLength); 
oRange.select();
} else if (document.getElementById(name).setSelectionRange) {
document.getElementById(name).setSelectionRange(iStart, iLength);
} 
document.getElementById(name).focus(); 
}
break;
}
}
if (Wert.length==0) {
document.getElementById(name+'_LIST').options[0].selected = true;
}
//Tastencode 13 = enter
} else if(Tastencode==9) {

} else {
if (Tastencode!=13){
Navigieren(Tastencode,name);
} else {
Enter(name);
}}
//	a=a+10;
//	document.getElementById('TextField').style.width=a;
//	document.getElementById('Test').title=Wert+'-'+Tastencode;
}
function BlurDropDown(name)
{
  try {
  if(DropDownEdited==1)
      eval('onChangeOf'+name+'()');
      } catch(e) {}
};
function CloseDropDown(name)
{
  try {
        if(document.getElementById(name+'_DIV').style.display!="none")
            document.getElementById(name+'_DIV').style.display="none";
      } catch(e) {}

}
function showDropDown(name) {
d=document;
if (d.getElementById(name+'_DIV').style.display=='none') {
var element = d.getElementById(name);
var a=getPosition(element);

d.getElementById(name+'_DIV').style.top=a.y+21;
d.getElementById(name+'_DIV').style.left=a.x-1;
d.getElementById(name+'_DIV').style.display="inline";
try {
if (element.value!=''){
d.getElementById(name+'_LIST').options.title=d.getElementById(name).value;
} else {
document.getElementById(name+'_LIST').options[0].selected = true;
}} catch(e) { }
} else {
d.getElementById(name+'_DIV').style.display="none";
}
}
function SDivUp(element) {
document.frmSeite.SDivMode.value="-1";
d=document;
var di=d.getElementById('pages_DIV');
if (di.style.display=='none') {

var a=getPosition(element);
di.style.top=a.y+15;
di.style.left=a.x-1;
di.style.display="inline";
} else {
di.style.display="none";
}
return false;
}
function SDivDown(element) {
document.frmSeite.SDivMode.value="1";
d=document;
var di=d.getElementById('pages_DIV');
if (di.style.display=='none') {

var a=getPosition(element);
di.style.top=a.y+15;
di.style.left=a.x-1;
di.style.display="inline";
} else {
di.style.display="none";
}
return false;
}
function shDrDo() {
document.frmSeite.SDivMode.value="0";
d=document;
var di=d.getElementById('pages_DIV');
if (di.style.display=='none') {

var element = d.getElementById('pagespos');
var a=getPosition(element);
di.style.top=a.y+15;
di.style.left=a.x-1;
di.style.display="inline";
} else {
di.style.display="none";
}
}
function getPosition(element)
{
var elem=element,tagname="",x=0,y=0;
while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined"))
{
if(elem.id=="syncon") break;
y+=elem.offsetTop;
x+=elem.offsetLeft;
tagname=elem.tagName.toUpperCase();
if (tagname=="BODY")
elem=0;
if (typeof(elem)=="object")
if (typeof(elem.offsetParent)=="object")
elem=elem.offsetParent;
}
position=new Object();
position.x=x;
position.y=y;
return position;
}
function ausgabe(wert){
window.status = wert;
}
// ---------------------------------------- DropDown ende --------------------------------------

function SubReiterSelect(r,f1,f2)
{
var cr,f1,f2,last;
cr=document.frmSubReiter.CurrentSubReiter;
if(cr) 
{
if(document.getElementById("subreiter"+cr.value).style.cursor!='auto') cr.value=1;
document.getElementById("subreiter"+cr.value).style.cursor='pointer';
document.getElementById("subreiter"+cr.value).style.backgroundColor=f2;
document.getElementById("divsubreiter"+cr.value).style.display='none';
document.getElementById("subreiter"+r).style.cursor='auto';
document.getElementById("subreiter"+r).style.backgroundColor=f1;
document.getElementById("divsubreiter"+r).style.display='block';
cr.value=r;
}
}

function ReiterSelect(r,f1,f2)
{
var cr;
cr=document.SPDBForm.CurrentReiter;
if(!cr) {cr=document.SPDBForm[0].CurrentReiter;}
if(cr) {
if(document.getElementById("reiter"+cr.value).style.cursor!='auto') cr.value=1;
document.getElementById("reiter"+cr.value).style.cursor='pointer';
document.getElementById("reiter"+cr.value).style.backgroundColor=f2;
document.getElementById("divreiter"+cr.value).style.display='none';
document.getElementById("reiter"+r).style.cursor='auto';
document.getElementById("reiter"+r).style.backgroundColor=f1;
document.getElementById("divreiter"+r).style.display='block';
cr.value=r;
}
}
function texteditdict(id)
{
var dd = document;
var element = dd.getElementById('texteditmenu');

var h=dd.getElementById('texteditid');
if(h) {h.value=id;}

if(element)
if (element.style.display=='none') 
{		
element.style.top=y+2;
if(x>800) {
element.style.left=x-144-1;}
else {
element.style.left=x-1;}
element.style.display="inline"

dd=document.getElementById('divrefresh');
if(dd) {
dd.style.width=document.body.clientWidth;
dd.style.height=document.body.clientHeight;
dd.style.top=document.body.scrollTop;
dd.style.display='inline';}                 			
}
}
function MenuClose(){
var dd = document;
var element = dd.getElementById('texteditmenu');
if(element) element.style.display="none";
dd=document.getElementById('divrefresh');
if(dd) dd.style.display='none';
dd=document.getElementById('texteditmenuNav');
if(dd) dd.style.display='none';
dd=document.getElementById('texteditmenuNavNav');
if(dd) dd.style.display='none';
}

function texteditEnd()
{
var dd = window.parent.document;
var element = dd.getElementById('texteditdiv');
if(element) element.style.display="none";
dd=dd.getElementById('divrefresh');
if(dd) dd.style.display='none';
}


function textedit(id,name)
{
var weiter = true;
var dd = document;
var element = dd.getElementById('texteditdiv');
var ifr = dd.getElementById('texteditif');
var vararr,sub;
if (name == 'DictDelete') {
    weiter = confirm ('-- ACHTUNG -- -- ACHTUNG -- -- ACHTUNG -- \n\n\n Wollen sie das Dictionary wirklich loeschen?')
}
if (weiter) {
if(id=='') {
var h=dd.getElementById('texteditid');
if(h) id=h.value;}
if(element)
if (element.style.display=='none') 
{
if(name=='alles'||name=='allesN'||name=='NeueNav'||name=='NeuesDict') {
element.style.top=20;
element.style.left=20;
element.style.width=1100;
element.style.height=800;
ifr.style.width=1100;
ifr.style.height=800;
} else {
element.style.width=615;
element.style.height=301;
ifr.style.width=615;
ifr.style.height=301;

element.style.top=y+2;
if(x>800) {
    element.style.left=x-400-1;}
else {
    element.style.left=x-1;}}
if(window.location.search != "") {
     QUERYSTRING = window.location.search+"&nnn=nnn"
     QUERYSTRING = QUERYSTRING.replace(/\?/,"");

     var teilstrings = QUERYSTRING.split("&");
    
     for (i=0;i<teilstrings.length;i++) {
          vararr = teilstrings[i].split("=");
          vararr[0]=vararr[0].toUpperCase();
          if(vararr[0]=="SUB") sub=vararr[1];
      }
} else sub="home";
ifr.src="DescriptionEdit.aspx?sub="+sub+"&id="+id+"&name="+name;
element.style.display="inline";

dd=document.getElementById('divrefresh');
if(dd) {
dd.style.width=document.body.clientWidth;
dd.style.height=document.body.clientHeight;
dd.style.top=document.body.scrollTop;
dd.style.display='inline';}                 			
}
try {
element=document.getElementById('texteditmenu');
if(element) {element.style.display="none";}
} catch(e) { }

try {
element=document.getElementById('texteditmenuNav');
if(element) {element.style.display="none";}
} catch(e) { }

try {
element=document.getElementById('texteditmenuNavNav');
if(element) {element.style.display="none";}
} catch(e) { }

} else {

try {
element=document.getElementById('texteditmenu');
if(element) {element.style.display="none";}
} catch(e) { }

document.getElementById('divrefresh').style.display='none';

}
}

function texteditNav(id)
{
var dd = document;
var element = dd.getElementById('texteditmenuNav');

var h=dd.getElementById('texteditid');
if(h) {h.value=id;}

if(element)
if (element.style.display=='none') 
{		
element.style.top=y+2;
if(x>800) {
element.style.left=x-144-1;}
else {
element.style.left=x-1;}
element.style.display="inline"

dd=document.getElementById('divrefresh');
if(dd) {
dd.style.width=document.body.clientWidth;
dd.style.height=document.body.clientHeight;
dd.style.top=document.body.scrollTop;
dd.style.display='inline';}                 			
}
}

function texteditNavNav(id)
{
var dd = document;
var element = dd.getElementById('texteditmenuNavNav');

var h=dd.getElementById('texteditid');
if(h) {h.value=id;}

if(element)
if (element.style.display=='none') 
{		
element.style.top=y;
if(x>800) {
element.style.left=x-144-1;}
else {
element.style.left=x-1;}
element.style.display="inline"

dd=document.getElementById('divrefresh');
if(dd) {
dd.style.width=document.body.clientWidth;
dd.style.height=document.body.clientHeight;
dd.style.top=document.body.scrollTop;
dd.style.display='inline';}                 			
}
}

function SetToDel(a) { };

function CheckboxesEmpty(checkboxes)
{
    var i;
   
    if(checkboxes.length) {
        for(i=0;i<checkboxes.length;i++) {
            if(checkboxes[i].checked) return false;
        }
        return true;
    }
    return false;
}

/*-- START Dia-Zoom --*/
var dia_runter = false;
var dia_nich = false;
var dia_pic;
var dia_id;
function DIARunter(bild, id){
    if (window.event.button && window.event.button == 1){
        dia_pic = bild;
        dia_id = id;
        //alert(bild.style.cursor);
        elm = dia_pic;
        dia_x = 1;
        dia_y = 1;
        while (elm != null) {
            if(elm.id=="syncon") break;
            dia_x += elm.offsetLeft;
            dia_y += elm.offsetTop;
            elm = elm.offsetParent;
        }
	    if (dia_nich ==true){
		    dia_nich = false;
	    }else if (!(window.event.offsetX < 15 && dia_pic.height - window.event.offsetY  <  25)) {
		    Xstart = window.event.clientX - 2;
		    document.getElementById("dia").style.left  = Xstart + "px";
		    document.getElementById("dia").style.top = dia_y + "px";
		    document.getElementById("dia").style.width = 0;
		    document.getElementById("dia").style.height = dia_pic.height -2 +"px";
		    document.getElementById("dia").style.cursor = "crosshair"
		    document.getElementById("dia").style.visibility = "visible";
		    dia_runter = true;
	    } else if (window.event.offsetX < 22 && dia_pic.height - window.event.offsetY  <  25) {
	        if (document.URL.search("Zoom=false") == -1)
	            document.URL = document.URL +"&Zoom=false";
	    }
    }
}
function DIABewegung(bild){
    if (bild)
        dia_pic = bild;
    if (dia_runter == true){
    //alert(document.getElementById("dia").style.pixelLeft);
	    var x;
	    x = window.event.x - document.getElementById("dia").style.pixelLeft -2; 
	    //y = window.event.offsetY - document.getElementById("dia").style.pixelTop  - 5;
	    if (x >= 0)
		    document.getElementById("dia").style.width = x + "px";
	    //if (y >= 0)
	    //  document.getElementById("dia").style.height = 400 + "px";
    }else if  (window.event.offsetX < 22 && dia_pic.height - window.event.offsetY  <  25) {
        dia_pic.style.cursor = "pointer";
        //document.getElementById("pic").alt
        //alert(window.event.offsetY - document.getElementById("pic").offsetTop - 35 - document.getElementById("pic").height > -25);
    }else{
	
        dia_pic.style.cursor = "crosshair";
    }
}
function DIAHoch(){
	dia_runter=false;
	document.getElementById("dia").style.cursor = "pointer"
}
function DIAZoom(){
    dia_x=1;
    elm = dia_pic;
    while (elm != null) {
        dia_x += elm.offsetLeft;
        elm = elm.offsetParent;
    }
	document.getElementById("zoomX0").value = document.getElementById("dia").style.pixelLeft - dia_x;
	document.getElementById("zoomX1").value = document.getElementById("dia").style.pixelLeft - dia_x + document.getElementById("dia").style.pixelWidth;
	document.getElementById("zoomID").value = dia_id;
	document.getElementById("ZoomFrm").submit();
	dia_nich = true;
}
/*-- ENDE Dia-Zoom --*/

function nspopup(url,f1,f2,f3,f4,f5)
{
var dd = document;
var element = dd.getElementById('nsdiv');
var ifr = dd.getElementById('nsif');
var w;
if(element)
if (element.style.display=='none') 
{		
w=(document.body.clientHeight-550)/2;
if(w<=0) w=1;
element.style.top=w;
w=(document.body.clientWidth-700)/2;
if(w<=0) w=1;
element.style.left=w;
ifr.src=url+"&f1="+escape(f1)+"&f2="+escape(f2)+"&f3="+escape(f3)+"&f4="+escape(f4)+"&f5="+escape(f5);
element.style.display="inline";
dd=document.getElementById('divrefresh');
if(dd) {
dd.style.width=document.body.clientWidth;
dd.style.height=document.body.clientHeight;
dd.style.top=document.body.scrollTop;
dd.style.display='inline';}                 			
}
}
function nsEnd()
{
var dd = window.parent.document;
var element = dd.getElementById('nsdiv');
var ifr = dd.getElementById('nsif');
if(element) element.style.display="none";
dd=dd.getElementById('divrefresh');
if(dd) dd.style.display='none';
if(ifr) ifr.src="leer.html";
}

function RefreshParent(n,v) {
    var dd = window.parent.document;
    dd.SPDBForm.DoRefresh.value=v;
    dd.SPDBForm.synwaylastcontrol.value=n;
    dd.SPDBForm.synwayscrollx.value=((isNav) ? window.pageXOffset : dd.body.scrollLeft);
    dd.SPDBForm.synwayscrolly.value=((isNav) ? window.pageYOffset : dd.body.scrollTop);
    dd.body.style.cursor="wait";
    d=dd.getElementById('divrefresh');
    if(d) {
    d.style.width=dd.body.clientWidth;
    d.style.height=dd.body.clientHeight;
    d.style.top=dd.body.scrollTop;
    d.style.display='inline';}
}
function PageQuery(q) {
 if(q.length > 1) this.q = q.substring(1, q.length);
 else this.q = null;
 this.keyValuePairs = new Array();
 if(q) {
  for(var i=0; i < this.q.split("&").length; i++) {
   this.keyValuePairs[i] = this.q.split("&")[i];
  }
 }
 this.getKeyValuePairs = function() { return this.keyValuePairs; }
 this.getValue = function(s) {
  for(var j=0; j < this.keyValuePairs.length; j++) {
   if(this.keyValuePairs[j].split("=")[0].toLowerCase() == s.toLowerCase())
    return this.keyValuePairs[j].split("=")[1];
  }
  return false;
 }
 this.getParameters = function() {
  var a = new Array(this.getLength());
  for(var j=0; j < this.keyValuePairs.length; j++) {
   a[j] = this.keyValuePairs[j].split("=")[0];
  }
  return a;
 }
 this.getLength = function() { return this.keyValuePairs.length; } 
}
function noenter() {
if(window.event.keyCode == 13) {window.event.keyCode =9;
}
}

function delcheck(msg) {return confirm(msg);}

/*-- BEGIN Documentation --*/
var Docfens = null;
function MeName(){
window.name='index';}
function popUp() { 
if (Docfens) {
Docfens.focus(); } else {
var datei = 'SynWayDocu.aspx#'+ document.getElementById('D1').value;
Docfens=window.open(datei, 'DocuFenster', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=700, height=400, left=10, top=0'); 
}}

var liSID = '';
var liZID = '';
function liM(e){
    if(document.getElementById('syncon')) {
	    document.getElementById('ligez').style.left = (event.clientX + document.getElementById('syncon').scrollLeft ) + "px";
	    document.getElementById('ligez').style.top = (event.clientY + document.getElementById('syncon').scrollTop - document.getElementById('syncon').offsetTop +10 ) + "px";}
	else {
	    document.getElementById('ligez').style.left = (event.clientX + document.body.scrollLeft ) + "px";
	    document.getElementById('ligez').style.top = (event.clientY + document.body.scrollTop ) + "px";}
}
function liU(e){
    var dd = document;
    if(liZID!= '')
	    IFREdit(dd.getElementById('editurl').value,liSID,liZID);
	document.getElementById('ligez').style.visibility = "hidden";
	document.onmousemove = handlerMM;
	document.onmouseup = null;
}

function IFREdit(editurl,ID1,ID2){
        var dd = document;
        var element = dd.getElementById('nsdiv');
        var ifr = dd.getElementById('nsif');
        var w;
        if(element)
            if (element.style.display=='none') {		
                if(document.getElementById('syncon')) {
                    w=(document.body.clientHeight-550)/2+document.getElementById('syncon').scrollTop;}
                else {
                    w=(document.body.clientHeight-550)/2+document.body.scrollTop;}
                if(w<=0) w=1;
                element.style.top=w;
                w=(document.body.clientWidth-700)/2;
                if(w<=0) w=1;
                element.style.left=w;
                ifr.src=editurl+"&nonav=1&ID1="+escape(ID1)+"&ID2="+escape(ID2);
                element.style.display="inline";
                dd=document.getElementById('divrefresh');
                if(dd) {
                    dd.style.width=document.body.clientWidth;
                    dd.style.height=document.body.clientHeight;
                    dd.style.top=document.body.scrollTop;
                    dd.style.display='inline';}                 			
            }
}

function liH(obj,id){
	liZID = id;
	if(id != ''){
		obj.style.cursor = "pointer";
	}else{
		obj.style.cursor = "auto";
	}
}
function liZiehen(obj,id){
	liZID = '';
	liSID = id;
	document.getElementById('ligez').style.visibility = "visible";
	
    if(document.getElementById('syncon')) {
	    document.getElementById('ligez').style.left = (event.clientX + document.getElementById('syncon').scrollLeft ) + "px";
	    document.getElementById('ligez').style.top = (event.clientY + document.getElementById('syncon').scrollTop - document.getElementById('syncon').offsetTop + 10 ) + "px";}
    else {
	    document.getElementById('ligez').style.left = (event.clientX + document.body.scrollLeft ) + "px";
	    document.getElementById('ligez').style.top = (event.clientY + document.body.scrollTop ) + "px";}
	document.getElementById('ligez').innerHTML="<img id='ligezb'>";
	document.getElementById('ligezb').src = obj.src;
	if( window.captureEvents && Event.MOUSEMOVE) {
		window.captureEvents( Event.MOUSEMOVE );
	}
	
	if( window.captureEvents && Event.MOUSEUP) {
		window.captureEvents( Event.MOUSEUP );
	}
	document.onmousemove = liM;
	document.onmouseup = liU;
}
var bvar1,bvar2,bvar3;
function baumHover(var1,var2,var3){
	bvar1 = var1;
	bvar2 = var2;
	bvar3 = var3;
	setTimeout("if(liSID != '' && bvar1 != '' && bvar1 == '"+var1+"' && bvar2 == '"+var2+"' && bvar2 == '"+var2+"'){ baumClick(bvar1,bvar2,bvar3);}",1000);
}
function baumHoverSrc(var1,var2,var3){
	bvar1 = var1;
	bvar2 = var2;
	bvar3 = var3;
}
function baumHoverOut(var1,var2,var3){
	bvar1 = "";
	bvar2 = "";
	bvar3 = 0;
}
/*-- ENDE Documentation --*/


/* SPTicket */
function SetupLayout() {
window.onresize=SetupLayout2;
SetupLayout2();
}
function onMoveSitze()
{
    var Sitzplan,px,py,divSitze,h,b,divSitzplan,maxWidth,maxHeight;
    
    Sitzplan=document.getElementById('sitzplan');           
    divSitzplan=document.getElementById('divSitzplan');
    divSitze=document.getElementById('divSitze');
    maxWidth=document.getElementById('maxWidth');
    maxHeight=document.getElementById('maxHeight');

    if(divSitzplan) {
        px=divSitze.scrollLeft/(divSitze.scrollWidth-parseFloat(divSitze.style.width));
        py=divSitze.scrollTop/(divSitze.scrollHeight-parseFloat(divSitze.style.height)); 
        if(py>1) py=1;
        if(px>1) px=1;
        b=Sitzplan.width;
        if (b<=parseFloat(divSitzplan.style.width)) b=parseFloat(divSitzplan.style.width)+1;
        h=Sitzplan.height;
        if (h<=parseFloat(divSitzplan.style.height)) h=parseFloat(divSitzplan.style.height)+1;
        divSitzplan.style.left=(b-parseFloat(divSitzplan.style.width))*px;
        divSitzplan.style.top=(h-parseFloat(divSitzplan.style.height))*py;
    }
}

function MoveSitze(e) {
    var Sitzplan,elm,x,y,px,py,tagname,divSitze,maxWidth,maxHeight,h,b,divSitzplan;
    
    x=0;
    y=0;
    Sitzplan=document.getElementById('sitzplan');           
    divSitzplan=document.getElementById('divSitzplan');
    if(!e) {
        e=window.event;
        x=e.x;
        y=e.y;
        if(e.srcElement.id=='divSitzplan') {
            y += e.srcElement.offsetTop;
            x += e.srcElement.offsetLeft;
        }
    }else {
        elm = Sitzplan;
        while (elm != null) {
            y += elm.offsetTop;
            x += elm.offsetLeft;
            elm = elm.offsetParent;}
        x=e.clientX-x;
        y=e.clientY-y;}
    if(x<1) x=1;
    if(y<1) y=1;
    if(x>Sitzplan.width) x=Sitzplan.width+1;
    if(y>Sitzplan.height) y=Sitzplan.height+1;
    divSitze=document.getElementById('divSitze');
    maxWidth=document.getElementById('maxWidth');
    maxHeight=document.getElementById('maxHeight');
    b=Sitzplan.width;
    if (b<=parseFloat(divSitzplan.style.width)) b=parseFloat(divSitzplan.style.width)+1;
    h=Sitzplan.height;
    if (h<=parseFloat(divSitzplan.style.height)) h=parseFloat(divSitzplan.style.height)+1;
    
    px=x/parseFloat(Sitzplan.width);
    py=y/parseFloat(Sitzplan.height)
    if(px>0.8) px=1;
    if(py>0.8) py=1;
    if(px<0.2) px=0;
    if(py<0.2) py=0;
    
    divSitzplan.style.left=(b-parseFloat(divSitzplan.style.width))*px;
    divSitzplan.style.top=(h-parseFloat(divSitzplan.style.height))*py;

    b=parseFloat(divSitzplan.style.left)/(b-parseFloat(divSitzplan.style.width))
    h=parseFloat(divSitzplan.style.top)/(h-parseFloat(divSitzplan.style.height))
    if(b>0.8) b=1;
    if(h>0.8) h=1;
    if(b<0.2) b=0;
    if(h<0.2) h=0;
    divSitze.scrollLeft=(divSitze.scrollWidth-parseFloat(divSitze.style.width))*b;
    divSitze.scrollTop=(divSitze.scrollHeight-parseFloat(divSitze.style.height))*h; 
    if(!MouseSupport) {
        if(b>0.9) {
            document.getElementById('btnplanrechts').style.visibility='hidden';}
        else {
            document.getElementById('btnplanrechts').style.visibility='visible';}
        if(b<0.1) {
            document.getElementById('btnplanlinks').style.visibility='hidden';}
        else {
            document.getElementById('btnplanlinks').style.visibility='visible';}
        if(h>0.9) {
            document.getElementById('btnplanrunter').style.visibility='hidden';}
        else {
            document.getElementById('btnplanrunter').style.visibility='visible';}
        if(h<0.1) {
            document.getElementById('btnplanhoch').style.visibility='hidden';}
        else {
            document.getElementById('btnplanhoch').style.visibility='visible';}}
}
function SPHeight()
{
var Gesamt,btnZurueck,elm,y;
btnZurueck=document.getElementById('btnZurueck');
gesamt=document.body.clientHeight
if(!MouseSupport) {
    gesamt=gesamt-85-36;}
else
    gesamt=gesamt-60-36;
if(btnZurueck) {
    elm=btnZurueck;
    y=0;
    while (elm != null) {
      if(elm.id) {
        if(elm.id!='syncon') y += elm.offsetTop; } 
      else y += elm.offsetTop;
      elm = elm.offsetParent;
    }
    gesamt=gesamt-y;}
return gesamt;
}     
function SPHeight2()
{
var Gesamt,btnZurueck,elm,y,Unterkannte;
btnZurueck=document.getElementById('btnZurueck');
Unterkannte=document.getElementById('Unterkannte');
gesamt=document.body.clientHeight;
if(MouseSupport) 
    gesamt=gesamt-55;
else
    gesamt=gesamt-67;

if(btnZurueck) {
    elm=Unterkannte;
    y=0;
    while (elm != null) {
      if(elm.id) {
        if(elm.id!='syncon') y += elm.offsetTop; } 
      else y += elm.offsetTop;
      elm = elm.offsetParent;
    }
    gesamt=gesamt-y;}
return gesamt;
}     
function SPWidth()
{
var Gesamt,btnZurueck,elm,x;
btnZurueck=document.getElementById('btnZurueck');
gesamt=document.body.clientWidth-36;
if(btnZurueck) {
    elm=btnZurueck;
    x=0;
    while (elm != null) {
      if(elm.id) {
        if(elm.id!='syncon') x += elm.offsetLeft; } 
      else x += elm.offsetLeft;
      elm = elm.offsetParent;
    }
    gesamt=gesamt-x;}
return gesamt;
}     

function SizeWarenkorb()
{
var divwarenkorb,btnWarenkorbHoch,btnWarenkorbRunter,h,maxhoehe,tdwarenkorb,divSitzplan,ajaxout,h2,gesamt,maxHeight;
    
if(!MouseSupport) {
    btnWarenkorbHoch=document.getElementById('btnwarenkorbhoch');
    btnWarenkorbRunter=document.getElementById('btnwarenkorbrunter');}
divwarenkorb=document.getElementById('SynWAYWarenkorbDIV');
tdwarenkorb=document.getElementById('tdWarenkorb');
ajaxout=document.getElementById('ajaxout');

if(divwarenkorb) {
    if(MouseSupport) divwarenkorb.style.overflow='auto';
    h=divwarenkorb.scrollHeight;
    divSitzplan=document.getElementById('divSitzplan');
    if(ajaxout) {
        h2=ajaxout.scrollHeight+85;}
    else {
        h2=85;}
    gesamt=SPHeight()-40;
    //if(h2>400) h2=400;
    if(ajaxout) {
        maxhoehe=gesamt-35-ajaxout.scrollHeight;
        if(maxhoehe<gesamt/2) maxhoehe=gesamt/2;
    } else {
        maxhoehe=gesamt;
    }
    if(maxhoehe<100) maxhoehe=100;
    if(h>maxhoehe) {
        divwarenkorb.style.borderStyle='dotted';
        if(!MouseSupport) divwarenkorb.style.overflow='hidden';
        if(btnWarenkorbHoch) {
            if(!MouseSupport) {
                btnWarenkorbHoch.style.display='inline';
                btnWarenkorbRunter.style.display='inline';
                if(divwarenkorb.scrollTop>=1) {
                    btnWarenkorbHoch.style.visibility='visible';}
                else {
                    btnWarenkorbHoch.style.visibility='hidden';}
                if(divwarenkorb.scrollTop+maxhoehe<h) {
                    btnWarenkorbRunter.style.visibility='visible';}
                else {
                    btnWarenkorbRunter.style.visibility='hidden';}}
            maxhoehe=maxhoehe-37;
            if(!MouseSupport) {
                btnWarenkorbHoch.onclick=btnWarenkorbHoch_onClick;
                btnWarenkorbRunter.onclick=btnWarenkorbRunter_onClick;}}
    }else {
        divwarenkorb.style.borderStyle='none';
        if(!MouseSupport) divwarenkorb.style.overflow='visible';
        if(btnWarenkorbHoch) {
            btnWarenkorbHoch.style.display='none';
            btnWarenkorbRunter.style.display='none';}
    }
    divwarenkorb.style.height=maxhoehe;
    divwarenkorb.style.maxHeight=maxhoehe;
    if(MouseSupport) {       
        if(divwarenkorb.clientWidth<divwarenkorb.scrollWidth) {
            divwarenkorb.style.width=divwarenkorb.scrollWidth+60;
            divwarenkorb.style.maxWidth=divwarenkorb.scrollWidth+60;}
    }
}
}

function btnWarenkorbRunter_onClick()
{
var divwarenkorb,btnWarenkorbHoch,btnWarenkorbRunter,h,p,g;
    
btnWarenkorbHoch=document.getElementById('btnwarenkorbhoch');
btnWarenkorbHoch.style.visibility='visible';
btnWarenkorbRunter=document.getElementById('btnwarenkorbrunter');
btnWarenkorbRunter.style.visibility='hidden';
divwarenkorb=document.getElementById('SynWAYWarenkorbDIV');
if(divwarenkorb) {
    h=divwarenkorb.scrollHeight;
    p=divwarenkorb.scrollTop;
    g=divwarenkorb.clientHeight;
    p=p+100;
    if (p+g>h) {
        setTimeout("document.getElementById('btnwarenkorbrunter').style.visibility='hidden';",100);
        p=h-g;
    } else {
        setTimeout("document.getElementById('btnwarenkorbrunter').style.visibility='visible';",100);
    }
    divwarenkorb.scrollTop=p;
}
}
function btnWarenkorbHoch_onClick()
{
var divwarenkorb,btnWarenkorbHoch,btnWarenkorbRunter,h,p,g;
btnWarenkorbHoch=document.getElementById('btnwarenkorbhoch');
btnWarenkorbHoch.style.visibility='hidden';
btnWarenkorbRunter=document.getElementById('btnwarenkorbrunter');
btnWarenkorbRunter.style.visibility='visible';
divwarenkorb=document.getElementById('SynWAYWarenkorbDIV');
if(divwarenkorb) {
    h=divwarenkorb.scrollHeight;
    p=divwarenkorb.scrollTop;
    g=divwarenkorb.clientHeight;
    p=p-100;
    if (p<0) {
        setTimeout("document.getElementById('btnwarenkorbhoch').style.visibility='hidden';",100);
        p=0;
    } else {
        setTimeout("document.getElementById('btnwarenkorbhoch').style.visibility='visible';",100);
    }
    divwarenkorb.scrollTop=p;
}
}

function SizeTickets()
{
var divTickets,btnTicketsHoch,btnTicketsRunter,h;

if(!MouseSupport) {
    btnTicketsHoch=document.getElementById('btnticketshoch');
    btnTicketsRunter=document.getElementById('btnticketsrunter');}

    
divTickets=document.getElementById('ajaxout');
if(divTickets) {
    if(MouseSupport) divTickets.style.overflow='auto';
    h=divTickets.scrollHeight;
    var hVGL;
    hVGL=(SPHeight()-40)/2;
    if(h>hVGL) {
        divTickets.style.borderStyle='dotted';
        if(!MouseSupport) divTickets.style.overflow='hidden';
        divTickets.style.height=hVGL-37;
        divTickets.style.maxHeight=hVGL-37;
        if(!MouseSupport) {
            btnTicketsHoch.style.display='inline';
            btnTicketsRunter.style.display='inline';
            if(divTickets.scrollTop>=1) {
                btnTicketsHoch.style.visibility='visible';}
            else {
                btnTicketsHoch.style.visibility='hidden';}
            if(divTickets.scrollTop<h-(hVGL-37)) {
                btnTicketsRunter.style.visibility='visible';}
            else {
                btnTicketsRunter.style.visibility='hidden';}
            btnTicketsHoch.onclick=btnTicketsHoch_onClick;
            btnTicketsRunter.onclick=btnTicketsRunter_onClick;}
    }
    else {
        divTickets.style.height=divTickets.scrollHeight;
        divTickets.height=divTickets.scrollHeight;
        divTickets.style.maxHeight=divTickets.scrollHeight;
        divTickets.style.borderStyle='none';
        if(!MouseSupport) {
            divTickets.style.overflow='visible';
            btnTicketsHoch.style.display='none';
            btnTicketsRunter.style.display='none';}
    }
    if(MouseSupport) {
        if(divTickets.scrollWidth>divTickets.clientWidth) {
            if(divTickets.scrollHeight>divTickets.clientHeight) {
                divTickets.style.width=divTickets.scrollWidth+60;
                divTickets.style.maxWidth=divTickets.scrollWidth+60;}
            else {
                divTickets.style.width=divTickets.scrollWidth;
                divTickets.style.maxWidth=divTickets.scrollWidth;}
        }
    }
}
}

function btnTicketsRunter_onClick()
{
var divTickets,btnTicketsHoch,btnTicketsRunter,h,p,g;
    
btnTicketsHoch=document.getElementById('btnticketshoch');
btnTicketsHoch.style.visibility='visible';
btnTicketsRunter=document.getElementById('btnticketsrunter');
btnTicketsRunter.style.visibility='hidden';
divTickets=document.getElementById('ajaxout');
if(divTickets) {
    h=divTickets.scrollHeight;
    p=divTickets.scrollTop;
    g=divTickets.clientHeight;
    p=p+100;
    if (p+g>h) {
        setTimeout("document.getElementById('btnticketsrunter').style.visibility='hidden';",100);
        p=h-g;
    } else {
        setTimeout("document.getElementById('btnticketsrunter').style.visibility='visible';",100);
    }
    divTickets.scrollTop=p;
}
}
function btnTicketsHoch_onClick()
{
var divTickets,btnTicketsHoch,btnTicketsRunter,h,p,g;
btnTicketsHoch=document.getElementById('btnticketshoch');
btnTicketsHoch.style.visibility='hidden';
btnTicketsRunter=document.getElementById('btnticketsrunter');
btnTicketsRunter.style.visibility='visible';
divTickets=document.getElementById('ajaxout');
if(divTickets) {
    h=divTickets.scrollHeight;
    p=divTickets.scrollTop;
    g=divTickets.clientHeight;
    p=p-100;
    if (p<0) {
        setTimeout("document.getElementById('btnticketshoch').style.visibility='hidden';",100);
        p=0;
    } else {
        setTimeout("document.getElementById('btnticketshoch').style.visibility='visible';",100);
    }
    divTickets.scrollTop=p;
}
}
function SetupLayout2() {
var tdSaalplan,maxWidth,maxHeight,divSitze,
    btnSitzeHoch,btnSitzRunter,btnSitzeRechts,btnSitzeLinks,
    VORTLogo,Sitzplan,divSitzplan,f,h,b;
    
divSitze=document.getElementById('divSitze');
if(divSitze) {
    if(MouseSupport) {
        divSitze.style.overflow='auto';
        divSitze.onscroll=onMoveSitze;
        }
    tdSaalplan=document.getElementById('tdSaalplan');
    maxWidth=document.getElementById('maxWidth');
    
    maxHeight=document.getElementById('maxHeight');
    VORTLogo=document.getElementById('VORTLogo');
    Sitzplan=document.getElementById('sitzplan');
    divSitzplan=document.getElementById('divSitzplan');
    if(!MouseSupport) {
        btnSitzeHoch=document.getElementById('btnplanhoch');
        btnSitzRunter=document.getElementById('btnplanrunter');
        btnSitzeRechts=document.getElementById('btnplanrechts');
        btnSitzeLinks=document.getElementById('btnplanlinks');}
  
    Sitzplan.onclick=MoveSitze;
    divSitzplan.onclick=MoveSitze;

    if(Sitzplan) {
        var w,h,kleiner;
        kleiner=0;
        h=SPHeight2();
        if(h<110) h=110;
        w=SPWidth()-260;
        if(w<750) w=750;
        Sitzplan.style.display="inline";
        if(w>parseFloat(maxWidth.value)) {
            w=parseFloat(maxWidth.value);
            if(!MouseSupport) {
                btnSitzeRechts.style.display='none';
                btnSitzeLinks.style.display='none';}
        } else {
            w=w-44;
            kleiner=1;
            if(!MouseSupport) {
                btnSitzeRechts.style.display='inline';
                btnSitzeLinks.style.display='inline';
                btnSitzeRechts.onclick=btnSitzeRechts_onClick;
                btnSitzeLinks.onclick=btnSitzeLinks_onClick;}
        }
        divSitze.style.maxWidth=w;
        divSitze.style.width=w;
        if(h>parseFloat(maxHeight.value)) {
            if(!MouseSupport) {
                //h=parseFloat(maxHeight.value);
                btnSitzRunter.style.display='none';
                btnSitzeHoch.style.display='none';}
        } else {
            h=h-33;
            kleiner=1;
            if(!MouseSupport) {
                btnSitzRunter.style.display='inline';
                btnSitzeHoch.style.display='inline';
                btnSitzRunter.onclick=btnSitzeRunter_onClick;
                btnSitzeHoch.onclick=btnSitzeHoch_onClick;}
        }
        if(kleiner) {
            divSitze.style.borderStyle='dotted';
            divSitzplan.style.display="inline";
            divSitzplan.style.left=0;
            divSitzplan.style.top=0;                       
            
            f=w/parseFloat(maxWidth.value)
            if(f>1) f=1;
            divSitzplan.style.width=parseFloat(Sitzplan.width)*f;
            
            f=h/parseFloat(maxHeight.value);
            if(f>1) f=1;
            divSitzplan.style.height=parseFloat(Sitzplan.height)*f;
        } else {
            divSitze.style.borderStyle='none';
            divSitzplan.style.display="none";
            divSitze.scrollLeft=0;
            divSitze.scrollTop=0;
        }
        divSitze.style.maxHeight=h;
        divSitze.style.height=h;
        if(!MouseSupport) {
            b=Sitzplan.width;
            if (b<=parseFloat(divSitzplan.style.width)) b=parseFloat(divSitzplan.style.width)+1;
            h=Sitzplan.height;
            if (h<=parseFloat(divSitzplan.style.height)) h=parseFloat(divSitzplan.style.height)+1;
            b=parseFloat(divSitzplan.style.left)/(b-parseFloat(divSitzplan.style.width))
            h=parseFloat(divSitzplan.style.top)/(h-parseFloat(divSitzplan.style.height))
            if(b>0.8) b=1;
            if(h>0.8) h=1;
            if(b<0.2) b=0;
            if(h<0.2) h=0;
            
            if(b>0.9) {
                document.getElementById('btnplanrechts').style.visibility='hidden';}
            else {
                document.getElementById('btnplanrechts').style.visibility='visible';}
            if(b<0.1) {
                document.getElementById('btnplanlinks').style.visibility='hidden';}
            else {
                document.getElementById('btnplanlinks').style.visibility='visible';}
            if(h>0.9) {
                document.getElementById('btnplanrunter').style.visibility='hidden';}
            else {
                document.getElementById('btnplanrunter').style.visibility='visible';}
            if(h<0.1) {
                document.getElementById('btnplanhoch').style.visibility='hidden';}
            else {
                document.getElementById('btnplanhoch').style.visibility='visible';}                   
        }
    } 
}
SizeWarenkorb();
SizeTickets();
}

function ses(s) {

    if(!s) {
        if(!window.event) {
            s=event.srcElement.id;
        } else {
            s=window.event.srcElement.id;
        }
    }
    else {
        if(s.target) {
            s=s.target.id;}
    }
    return SelectSitz(s)
}
function SelectSitz(s) {
    var sel;
    sel=document.getElementById('SelSitz').value;
    if (sel != '') 
        if (document.getElementById(sel)) {
        
            document.getElementById(sel).style.borderStyle="solid";
            if(document.getElementById(sel).DBW) {
                document.getElementById(sel).style.borderWidth=document.getElementById(sel).DBW+"px";
            } else {
                document.getElementById(sel).style.borderWidth="1px";
            }
            document.getElementById(sel).style.borderColor="black";
            document.getElementById('SelSitz').value='';
        }

    var sub;
    sub=document.getElementById("sub").value
    if (sel != s)
    {
        if(document.getElementById(s)) {
           if(document.getElementById(s).style.borderWidth!="3px" || document.getElementById(s).style.borderColor!="blue") {
                document.getElementById(s).style.borderStyle="solid";
                document.getElementById(s).style.borderWidth="3px";
	            document.getElementById(s).style.borderColor="blue";
	            document.getElementById('SelSitz').value=s; 
	            stadionplan3.onSitzClick(sub,s,onSitzClick_Callback);}
           }
	 } else
	 {
	        document.getElementById('SelSitz').value='';
	        stadionplan3.onSitzClick(sub,"--none-",onSitzClick_Callback);
	 }
}

function onSitzClick_Callback(res) {
if(res != null) { 
    document.getElementById('ajaxout').innerHTML=res.value;   
    if(res.value.charCodeAt(0)!=32) {
        var s;      
        s=document.getElementById('SelSitz').value;
        document.getElementById(s).style.borderWidth="1px";
        document.getElementById(s).style.borderColor="black";
        document.getElementById('SelSitz').value='';
    }
}
SizeWarenkorb();
SizeTickets();
}

function onClickKartentyp_Callback(res) {
    if(res != null) {                
        var html=res.value;
        var div;
        if(html != null) {
            if(html[3] != null && html[3]!='') {
                document.getElementById('ajaxout').innerHTML=html[3];}
            if(html[0] == null || html[0]=='') {
                 alert(html[1]);
                 s=document.getElementById('SelSitz').value;
                 if(s!='') {
                     document.getElementById(s).style.borderStyle="solid";
                     document.getElementById(s).style.borderWidth=document.getElementById(s).DBW+"px";
                     document.getElementById(s).style.borderColor="black";                
                     document.getElementById('SelSitz').value='';}
            } else {
                div=document.getElementById(html[0]);
                if(div) div.innerHTML =html[1];
                var s;
                s=document.getElementById('SelSitz').value;
                if(s!='') {
                    document.getElementById(s).style.borderStyle="solid";
                    document.getElementById(s).style.borderColor="black";
                    document.getElementById(s).style.backgroundColor="yellow";
                    document.getElementById(s).style.borderWidth="3px";
                    document.getElementById(s).DBW="3";}
                document.getElementById('SelSitz').value='';
                s=html[2].substr(12,37);
                var sub;
                if(document.getElementById(s)) {
                    document.getElementById(s).style.borderStyle="solid";
                    document.getElementById(s).style.borderWidth="3px";
                    document.getElementById(s).style.borderColor="blue";
                    document.getElementById('SelSitz').value=s; 
                }     
                transactioncost();
            }
        }
    }
    SizeWarenkorb();
    SizeTickets();
    if(document.getElementById('SynWAYWarenkorbDIV')) {
        if(document.getElementById('btnwarenkorbhoch')) {
            document.getElementById('btnwarenkorbhoch').style.visibility='visible';
            document.getElementById('btnwarenkorbrunter').style.visibility='hidden';}
        document.getElementById('SynWAYWarenkorbDIV').scrollTop=document.getElementById('SynWAYWarenkorbDIV').scrollHeight-document.getElementById('SynWAYWarenkorbDIV').clientHeight;}
   }
   
function onClickKartentypImBlock_Callback(res) {
if(res != null) {                
    var html=res.value;
    var div;
    if(html != null) {
        if(html[2] != null && html[2]!='') {
            document.getElementById('ajaxout').innerHTML=html[2];}
        if(html[0] == null || html[0]=='') {
             alert(html[1]);
        } else {
            div=document.getElementById(html[0]);
            if(div) div.innerHTML =html[1];
            transactioncost();
        }
    }
}
SizeWarenkorb();
SizeTickets();
if(document.getElementById('SynWAYWarenkorbDIV')) {
    if(document.getElementById('btnwarenkorbhoch')) {
        document.getElementById('btnwarenkorbhoch').style.visibility='visible';
        document.getElementById('btnwarenkorbrunter').style.visibility='hidden';}
    document.getElementById('SynWAYWarenkorbDIV').scrollTop=document.getElementById('SynWAYWarenkorbDIV').scrollHeight-document.getElementById('SynWAYWarenkorbDIV').clientHeight;}
}
function AjaxChangeWK(sub,id,Opt1ID,Opt2ID,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,divname,v) {
    if(v=='' || v=='0') {
        stadionplan3.OUTWK(sub,id,Opt1ID,Opt2ID,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,divname,AjaxWK_callback);}
    else {
        stadionplan3.ChangeWK(sub,id,Opt1ID,Opt2ID,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,v,divname,AjaxWK_callback);}
}           
function AjaxChangeAnmerkung(sub,id,Opt1ID,Opt2ID,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,divname,Anmerkung) {
  stadionplan3.ChangeAnmerkung(sub,id,Opt1ID,Opt2ID,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,Anmerkung,divname,AjaxWK_callback);
}           
function AjaxOUTWK(sub,id,opt1,opt2,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,divname) {
var sel,s;
s='K'+id.replace(/-/g,"_");
if(document.getElementById('SelSitz')) {
    sel=document.getElementById('SelSitz').value;
      if (sel != '') {
        var ss;
        ss=document.getElementById(sel);
        if(ss) {
            ss.style.borderStyle="solid";
            if(document.getElementById(sel).DBW) {
                ss.style.borderWidth=document.getElementById(sel).DBW+"px";}
            else {
                ss.style.borderWidth="1px";}
            ss.style.borderColor="black";
        }
        document.getElementById('SelSitz').value='';
    }
}     
if(document.getElementById(s)) {
  if(document.getElementById('SelSitz')) document.getElementById('SelSitz').value=s; }
 stadionplan3.OUTWK(sub,id,opt1,opt2,vo3,vo4,vo5,vo6,vo7,vo8,vo9,vo10,divname,AjaxWK_callback);}
    
function AjaxWK_callback(res) {
    if(res != null) {
        var html=res.value;
        var div;
        if(html != null) {
            if(html[0] == null || html[0]=='') {
                alert(html[1]);
            } else {
                   div=document.getElementById(html[0]);
                   if(div) div.innerHTML =html[1];
                   var s;
                   
                   if(document.getElementById('SelSitz')) {
                       s=document.getElementById('SelSitz').value;
                       if(s!="") {
                            var ss;
                            ss=document.getElementById(s);
                            if(ss) {
                                ss.style.borderStyle="solid";
                                ss.style.borderWidth="1px";
                                ss.style.borderColor="black";                               
                                ss.style.cursor="pointer";
                                ss.onclick=ses;
                                ss.DBW="1";
                                var f;
                                f=html[2].substr(5,7);
                                if(f=='') f='#9ACD32';
                                document.getElementById(s).style.backgroundColor=f;
                                document.getElementById('SelSitz').value='';}
                       }
                   }
                   transactioncost();
            }
        }
    }
    SizeWarenkorb();
    SizeTickets();
}

function ClickKartentyp(o,SubName,KartenID,ID)
{
    o.style.visibility='hidden';
    stadionplan3.onClickKartentyp(SubName,KartenID,ID,onClickKartentyp_Callback);
}

function ClickKartentypBlock(o,SubName,Block,ID)
{
    o.style.visibility='hidden';
    stadionplan3.onClickKartentypImBlock(SubName,Block,ID,onClickKartentypImBlock_Callback);
}

function btnSitzeRechts_onClick()
{
   var Sitzplan,x,px,tagname,divSitze,maxWidth,b,divSitzplan;
   
   btn=document.getElementById('btnplanrechts');
   btn.style.visibility='hidden';
            
    Sitzplan=document.getElementById('sitzplan');
    divSitze=document.getElementById('divSitze');
    divSitzplan=document.getElementById('divSitzplan');
    
    x=parseFloat(divSitzplan.style.left);
    maxWidth=document.getElementById('maxWidth');
    b=Sitzplan.width;
    if (b<=parseFloat(divSitzplan.style.width)) b=parseFloat(divSitzplan.style.width)+1;
    px=x/(b-parseFloat(divSitzplan.style.width))+0.3;
    if(px>0.9) px=1;
    if(px<0.1) px=0;
    divSitzplan.style.left=(b-parseFloat(divSitzplan.style.width))*px;
    b=parseFloat(divSitzplan.style.left)/(b-parseFloat(divSitzplan.style.width))
    document.getElementById('btnplanlinks').style.visibility='visible';
    setTimeout("document.getElementById('btnplanrechts').style.visibility='visible';",99);
    if(b>0.9) {
        setTimeout("document.getElementById('btnplanrechts').style.visibility='hidden';",100);
        b=1;}
    else if(b<0.1) {
        b=0;}
        
    divSitze.scrollLeft=(divSitze.scrollWidth-parseFloat(divSitze.style.width))*b;
}
function btnSitzeLinks_onClick()
{
   var Sitzplan,x,px,tagname,divSitze,maxWidth,b,divSitzplan;

   btn=document.getElementById('btnplanlinks');
   btn.style.visibility='hidden';  
   
    Sitzplan=document.getElementById('sitzplan');
    divSitze=document.getElementById('divSitze');
    divSitzplan=document.getElementById('divSitzplan');

    x=parseFloat(divSitzplan.style.left);
    maxWidth=document.getElementById('maxWidth');
    b=Sitzplan.width;
    if (b<=parseFloat(divSitzplan.style.width)) b=parseFloat(divSitzplan.style.width)+1;
    px=x/(b-parseFloat(divSitzplan.style.width))-0.3;
    if(px>0.9) px=1;
    if(px<0.1) px=0;
    divSitzplan.style.left=(b-parseFloat(divSitzplan.style.width))*px;
    b=parseFloat(divSitzplan.style.left)/(b-parseFloat(divSitzplan.style.width));
    document.getElementById('btnplanrechts').style.visibility='visible';
    setTimeout("document.getElementById('btnplanlinks').style.visibility='visible';",99);
    if(b>0.9) {
        b=1;}
    else if(b<0.1) {
        setTimeout("document.getElementById('btnplanlinks').style.visibility='hidden';",100);
        b=0;}
        
    divSitze.scrollLeft=(divSitze.scrollWidth-parseFloat(divSitze.style.width))*b;
}
function btnSitzeHoch_onClick()
{
    var Sitzplan,y,py,tagname,divSitze,maxHeight,h,divSitzplan;

    btn=document.getElementById('btnplanhoch');
    btn.style.visibility='hidden';
                
    Sitzplan=document.getElementById('sitzplan');
    divSitze=document.getElementById('divSitze');
    divSitzplan=document.getElementById('divSitzplan');

    y=parseFloat(divSitzplan.style.top);
    maxHeight=document.getElementById('maxHeight');
    h=Sitzplan.height;
    if (h<=parseFloat(divSitzplan.style.height)) h=parseFloat(divSitzplan.style.height)+1;
    py=y/(h-parseFloat(divSitzplan.style.height))-0.3;
    if(py>0.9) py=1;
    if(py<0.1) py=0;
    divSitzplan.style.top=(h-parseFloat(divSitzplan.style.height))*py;
    h=parseFloat(divSitzplan.style.top)/(h-parseFloat(divSitzplan.style.height))
    document.getElementById('btnplanhoch').style.visibility='visible';
    setTimeout("document.getElementById('btnplanrunter').style.visibility='visible';",99);
    if(h>0.9) {
        setTimeout("document.getElementById('btnplanrunter').style.visibility='hidden';",100);
        h=1;}
    else if(h<0.1) {
        h=0;}
        
    divSitze.scrollTop=(divSitze.scrollHeight-parseFloat(divSitze.style.height))*h;
}
function btnSitzeRunter_onClick()
{
    var Sitzplan,y,py,tagname,divSitze,maxHeight,h,divSitzplan;

    btn=document.getElementById('btnplanrunter');
    btn.style.visibility='hidden';
                
    Sitzplan=document.getElementById('sitzplan');
    divSitze=document.getElementById('divSitze');
    divSitzplan=document.getElementById('divSitzplan');

    y=parseFloat(divSitzplan.style.top);
    maxHeight=document.getElementById('maxHeight');
    h=Sitzplan.height;
    if (h<=parseFloat(divSitzplan.style.height)) h=parseFloat(divSitzplan.style.height)+1;
    py=y/(h-parseFloat(divSitzplan.style.height))+0.3;
    if(py>0.9) py=1;
    if(py<0.1) py=0;
    divSitzplan.style.top=(h-parseFloat(divSitzplan.style.height))*py;
    h=parseFloat(divSitzplan.style.top)/(h-parseFloat(divSitzplan.style.height))
    document.getElementById('btnplanhoch').style.visibility='visible';
    setTimeout("document.getElementById('btnplanrunter').style.visibility='visible';",99);
    if(h>0.9) {
        setTimeout("document.getElementById('btnplanrunter').style.visibility='hidden';",100);
        h=1;}
    else if(h<0.1) {
        h=0;}
        
    divSitze.scrollTop=(divSitze.scrollHeight-parseFloat(divSitze.style.height))*h;
}

function lrpSel(NID,v) {
d=document;
if(d.SPDBForm.LB_LRP_ID) {LID=d.getElementById("lprausH").value;
if(LID) {if(LID!="") {a=d.getElementById(LID);
if(a) {a.style.borderWidth=1;
a.style.borderColor="black";}}}
if(NID) {if(NID!="") {
n=d.getElementById(NID);
if(n) {d.getElementById("lprausH").value=NID;
d.SPDBForm.LB_LRP_ID.value=v;
n.style.borderWidth=2;
n.style.borderColor="red";
onChangeOfLB_LRP_ID();}}}
}}

function InitUseGutschein()
{
    var txtGS,btnGS;
    txtGS=document.getElementById("idUseGutschein");
    btnGS=document.getElementById("idBtnGutschein");
    if(btnGS) {
        if(txtGS) {
            txtGS.style.width=180;
            txtGS.value='achtzehn Ziffern';
            txtGS.onchange=GSCheck;
            txtGS.onkeydown=GSCheck;
            txtGS.onkeyup=GSCheck;
            txtGS.onmousedown=GSFocus;
            txtGS.onclick=GSFocus;
            txtGS.onblur=GSBlur;
            txtGS.onfocus=GSFocus;
            btnGS.onclick=GSUSe;
            GSCheck();
        }
     }
};

function GSCheck() {
    var txtGS,btnGS,gs,i;
    txtGS=document.getElementById("idUseGutschein");
    btnGS=document.getElementById("idBtnGutschein");
    if(btnGS) {
        if(txtGS) {
            gs=txtGS.value;
            Ziffern=0;
            for(i=0;i<gs.length;i++) {
                if(gs.charAt(i)>='0' && gs.charAt(i)<='9') Ziffern++;
                if((gs.charAt(i)<'0' || gs.charAt(i)>'9') && gs.charAt(i)!=' ') {
                    gs=gs.replace(gs.charAt(i),'');
                    i=i-1;
                }
            }
            if(gs.charAt(0)==' ') gs=gs.replace(' ','');
            if(gs=='') gs='achtzehn Ziffern';
            if(gs.length<5) gs=gs.replace(' ','');
            if(txtGS.value!=gs) txtGS.value=gs;
            btnGS.disabled=Ziffern!=18 || txtGS.Value=='achtzehn Ziffern';
        }
    }
}

function GSFocus() {
    var txtGS;
    txtGS=document.getElementById("idUseGutschein");
    if(txtGS) {
        if(txtGS.Value=='achtzehn Ziffern') txtGS.Value='';
    }
}

function GSBlur() {
    var txtGS;
    txtGS=document.getElementById("idUseGutschein");
    if(txtGS) {
        if(txtGS.Value=='') txtGS.Value='achtzehn Ziffern';
        GSCheck();
    }
}
function GSUSe()
{
    var txtGS,btnGS;
    txtGS=document.getElementById("idUseGutschein");
    btnGS=document.getElementById("idBtnGutschein");
    if(btnGS) {
        if(txtGS) {
            ajax.GSUse('Bestellung',txtGS.value,'divwarenkorb',AjaxGS_callback);
        }
    }
}
function AjaxGS_callback(res) {
    if(res != null) {
        var html=res.value;
        var div;
        if(html != null) {
            if(html[1]!='') {
                alert(html[1]);
            } else {
                div=document.getElementById('divwarenkorb');
                if(div) {
                    txtGS=document.getElementById("idUseGutschein");
                    txtGS.Value='achtzehn Ziffern';
                    div.innerHTML =html[0];}
            }
        };
    }
}
