// MARIProjekt.NET 3.7
// (C) by MARINGO Computers GmbH www.maringo.de

////////////////////////////////
// Globals
// 
var ie4=document.all && navigator.userAgent.indexOf("Opera")==-1;
var bIsIE = (navigator.userAgent.indexOf('MSIE') != -1);
var bIsSafari2 = (navigator.userAgent.indexOf('Safari/4') != -1); //Verhalten nur bei Version2 falsch, die sich mit Safari/4xx meldet
var bIsSafari = (navigator.userAgent.indexOf('Safari') != -1); //Verhalten nur bei Version2 falsch, die sich mit Safari/4xx meldet
var bIsOpera= ( navigator.userAgent.indexOf("Opera")!=-1);
var ns6=document.getElementById && !document.all;
var ns4=document.layers;
var dom=document.getElementById;
var sReloadURL = "";
var sLastNoValidatedControlName = "-1";

var s_6079 = "";

//*****************************************************************************
// Zahlen- und Datumsformatierung
//*****************************************************************************


var oCultureInfo = {
	sCurrencyGroupSeparator: '',
	sCurrencyDecimalSeparator: '.',
	sCurrencyDefaultDecimalPlaces: 2,
	sCurrencyNegativeSign: '-',
	sDateTimeShortTimeFormat: 'hh:mm',
	sDateTimeDateFormat: 'd'
};

function sFormatDate(dt) {
}

function sFormatTimeHHMM(dt) {
}

function sFormatDateTime(dt) {
}

function sFormatDateTimeEx(dt, pattern) {
}

function sFormatCurrency(nm, decimals) {
    return sFormatCurrencyEx(oCultureInfo.sCurrencyDecimalSeparator, oCultureInfo.sCurrencyGroupSeparator, decimals, nm);
}

////////////////////////////////
// Formatiert eine Zahl und gibt diese entsprechend als String zurueck.
function sFormatCurrencyEx(charDecSep, charGrpSep, cntDecimals, nm) {
    nm = nm.toFixed(2);//RoundN(nm, cntDecimals);
    var snm = '' + nm;
    snm = snm.replace(/\./g, charDecSep);
    
    return snm;
}

////////////////////////////////
// Parst einen String und gibt die enthaltene Zahl unter Zuhilfenahme von oCultureInfo zurueck.
function gCStr2Cur (value) {
    if (value.substr != undefined) value = '' + value;
    
    var digitsbevor=0;
    var digitsafter=0;
    var isdecimal=false;
    var isnegative=false;
    var digits='';
        
    var i=0;
    
    while (i<value.length) {
        //Reihenfolge beachten
        //Vorzeichen
        if (digitsbevor==0 && !isdecimal && !isnegative && i + oCultureInfo.sCurrencyNegativeSign.length < value.length && value.substr(i, oCultureInfo.sCurrencyNegativeSign.length)==oCultureInfo.sCurrencyNegativeSign) {
            isnegative=true;
            i += oCultureInfo.sCurrencyNegativeSign.length;
        }
        
        else if (i + oCultureInfo.sCurrencyDecimalSeparator.length < value.length && value.substr(i, oCultureInfo.sCurrencyDecimalSeparator.length)==oCultureInfo.sCurrencyDecimalSeparator) {
            if (isdecimal) {
                digitsbevor += digitsafter;
                digitsafter=0;
            }
            else {
                isdecimal = true;
            }
            
            i+= oCultureInfo.sCurrencyDecimalSeparator.length;
        }
        else {
            var d=value.substr(i, 1);
            if (d=='0' || d=='1' || d=='2' || d=='3' || d=='4' || d=='5' || d=='6' || d=='7' || d=='8' || d=='9') {
                digits = digits.concat(d);
                
                if (isdecimal)
                    digitsafter++;
                else
                    digitsbevor++;
            }
            ++i;
        }
    }
    
    if (digitsbevor == 0 && digitsafter == 0) {
        return 0;
    }
    else {
        var m = digitsbevor;
		var c = 0;
        for (i=0;i<digits.length;++i) {
        	--m;
			c += digits.substr(i, 1) * Math.pow(10, m);
        }
		
		if (isnegative) {
			c *= -1;
		}
		
		return c;
    }
}


var gCStr2TimeShort_regex = undefined;
////////////////////////////////
// Wandelt einen String zu einer Date-Instanz und gibt diese zurueck.
// sValue: Der String mit dem kurzen ZeitFormat.
// return: Gibt die geparste Zeit zurück oder undefined wenn das Format nicht passt.
function gCStr2TimeShort(sValue){
	if (gCStr2TimeShort_regex == undefined) {
	    gCStr2TimeShort_regex = new Object();
	    gCStr2TimeShort_regex.reg = undefined;
	    gCStr2TimeShort_regex.hourIndex = -1;
		gCStr2TimeShort_regex.minuteIndex = -1;
		gCStr2TimeShort_regex.ampmI = -1;
		gCStr2TimeShort_regex.secondI = -1;
		switch (oCultureInfo.sDateTimeShortTimeFormat) {
			case '':
			case 't':
				gCStr2TimeShort_regex.reg = /^\s*([01]?\d|2[0-3]):([0-5]\d)\s*$/
				gCStr2TimeShort_regex.hourIndex = 1;
				gCStr2TimeShort_regex.minuteIndex = 2;
			break;
			case 'T':
				gCStr2TimeShort_regex.reg = /^\s*([01]?\d|2[0-3]):([0-5]\d):([0-5]\d)\s*$/
				gCStr2TimeShort_regex.hourIndex = 1;
				gCStr2TimeShort_regex.minuteIndex = 2;
				gCStr2TimeShort_regex.secondI = 3;
			break;
			default:
				var tmps = oCultureInfo.sDateTimeShortTimeFormat;
				
				var match = tmps.match(/h{1,2}|H{1,2}/);
				var hourI = match === null ? -1 : match.index;
				
				match = tmps.match(/mm/);
				var minuteI = match === null ? -1 : match.index;
				
				match = tmps.match(/tt/);
				var ampmI = match === null ? -1 : match.index;
				
				match = tmps.match(/ss/);
				var secondI = match === null ? -1 : match.index;
				
				var indexArray = new Array(hourI, minuteI, ampmI, secondI);
				indexArray.sort();
				var curIndex = 1;
				for (var i=0; i < indexArray.length; ++i) {
				    if (indexArray[i] != -1) {
				        if (indexArray[i] == hourI) { gCStr2TimeShort_regex.hourIndex = curIndex; }
				        else if (indexArray[i] == minuteI) { gCStr2TimeShort_regex.minuteIndex = curIndex; }
				        else if (indexArray[i] == ampmI) { gCStr2TimeShort_regex.ampmI = curIndex; }
				        else if (indexArray[i] == secondI) { gCStr2TimeShort_regex.secondI = curIndex; }
    				    
				        curIndex++;
				    }
				}
				
				tmps = tmps.replace(/ss/, '([0-5]\\d)');
				tmps = tmps.replace(/([^0-9a-zA-Z])?tt/, function (sAll, s1) {
				    return s1 + '*(AM|PM)?';
				});
				tmps = tmps.replace(/H{1,2}/i, '([01]?\\d|2[0-3])')
				tmps = tmps.replace(/mm/, '([0-5]\\d)');
				tmps = tmps.replace(/\s/, '\\s');
				
				tmps = '^\s*' + tmps + '\s*$';
				
				gCStr2TimeShort_regex.reg = new RegExp(tmps, 'i');
				
				
			break;
		}
	}
	
	var match = gCStr2TimeShort_regex.reg.exec(sValue);
	if (match === null) {
		return undefined;
	}
	else {
		var hour = match[gCStr2TimeShort_regex.hourIndex];
		var minute = match[gCStr2TimeShort_regex.minuteIndex];
		var ampm = match[gCStr2TimeShort_regex.ampmI];
		var second = match[gCStr2TimeShort_regex.secondI];
		
		if (hour == undefined) hour = 0;
		if (minute == undefined) minute = 0;
		if (second == undefined) second = 0;
		
		if (ampm != undefined && hour < 12 && ampm.search(/PM/i) >= 0) {
			hour = parseInt(hour) + 12;
		}
		
		return new Date(1970, 0, 1, hour, minute, second);
	}
}

var gStr2Date_regex = undefined;
/*******************************
/* Wandelt einen String zu einer Date-Instanz und gibt diese zurück.
/* sValue:		Der String im Datumsformat.
/* return:		Eine Instanz von Date oder aber bei ungültigem String undefined
/* remarks:		Derzeit akzeptierte Formatsymbole:
				d dd MM yy yyyy
/*******************************/
function gStr2Date(sValue){
	if (gStr2Date_regex == undefined) {
		gStr2Date_regex = new Object();
		gStr2Date_regex.dayIndex = -1;
		gStr2Date_regex.monthIndex = -1;
		gStr2Date_regex.yearIndex = -1;
		
		switch(oCultureInfo.sDateTimeDateFormat) {
			case '':
			case 'd': // MM/dd/yyyy
				gStr2Date_regex.monthIndex = 0;
				gStr2Date_regex.dayIndex = 1;
				gStr2Date_regex.yearIndex = 2;
				break;
			default:
				var tmps = oCultureInfo.sDateTimeDateFormat;
				
				var match = tmps.match(/dd/);
				var dayI = match == null ? -1 : match.index;
				
				match = tmps.match(/MM/);
				var monthI = match == null ? -1 : match.index;
				
				match = tmps.match(/yy(yy)?/);
				var yearI = match == null ? -1 : match.index;
				
				var indexArray = new Array(dayI, monthI, yearI);
				indexArray.sort();
				var curIndex = 0;
				var sDigOn4 = '^';
				var sDigOn6 = '^';
				var sDigOn8 = '^';
				for (var i = 0; i < indexArray.length; ++i) {
					if (indexArray[i] != -1) {
						switch (indexArray[i]) {
							case dayI:
								gStr2Date_regex.dayIndex = curIndex;
								break;
							case monthI:
								gStr2Date_regex.monthIndex = curIndex;
								break;
							case yearI:
								gStr2Date_regex.yearIndex = curIndex;
								break;
						}
						
						curIndex++;
					}
				}
				break;
		}
	}
	
	var rgx_digits = /^\D*(\d.*\d)\D*$/g
	var match = rgx_digits.exec(sValue);
	if (match == null) 
		return undefined;
	else {
		sValue = match[1];
	}
	
	var day;
	var month;
	var year;
	
	var rgxOnlyDigits = /^\d{4,8}$/
	match = rgxOnlyDigits.exec(sValue);
	if (match == null || sValue.length < 4) {
		var arr = new Array();
		var arr_i = 0;
		var arr_is = false;
		var n = 0;
		for (var i=sValue.length -1; i>=0; --i){
		    var cd;
		    switch (sValue.substr(i,1)) {
		        case '0': cd = 0; break;
		        case '1': cd = 1; break;
		        case '2': cd = 2; break;
		        case '3': cd = 3; break;
		        case '4': cd = 4; break;
		        case '5': cd = 5; break;
		        case '6': cd = 6; break;
		        case '7': cd = 7; break;
		        case '8': cd = 8; break;
		        case '9': cd = 9; break;
		        default:
					arr_i++;
					if (arr_i > 2) return undefined;
					n = 0;
					cd = null;
					arr_is = false;
					break;
		    }
		    
		    if (cd != null) {
		        var v = cd * Math.pow(10, n);
		        if (arr_is)
		        	arr[arr_i] += v;
		        else
		            arr[arr_i] = v;
				n++;
				arr_is = true;
		    }
		}
		arr.reverse();
		
		day = arr[gStr2Date_regex.dayIndex];
		month = arr[gStr2Date_regex.monthIndex];
		year = arr[gStr2Date_regex.yearIndex];
	}
	else { //Eingabe ohne Trennzeichen
		switch (sValue.length) {
			case 4:
			case 6:
			case 8: break;
			default:
				return undefined;
		}
		
		day = '';
		month = '';
		year = sValue.length > 4 ? '' : undefined;
		
		var sc = '';
		var nc = 0;
		var nd = 0;
		var ne = 0;
		do {
			sc = sValue.substr(nc, 1);			
			
			if (nd == gStr2Date_regex.yearIndex && sValue.length == 4) nd++;
			
			if (nd == gStr2Date_regex.dayIndex) {
				day += sc;
				if (ne == 1) {
					nd++;
					ne = 0;
				}
				else
					ne++;
			}
			else if (nd == gStr2Date_regex.monthIndex) {
				month += sc;
				if (ne == 1) {
					nd++;
					ne = 0;
				}
				else
					ne++;
			}
			else {
				year += sc;
				if (sValue.length == 6 && ne == 1 || sValue.length == 8 && ne == 3) {
					nd++;
					ne = 0;
				}
				else
					ne++;
			}
			nc++;
		} while(nc < sValue.length);
	}
	
	var today = new Date();
	if (day == undefined) day = today.getDate();
	
	if (month == undefined) 
	    month = today.getMonth();
	else
	    month--;
	    
	if (year == undefined) 
		year = today.getYear();
	else if (year < 1000) {
		if (year > 99) return undefined;
		
		var y = today.getYear() / 100;
		y = RoundN(y, 0);
		if (year > 49)
			y--;
		
		year = y * 100 + RoundN(year, 2);
	}
	
	return new Date(year, month, day);
}

////////////////////////////////
// Rundet eine Zahl kaufmännisch, mit der Anzahl der Nachkommastellen im Rückgabewert
// d: Die Gleitkommazahl, die gerundet werden soll.
// decimals: Die Anzahl der Nachkommastellen wo gerundet werden soll.
function RoundN(d, decimals) {
    if (decimals == undefined) decimals = oCultureInfo.lCurrencyDefaultDecimalPlaces;
    
    var e = Math.pow(10, decimals);
    return Math.round(d * e) / e;
}


function leftTrim(str) {
	return (str.replace(/^\s+/,""));
}  

function rightTrim(str)  {
	return (str.replace(/\s+$/,""));
}

function Trim(str)  {
	return (str.replace(/\s+$/,"").replace(/^\s+/,""));
}

////////////////////////////////
// 'ermittelt einen Parameter aus einer Parameterliste
function  gsParameter(sList,sPart,sDefault){
    var sString = '';
    if(sList)
      {}
      else
      {
        if(sDefault=='undefinied')
		   {
			  return '';
		   }else{
		      return sDefault;
		   }
		}
	var oArray = sList.split(sPart + ':='); 
	if (oArray.length == 1)
		{  if(sDefault=='undefinied')
		   {
			  return '';
		   }else{
		      return sDefault;
		   }
		} 
	if(oArray[1].search(';') > -1)
		{sString = oArray[1].slice(0,oArray[1].search(';'));}
	else
		{sString = oArray[1];}
	return sString;
}

////////////////////////////////
// replacestring    ersetzt die Teile, die mit #'Steuerelementname'## umrandet sind, mit dem Wert des Steuerelements 
function replacestring(eElem,sString) {
 
	var eForm=window.document.forms[0];
	var oArray = sString.split('##'); 
	for(var i = 0 ; i <= oArray.length -2 ; i++)
      { 
		if(oArray[i].search('#') > -1)
		  {
			var sTemp = oArray[i].slice(oArray[i].search('#')+ 1); 
			sString = sString.replace('#' + sTemp + '##' ,eForm.elements[sTemp].value);
		  };
      };
	return sString;
}

////////////////////////////////
// replacestring   das gleiche wie replacstring, nur mit encoded URl ///macht z.b. "?" kaputt, weil encodeURIComponent anders encoded
function replaceurl(eElem,sString) {
 
	var eForm=window.document.forms[0];
	var oArray = sString.split(encodeURIComponent('##')); 
	for(var i = 0 ; i <= oArray.length -2 ; i++)
      { 
		if(oArray[i].search(encodeURIComponent('#')) > -1)
		  {
			var sTemp = decodeURIComponent(oArray[i].slice(oArray[i].search(encodeURIComponent('#'))+ 3)); 
			sString = sString.replace(encodeURIComponent('#' + sTemp + '##') ,encodeURIComponent(eForm.elements[sTemp].value));
		  };
      };
	return sString;
}

////////////////////////////////
// 'schreibt einen Wert in ein Control
 function ControlSetValue(eElem,sControlName,sValue) {
     eForm = window.document.forms[0];
     if (typeof(sValue)=='string') {
	 	sValue = replacestring(eElem, sValue);
	 }
     if (typeof(eForm.elements[sControlName]) == 'object') {
	 	eForm.elements[sControlName].value = sValue;
	 }
}

////////////////////////////////
// 'setzt COntrols auf Visible bzw. UnVisible

function ShowElement(sElement,bshow) {
	if (document.getElementById(sElement))	{
		if (bshow == true)
			{document.getElementById(sElement).style.visibility  ="visible";}
		else
			{document.getElementById(sElement).style.visibility  ="hidden";}
	}
}

////////////////////////////////
// Entfernt alle SubNodes aus einem Html-Element
function ClearHtmlNode(element) {
    if (element != undefined) {
        while (element.firstChild != undefined) {
            element.removeChild(element.firstChild);
        }
    }
}

////////////////////////////////
// Entfernt alle Fehler aus lblErrors
function ClearErrors() {
    ClearHtmlNode(document.getElementById('lblErrors'));
}

////////////////////////////////
// Fügt einen Fehler zum Error-Label hinzu.
function AddError(sErrorMsg){
    var node = document.getElementById('lblErrors');
    if (node == undefined){
        alert(sErrorMsg);
    }
    else {
        if (node.firstChild != undefined) {
            node.appendChild(document.createElement('br'));
        }
        
        node.appendChild(document.createTextNode(sErrorMsg));
    }
}

////////////////////////////////
// disbaled all Buttons in Form

function DisableAllButtons() {
    var inputObjs = document.getElementsByTagName('INPUT');
    for(var i = 0; i < inputObjs.length; i++) {
      if(inputObjs[i].type.toLowerCase() == 'button' || inputObjs[i].type.toLowerCase() == 'submit' || inputObjs[i].type.toLowerCase() == 'reset') {
        inputObjs[i].disabled = true;
      }
    }
}
 
////////////////////////////////
// 'clear Combobox
function ClearCombo(sElementID) {
	eElem = document.getElementById(sElementID);
	if (typeof(eElem) =='undefined') return;
	if(eElem.tagName!='SELECT') return;
	while (eElem.hasChildNodes()) {
		eElem.removeChild(eElem.firstChild);
	}
	eElem.length = 0;
}

////////////////////////////////
// showmenu
function showmenu(e,which,sKey) {
	
	 if (!document.all&&!document.getElementById&&!document.layers) return;
	
	 which = which.replace(/I=/g,'X=' + sKey + '&I=');
	 clearhidemenu();
	
	 menuobj=(ie4||bIsOpera)? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : "";
	 menuobj.thestyle=(ie4||ns6||bIsOpera)? menuobj.style : menuobj;
	
	 if (ie4 || ns6 || bIsOpera) {
	 	menuobj.innerHTML = which;
	 }
	 else {
	 	menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=200 onmouseover="clearhidemenu();" onmouseout="hidemenu();">' + which + '</layer>');
	 	menuobj.document.close();
	 }
	
	 menuobj.contentwidth=(ie4||ns6||bIsOpera)? menuobj.offsetWidth : menuobj.document.gui.document.width;
	 menuobj.contentheight=(ie4||ns6||bIsOpera)? menuobj.offsetHeight : menuobj.document.gui.document.height;
	 var eventX=bIsSafari2? event.clientX-self.scrollX : (ie4||bIsOpera)? event.clientX : ns6? e.clientX : e.x;
	 var eventY=bIsSafari2? event.clientY-self.scrollY : (ie4||bIsOpera)? event.clientY : ns6? e.clientY : e.y;
	
	 //Find out how close the mouse is to the corner of the window
	 var rightedge=(ie4||bIsOpera)? document.body.clientWidth-eventX : window.innerWidth-eventX;
	 var bottomedge=(ie4||bIsOpera)? document.body.clientHeight-eventY : window.innerHeight-eventY;
	
	 //if the horizontal distance isn't enough to accomodate the width of the context menu
	if (rightedge < menuobj.contentwidth) {
	 	//move the horizontal position of the menu to the left by it's width
		menuobj.thestyle.left = (ie4 || bIsOpera) ? document.body.scrollLeft + eventX - menuobj.contentwidth : ns6 ? window.pageXOffset + eventX - menuobj.contentwidth : eventX - menuobj.contentwidth;
	}
	else {
		//position the horizontal position of the menu where the mouse was clicked
		menuobj.thestyle.left = (ie4 || bIsOpera) ? document.body.scrollLeft + eventX : ns6 ? window.pageXOffset + eventX : eventX;
	}
	
	 //same concept with the vertical position
	 if (bottomedge < menuobj.contentheight) {
	 	menuobj.thestyle.top = (ie4 || bIsOpera) ? document.body.scrollTop + eventY - menuobj.contentheight : ns6 ? window.pageYOffset + eventY - menuobj.contentheight : eventY - menuobj.contentheight;
	 }
	 else {
	 	menuobj.thestyle.top = (ie4 || bIsOpera) ? document.body.scrollTop + event.clientY : ns6 ? window.pageYOffset + eventY : eventY;
	 }
	
	 menuobj.thestyle.visibility="visible";
	 return false;
}

////////////////////////////////
// contains_ns6
//Determines if 1 element in contained in another- by Brainjar.com
function contains_ns6(a, b) {
     while (b.parentNode) {
	 	if ((b = b.parentNode) == a) {
			return true;
		}
	 }
     return false;
}

////////////////////////////////
// hidemenu
function hidemenu() {
     if (window.menuobj) {
	 	menuobj.thestyle.visibility = (ie4 || ns6 || bIsOpera) ? "hidden" : "hide";
	 }
}

////////////////////////////////
// dynamichide
function dynamichide(e) {
     if (ie4 && !menuobj.contains(e.toElement)) {
	 	hidemenu();
	 }
	 else {
	 	if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)) {
			hidemenu();
		}
	 }
}

////////////////////////////////
// delayhidemenu
function delayhidemenu() {
     if (ie4 || ns6 || ns4 || bIsOpera) {
	 	delayhide = setTimeout("hidemenu()", 500);
	 }
}

////////////////////////////////
// clearhidemenu
function clearhidemenu() {
     if (window.delayhide) {
	 	clearTimeout(delayhide);
	 }
}

////////////////////////////////
// highlightmenu
function highlightmenu(e,state) {
     if (document.all) {
	 	source_el = event.srcElement;
	 }
	 else {
	 	if (document.getElementById) {
			source_el = e.target;
		}
	 }
     if (source_el.className=="menuitems") {
          source_el.id=(state=="on")? "mouseoverstyle" : "";
     }
     else {
          while(source_el.id!="popmenu") {
               source_el=document.getElementById? source_el.parentNode : source_el.parentElement;
               if (source_el.className == "menuitems") {
			   	source_el.id = (state == "on") ? "mouseoverstyle" : "";
			   }
               
          }
     }
}

////////////////////////////////
//imgOver
function imgOver(Pic) {
	Pic.src=Pic.src.replace(/_21/,"_h_21")
}
////////////////////////////////
//imgOut
function imgOut(Pic) {
	Pic.src=Pic.src.replace(/_h_21/,"_21")
}
////////////////////////////////
//ShowHelp
function ShowHelp(height, width) 
{ 
  ShowHelpEx('', height, width);
}
function ShowHelpEx(link, height, width) {
  if (height==null) height=250;
  if (width==null) width=500;
  HelpWindow = window.open(link,'help','height=' + height +',width=' + width + ',menubar=0,scrollbars=auto');
  if (HelpWindow != null) { HelpWindow.focus(); }
}

////////////////////////////////
//ShowRpt
function ShowRpt()
{ HelpWindow = window.open('','report','height=700,width=1000,left=10,top=10,menubar=0,scrollbars=auto,resizable=yes');
  if (HelpWindow != null) { HelpWindow.focus(); }
}
////////////////////////////////
//ShowPopUpForm
////////////////////////////////
// Nix am Aufruf ändern!!!!!! Wegen Outlook-Addin
function ShowPopUpForm(sFrm, nHeight, nWidth) 
{ if (nHeight==null) nHeight=250;
  if (nWidth==null) nWidth=500;
  MyWindow = window.open('',sFrm,'height=' + nHeight +',width=' + nWidth + ',menubar=0,scrollbars=auto,resizable=yes');
  if (MyWindow != null) { MyWindow.focus(); }
}
////////////////////////////////
//Komplett mit URL, um aus JAVA gerufen zu werden
function ShowPopUpURLForm(sURL, sFrm, nHeight, nWidth) 
{ if (nHeight==null) nHeight=250;
  if (nWidth==null) nWidth=500;
  MyWindow = window.open(sURL,sFrm,'height=' + nHeight +',width=' + nWidth + ',menubar=0,scrollbars=auto');
  if (MyWindow != null) { MyWindow.focus(); }
}

////////////////////////////////
// MARIHTTPrequest
// Loads asynchronous XML
function MAHTTPRequest() {
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else {
		if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} 
				catch (e) {
				}
			}
		}
	}
	
	if (!http_request) {
	  alert('MARIProjekt:( No instance of XMLHTTP Request could be created. Use a newer browser!');
	  return false;
	}
	return http_request;
}
////////////////////////////////
// FillComboXML
function FillComboXML(xmlDoc, cbo, defaultValue) {
	var XMLoptions = xmlDoc.documentElement.getElementsByTagName("Table");
	
	cbo.length=XMLoptions.length;
	var selectedIndex=-1;
	for (var i = 0; i<XMLoptions.length; i++) {
		var oElement = XMLoptions[i].getElementsByTagName("Element");
		var oValue = XMLoptions[i].getElementsByTagName("Value");
		if (oElement[0].firstChild == null) {
			var optionElement = '';
		} else {
			var optionElement = oElement[0].firstChild.nodeValue;
		}		
		//var optionValue = oValue[0].firstChild.nodeValue + '(' + optionElement + ')';
		
		if (oValue[0] == null) {
			var optionValue = '';
		} else {
			if (oValue[0].firstChild == null){ 
				var optionValue = ''
			} else {
				var optionValue = oValue[0].firstChild.nodeValue
			}
		}
		cbo.options[i]=new Option(optionValue,optionElement);
		if (optionElement == defaultValue) 
			 selectedIndex = i;
	} //For
	if (selectedIndex >= 0) {
		cbo.selectedIndex = selectedIndex;
	}
}

////////////////////////////////
// FillXMLForm
// fills a form by Elements
function FillXMLForm(xmlDoc)
{
   var XMLoptions = xmlDoc.documentElement.getElementsByTagName("Table");

   for (var i = 0; i < XMLoptions.length; i++) {

      var oElement = XMLoptions[i].getElementsByTagName("Element");
      var oValue = XMLoptions[i].getElementsByTagName("Value");
      var oTyp = XMLoptions[i].getElementsByTagName("Typ");
      var sElement = oElement[0].firstChild.nodeValue;
      //alert ('FillXMLForm('+i+') Element.Name='+sElement);
      var sValue = oValue[0].firstChild.nodeValue;
      var sTyp = oTyp[0].firstChild.nodeValue;
      //alert (sElement);
      switch (sTyp) {
       case "Textbox" :
			document.getElementById(sElement).value=sValue;
			break;
		case "Browser" :
			var oBrowser = oValue[0].getElementsByTagName("MARIBrowser");
			var sDestination = oBrowser[0].getElementsByTagName("Destination")[0].firstChild.nodeValue;
			var lRows = oBrowser[0].getElementsByTagName("Rows")[0].firstChild.nodeValue;
			var lCols = oBrowser[0].getElementsByTagName("Cols")[0].firstChild.nodeValue;
			var lFixedRows = oBrowser[0].getElementsByTagName("FixedRows")[0].firstChild.nodeValue;
			var oRows = oBrowser[0].getElementsByTagName("Row");
			var s="";

			try {
			// L?schen der Tabelle
				var oTable = document.getElementById(sElement);
				for (var row=oTable.rows.length-1;row>=lFixedRows;row--) {
					oTable.deleteRow(row);
				}

				// erneutes fuellen
				for (var row=lFixedRows;row<oRows.length;row++) {
					var oTR =oTable.insertRow(row);
					oCols = oRows[row].getElementsByTagName("Col");
					for (var icol=0;icol<oCols.length;icol++) {
						var oTD = document.createElement("td");
						if (oCols[icol].childNodes.length>0) {
							s=oCols[icol].childNodes[0].nodeValue;
							oTD.appendChild(document.createTextNode(s));
						}  
						oTR.appendChild(oTD);
					}
				}
			} catch (e) {
			}
			break;
	  }	
   }
} //FillXMLForm

////////////////////////////////
// FillXMLFormEvent
// fills a form by Elements
function FillXMLFormEvent() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200 || http_request.status == 304) {
			FillXMLForm(http_request.responseXML, document);
		} else {
			alert('MARIProjekt: Error processing FillXMLFormEvent()');
		}
	}
}

///////////////////////////////
// FillXMLSearchEvent
// Fill search Elements
// requires hidden txtLinkTag for the destination link; table with ID ocxBrowser
function FillXMLSearchEvent() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200 || http_request.status == 304) {
			var sLink = document.getElementById("txtLinkTag").value;
			MARIFillXMLTableFromRS(http_request.responseXML, "ocxBrowser", 1, sLink);
		} else {
			alert('MARIProjekt: Error processing FillXMLSearchEvent() http_request.status=' + http_request.status);
		}
	}

}
///////////////////////////////
// MARIFillXMLTableFromRS
// replace data lines of an existing table with DataSet Infos
function MARIFillXMLTableFromRS(xmlDoc, sTableID, lFixedRows, sLink) {
	
	MARIFillXMLFlexGridFromRS(xmlDoc, sTableID, lFixedRows, sLink);
	return;
	
	// Delete table
	var oTable = document.getElementById(sTableID);
	for (var row=oTable.rows.length-1;row>=lFixedRows;row--) {
		oTable.deleteRow(row);
	}
	// create header (will change by selected search index)
	var XMLCols = xmlDoc.documentElement.getElementsByTagName("SysColumn");
	var iHeads = XMLCols.length;
	var oHeadTR = oTable.rows[0];
	var aFields = new Array(iHeads);
	for (var col = oHeadTR.cells.length - 1; col >= 0; col--) {
		oHeadTR.deleteCell(col);
	}
	for (var col=0;col<XMLCols.length;col++) {
		var oField = XMLCols[col].getElementsByTagName("TableField");
		var oHead = XMLCols[col].getElementsByTagName("HeadField");
		aFields[col] = oField[0].firstChild.nodeValue;
		var oTD=oHeadTR.insertCell(col);
		oTD.appendChild(document.createTextNode(oHead[0].firstChild.nodeValue));
  	}
	// indentify the link column to add the hyperlink
	var XMLBoundColumn = xmlDoc.documentElement.getElementsByTagName("BoundColumn");
	var nBoundColumn = XMLBoundColumn[0].firstChild.nodeValue;
	
	var XMLoptions = xmlDoc.documentElement.getElementsByTagName("Table");
	row = lFixedRows;
	for (var i = 0; i < XMLoptions.length; i++) {
		var oTR =oTable.insertRow(row++);
		for (var d=0; d<aFields.length;d++) {
			var s = XMLoptions[i].getElementsByTagName(aFields[d])[0].firstChild.nodeValue;
			var oTD = document.createElement("td");
			if (sLink!="" && d==nBoundColumn) {
				var url = sLink;
				url = url.replace(/I=/g,'X=' + s + '&I=');
				var a=document.createElement("a");
				a.href=url;
				a.appendChild(document.createTextNode(s));
				oTD.appendChild(a);
			} else {
				oTD.appendChild(document.createTextNode(s));
			}
			oTR.appendChild(oTD);
		}
	}	
}

///////////////////////////////
// MARIFillXMLTableFromRS
// replace data lines of an existing table with DataSet Infos
function MARIFillXMLFlexGridFromRS(xmlDoc, sBrowserID, lFixedRows, sLink) {
	// Delete table
	//geht noch nicht fuer fixedCols
	sBrowserID = sBrowserID + 'LIST_';
	var oTableFR = document.getElementById(sBrowserID + 'TableFR');
	var oTable = document.getElementById(sBrowserID + 'TableBO');
	
	for (var row=oTableFR.rows.length-1;row>=lFixedRows;row--) {
		// Alle bis auf eine l?schen, geht erstmal nur f?r eine FixedRow
		oTableFR.deleteRow(row);
	}
	
	for (var row=oTable.rows.length-1;row>=0;row--) {
		oTable.deleteRow(row);
	}
	// create header (will change by selected search index)
	var XMLCols = xmlDoc.documentElement.getElementsByTagName("SysColumn");
	var iHeads = XMLCols.length;
	var oHeadTR = oTableFR.rows[0];
	var aFields = new Array(iHeads);
	for (var col = oHeadTR.cells.length - 1; col >= 0; col--) {
		oHeadTR.deleteCell(col);
	}
	
	for (var col = 0; col < XMLCols.length; col++) {
		var oField = XMLCols[col].getElementsByTagName("TableField");
		var oHead = XMLCols[col].getElementsByTagName("HeadField");
		aFields[col] = oField[0].firstChild.nodeValue;
		var oTD = oHeadTR.insertCell(col);
		oTD.appendChild(document.createTextNode(oHead[0].firstChild.nodeValue));
	}
  	
	// indentify the link column to add the hyperlink
	var XMLBoundColumn = xmlDoc.documentElement.getElementsByTagName("BoundColumn");
	var nBoundColumn = XMLBoundColumn[0].firstChild.nodeValue;
	
	var XMLoptions = xmlDoc.documentElement.getElementsByTagName("Table");
	row=0;
	for (var i = 0; i < XMLoptions.length; i++) {
		var oTR = oTable.insertRow(row++);
		for (var d = 0; d < aFields.length; d++) {
			var s = XMLoptions[i].getElementsByTagName(aFields[d])[0].firstChild.nodeValue;
			var oTD = document.createElement("td");
			if (sLink != "" && d == nBoundColumn) {
				var url = sLink;
				url = url.replace(/I=/g, 'X=' + s + '&I=');
				var a = document.createElement("a");
				a.href = url;
				a.appendChild(document.createTextNode(s));
				oTD.appendChild(a);
			} else {
				oTD.appendChild(document.createTextNode(s));
			}
			oTR.appendChild(oTD);
		}
	}
}
///////////////////////////////
// SetReloadUrl
// store the next reload by the link to a pop form
function SetReloadUrl(sNewUrl) {
	sReloadURL=sNewUrl;
}
///////////////////////////////
// ReloadPage
// Called by the closing popup windows to realod the parent
function ReloadPage(sDirectUrl) {
	if (typeof(sDirectUrl) == 'string') {
		window.open(sDirectUrl,'_self');
	} else {
		//alert ('ReloadPage');
		if (sReloadURL=="") {
			try {
				sReloadURL = document.getElementById("txtReloadTag").value;
			}
			catch (e) {}
		}
		if (sReloadURL!="") {
			//alert('Fenster Reload = ' + sReloadURL);
			window.open(sReloadURL,'_self');
		}
	}
}

function sGetInnerstText(sHtmlText) {
	var saTemp;
	var lTemp;
	saTemp = sHtmlText;
	lTemp = sHtmlText.search("</");
	if (lTemp >=0)	saTemp = sHtmlText.slice(0,lTemp);	
    lTemp = saTemp.lastIndexOf(">");        
    if (lTemp >=0)	saTemp = saTemp.slice(lTemp+1);
    return saTemp;
}

function sGetValue(sHtmlText) {
	var saTemp;
	var sValue;
	var sControlID;
	var bValueWithSpace;
	var lTemp;
	var lTemp2;
	
	saTemp = sHtmlText.toLowerCase();
	lTemp = saTemp.search("value=");
	
	if (lTemp >= 0) {
		saTemp = sHtmlText.substring(lTemp + "value=".length, sHtmlText.length);
		if (saTemp.substring(0, 1) == "\"") {
			saTemp = saTemp.substring(1, saTemp.length);
			saTemp = saTemp.substring(0, saTemp.indexOf("\""));
		}
		else {
			saTemp = saTemp.substring(0, saTemp.indexOf(" "));
		}
	} else {
		saTemp = sGetInnerstText(sHtmlText);
	}
    return saTemp; 
}

function syncInnerHtmlAndValue(sHtmlText) {

    var saTemp;
	var sValue;
	var sReturn;
	var sControlID;
	var bValueWithSpace;
	var lTemp;
	var lTemp2;
	
	saTemp = sHtmlText.toLowerCase();
	lTemp = saTemp.search("value=");
	
	if (lTemp>=0) { 
	     lTemp2 = saTemp.search("id=");
	     sControlID = sHtmlText.substring(lTemp2 + "id=".length, sHtmlText.length);
	     if (sControlID.substring(0, 1) == "\"") {
		 	sControlID = sControlID.substring(1, sControlID.length);
		 	sControlID = sControlID.substring(0, sControlID.indexOf("\""));
		 } else {
		 	sControlID = sControlID.substring(0, sControlID.indexOf(" "));
		 }
	     eElem = document.getElementById(sControlID);
	     if (eElem == null) return sHtmlText;
         
         sValue = eElem.value;
	   
	     saTemp = sHtmlText.substring(lTemp + "value=".length, sHtmlText.length);
	     if (saTemp.substring(0, 1) == "\"") {
		 	saTemp = saTemp.substring(1, saTemp.length);
		 	saTemp = saTemp.substring(0, saTemp.indexOf("\""));
		 	bValueWithSpace = true;
		 } else {
		 	saTemp = saTemp.substring(0, saTemp.indexOf(" "));
		 	bValueWithSpace = false;
		 }
         
          if (saTemp != sValue) {
		  	if (bValueWithSpace) {
		  		sReturn = sHtmlText.toLowerCase();
		  		sReturn = sReturn.replace("value=\"" + saTemp + "\"", "value=\"" + sValue + "\"");
		  	} else {
		  		sReturn = sHtmlText.toLowerCase();
		  		sReturn = sReturn.replace("value=" + saTemp, "value=\"" + sValue + "\"");
		  	}
		  } else {
		  	sReturn = sHtmlText;
		  }
      } else {
        sReturn = sHtmlText;
      }
    return sReturn;
}

function setCursorHand(obj)
{
	// Change the mouse cursor to hand or pointer
	if (bIsIE)
		obj.style.cursor = "hand";
	else
		obj.style.cursor = "pointer";
		//obj.firstChild.style.cursor = "pointer";
}

///////////////////////////////
// StartParameter
if (ie4||ns6) document.onclick=hidemenu;
var  http_request = false;

///////////////////////////////
// ocxList
//----------------------------------------------------------------------------------------------------------

//Sort
//----------------------------------------------------------------------------------------------------------


if (dom) {

	// Global variables
	var rowArray = new Array();		// Data row array (class|col|class|coll)
	var titleRowArray = new Array();	// Contains title texts
	var titleRowCellArray = new Array();	// Dynamically constructed title cells
	var titleSpanCellArray = new Array();	// Title elelments from row-spanned
	var colSpanArray = new Array();		// Rows col-spanned
	var colTitleFilled = new Array();	// Indicates whether title is filled
	var sortIndex;				// Selected index for sort
	var sGlobalID;                          // TabellenID
	var descending = false;			// Descending order
	var nRow, actualNRow, maxNCol,nFixedCols;		// Various table stats
	var origColor;				// Holds original default color

	
	// Configurable constants
	var ascChr = "^";			// Symbol for ascending sort
	var desChr = "v";			// Symbol for descending sort
	var selectedColor = "blue";		// Color for sort focus
	var defaultColor = "black";		// Default color for sort off-focus
	var recDelimiter = '|';			// Char used as a record separator
	var updownColor = 'gray';		// Specified the color for up/downs 


function initTable(sID) {
	// Check whether it's viewed by IE 5.0 or greater
	if (! checkBrowser()) return;

	// Local variables
	var countCol;
	var nChildNodes;
	var innerMostNode;
	var nColSpan, nRowSpannedTitleCol, colPos;
	var cell, cellText;
	var titleFound = false;
	var rNRowSpan, rNColSpan;

	oTableBO = document.getElementById(sID + '_TableBO');
    oTableFR = document.getElementById(sID + '_TableFR');
    oTableFF = document.getElementById(sID + '_TableFF');
    oTableFC = document.getElementById(sID + '_TableFC');

    if (!oTableBO) return;
    if (oTableBO.rows.length==0) return;
    
    nFixedCols = 0;
    if (oTableFC) nFixedCols = oTableFC.rows[oTableFC.rows.length-1].cells.length;
    maxNCol = oTableBO.rows[oTableBO.rows.length-1].cells.length + nFixedCols;

	// Initializing arrays
	rowArray = new Array();
	colSpanArray = new Array();
	colTitleFilled = new Array();
	titleRowArray = new Array();
	titleRowCellArray = new Array();
	
	for (var i = 0; i < maxNCol; i++) {
		colTitleFilled[i] = false;
	}

	// keine Sortierung bei einer Zeile
	if (oTableBO.rows.length < 1) return;

	// Initialization of local variables
	actualNRow = 0;			// Number of actual data rows
	rNRowSpan = 0;			// Remaining rows in the row span
	rNColSpan = 0;			// Remaining cols in the col span
	nRowSpannedTitleCol = 0;// Number of title cols from row span
		
	// Loop through rows
	nRow = oTableFR.rows.length;	
    for (var i = 0; i < nRow; i++) {
		nColSpan = 1, colPos = 0;
		countCol = 0;
		countColFix = 0;
		
		for (var j = 0; j < maxNCol; j++) {
			if (j < nFixedCols) {
				ltemp = oTableFF.rows[i].cells[j].colSpan;
			}
			else {
				ltemp = oTableFR.rows[i].cells[j - nFixedCols].colSpan;
			}
			
			if (ltemp > 1 && rNColSpan == 0) {
				nColSpan = ltemp;
				colPos += nColSpan;
			}
			else {
				colPos++;
			}
			if (nColSpan == 1 && rNRowSpan == 0 && rNColSpan == 0 && titleFound == false) {
				colSpanArray[i] = true;
				if (colTitleFilled[j] != true) {
					if (j < nFixedCols) {
						titleRowCellArray[j] = oTableFF.rows[i].cells[countColFix];
						countColFix++;
					}
					else {
						titleRowCellArray[j] = oTableFR.rows[i].cells[countCol];
						countCol++;
					}
				}
				else {
					titleRowCellArray[j] = titleSpanCellArray[j];
				}
				titleRowArray[j] = titleRowCellArray[j].innerHTML;
			}
		}
	} //for i nRow

	nRow = oTableBO.rows.length;	
    for (var i = 0; i < nRow; i++) {
		nColSpan = 1, colPos = 0;
		// Loop through columns
		// Initializing
		if (nFixedCols > 0) {
			lTempFix = oTableFC.rows[i].cells.length;
		}
		else {
			lTempFix = 0;
		}
		
		lTemp = oTableBO.rows[i].cells.length;
		for (var j = 0; j < lTemp + lTempFix; j++) {
			// Do this iff title has not been found
			if (j < lTempFix) {
				oCell = oTableFC.rows[i].cells[j];
			}
			else {
				oCell = oTableBO.rows[i].cells[j - lTempFix];
			}
			
			if (oCell.rowSpan > 1) {
				if (oCell.colSpan < 2) {
					titleSpanCellArray[colPos] = oCell;
					colTitleFilled[colPos] = true;
					nRowSpannedTitleCol++;
				}
				if (oCell.rowSpan - 1 > rNRowSpan) {
					rNRowSpan = oCell.rowSpan - 1;
					if (oCell.colSpan > 1) 
						rNColSpan = rNRowSpan + 1;
				}
			}
			
			if (oCell.colSpan > 1 && rNColSpan == 0) {
				nColSpan = oCell.colSpan;
				colPos += nColSpan;
			}
			else {
				colPos++;
			}
		}
		
		if (nColSpan == 1 && rNRowSpan == 0) {
			if (nFixedCols > 0) {
				lTempFix = oTableFC.rows[i].cells.length;
			}
			else {
				lTempFix = 0;
			}
			
			lTemp = oTableBO.rows[i].cells.length;
			for (var j = 0; j < lTemp + lTempFix; j++) {
				if (j < lTempFix) {
					oCell = oTableFC.rows[i].cells[j];
				}
				else {
					oCell = oTableBO.rows[i].cells[j - lTempFix];
				}
				// Can't have row span in record rows ...
				if (oCell.rowSpan > 1) 
					return;
				
				if (j != 0) 
					rowArray[actualNRow] += recDelimiter;
				else 
					rowArray[actualNRow] = '';
				
				//rowArray[actualNRow] += innerMostNode.outerHTML;
				
				// wenn Control den Value in rowArray schreiben
				rowArray[actualNRow] += oCell.className + recDelimiter + syncInnerHtmlAndValue(oCell.innerHTML);
			}
			// Inconsistent col lengh for data rows
			if (lTemp + lTempFix > maxNCol) 
				return;
			actualNRow++;
			colSpanArray[i] = false;
		}
		else {
			if (nColSpan == 1 && rNRowSpan == 0 && rNColSpan == 0 && titleFound == false) {
				colSpanArray[i] = false;
			}
			else {
				colSpanArray[i] = true;
			}
		}
		
		// Counters for row/column spans
		if (rNRowSpan > 0) 
			rNRowSpan--;
		if (rNColSpan > 0) 
			rNColSpan--;
	} // for i nRow
} //initTable

///////////////////////////////
// Maskiert HTML-Sonderzeichen (& < > " ')
function escapeToHTML(str)
{
str = "" + str;
str = str.replace(/&/g, "&amp;");
str = str.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
return str;
}

///////////////////////////////
// Demaskiert HTML-Sonderzeichen (& < > " ')
function unescapeFromHTML(str)
{
str = "" + str;
str = str.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&#39;/g, "'");
str = str.replace(/&amp;/g, "&");
return str;
}

///////////////////////////////
// Fuegt ein Event zu einem Control hinzu, ohne dabei das Event zu ueberschreiben.
function addEventEx(elem, evType, func, useCapture) {
    if (elem.addEventListener) {
        elem.addEventListener(evType, func, useCapture);
        return true;
    }
    else if (elem.attachEvent){
        var r = elem.attachEvent("on" + evType, func);
        return r;
    }
    else {
        var onEvt = "on" + evType;
        var elOldEvFuncs = elem;
        if ((typeof elem[onEvt]) == 'function') {
            elem[onEvt] = function() {
                elOldEvFuncs();
                func();
            }
        }
        else {
            elem[onEvt] = func;
        }
    }
}

//*****************************************************************************
// Function called when user clicks on a title to sort
//*****************************************************************************
function sortTable(index,sID) {
	// Re-inializing the table object
	initTable(sID);
	
	oTableBO = document.getElementById(sID + '_TableBO');
    oTableFC = document.getElementById(sID + '_TableFC');
   
        // Local variables
	var nChildNodes;
	var innerMostNode;
	var rowContent;
	var rowCount;
	var cell, cellText;
	var newTitle;
	var sTemp;
	
	// Can't sort past the max allowed column size
	if (index < 0 || index >= maxNCol) return;
	
	// Assignment of sort index
	sortIndex = index;
    sGlobalID = sID;
	
    // Doing the sort using JavaScript generic function for an Array
	rowArray.sort(compare);

	// Re-drawing the title row
	
	for (var j = 0; j < maxNCol; j++) {
		cellText = titleRowArray[j];
		if (j == sortIndex) {
			newTitle = ' <font color=' + updownColor + '>';
			if (descending) 
				newTitle += desChr;
			else 
				newTitle += ascChr;
			newTitle += '</font>';
		}
		else {
			newTitle = '';
		}
		
		//newTitle in CellText;
		if (bIsIE) {
			sFont = "<FONT";
			sDiv = "</DIV>";
		}
		else {
			sFont = "<font";
			sDiv = "</div>";
		}
		if (cellText.search(sFont) >= 0) {
			sTemp = cellText.slice(0, cellText.search(sFont));
		}
		else {
			sTemp = cellText.slice(0, cellText.search(sDiv));
		}
		titleRowCellArray[j].innerHTML = sTemp + newTitle + "</DIV>";
	}

	// Re-drawing the table
	rowCount = 0;
	for (var i = 0; i < nRow; i++) {
		if (!colSpanArray[i]) {
			rowContent = rowArray[i].split(recDelimiter);
			for (var j = 0; j < maxNCol; j++) {
				if (j < nFixedCols) {
					oCell = oTableFC.rows[i].cells[j];
				}
				else {
					oCell = oTableBO.rows[i].cells[j - nFixedCols];
				}
				oCell.innerHTML = rowContent[(2 * j) + 1];
				oCell.className = rowContent[2 * j];
			}
			rowCount++;
		}
	}

	// Switching btw descending/ascending sort
	if (descending)
		descending = false;
	else
		descending = true;
} //sortTable

//*****************************************************************************
// Function to be used for Array sorting
//*****************************************************************************
function compare(a, b) {
	// Getting the element array for inputs (a,b)
	var aRowContent = a.split(recDelimiter);
	var bRowContent = b.split(recDelimiter);
	
	// Needed in case the data conversion is necessary
    var saTemp, sbTemp, lTemp; 	
       	
	var sColDef = document.getElementById(sGlobalID + 'ColDef' + sortIndex); 
    if (sColDef) {
		sColDef = sColDef.value;
		var sFormat = gsParameter(sColDef, 'Format', '');
	}
	else {
		var sFormat = '';
		sColDef = '';
	}
   
    saTemp = sGetValue(aRowContent[(2*sortIndex)+1]);
    sbTemp = sGetValue(bRowContent[(2*sortIndex)+1]);
   
    var aToBeCompared, bToBeCompared;
       
	//DatumLang
	if (sFormat == 11) {
		var sDateFormat = gsParameter(sColDef, 'DateFormat', '');
		var aToBeCompared = dtGetDate(sFormat, sDateFormat, saTemp);
		var bToBeCompared = dtGetDate(sFormat, sDateFormat, sbTemp);
	}
	else {
	
		aToBeCompared = parseFloat(saTemp, 10);
		if (isNaN(aToBeCompared)) 
			aToBeCompared = saTemp.toUpperCase();
		
		bToBeCompared = parseFloat(sbTemp, 10);
		if (isNaN(bToBeCompared)) 
			bToBeCompared = sbTemp.toUpperCase();
		
		if (aToBeCompared == "undefined") 
			aToBeCompared = ' ';
		if (bToBeCompared == "undefined") 
			bToBeCompared = ' ';
	}
	
	if (aToBeCompared < bToBeCompared) {
		if (!descending) {
			return -1;
		}
		else {
			return 1;
		}
	}
	if (aToBeCompared > bToBeCompared) {
		if (!descending) {
			return 1;
		}
		else {
			return -1;
		}
	}
	
	return 0;
} //compare

//*****************************************************************************
// Function to set the cursor
//*****************************************************************************
function setCursorandStatus(obj)
{
	// Show hint text at the browser status bar
	window.status = "Sort by " + obj.innerHTML;
	// Change the mouse cursor to hand or pointer
	if (bIsIE)
		obj.style.cursor = "hand";
	else
		obj.style.cursor = "pointer";
		//obj.firstChild.style.cursor = "pointer";
}

//*****************************************************************************
// Function to set the title color
//*****************************************************************************
function setColor(obj,mode)
{
	if (mode == "selected") {
		// Remember the original color
		if (obj.style.color != selectedColor) 
			defaultColor = obj.style.color;
		obj.style.color = selectedColor;
	}
	else {
		// Restoring original color and re-setting the status bar
		obj.style.color = defaultColor;
		window.status = '';
	}
}

//*****************************************************************************
// Function to check browser type/version
//*****************************************************************************
function checkBrowser()
{
	if (navigator.appName == "Microsoft Internet Explorer"
		&& navigator.appVersion.indexOf("5.") >= 0) {
		bIsIE = true;
		return true;
	}
	// For some reason, appVersion returns 5 for Netscape 6.2 ...
	else if (navigator.appName == "Netscape" &&
	navigator.appVersion.indexOf("5.") >= 0) {
		bIsIE = false;
		return true;
	}
	else 
		return false;
}
//ermittelt aus einem Datumsstring mit sFormat(ColDef.nFormatStyle) und dem sDateFormat(oContext.gnLanguageDateFormat) ein Datum
function dtGetDate (sFormat,sDateFormat,sDate) {
	if (sFormat==11) { //DatumLang
	    return gStr2Date(sDate);
		/*switch(sDateFormat) {
		case '1': //dd.mm.yyyy
			lTemp = sDate.lastIndexOf('.');
			var sJahr = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('.');
			var sMonat = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sTag = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
			break;
		case '2': //mm/dd/yyyy
			lTemp = sDate.lastIndexOf('/');
			var sJahr = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('/');
			var sTag = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sMonat = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
			break;
		case '3': //dd/mm/yyyy
			lTemp = sDate.lastIndexOf('/');
			var sJahr = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('/');
			var sMonat = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sTag = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
			break;
		case '4': //dd-mm-yyyy
			lTemp = sDate.lastIndexOf('-');
			var sJahr = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('-');
			var sMonat = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sTag = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
		case '5': //yyyy-mm-dd
			lTemp = sDate.lastIndexOf('-');
			var sTag = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('-');
			var sMonat = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sJahr = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
			break;
		case '6': //yyyy.mm.dd
			lTemp = sDate.lastIndexOf('.');
			var sTag = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('.');
			var sMonat = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sJahr = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
			break;
		case '7': //yyyy/mm/dd
			lTemp = sDate.lastIndexOf('/');
			var sTag = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			lTemp = sDate.lastIndexOf('/');
			var sMonat = sDate.slice(lTemp + 1);
			if (lTemp >= 0) 
				sDate = sDate.slice(0, lTemp);
			
			var sJahr = sDate;
			
			return dtDate = new Date(sJahr, sMonat, sTag);
		}
		*/
	} //sFormat
}//dtGetDate

}//Dom

//Scroll
//----------------------------------------------------------------------------------------------------------
var oAllProps = []; // Array mit allen Steuerelementen

function oGetProperties() { //ein Steuerlement
   	this.disabled = false;	
	this.Balken = null;
	this.Control = null;
	this.id = null;
	this.TableFF = null;
	this.TableFR = null;
	this.TableFC= null;
	this.TableBO = null;
	this.bIsInitialisiert = false;
	this.Body = null;
	this.rows = null;
	this.cols = null;
	this.Position = null;
	this.scrollX = 0;
	this.scrollY = 0;
}

function Init(id,cols) {
	var oProperties = new oGetProperties();
	oAllProps[id] = oProperties;

	oProperties.cols = cols;
	oProperties.id = id;
	Reset(oProperties, id);
	oProperties.scrollX = 0;
	oProperties.scrollY = 0;
    addEvent(window, "load", onLoadForm);
}

function Reset(oProps, id) {
	if (oProps && id) {
		oProps.Control = getElementById(id);
		oProps.disabled = getAttrib(oProps.Control, "disabled");
		oProps.Balken = getElementById(id + "_Balken");
		oProps.Body = getElementById(id + "_Body");
		oProps.Position = getElementById(id + "_Position");
		
		oProps.TableFF = oGetTableSub(id, 0, 0);
		oProps.TableFR = oGetTableSub(id, 0, 1);
		oProps.TableFC = oGetTableSub(id, 1, 0);
		oProps.TableBO = oGetTableSub(id, 1, 1);
		
		if (!oProps.disabled) {
			if (oProps.Body) {
				if (bIsIE) 
					addEvent(oProps.Body, "mousewheel", onMouseWheel);
			}
			if (oProps.Position) 
				addEvent(oProps.Position, "scroll", onScroll);
		}
		oProps.bIsInitialisiert = false;
	}
}

function oGetCol()
{
	var o = new Object();
	o.idx = -1;
	o.x = -1;
	o.y = -1;
	o.xx = -1;
	o.yy = -1;
	o.srcElem = null;
	return o;
}

function oGetListID(srcElem) {
	//ok
	var id = null;

	while (srcElem && !id)	{
		if (srcElem.tagName == "TABLE") {
			var testId = getAttrib(srcElem, "id");

			if (testId) {
				var len = testId.length;
				if (len > 15) {
					var tmp = testId.substr(len - 15, 15);
				}
		
				for (var tmp in oAllProps) {
					if (testId == tmp) {
						id = tmp;
						break
					}
				}
			}
		}
		srcElem =oGetParent(srcElem);
	}
	return id;
}

function oGetParent(srcElem) {
	if( srcElem.parentElement )
		return srcElem.parentElement;
	else
		return srcElem.parentNode;
}

function getAttrib(obj, att)
{
	if (obj.getAttribute)
		return obj.getAttribute(att);

	if (obj.attributes) {
		var a = obj.attributes[att];
		if (a) 
			return a.value;
	}
	else 
		return obj[att];
}

function lGetAbsPosX(o) {
	if (typeof(o) != 'object' || o == null)
		return 0;
	else
		return parseInt(o.offsetLeft) + lGetAbsPosX(o.offsetParent);
}

function lGetAbsPosY(o) {
	if (typeof(o) != 'object' || o == null)
		return 0;
	else
		return parseInt(o.offsetTop) + lGetAbsPosY(o.offsetParent);
}

function getElementById(tagId)  {
	var obj;
	if (document.all) {
		obj = document.all[tagId];
	}
	else 
		obj = document.getElementById(tagId);
				
	if(obj && obj.length && obj[0].id==tagId)
		obj=obj[0];
	return obj;
}

function oGetSub(sID, sSuffix) {
	var oTemp = null;
	//sSuffix
	oTemp=getElementById(sID + "_Table" + sSuffix + "Parent");
	return oTemp;
}

function oGetTableSub(id, row, col) {
	if(row==0 && (col==0)) 	{
		var sSuffix = 'FF' 
	}
	else if (row==1 && (col==0)) {
		var sSuffix = 'FC'
	}
	else if (row==0 && (col==1)) {
		var sSuffix = 'FR'
	}
	else if (row==1 && (col==1)) { 
		var sSuffix = 'BO'
	}
	
	var oTemp=oGetSub(id,sSuffix);
	if (oTemp) {
		var a = oTemp.getElementsByTagName("TABLE");
		if (a) 
			return a[0];
	}
	return null;
}

function oGetChildByTag(o, tag)
{
	var tmp = o.getElementsByTagName(tag);
	return (tmp && tmp.length > 0) ? tmp[0] : null;
}

function addEvent(o, evnt, handler)
{
	if (document.addEventListener)
		o.addEventListener(evnt, handler, true);
	else
		o.attachEvent("on" + evnt, handler);
}

function oGetActHeadRow(th, cols)
{
	if ((th && (typeof(th) != "undefined")) && th.rows.length > 0)
		return (th.rows.length > 1) ? th.rows[1] : (cols.length > 0 ? th.rows[0] : null);
	else
		return null;
}


function oSetColPos(col, elem)
{
    col.x = lGetAbsPosX(elem);
	col.y = lGetAbsPosY(elem);
	col.xx = col.x + parseInt(elem.offsetWidth);
	col.yy = col.y + parseInt(elem.offsetHeight);
	col.idx = 0;
	col.srcElem = elem;
	return col;
}

function oSetColsPos(cols, thead, startAt) {
	if (thead) {
		var tr = oGetActHeadRow(thead, cols);
		if (tr) {
			var len = tr.cells.length;
			for (var i = 0; i < len; i++) {
				var mapIdx = startAt + i;
				oSetColPos(cols[mapIdx], tr.cells[i]);
				cols[mapIdx].idx = mapIdx;//i;
			}
		}
	}
}

function InitHead(oProps)
{
	var t = null;
	if (oProps.TableFF) { //keine fixedrows
		var th0 = oProps.TableFF.tHead;
		var th1 = null;
		if (!th0) {
			th0 = oProps.TableFC.tHead;
			th1 = oProps.TableBO.tHead;
		}
		else 
			th1 = oProps.TableFR.tHead;
		
		oSetColsPos(oProps.cols, th0, 0);
		
		var row = oGetActHeadRow(th0, oProps.cols);
		var len = row.cells.length;
		if (len != oProps.cols.length) 
			oSetColsPos(oProps.cols, th1, len);
	}
	else {
		t = oProps.Control;
	}
	
	if (t)
		oSetColsPos(oProps.cols, t.tHead, 0);
}

function onMouseWheel(e)
{
	var id = oGetListID(e.srcElement);
	var oProps = oAllProps[id];

	if (oProps && oProps.Position)
		oProps.Position.scrollTop -= e.wheelDelta;

	e.returnValue = false;
}

function oGetWidth(id)
{
	var colWidth = 0;
	var oBody = oAllProps[id].Body;
	if (oBody) {
		var oTable = oGetChildByTag(oBody, "TABLE");
		if (oTable)
			colWidth += parseInt(oTable.offsetWidth);
	}
	return colWidth;
}

function oGetHeight(id)
{
	var rowHeight = 0;
	var oBody = oAllProps[id].Body;
	if (oBody) {
		var a = oGetChildByTag(oBody, "TABLE");
		if (a)
			rowHeight += oGetTableHeight(a);
	}
	return rowHeight;
}

function oGetTableHeight(table)
{	
	var rowHeight = 0;
	
	if (table) {
		var cs = (table.cellSpacing) ? parseInt(table.cellSpacing) : 0;
		rowHeight = parseInt(table.offsetHeight) - cs;

		if (rowHeight < 0)
			rowHeight = 0;
	}
	return rowHeight;
}

function syncBalken(id)
{
	var oBalken = oAllProps[id].Balken;
	if (oBalken) {
		oBalken.style.width=oGetWidth(id)+"px";	
		oBalken.style.height=oGetHeight(id)+"px";
	}
}

function syncBody(id)
{
	var oProps = oAllProps[id];
	var Pos = oProps.Position;
	var gv = oProps.Body;
	if (Pos && gv) {
		gv.style.left = parseInt(Pos.offsetLeft)+"px";
		gv.style.top = parseInt(Pos.offsetTop)+"px";

		gv.style.width = parseInt(Pos.clientWidth)+"px";
		gv.style.height = parseInt(Pos.clientHeight)+"px";
	}
}

function lGetRowHeight(id, row)
{
	var oTable = oGetTableSub(id, row, 0);
    if (oTable) {
		var h0 = oGetTableHeight(oTable);
	}
	else {
		var h0 = 0;
	}
    
    var oTable = oGetTableSub(id, row ,1 );
    if (oTable) {
		var h1 = oGetTableHeight(oTable);
	}
	else {
		var h1 = 0;
	}
    return Math.max(h0, h1);
}

function lGetColWidth(id, col)
{
	var oTable = oGetTableSub(id, 0, col);
    if (oTable) {
		var w0 = parseInt(oTable.offsetWidth);
	}
	else {
		var w0 = 0;
	}
    
    var oTable = oGetTableSub(id, 1, col);
    if (oTable) {
		var w1 = parseInt(oTable.offsetWidth);
	}
	else {
		var w1 = 0;
	}
    return Math.max(w0, w1);
}

function syncTable(id)
{
	var totalwidth = 0;
	var totalheight = 0;
	var oProps = oAllProps[id];
	var oList = oProps.Control;
	var oBody = oProps.Body;
	if (oBody) {
		var colGroup = oGetChildByTag(oBody, "COLGROUP");
		if (colGroup) {
			var colGroups = colGroup.getElementsByTagName("COL");
			if (colGroups && colGroups.length == 2) {
				var v0 = lGetColWidth(id, 0);
				if (v0 != 0 && colGroups[0].style.display != "none") 
					colGroups[0].width = v0 + "px";
				
				var v1 = lGetColWidth(id, 1);
				if (v1 != 0 && colGroups[1].style.display != "none") 
					colGroups[1].width = v1 + "px";
				
				if (v0 != 0 && v1 != 0) 
					totalwidth = v0 + v1;
				else 
					totalwidth = Math.max(v0, v1);
			}
		}
		
		if ((oList.rows) && (oList.rows.length == 2)) {
			var v0 = lGetRowHeight(id, 0);
			if (v0 != 0 && oList.rows[0].style.display != "none") 
				oList.rows[0].style.height = v0 + "px";
			
			var v1 = lGetRowHeight(id, 1);
			if (v1 != 0 && oList.rows[1].style.display != "none") 
				oList.rows[1].style.height = v1 + "px";
			
			if (v0 != 0 && v1 != 0) 
				totalheight = v0 + v1;
			else 
				totalheight = Math.max(v0, v1);
		}
		
		oList.style.left = "0px";
		oList.style.top = "0px";
		oList.style.width = (totalwidth == 0) ? "" : totalwidth + "px";
		oList.style.height = (totalheight == 0) ? "" : totalheight + "px";
		
		var a = oGetChildByTag(oBody, "TABLE");
		if (a) {
			a.style.left = "0px";
			a.style.top = "0px";
			
			a.style.width = (totalwidth == 0) ? "" : totalwidth + "px";
			a.style.height = (totalheight == 0) ? "" : totalheight + "px";
		}
		
		var tmp = document.getElementById(id + "_BottomPager");
		if (tmp) 
			tmp.style.top = "0px";
		
		tmp = document.getElementById(id + "_TopPager");
		if (tmp) 
			tmp.style.top = "0px";
	}
}

var savedTop=0;
var savedLeft=0;

function onScroll(e)
{
	var tmp = null;
	if (typeof(e) == "string")
		tmp = e;
	else {
		var src = (bIsIE) ? e.srcElement : e.currentTarget;
		var idx = src.id.lastIndexOf("_");
		tmp = src.id.substr(0, idx);
	}

	var oProps = oAllProps[tmp];
	var Pos=oProps.Position;

	if (Pos) {
		var Posl = parseInt(Pos.scrollLeft);
		
		if (Posl != savedLeft) {
			var oTableFR = oGetTableSub(tmp, 0, 1);
			if (oTableFR) 
				oTableFR.style.left = (-Posl) + "px";
			
			
			var oTableBO = oGetTableSub(tmp, 1, 1);
			if (oTableBO) 
				oTableBO.style.left = (-Posl) + "px";
			
			savedLeft = Posl;
		}
		
		var Post = parseInt(Pos.scrollTop);
		if (Post != savedTop) {
			var oTableFC = oGetTableSub(tmp, 1, 0);
			if (oTableFC) 
				oTableFC.style.top = (-Post) + "px";
			
			var oTableBO = oGetTableSub(tmp, 1, 1);
			if (oTableBO) 
				oTableBO.style.top = (-Post) + "px";
			
			pager = document.getElementById(tmp + "_BottomPager");
			if (pager) 
				pager.style.top = (-Post) + "px";
			
			savedTop = Post;
		}
	}

	if (bIsIE && oProps.bIsInitialisiert)
		InitHead(oProps);
}

function onLoadForm(sender)
{
	for (var id in oAllProps)
		if (!oAllProps[id].bIsInitialisiert)
			InitLayout(id);
}

function InitLayout(id)
{
	var oProps = oAllProps[id];
	syncTable(id);
	
	var oBody = oProps.Body;
	var Pos = oProps.Position;
	if (oBody && Pos) {
		if (oBody.style.width != "")
			Pos.style.width = parseInt(oBody.style.width)+"px";
		if (oBody.style.height != "")
			Pos.style.height = parseInt(oBody.style.height)+"px";
	}
	
	syncBalken(id);
	syncBody(id);
	
	InitHead(oProps);
			
	Pos.scrollLeft = oProps.scrollX;
	Pos.scrollTop = oProps.scrollY;
	onScroll(id);	
	
	oProps.bIsInitialisiert = true;
}
//End ocxList------------------------------------------------------------------------------------------------

//TREEVIEW---------------------------------------------------------------------------------------------------

function FolderClick(node) {
    
	var nextDIV = node.nextSibling;
    if(!nextDIV) return;
	while(nextDIV.nodeName != "DIV") {
		nextDIV = nextDIV.nextSibling;
	}
    //node.parentElement.parentElement.style.backgroundColor = "#111111";
	if (nextDIV.style.display == 'none') {
	
		if (node.childNodes.length > 0) {
		
			if (node.childNodes.item(0).nodeName == "IMG") {
				node.childNodes.item(0).src = getImgDir(node.childNodes.item(0).src) + "mp_bone_outlineminus-16x16.gif";
			}
			if (node.childNodes.length > 1) {
				if (node.childNodes.item(1).nodeName == "IMG") {
					if (node.childNodes.item(1).src == getImgDir(node.childNodes.item(1).src) + "mp_bone_fileclose-16x16.gif") {
						node.childNodes.item(1).src = getImgDir(node.childNodes.item(1).src) + "mp_bone_fileopen-16x16.gif";
					}
				}
			}
		}
		
		nextDIV.style.display = 'block';
	}
	
	else {
	
		if (node.childNodes.length > 0) {
			if (node.childNodes.item(0).nodeName == "IMG") {
				node.childNodes.item(0).src = getImgDir(node.childNodes.item(0).src) + "mp_bone_outlineplus-16x16.gif";
			}
			if (node.childNodes.length > 1) {
				if (node.childNodes.item(1).nodeName == "IMG") {
					if (node.childNodes.item(1).src == getImgDir(node.childNodes.item(1).src) + "mp_bone_fileopen-16x16.gif") {
						node.childNodes.item(1).src = getImgDir(node.childNodes.item(1).src) + "mp_bone_fileclose-16x16.gif";
					}
				}
			}
		}
		nextDIV.style.display = 'none';
	}
}

function NodeClick(node, folderCode, sTreeName) {
	if (folderCode != document.getElementById(sTreeName + 'VALUE').value) {
		MarkNode(getNode(document.getElementById(sTreeName + 'VALUE').value, sTreeName), 3, folderCode, sTreeName);
		MarkNode(node, 1, folderCode, sTreeName);
		document.getElementById(sTreeName + 'VALUE').value = folderCode;
		if (document.getElementById(sTreeName).ondblclick) 
			document.getElementById(sTreeName).ondblclick();
	}
}

function getNode(folderCode, sTreeName) {
   return document.getElementById(sTreeName + 'NODE' + folderCode)
}

function MarkNode(node, nMode, folderCode, sTreeName)
{ //nMode = 1 Select
  //nMode = 2 MouseOver
  //nMode = 3 DeSelect
  //nMode = 4 MouseOut
  
	var color = "#FFFFFF";
	
	if (nMode == 1) {
		var color = "#FFAA00";
	}
	else 
		if (nMode == 2) {
			var color = "#BBBBBB";
		}
	
	
	if ((nMode==1) || (nMode==3)  || (document.getElementById(sTreeName + 'VALUE').value != folderCode)) {
		node.style.backgroundColor = color;
	}
}

function getImgDir(sFileName) {
    return sFileName.substring(0, sFileName.lastIndexOf('/') + 1);
}

//PeriodenCombo------------------------------------------------------------------------------------------------------
function cboOneDown(sElementID) {
    oCBO = document.getElementById(sElementID);
    if (typeof(oCBO) =='undefined') return;
    if (oCBO.selectedIndex==oCBO.length-1) return;
    oCBO.selectedIndex++;
    oCBO.onchange();
}

function cboOneUp(sElementID) {
    oCBO = document.getElementById(sElementID);
    if (typeof(oCBO) =='undefined') return;
    if (oCBO.selectedIndex==0) return;
    oCBO.selectedIndex--;
    oCBO.onchange();
}

function SetButtons(sElementID) {
    oCBO = document.getElementById(sElementID);
    oButtonR = document.getElementById(sElementID + 'R');
    oButtonL = document.getElementById(sElementID + 'L');
    if (oCBO.selectedIndex==0) {
		oButtonL.disabled = true;
	}
    else {
		oButtonL.disabled = false;
	}
    if (oCBO.selectedIndex==oCBO.length-1) {
		oButtonR.disabled = true;
	}
    else {
		oButtonR.disabled = false;
	}
}

//Time-------------------------------------------------------------------------------------------------------------

function dtString2Time(sTime) {
	var date = new Date();
	var lhours = 0;
	var lminutes = 0;
	var sValue = Trim(sTime);
  
	if (sValue=='') { //Error
	    date.setHours(0);
	    date.setMinutes(0);
	    return date;
	} 
            
	var sTemp1 = sValue.slice(0,1);
	var sTemp2 = sValue.slice(1,2);
	
	if (isNaN(sTemp1)) { //Error
		date.setHours(0);
		date.setMinutes(0);
		return date;
	} 
	
	if ((isNaN(parseInt(sTemp2))) || (parseInt(sTemp1) > 2)) {
		lhours = parseInt(sTemp1);
		sValue = sValue.substring(1, sValue.length);
	}
	else {
		lhours = parseInt(sTemp1) * 10 + parseInt(sTemp2);
		if (lhours > 23) {
			lhours = parseInt(sTemp1);
			sValue = sValue.substring(1, sValue.length);
		}
		else {
			sValue = sValue.substring(2, sValue.length);
		}
	}
	
	sTemp1 = sValue; 
	while ((isNaN(parseInt(sTemp1.substring(0,1)))) && (sTemp1.length > 0)) {
		sTemp1 = sTemp1.substring(1,sTemp1.length);
	}
	
	if (sTemp1.length > 0) {
		sValue = sTemp1;
		sTemp1 = sValue.slice(0, 1);
		sTemp2 = sValue.slice(1, 2);
		
		if (isNaN(parseInt(sTemp2))) {
			lminutes = parseInt(sTemp1);
			sValue = sValue.substring(1, sValue.length);
		}
		else {
			lminutes = parseInt(sTemp1) * 10 + parseInt(sTemp2);
			if (lminutes > 59) {//Error
				date.setHours(0);
				date.setMinutes(0);
				return date;
			}
			else {
				sValue = sValue.substring(2, sValue.length);
			}
		}
	}
	
	sValue = leftTrim(sValue);
      
	if (sValue.length > 0) {
		if (sValue.slice(0, 1).toUpperCase() == 'P') {
			if ((lhours == 0) || (lhours > 12)) {//Error
				date.setHours(0);
				date.setMinutes(0);
				return date;
			}
			else {
				lhours = (lhours < 12) ? lhours = lhours + 12 : lhours;
			}
		}
		if (sValue.slice(0, 1).toUpperCase() == 'A') {
			if (lhours > 12) {
			}
			else {
				lhours = (lhours == 12) ? lhours = 0 : lhours;
			}
		}
	}

	date.setHours(lhours);
	date.setMinutes(lminutes);
	return date;
} //dtString2Time

function bValidateTime(oControl, nTimeFormat) {
	var lhours = 0;
	var lminutes = 0;
	var sValue = oControl.value;
	var sAMPM;
	var bMitMeldung = false;

	// wegen Eventreihenfolge FF
	// die Meldung kam bereits im onBlur
	//bMitMeldung = ((sLastNoValidatedControlName!=oControl.id) && (!(bIsIE || bIsSafari))); 
	
	//wichtig, damit der cursor herauskommt
	sLastNoValidatedControlName='-1';
	
	sValue = Trim(sValue);
	 
	if (sValue=='') return true;
	
	var sTemp1 = sValue.slice(0,1);
	var sTemp2 = sValue.slice(1,2);
	
	if (isNaN(sTemp1)) {
		sLastNoValidatedControlName = oControl.id;
		if (bMitMeldung) {
			alert(s_6079);
			gsetFocus(oControl.id);
		}
		return false;
	}
	
	if ((isNaN(parseInt(sTemp2))) || (parseInt(sTemp1) > 2)) {
		lhours = parseInt(sTemp1);
		sValue = sValue.substring(1, sValue.length);
	}
	else {
		lhours = parseInt(sTemp1) * 10 + parseInt(sTemp2);
		if (lhours > 23) {
			lhours = parseInt(sTemp1);
			sValue = sValue.substring(1, sValue.length);
		}
		else {
			sValue = sValue.substring(2, sValue.length);
		}
	}
	
	sTemp1 = sValue; 
	while ((isNaN(parseInt(sTemp1.substring(0,1)))) && (sTemp1.length > 0)) {
		sTemp1 = sTemp1.substring(1,sTemp1.length);
	}
	
	if (sTemp1.length > 0) {
		sValue = sTemp1;
		sTemp1 = sValue.slice(0, 1);
		sTemp2 = sValue.slice(1, 2);
		
		if (isNaN(parseInt(sTemp2))) {
			lminutes = parseInt(sTemp1);
			sValue = sValue.substring(1, sValue.length);
		}
		else {
			lminutes = parseInt(sTemp1) * 10 + parseInt(sTemp2);
			if (lminutes > 59) {
				sLastNoValidatedControlName = oControl.id;
				if (bMitMeldung) {
					alert(s_6079);
					gsetFocus(oControl.id);
				}
				return false;
			}
			else {
				sValue = sValue.substring(2, sValue.length);
			}
		}
	}
	
	sValue = leftTrim(sValue);
	
	if (sValue.length > 0) {
		if (sValue.slice(0, 1).toUpperCase() == 'P') {
			if ((lhours == 0) || (lhours > 12)) {
				sLastNoValidatedControlName = oControl.id;
				if (bMitMeldung) {
					alert(s_6079);
					gsetFocus(oControl.id);
				}
				return false;
			}
			else {
				lhours = (lhours < 12) ? lhours = lhours + 12 : lhours;
			}
		}
		if (sValue.slice(0, 1).toUpperCase() == 'A') {
			if (lhours > 12) {
			}
			else {
				lhours = (lhours == 12) ? lhours = 0 : lhours;
			}
		}
	}
	
	if (parseInt(nTimeFormat) == 1) {
		sTemp1 = (((lhours > 0) && (lhours < 13)) ? String(lhours) : ((lhours == 0) ? '12' : String(lhours - 12)));
		sValue = (sTemp1.length == 1) ? '0' + sTemp1 : sTemp1;
		sValue = sValue + ':';
		sValue = sValue + ((lminutes < 10) ? '0' + String(lminutes) : String(lminutes));
		sValue = sValue + ((lhours > 11) ? ' PM' : ' AM');
	}
	else {
		sValue = (lhours < 10) ? '0' + String(lhours) : String(lhours);
		sValue = sValue + ':';
		sValue = sValue + ((lminutes < 10) ? '0' + String(lminutes) : String(lminutes));
	}
	oControl.value = sValue;
	return true;
} //bValidateTime
  
 function bValidatedTimeOnBlur(oControl,nTimeFormat) {
    
    if (oControl.id == sLastNoValidatedControlName) {
		if (!bValidateTime(oControl, nTimeFormat)) {
			alert(s_6079);
			gsetFocus(oControl.id);
		}
		try // setzt den Focus und verhindert andere events (IE)
		{
			oControl.select(0, oControl.value.length);
			return false;
		} 
		catch (e) {
		}
	//geht nicht, da onBlur etwas haeufiger kommt als es sollte
	}
	else {
		return true;
	} //sNoValidatedControlName='-1';}
}
   
 function gsetFocus(sID) { 
     //mit Verzoegerung wegen FF
     if (document.forms[0].elements[sID]) {
	 	window.setTimeout('document.forms[0].' + sID + '.focus()', 1);
	 	window.setTimeout('document.forms[0].' + sID + '.select(0,' + '50' + ')', 1);
	 }
}


//*****************************************************************************
// Popuprovider
//*****************************************************************************
var popupProvider_instances = undefined;
////////////////////////////////
// Oeffnet ein Popupprovider
////////////////////////////////
// popupControl: Das Html-Element (div) welches als Popupangezeigt werden soll.
// Eigenschaften:
function popupProvider(popupControl){
    //Eigenschaften
	this.isPopupOpen = false;
	this.popupControl = popupControl;
	this.placement = 1; //0 = top, 1 = Bottom
	this.bendBorderPixel = 3; //Wieviel Pixel entfernt von Popup geklickt werden darf, ohne das es sich schließt
	this.popupMarginFromTarget = { x: 3, y: 5}; //Die Zahl an Pixel, wieweit das Popup von target-Control entfernt geöffnet werden soll.
	this.suppressNextWndClick = true;
	this.rtl = document.getElementsByTagName('html')[0].dir == "rtl";
	
	//Funktionen
	
	this.closePopup = function(){
		if (this.isPopupOpen) {
			this.isPopupOpen = false;
			this.popupControl.style.visibility = 'hidden';
			
			if (this.onPopupClosed != undefined) {
			    this.onPopupClosed(this);
			}
		}
	};
	
	this.openPopup = function(target){
	    if (this.isPopupOpen) {
	        this.closePopup();
	    }
	
		if (!this.isPopupOpen) {
			var point = {
				x: 0,
				y: 0,
				width: 0,
				height: 0
			};
			
			point.x = this.absLeft(target);
			point.y = this.absTop(target);
			point.width = target.offsetWidth;
			point.height = target.offsetHeight;
			
			var screenSize = { x:0, y:0, width: 0, height: 0};
			if (bIsIE) {
				if (ie4) {
				    screenSize.x = document.body.scrollLeft;
				    screenSize.y = document.body.scrollTop;
					screenSize.width = document.body.clientWidth;
					screenSize.height = document.body.clientHeight;
				}
				else {
					screenSize.x = window.innerWidth;
				    screenSize.y = window.innerHeight;
				    screenSize.width = document.documentElement.clientWidth;
				    screenSize.height = document.documentElement.clientHeight;
				}
			}
			else {
				screenSize.x = window.pageXOffset;
				screenSize.y = window.pageYOffset;
				screenSize.width = window.innerWidth;
				screenSize.height = window.innerHeight;
			}
			
			//alert('x:' + screenSize.x + ' y:' + screenSize.y);
			
			var popupSize = {width: 0, height: 0};
			popupSize.width = this.popupControl.offsetWidth;
			popupSize.height = this.popupControl.offsetHeight;
			
			var scrollPos = { left: 0, top: 0};
			scrollPos.left = this.absScrollLeft(target);
			scrollPos.top = this.absScrollTop(target);
			
			//placement auswerten, Right To Left beachten
			
			if (this.placement == 0) {
				//var y = point.y - popupSize.height - this.popupMarginFromTarget.y - scrollPos.top;
				var y = point.y - popupSize.height - this.popupMarginFromTarget.y;
				/*if (y - screenSize.y < this.bendBorderPixel) {
					y = point.y + point.height + this.popupMarginFromTarget.y;
				}*/
				
				point.y = y;
			}
			else if (this.placement == 1) {
				//var y = point.y + point.height + this.popupMarginFromTarget.y - scrollPos.top;
				var y = point.y + point.height + this.popupMarginFromTarget.y;
				/*if (y + popupSize.height - screenSize.y > screenSize.height - this.bendBorderPixel) {
					y = point.y - popupSize.height - this.popupMarginFromTarget.y;
				}*/
				
				point.y = y;
			}
			
			if (this.rtl) {
				var x = (point.x + point.width) - popupSize.width - this.popupMarginFromTarget.x - scrollPos.left;
				if (x - screenSize.x < this.bendBorderPixel) {
					x = point.x + this.popupMarginFromTarget.x;
				}
				
				point.x = x;
			}
			else {
				var x = point.x + this.popupMarginFromTarget.x - scrollPos.left;
				if (x + popupSize.width - screenSize.x > screenSize.width - this.bendBorderPixel) {
					x = (point.x + point.width) - popupSize.width - this.popupMarginFromTarget.x;
				}
				
				point.x = x;
			}
			
			this.isPopupOpen = true;
			this.popupControl.style.left = point.x;
			this.popupControl.style.top = point.y;
			this.popupControl.style.visibility = 'visible';
			
			this.suppressNextWndClick = true;
		}
	};
	
	
	this.absLeft = function(el) {
		return (el.offsetParent) ? el.offsetLeft + this.absLeft(el.offsetParent) : el.offsetLeft;
	};
	
	this.absTop = function(el) {
		return (el.offsetParent) ? el.offsetTop + this.absTop(el.offsetParent) : el.offsetTop;
	};
	
	this.absScrollLeft = function(el) {
	    return el.offsetParent ? el.scrollLeft + this.absScrollLeft(el.offsetParent) : el.scrollLeft;
	};
	
	this.absScrollTop = function(el) {
	    /*if (bIsIE) {
            return el.offsetParent ? el.scrollTop + this.absScrollTop(el.offsetParent) : el.scrollTop;
        }
        else {
            if (el.offsetParent != undefined) {
                var x = 0;
                if (el.offsetTop - el.offsetParent.scrollHeight > 0) { x = el.offsetTop - el.offsetParent.scrollHeight }
                
                return x + this.absScrollTop(el.offsetParent);
            }
            else {
                return 0;
            }
        }*/
        
        return el.offsetParent ? el.scrollTop + this.absScrollTop(el.offsetParent) : el.scrollTop;
	};
	
	this.onWindowClick = function(target){
	    if (this.suppressNextWndClick) {
			this.suppressNextWndClick = false;
		}
		else {
			var eventP = {
				x: 0,
				y: 0
			};
			
			if (bIsIE) {
				eventP.x = window.event.clientX;
				eventP.y = window.event.clientY;
			}
			else {
				eventP.x = target.clientX;
				eventP.y = target.clientY;
			}
    		
		    var popupP = {x1: 0, y1: 0, x2: 0, y2: 0};
		    popupP.x1 = this.absLeft(this.popupControl);
		    popupP.y1 = this.absTop(this.popupControl);
		    popupP.x2 = popupP.x1 + this.popupControl.offsetWidth;
		    popupP.y2 = popupP.y1 + this.popupControl.offsetHeight;
    		
		    if (eventP.x < popupP.x1 - this.bendBorderPixel || eventP.x > popupP.x2 + this.bendBorderPixel || 
			    eventP.y < popupP.y1 - this.bendBorderPixel || eventP.y > popupP.y2 + this.bendBorderPixel) {
			    this.closePopup();
		    }
		}
	};
	
	
	
	if (popupProvider_instances == undefined) {
		addEvent(document.body, 'click', popupProvider_windowClick, true);
		
		popupProvider_instances = new Array();
	}
	
	popupProvider_instances.push(this);
}

////////////////////////////////
// Oeffnet ein Popupprovider
////////////////////////////////
// provider: Eine Instanz eines PopupProviders.
// target: Das Html-Element, an welchem das Popup angezeigt werden soll
function popupProvider_open(provider, target){
	if (provider != undefined && provider.openPopup != undefined) {
		provider.openPopup(target);
	}
	
	alert('popupProvider_open');
}

////////////////////////////////
// Schliesst ein Popup-Provider
////////////////////////////////
// provider: Eine Instanz des Popup-Providers, die geschlossen werden soll.
function popupProvider_close(provider){
	if (provider != undefined && provider.closePopup != undefined){
		provider.closePopup();
	}
	
	alert('popupProvider_close');
}

////////////////////////////////
// Wird ausgeloest bei Body_OnClick
////////////////////////////////
// e: Das entsprechende Event/Control.
function popupProvider_windowClick(e){
	if (popupProvider_instances != undefined) {
		for (var i=0; i<popupProvider_instances.length; i++) {
			if (popupProvider_instances[i] != undefined && popupProvider_instances[i].isPopupOpen){
				popupProvider_instances[i].onWindowClick(e);
			}
		}
	}
}

function NodeSetText(elm, text) {
    if (elm != undefined && elm.childNodes!= undefined) {
        while (elm.childNodes.length > 0) {
            elm.removeChild(elm.firstChild);
        }
        
        elm.appendChild(document.createTextNode(text));
    }
}

function NodeGetText(elm) {
    if (elm == undefined) 
        return '';
    else {
        for (var i=0; i<elm.childNodes.length; ++i){
            if (elm.childNodes[i].nodeType == 3) {
                return elm.childNodes[i].nodeValue;
            }
        }
        return '';
    }
}

//Fügt einem HtmlControl eine CSS-Klasse hinzu
function addCSSClassName(control, className) {
	if (control.className == undefined || control.className == '') {
		control.className = className;
	}
	else {
		var classNameU = className.toUpperCase();
		var arr = control.className.split(' ');
		var exists = false;
		
		for (var i=0; i < arr.length; i++) {
			if (arr[i].toUpperCase() == classNameU) {
				exists = true;
				break;
			}
		}
		
		if (!exists) {
			arr.push(className);
		}
		
		control.className = arr.join(' ');
	}
}

//Entfernt aus einem HtmlControl eine CSS-Klasse
function removeCSSClassName(control, className){
	if (control.className != undefined) {
		className = className.toUpperCase();
		
		var arr1 = control.className.split(' ');
		var arr2 = new Array();
		
		for (var i=0; i<arr1.length; i++) {
			if (arr1[i].toUpperCase() != className) {
				arr2.push(arr1[i]);
			}
		}
		
		control.className = arr2.join(' ');
	}
}

function frmXcelsiusDashboard_checkFlashPopup() {
    var txtShowFlashInPopup = document.getElementById('txtShowFlashInPopup');
    var flsXcelsius = document.getElementById('flsXcelsius');
    //var btnShowInPopup = document.getElementById('btnShowInPopup');
    var txtFlashVars = document.getElementById('txtFlashVars');
    var txtHasMovie = document.getElementById('txtHasMovie');
    
    if (txtShowFlashInPopup == undefined || flsXcelsius == undefined /*|| btnShowInPopup == undefined*/ || txtFlashVars == undefined || txtHasMovie == undefined) { return; }
    
    var bShowInPopup = txtShowFlashInPopup.value == 'false' ? false : true;
    var bHasMovie = txtHasMovie.value == 'false' ? false : true;
    
    if (bShowInPopup && bHasMovie) {
        var sHtml;
        if (bIsIE){
            sHtml = flsXcelsius.outerHTML;
        }
        else {
            sHtml = getOuterHTML(flsXcelsius);
        }
        
        flsXcelsius.parentNode.removeChild(flsXcelsius);
        
        var urlSuff = window.location.protocol + '//' + window.location.host + window.location.pathname;
        
        sHtml = sHtml.replace(/style=".*?"/i, 'style="width:99%;height:99%;"');
        sHtml = sHtml.replace(/<PARAM NAME="FlashVars" VALUE=".*?">/gi, '<PARAM NAME="FlashVars" VALUE="' + txtFlashVars.value + '">');
        sHtml = sHtml.replace(/FlashVars=".*?"/ig, 'FlashVars="' + txtFlashVars.value + '"');
        sHtml = sHtml.replace(/="MARIProjekt\.aspx/gi, '="' + urlSuff);
        sHtml = sHtml.replace(/="MARIURL=MARIProjekt%2Easpx/gi, '="MARIURL=' + escapeEx(urlSuff));
        sHtml = sHtml.replace(/"#?dedfce"/gi, '"#ffffff"');
        sHtml = sHtml.replace(/(width|height)=".*?"/gi, 'style="width:100%;height:100%" ');
        
        var wnd = window.open('', 'Xcelsius', 'location=false,menubar=false,scrollbars=false,toolbar=false,width=800,height=600,resizable=yes');
        if (wnd != null) { 
			wnd.document.body.innerHTML = sHtml 
		}
    
        /*btnShowInPopup.style.visibility = 'hidden';*/
    }
}

function getOuterHTML(object) {
    var element;
    if (!object) return null;
    element = document.createElement("div");
    element.appendChild(object.cloneNode(true));
    return element.innerHTML;
}

function ComboBox_UpdateToolTip(cbo) {
	if (cbo == null) return;
	if (cbo.options == null) return;
	
	for (i=0; i<cbo.options.length; ++i) {
		if (cbo.options[i].value == cbo.value) {
			cbo.title = cbo.options(i).text;
			break;
		}
	}
}

/************************************************
/* Escaped einen Unicode String zu einem URL-String.
/************************************************
/* Hinweis: escape(str) arbeitet nur mit ASCII (bis 127) zusammen.
/************************************************/
function escapeEx(str) {
	if (encodeURIComponent) {
		return encodeURIComponent(str);
	}
	else {
		return escape(str);
	}
}

/************************************************
/* Unescaped einen URL-String zu einem Unicode-String.
/************************************************
/* Hinweis: escape(str) arbeitet nur mit ASCII (bis 127) zusammen.
/************************************************/
function unescapeEx(str) {
	if (decodeURIComponent) {
		return decodeURIComponent(str);
	}
	else {
		return unescape(str);
	}
}

/************************************************
/* Erstellt einen AJAX Request für Ermittlung von geplanten und die tatsächlichen Stunden/Artikelmengen
/* und führt nach erhalt des Response callback aus.
/************************************************
/*
/* @param 
/* @param {boolean}		bArtikel		Artikel oder Stundenbuchung
/* @param {string} 		sProjekt		Projektnummer
/* @param {string}		sPersNr			Personalnummer
/* @param {integer}		lVKPosID		
/* @param {integer}		lPhasenID
/* @param {function)	callback		Function(object:{lPlanned:, lUsed:});
/*										Wird aufgerufen, wenn vom Server der Response
/*										erhalten wurde
/***********************************************/
function getAJAX_TimeSheetGetPlanedUsedHours(url, bArtikel, sProjekt, sPersNr, lVKPosID, lPhasenID, sDatum, lVertragsID, callback) {
	var s = '';
	s += '<mariAjax>';
	s += '<Request name="GetPlannedUsedHours">';
	
	s += '<bArtikel>' + (bArtikel ? '1' : '0') + '</bArtikel>';
	s += '<sProjekt>' + sProjekt + '</sProjekt>';
	s += '<sPersNr>' + sPersNr + '</sPersNr>';
	s += '<lVKPosID>' + lVKPosID + '</lVKPosID>';
	s += '<lPhasenID>' + lPhasenID + '</lPhasenID>';
	s += '<sDatum>' + sDatum + '</sDatum>';
	s += '<lVertragsID>' + lVertragsID + '</lVertragsID>';
	
	s += '</Request>';
	s += '</mariAjax>';
	
	//===========================================
	//XmlHttpRequest erstellen
	//===========================================
	var oRequest = MAHTTPRequest();
	
	if (oRequest == null) return;
	
	oRequest.open('POST', url);
	oRequest.setRequestHeader('Content-Type', 'text/xml');
	oRequest.onreadystatechange = function() {
		if (oRequest.readyState == 4 && oRequest.status == 200) {
			var xDoc = XML_getDocument(oRequest.responseText);
			
			var xPlanned = XML_selectNodes(xDoc, xDoc, '//mariAjax/Response/lPlanned');
			var xUsed = XML_selectNodes(xDoc, xDoc, '//mariAjax/Response/lUsed');
			var xUnit = XML_selectNodes(xDoc, xDoc, '//mariAjax/Response/sUnit');
			
			// Jeweils mit Einheit
			var lPlanned = '';
			var lUsed = '';
			var sUnit = '';
			
			if (xPlanned.length > 0) { lPlanned = NodeGetText(xPlanned[0]); }
			if (xUsed.length > 0) { lUsed = NodeGetText(xUsed[0]); }
			if (xUnit.length > 0) { sUnit = NodeGetText(xUnit[0]); }
			
			callback({ lPlanned: lPlanned, lUsed: lUsed, sUnit: sUnit });
		}
    };
	oRequest.setRequestHeader('Content-Type', 'text/xml');
    oRequest.send(s);
}

/************************************************
/* Erstellt browserspezifisch ein XmlDocument und gibt dieses zurück.
/************************************************
/* @param {string} sXml Xml, das in das Document geladen werden soll
/* @param {object} return XmlDocument
/***********************************************/
function XML_getDocument(sXml) {
	var xmlDoc = undefined;
	if (document.implementation && document.implementation.createDocument) {
		var parser = new DOMParser();
		
		if (sXml != undefined) {
			xmlDoc = parser.parseFromString(sXml, "text/xml");
		}
	}
	else {
		if (window.ActiveXObject) {
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async = "false";
			
			if (sXml != undefined) {
				xmlDoc.loadXML(sXml);
			}
		}
		else {
			return;
		}
	}
	
	return xmlDoc;
}

/************************************************
/* XPath suche
/************************************************
/* @param {object} xDoc Das XmLDocument
/* @param {object} xNode Der Knoten auf dem gesucht werden soll
/* @param {object} xPath Der X-Path-Ausdruck
/***********************************************/
function XML_selectNodes(xDoc, xNode, xPath) {
	var resArray;
	if (window.ActiveXObject) {
		resArray = xNode.selectNodes(xPath);
	}
	else {
		var nodeIter = xDoc.evaluate(xPath, xNode, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
		var node;
		
		resArray = [];
		while (node = nodeIter.iterateNext()) {
			resArray[resArray.length] = node;
		}
	}
	
	return resArray;
}



