

/**************************** Initialisierungen ******************************/



var myContentIsLoading = true;

var myLoadVisualizerCounter = 0;

var myLoadVisualizerTarget = new Object();

var myLoadVisualizerHTML = "<br /><br /><div style=\"text-align:center\" id=\"loadVisualizer\"></div>";

var calendarTimeToAppear = 15;

var myNubCalendars = new Array();



// ############################################################ Kalender ######################################################################



function Nubcal(name,mode,targetelement,multiselect,master)

{

	this.state = 0;

	this.name = name;

	this.curDate = new Date();

	this.mode = mode;

	this.selectMultiple = (multiselect == true); //'false' is not true or not set at all

	

	//the various calendar variables

	this.selectedDates = new Array();

	this.calendar;

	this.calHeading;

	this.calCells;

	this.rows;

	this.cols;

	this.cells = new Array();

	

	//The controls

	this.monthSelect;

	this.yearSelect;

	

	//standard initializations

	this.mousein = false;

	this.calConfig();

	this.setDays();

	

	var initDisplayDate = true;

	if((this.mode == 'popup') && (!this.selectMultiple) && (targetelement != undefined) && ((targetelement.type == 'text') || (targetelement.type == 'textarea')))

	{

	var md = targetelement.value;

	if((master != undefined) && (master != false) && ((md == undefined) || (md == '') || (md.indexOf(".") != 2) || (md.lastIndexOf(".") != 5))) md = master.value;

	if((md != undefined) && (md != '') && (md.indexOf(".") == 2) && (md.lastIndexOf(".") == 5))

		{			

			var idate = new Date(parseInt(md.substr(6,4)),parseInt(md.substr(3,2),10)-1,parseInt(md.substr(0,2),10));

			if((idate >= this.minDate) && (idate <= this.maxDate))

			{

				this.selectedDates.push(idate);

				this.displayMonth = idate.getMonth();

				this.displayYear = idate.getFullYear();

				var initDisplayDate = false;

			}

		}

	}

	if(initDisplayDate)

	{

		this.displayYear = this.displayYearInitial;

		this.displayMonth = this.displayMonthInitial;		

	}

	

	this.createCalendar(); //create the calendar DOM element and its children, and their related objects

	if(this.mode == 'popup' && (targetelement != undefined) && ((targetelement.type == 'text') || (targetelement.type == 'textarea'))) //if the target element has been set to be an input text box

	{

		this.tgt = targetelement;

		this.tgt.readOnly = true;

		this.calendar.style.position = 'absolute';

		this.topOffset = this.tgt.offsetHeight + 5; // the vertical distance (in pixels) to display the calendar from the Top of its input element

		this.leftOffset = -16; 					// the horizontal distance (in pixels) to display the calendar from the Left of its input element

		this.calendar.style.top = this.getTop(targetelement) + this.topOffset + 'px';

		this.calendar.style.left = this.getLeft(targetelement) + this.leftOffset + 'px';

		document.body.appendChild(this.calendar);

		this.tgt.calendar = this;

		this.tgt.onfocus = function () {this.calendar.show();}; //the calendar will popup when the input element is focused

		this.tgt.onblur = function () {if(!this.calendar.mousein){this.calendar.hide();}}; //the calendar will popup when the input element is focused

	}

	else

	{

		this.container = targetelement;

		this.container.appendChild(this.calendar);		

	}

	// Werte des zugehörigen Textfeldes bei Multiselect parsen

	if((multiselect) && (targetelement.value != undefined) && (targetelement.value != '')) this.parseInits(targetelement.value);

	

	this.state = 2; //0: initializing, 1: redrawing, 2: finished!

	this.visible ? this.show() : this.hide();

	this.selectByHover = false;

	// 

}

//-----------------------------------------------------------------------------

Nubcal.prototype.calConfig = function () //PRIVATE: initialize calendar variables

{

	//this.mode = 'flat'; //can be 'flat' or 'popup'

	this.displayYearInitial = this.curDate.getFullYear(); //the initial year to display on load

	this.displayMonthInitial = this.curDate.getMonth(); //the initial month to display on load (0-11)

	this.rangeYearLower = this.displayYearInitial;

	this.rangeYearUpper = this.displayYearInitial + 2;

	this.minDate = new Date(this.rangeYearLower,this.displayMonthInitial,this.curDate.getDate());

	this.maxDate = new Date(this.rangeYearUpper,11,31);

	this.startDay = 1; // the day the week will 'start' on: 0(Sun) to 6(Sat)

	this.showWeeks = true; //whether the week numbers will be shown

	this.selCurMonthOnly = false; //allow user to only select dates in the currently displayed month	

	//set the variables based on the calendar mode

	if(this.mode == 'popup') this.visible = false;

	else this.visible = true;

	this.setLang();

};

//-----------------------------------------------------------------------------

Nubcal.prototype.setLang = function()  //all language settings for Nubcal are made here.  Check Date.dateFormat() for the Date object's language settings

{

	this.daylist = new Array('So','Mo','Di','Mi','Do','Fr','Sa','So','Mo','Di','Mi','Do','Fr','Sa'); /*<lang:de>*/

	this.months_sh = new Array('Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez');

	this.monthup_title = 'Nächster Monat';

	this.monthdn_title = 'Vorheriger Monat';

	this.clearbtn_caption = '  Leeren  ';

	this.clearbtn_title = 'Löscht alle ausgewählten Daten';

	this.savebtn_caption = 'Speichern';

	this.savebtn_title = 'Übernimmt alle ausgewählten Daten';

	this.maxrange_caption = 'Dies ist der maximale Zeitraum.';

	this.minrange_caption = 'Es können keine Daten in der Vergangenheit ausgewählt werden.';

};

//-----------------------------------------------------------------------------

Nubcal.prototype.getTop = function (element) //PRIVATE: returns the absolute Top value of element, in pixels

{

    var oNode = element;

    var iTop = 0;

    

    while(oNode.tagName != 'BODY') {

        iTop += oNode.offsetTop;

        oNode = oNode.offsetParent;

    }

    

    return iTop;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.getLeft = function (element) //PRIVATE: returns the absolute Left value of element, in pixels

{

    var oNode = element;

    var iLeft = 0;

    

    while(oNode.tagName != 'BODY') {

        iLeft += oNode.offsetLeft;

        oNode = oNode.offsetParent;        

    }

    

    return iLeft;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.remove = function () //PUBLIC: Removes the calendar

{

	this.tgt.readOnly = false;

	document.body.removeChild(this.calendar);

};

//-----------------------------------------------------------------------------

Nubcal.prototype.show = function () //PUBLIC: displays the calendar

{

	closeAllOtherCalendars(this);

	this.calendar.style.display = 'block';

	this.visible = true;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.hide = function () //PUBLIC: Hides the calendar

{

	this.calendar.style.display = 'none';

	this.visible = false;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.toggle = function () //PUBLIC: Toggles (shows/hides) the calendar depending on its current state

{

	if(this.visible) {

		this.hide();

	}

	else {

		this.show();

	}

};

//-----------------------------------------------------------------------------

Nubcal.prototype.setDays = function ()  //PRIVATE: initializes the standard Gregorian Calendar parameters

{

	this.daynames = new Array();

	var j=0;

	for(var i=this.startDay; i< this.startDay + 7;i++) {

		this.daynames[j++] = this.daylist[i];

	}

		

	this.monthDayCount = new Array(31,((this.curDate.getFullYear() - 2000) % 4 ? 28 : 29),31,30,31,30,31,31,30,31,30,31);

};

//-----------------------------------------------------------------------------

Nubcal.prototype.setClass = function (element,className) //PRIVATE: sets the CSS class of the element, W3C & IE

{

	element.setAttribute('class',className);

	element.setAttribute('className',className); //<iehack>

};

//-----------------------------------------------------------------------------

Nubcal.prototype.createCalendar = function ()  //PRIVATE: creates the full DOM implementation of the calendar

{

	var tbody, tr, td;

	this.calendar = document.createElement('table');

	this.calendar.setAttribute('id',this.name+'_calendar');

	this.setClass(this.calendar,'calendar');

	//to prevent IE from selecting text when clicking on the calendar

	this.calendar.onselectstart = function() {return false;};

	this.calendar.ondrag = function() {return false;};

	tbody = document.createElement('tbody');

	

	//create the Main Calendar Heading

	tr = document.createElement('tr');

	td = document.createElement('td');

	td.appendChild(this.createMainHeading());

	tr.appendChild(td);

	tbody.appendChild(tr);

	

	//create the calendar Day Heading

	tr = document.createElement('tr');

	td = document.createElement('td');

	td.appendChild(this.createDayHeading());

	tr.appendChild(td);

	tbody.appendChild(tr);



	//create the calendar Day Cells

	tr = document.createElement('tr');

	td = document.createElement('td');

	td.setAttribute('id',this.name+'_cell_td');

	this.calCellContainer = td;	//used as a handle for manipulating the calendar cells as a whole

	td.appendChild(this.createNubCells());

	tr.appendChild(td);

	tbody.appendChild(tr);

	

	//create the calendar footer

	tr = document.createElement('tr');

	td = document.createElement('td');

	td.appendChild(this.createFooter());

	tr.appendChild(td);

	tbody.appendChild(tr);

	

	//add the tbody element to the main calendar table

	this.calendar.appendChild(tbody);



	//and add the onmouseover events to the calendar table

	this.calendar.owner = this;

	this.calendar.onmouseover = function() {this.owner.mousein = true;};

	this.calendar.onmouseout = function() {this.owner.mousein = false;};

	this.calendar.onmouseup = function () {if(this.owner.selectMultiple) this.owner.selectByHover = false;};

};

//-----------------------------------------------------------------------------

Nubcal.prototype.createMainHeading = function () //PRIVATE: Creates the primary calendar heading, with months & years

{

	//create the containing <div> element

	var container = document.createElement('div');

	container.setAttribute('id',this.name+'_mainheading');

	this.setClass(container,'mainheading');

	//create the child elements and other variables

	this.monthSelect = document.createElement('select');

	this.yearSelect = document.createElement('select');

	var monthDn = document.createElement('input'), monthUp = document.createElement('input');

	var opt, i;

	//fill the month select box

	for(i=0;i<12;i++)

	{

		opt = document.createElement('option');

		opt.setAttribute('value',i);

		if(this.state == 0 && this.displayMonth == i) {

			opt.setAttribute('selected','selected');

		}

		opt.appendChild(document.createTextNode(this.months_sh[i]));

		this.monthSelect.appendChild(opt);

	}

	//and fill the year select box

	for(i=this.rangeYearLower;i<=this.rangeYearUpper;i++)

	{

		opt = document.createElement('option');

		opt.setAttribute('value',i);

		if(this.state == 0 && this.displayYear == i) {

			opt.setAttribute('selected','selected');

		}

		opt.appendChild(document.createTextNode(i));

		this.yearSelect.appendChild(opt);		

	}

	//add the appropriate children for the month buttons

	monthUp.setAttribute('type','button');

	monthUp.setAttribute('value','>>');

	monthUp.setAttribute('title',this.monthup_title);	

	monthDn.setAttribute('type','button');

	monthDn.setAttribute('value','<<');

	monthDn.setAttribute('title',this.monthdn_title);

	// setting classes

	this.setClass(monthDn,'calinput');

	this.setClass(monthUp,'calinput');

	this.setClass(this.monthSelect,'calinput');

	this.setClass(this.yearSelect,'calinput');

	

	this.monthSelect.owner = this.yearSelect.owner = monthUp.owner = monthDn.owner = this;  //hack to allow us to access this calendar in the events (<fix>??)

	

	//assign the event handlers for the controls

	monthUp.onmouseup = function () {this.owner.nextMonth();};

	monthDn.onmouseup = function () {this.owner.prevMonth();};

	this.monthSelect.onchange = function()

	{

		this.owner.goToMonth(this.owner.yearSelect.value,this.value);

	};

	this.yearSelect.onchange = function()

	{

		this.owner.goToMonth(this.value,this.owner.monthSelect.value);

	};

	

	//and finally add the elements to the containing div

	container.appendChild(monthDn);

	container.appendChild(this.monthSelect);

	container.appendChild(this.yearSelect);

	container.appendChild(monthUp);

	return container;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.createFooter = function () //PRIVATE: creates the footer of the calendar - goes under the calendar cells

{

	var container = document.createElement('div');

	var clearSelected = document.createElement('input');

	clearSelected.setAttribute('type','button');

	clearSelected.setAttribute('value',this.clearbtn_caption);

	clearSelected.setAttribute('title',this.clearbtn_title);

	clearSelected.owner = this;

	this.setClass(clearSelected,'calinput');

	clearSelected.onclick = function() { this.owner.resetSelections(false);};

	container.appendChild(clearSelected);

	if(this.selectMultiple)

	{

		var saveSelected = document.createElement('input');

		saveSelected.setAttribute('type','button');

		saveSelected.setAttribute('value',this.savebtn_caption);

		saveSelected.setAttribute('title',this.savebtn_title);

		saveSelected.owner = this;

		this.setClass(saveSelected,'calinput');

		saveSelected.onclick = function() { this.owner.saveSelections()};

		container.appendChild(saveSelected);

	}

	return container;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.parseInits = function(inits)  //parse the String with the inits && change the state of the affected cells

{

	this.selectedDates = new Array();

	inits = inits.replace(/\n/g,'');

	inits = inits.replace(/\r/g,'');

	var intervals = inits.split(";");

	for(var i=0; i < intervals.length; i++)

	{	

		if(intervals[i].length == 10)

		{

			var tdate = new Date(parseInt(intervals[i].substr(6,4)),parseInt(intervals[i].substr(3,2),10)-1,parseInt(intervals[i].substr(0,2),10));

			if((tdate >= this.minDate) && (tdate <= this.maxDate))

			{

				this.selectedDates.push(tdate);

			}	

		}

		else if((intervals[i].indexOf("-") != -1) && (intervals[i].length == 21))

		{

			var von = new Date(parseInt(intervals[i].substr(6,4)),parseInt(intervals[i].substr(3,2),10)-1,parseInt(intervals[i].substr(0,2),10));

			var bis = new Date(parseInt(intervals[i].substr(17,4)),parseInt(intervals[i].substr(14,2),10)-1,parseInt(intervals[i].substr(11,2),10));

			if((von >= this.minDate) && (von <= bis))

			{	

				var further = true;

				while(further && (von <= bis))

				{

				if(von <= this.maxDate)

					{

					this.selectedDates.push(von);

					von = new Date(von.getTime() + (24 * 60 * 60 * 1000));

					}

				else further = false;

				}

			}

		}		

	}

	this.reDraw();

};

//-----------------------------------------------------------------------------

Nubcal.prototype.resetSelections = function (returnToDefaultMonth)  //PRIVATE: reset the calendar's selection variables to defaults

{

	this.selectedDates = new Array();

	this.rows = new Array(false,false,false,false,false,false,false);

	this.cols = new Array(false,false,false,false,false,false,false);

	if(this.tgt)  //if there is a target element, clear it too

	{

		this.tgt.value = '';

		if(this.mode == 'popup') {//hide the calendar if in popup mode

			this.hide();

		}

	}

		

	if(returnToDefaultMonth == true) {

		this.goToMonth(this.displayYearInitial,this.displayMonthInitial);

	}

	else {

		this.reDraw();

	}

};

//-----------------------------------------------------------------------------

Nubcal.prototype.saveSelections = function ()  //PRIVATE: passing the selected Dates to the related Text-Field

{

	var sel = this.selectedDates;

	function compare(a,b)

	{

		if(a > b) return 1;

		if(a < b) return -1;

		else return 0;

	}

	if(sel.length > 0)

	{

		sel.sort(compare);

		var result = sel[0].dateFormat();

		var isInterval = false;

		var hasSeperator = false;



		for(var i=1;i < sel.length;i++)

		{

			if(sel[i].getUeDay() == (sel[i-1].getUeDay() + 1))

			{				

				if(!hasSeperator)

				{

					hasSeperator = true;

					result += "-";

				}

			}

			else

			{

				if((i > 1) && (hasSeperator)) result += sel[i-1].dateFormat();

				result += (";\n" + sel[i].dateFormat());

				hasSeperator = false;

			}

		}

		if(hasSeperator) result += (sel[sel.length - 1].dateFormat());	

		this.tgt.value = result;

	}	

	this.hide();

};

//-----------------------------------------------------------------------------

Nubcal.prototype.createDayHeading = function ()  //PRIVATE: creates the heading containing the day names

{

	//create the table element

	this.calHeading = document.createElement('table');

	this.calHeading.setAttribute('id',this.name+'_caldayheading');

	this.setClass(this.calHeading,'caldayheading');

	var tbody,tr,td;

	tbody = document.createElement('tbody');

	tr = document.createElement('tr');

	this.cols = new Array(false,false,false,false,false,false,false);

	

	//if we're showing the week headings, create an empty <td> for filler

	if(this.showWeeks)

	{

		td = document.createElement('td');

		td.setAttribute('class','wkhead');

		td.setAttribute('className','wkhead'); //<iehack>

		tr.appendChild(td);

	}

	//populate the day titles

	for(var dow=0;dow<7;dow++)

	{

		td = document.createElement('td');

		td.appendChild(document.createTextNode(this.daynames[dow]));

		tr.appendChild(td);

	}

	tbody.appendChild(tr);

	this.calHeading.appendChild(tbody);

	return this.calHeading;	

};

//-----------------------------------------------------------------------------

Nubcal.prototype.createNubCells = function ()  //PRIVATE: creates the table containing the calendar day cells

{

	this.rows = new Array(false,false,false,false,false,false);

	this.cells = new Array();

	var row = -1, totalCells = (this.showWeeks ? 48 : 42);

	var beginDate = new Date(this.displayYear,this.displayMonth,1);

	var endDate = new Date(this.displayYear,this.displayMonth,this.monthDayCount[this.displayMonth]);

	var sdt = new Date(beginDate);

	sdt.setDate(sdt.getDate() + (this.startDay - beginDate.getDay()) - (this.startDay - beginDate.getDay() > 0 ? 7 : 0) );

	//create the table element

	this.calCells = document.createElement('table');

	this.calCells.setAttribute('id',this.name+'_calcells');

	this.setClass(this.calCells,'calcells');

	var tbody,tr,td;

	tbody = document.createElement('tbody');

	

	for(var i=0;i<totalCells;i++)

	{

		if(this.showWeeks) //if we are showing the week headings

		{

			if(i % 8 == 0)

			{

				row++;

				var actWeek = sdt.getWeek()

				tr = document.createElement('tr');

				td = document.createElement('td');

				if(this.selectMultiple) { //if selectMultiple is enabled, create the associated weekObj objects

					td.weekObj = new NubWeek(this,td,actWeek,row)

				}

				else //otherwise just set the class of the td for consistent look

				{

					td.setAttribute('class','wkhead');

					td.setAttribute('className','wkhead'); //<iehack>

				}

				td.appendChild(document.createTextNode(actWeek));			

				tr.appendChild(td);

				i++;

			}

		}

		else if(i % 7 == 0) //otherwise, new row every 7 cells

		{

			row++;

			tr = document.createElement('tr');

		}

		//create the day cells

		td = document.createElement('td');		

		if((sdt >= this.minDate) && (sdt <= this.maxDate))

		{

			td.appendChild(document.createTextNode(sdt.getDate()));// +' ' +sdt.getUeDay()));

			var cell = new NubCell(this,td,sdt,row);

			this.cells.push(cell);

			td.cellObj = cell;

		}		

		sdt.setDate(sdt.getDate() + 1); //increment the date

		tr.appendChild(td);

		tbody.appendChild(tr);

	}

	this.calCells.appendChild(tbody);

	this.reDraw();

	return this.calCells;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.reDraw = function () //PRIVATE: reapplies all the CSS classes for the calendar cells, usually called after chaning their state

{

	this.state = 1;

	var i,j;

	for(i=0;i<this.cells.length;i++) {

		this.cells[i].selected = false;

	}

	for(i=0;i<this.cells.length;i++)

	{

		for(j=0;j<this.selectedDates.length;j++) { //if the cell's date is in the selectedDates array, set its selected property to true

			if(this.cells[i].date.getUeDay() == this.selectedDates[j].getUeDay() ) {

				this.cells[i].selected = true;

			}

		}

		this.cells[i].setClass();

	}

	this.state = 2;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.deleteCells = function () //PRIVATE: removes the calendar cells from the DOM (does not delete the cell objects associated with them

{

	this.calCellContainer.removeChild(this.calCellContainer.firstChild); //get a handle on the cell table (optional - for less indirection)

	this.cells = new Array(); //reset the cells array

};

//-----------------------------------------------------------------------------

Nubcal.prototype.goToMonth = function (year,month) //PUBLIC: sets the calendar to display the requested month/year

{

	if((year == this.maxDate.getFullYear()) && (month > this.maxDate.getMonth()))

	{		

		this.monthSelect.blur();

		alert(this.maxrange_caption);

		this.monthSelect.value = this.displayMonth;		

	}

	else if((year == this.minDate.getFullYear()) && (month < this.minDate.getMonth()))

	{

		this.monthSelect.blur();

		alert(this.minrange_caption);		

		this.monthSelect.value = this.displayMonth;

		this.yearSelect.value = this.displayYear;

	}

	else

	{

		this.displayMonth = month;

		this.displayYear = year;

		this.deleteCells();

		this.calCellContainer.appendChild(this.createNubCells());	

	}	

};

//-----------------------------------------------------------------------------

Nubcal.prototype.nextMonth = function () //PUBLIC: go to the next month.  if the month is december, go to january of the next year

{

	var nextMonth = this.monthSelect.value;

	var nextYear = this.yearSelect.value;

	//increment the month/year values, provided they're within the min/max ranges

	if(nextMonth < 11) {

		nextMonth++;

	}

	else

	{

		nextMonth = 0;

		nextYear++;

	}

	

	if((nextYear < this.maxDate.getFullYear()) || ((nextYear == this.maxDate.getFullYear()) && (nextMonth <= this.maxDate.getMonth())))

	{

	this.monthSelect.value = nextMonth;

	this.yearSelect.value = nextYear;

	}

	else alert(this.maxrange_caption);

	

	//assign the currently displaying month/year values

	this.displayMonth = this.monthSelect.value;

	this.displayYear = this.yearSelect.value;

	

	//and refresh the calendar for the new month/year

	this.deleteCells();

	this.calCellContainer.appendChild(this.createNubCells());

};

//-----------------------------------------------------------------------------

Nubcal.prototype.prevMonth = function () //PUBLIC: go to the previous month.  if the month is january, go to december of the previous year

{

	var prevMonth = this.monthSelect.value;

	var prevYear = this.yearSelect.value;

	//increment the month/year values, provided they're within the min/max ranges

	if(prevMonth > 0) prevMonth--;

	else

	{

		prevMonth = 11;

		prevYear--;

	}

	

	if((prevYear > this.minDate.getFullYear()) || ((prevMonth >= this.minDate.getMonth()) && (prevYear == this.minDate.getFullYear())))

	{

	this.monthSelect.value = prevMonth;

	this.yearSelect.value = prevYear;

	}

	else  alert(this.minrange_caption);

	

	//assign the currently displaying month/year values

	this.displayMonth = this.monthSelect.value;

	this.displayYear = this.yearSelect.value;

	

	//and refresh the calendar for the new month/year

	this.deleteCells();

	this.calCellContainer.appendChild(this.createNubCells());

};

//-----------------------------------------------------------------------------

Nubcal.prototype.addZero = function (vNumber) //PRIVATE: pads a 2 digit number with a leading zero

{

	return ((vNumber < 10) ? '0' : '') + vNumber;

};

//-----------------------------------------------------------------------------

Nubcal.prototype.addDates = function (dates,redraw)  //PUBLIC: adds the array "dates" to the calendars selectedDates array (no duplicate dates) and redraws the calendar

{

	var j,in_sd;

	for(var i=0;i<dates.length;i++)

	{	

		in_sd = false;

		for(j=0;j<this.selectedDates.length;j++)

		{

			if(dates[i].getUeDay() == this.selectedDates[j].getUeDay())

			{

				in_sd = true;

				break;

			}

		}

		if(!in_sd) { //if the date isn't already in the array, add it!

			this.selectedDates.push(dates[i]);

		}

	}

	if(redraw != false) {//redraw  the calendar if "redraw" is false or undefined

		this.reDraw();

	}

};

//-----------------------------------------------------------------------------

Nubcal.prototype.removeDates = function (dates,redraw)  //PUBLIC: adds the dates to the calendars selectedDates array and redraws the calendar

{

	var j;

	for(var i=0;i<dates.length;i++)

	{

		for(j=0;j<this.selectedDates.length;j++)

		{

			if(dates[i].getUeDay() == this.selectedDates[j].getUeDay()) { //search for the dates in the selectedDates array, removing them if the dates match

				this.selectedDates.splice(j,1);

			}

		}

	}

	if(redraw != false) { //redraw  the calendar if "redraw" is false or undefined

		this.reDraw();

	}

};

//-----------------------------------------------------------------------------

Nubcal.prototype.outputDate = function (vDate, vFormat) //PUBLIC: outputs a date in the appropriate format (DEPRECATED)

{

	var vDay			= this.addZero(vDate.getDate()); 

	var vMonth			= this.addZero(vDate.getMonth() + 1); 

	var vYearLong		= this.addZero(vDate.getFullYear()); 

	var vYearShort		= this.addZero(vDate.getFullYear().toString().substring(3,4)); 

	var vYear			= (vFormat.indexOf('yyyy') > -1 ? vYearLong : vYearShort);

	var vHour			= this.addZero(vDate.getHours()); 

	var vMinute			= this.addZero(vDate.getMinutes()); 

	var vSecond			= this.addZero(vDate.getSeconds()); 

	return vFormat.replace(/dd/g, vDay).replace(/mm/g, vMonth).replace(/y{1,4}/g, vYear).replace(/hh/g, vHour).replace(/nn/g, vMinute).replace(/ss/g, vSecond);

};

//-----------------------------------------------------------------------------

Nubcal.prototype.updatePos = function (target) //PUBLIC: moves the calendar's position to target's location (popup mode only)

{

	this.calendar.style.top = this.getTop(target) + this.topOffset + 'px'

	this.calendar.style.left = this.getLeft(target) + this.leftOffset + 'px'

}

//-----------------------------------------------------------------------------

/*****************************************************************************/

function NubWeek(owner,tableCell,week,row)

{

	this.owner = owner;

	this.tableCell = tableCell;

	this.week = week;

	this.tableRow = row;

	this.tableCell.setAttribute('class','wkhead');

	this.tableCell.setAttribute('className','wkhead'); //<iehack>

	//the event handlers

	this.tableCell.onclick = this.onclick;

}

//-----------------------------------------------------------------------------

NubWeek.prototype.onclick = function ()

{

	//reduce indirection:

	var owner = this.weekObj.owner;

	var cells = owner.cells;

	var sdates = owner.selectedDates;

	var i,j;

	owner.rows[this.weekObj.tableRow] = !owner.rows[this.weekObj.tableRow];

	for(i=0;i<cells.length;i++)

	{

		if(cells[i].tableRow == this.weekObj.tableRow)

		{

			if(owner.rows[this.weekObj.tableRow] && (!owner.selCurMonthOnly || cells[i].date.getMonth() == owner.displayMonth && cells[i].date.getFullYear() == owner.displayYear)) //match all cells in the current row, with option to restrict to current month only

			{

				if(owner.selectedDates.arrayIndex(cells[i].date) == -1) {//if the date isn't already in the array

					sdates.push(cells[i].date);

				}

			}

			else										//otherwise, remove it

			{

				for(j=0;j<sdates.length;j++)

				{

					if(sdates[j].getTime() == cells[i].date.getTime())  //this.weekObj.tableRow && sdates[j].getMonth() == owner.displayMonth && sdates[j].getFullYear() == owner.displayYear)

					{

						sdates.splice(j,1);	//remove dates that are within the displaying month/year that have the same day of week as the day cell

						break;

					}

				}

			}

		}

	}

	owner.reDraw();

};

/*****************************************************************************/

//-----------------------------------------------------------------------------

function NubCell(owner,tableCell,dateObj,row)

{

	this.owner = owner;		//used primarily for event handling

	this.tableCell = tableCell; 			//the link to this cell object's table cell in the DOM

	this.cellClass;			//the CSS class of the cell

	this.selected = false;	//whether the cell is selected (and is therefore stored in the owner's selectedDates array)

	this.date = new Date(dateObj);

	this.dayOfWeek = this.date.getDay();

	this.week = this.date.getWeek();

	this.tableRow = row;

	

	//assign the event handlers for the table cell element	

	this.tableCell.onmouseover = this.onmouseover;

	this.tableCell.onmouseout = this.onmouseout;

	if(owner.selectMultiple) this.tableCell.onmousedown = this.onmousedown;

	else this.tableCell.onclick = this.onmousedown;

	

	//and set the CSS class of the table cell

	this.setClass();

}

//-----------------------------------------------------------------------------

NubCell.prototype.onmouseover = function () //replicate CSS :hover effect for non-supporting browsers <iehack>

{	

	var cell = this.cellObj;

	var owner = cell.owner;

	if(!owner.selectByHover)

	{

	this.setAttribute('class',this.cellClass + ' hover');

	this.setAttribute('className',this.cellClass + ' hover');

	}

	else

	{

		if(!owner.selCurMonthOnly || cell.date.getMonth() == owner.displayMonth && cell.date.getFullYear() == owner.displayYear)

		{

			if(!cell.selected) //if this cell has been selected

			{

				cell.selected = true;

				if(owner.selectedDates.arrayIndex(cell.date) == -1) {

					owner.selectedDates.push(cell.date);

				}

			}

			else		

			{

				cell.selected = false;

				var tmp = owner.selectedDates; // to reduce indirection

				//if the cell has been deselected, remove it from the owner calendar's selectedDates array

				for(var i=0;i<tmp.length;i++)

				{

					if(tmp[i].getUeDay() == cell.date.getUeDay()) {

						tmp.splice(i,1);

					}

				}

			}

			cell.setClass();

		}

	}

};

//-----------------------------------------------------------------------------

NubCell.prototype.onmouseout = function () //replicate CSS :hover effect for non-supporting browsers <iehack>

{

	this.cellObj.setClass();

};

//-----------------------------------------------------------------------------

NubCell.prototype.onmousedown = function () 

{

	//reduce indirection:

	var cell = this.cellObj;

	var owner = cell.owner;

	if(!owner.selCurMonthOnly || cell.date.getMonth() == owner.displayMonth && cell.date.getFullYear() == owner.displayYear)

	{

		if(owner.selectMultiple)  //if we can select multiple cells simultaneously, add the currently selected cell's date to the selectedDates array

		{

			if(!cell.selected) //if this cell has been selected

			{

				cell.selected = true;

				if(owner.selectedDates.arrayIndex(cell.date) == -1) {

					owner.selectedDates.push(cell.date);

				}

			}

			else		

			{

				cell.selected = false;

				var tmp = owner.selectedDates; // to reduce indirection

				//if the cell has been deselected, remove it from the owner calendar's selectedDates array

				for(var i=0;i<tmp.length;i++)

				{

					if(tmp[i].getUeDay() == cell.date.getUeDay()) {

						tmp.splice(i,1);

					}

				}

			}

		}

		else //if we can only select one cell at a time

		{

			owner.selectedDates = new Array(cell.date);

			if(owner.tgt) //if there is a target element to place the value in, do so

			{

				owner.tgt.value = owner.selectedDates[0].dateFormat();

				if(owner.mode == 'popup') {

					owner.hide();

				}

			}

			cell.selected = true;

		}

		if(owner.selectMultiple)

		{

			cell.setClass(); //redraw the calendar cell styles to reflect the changes

			owner.selectByHover = true;

		}

		else owner.reDraw();

	}

};

//-----------------------------------------------------------------------------

NubCell.prototype.setClass = function ()  //private: sets the CSS class of the cell based on the specified criteria

{

	if(this.selected) {

		this.cellClass = 'cell_selected';

	}

	else if(this.owner.displayMonth != this.date.getMonth() ) {

		this.cellClass = 'notmnth';	

	}

	else if(this.date.getDay() > 0 && this.date.getDay() < 6) {

		this.cellClass = 'wkday';

	}

	else {

		this.cellClass = 'wkend';

	}

	

	if(this.date.getFullYear() == this.owner.curDate.getFullYear() && this.date.getMonth() == this.owner.curDate.getMonth() && this.date.getDate() == this.owner.curDate.getDate()) {

		this.cellClass = this.cellClass + ' curdate';

	}



	this.tableCell.setAttribute('class',this.cellClass);

	this.tableCell.setAttribute('className',this.cellClass); //<iehack>

};

/*****************************************************************************/

Date.prototype.getDayOfYear = function () //returns the day of the year for this date

{

	return (this.getJulianDay() -  new Date(this.getFullYear(),0,1).getJulianDay() + 1);

};

Date.prototype.getJulianDay = function ()

{

	if (this.getMonth() < 2) var f = -1;

	else var f = 0;

	return (Math.floor((1461*(f+4800+this.getFullYear()))/4) + Math.floor(((this.getMonth()-1-(f*12))*367)/12) - Math.floor(3*Math.floor((this.getFullYear()+4900+f)/100)/4) + this.getDate() - 32075);

};

//-----------------------------------------------------------------------------

Date.prototype.getWeek = function()

{

  var jh=this.getFullYear()+1;

  var kalwo=this.kaldiff(this,jh);

  while(kalwo<1) { jh--; kalwo=this.kaldiff(this,jh); }

  return kalwo;

};

Date.prototype.kaldiff = function(datum,jahr) 

{

  var d4j=new Date(jahr,0,4);

  var wt4j=(d4j.getDay()+6)%7;

  return Math.floor(1.05+(datum.getTime()-d4j.getTime())/604800000+wt4j/7);

};

//-----------------------------------------------------------------------------

Date.prototype.getUeDay = function () //returns the number of DAYS since the UNIX Nubcal - good for comparing the date portion

{

	return parseInt(Math.floor((this.getTime() - this.getTimezoneOffset() * 60000)/86400000)); //must take into account the local timezone

};

//-----------------------------------------------------------------------------

Date.prototype.dateFormat = function(format)

{

	if(!format) { // the default date format to use - can be customized to the current locale

		format = 'd.m.Y';

	}

	LZ = function(x) {return(x < 0 || x > 9 ? '' : '0') + x};

	var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

	var DAY_NAMES = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');

	format = format + "";

	var result="";

	var i_format=0;

	var c="";

	var token="";

	var y=this.getFullYear().toString();

	var M=this.getMonth()+1;

	var d=this.getDate();

	var E=this.getDay();

	var H=this.getHours();

	var m=this.getMinutes();

	var s=this.getSeconds();

	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;

	// Convert real this parts into formatted versions

	var value = new Object();

	//if (y.length < 4) {y=''+(y-0+1900);}

	value['Y'] = y.toString();

	value['y'] = y.substring(2);

	value['n'] = M;

	value['m'] = LZ(M);

	value['F'] = MONTH_NAMES[M-1];

	value['M'] = MONTH_NAMES[M+11];

	value['j'] = d;

	value['d'] = LZ(d);

	value['D'] = DAY_NAMES[E+7];

	value['l'] = DAY_NAMES[E];

	value['G'] = H;

	value['H'] = LZ(H);

	if (H==0) {value['g']=12;}

	else if (H>12){value['g']=H-12;}

	else {value['g']=H;}

	value['h']=LZ(value['g']);

	if (H > 11) {value['a']='pm'; value['A'] = 'PM';}

	else { value['a']='am'; value['A'] = 'AM';}

	value['i']=LZ(m);

	value['s']=LZ(s);

	//construct the result string

	while (i_format < format.length) {

		c=format.charAt(i_format);

		token="";

		while ((format.charAt(i_format)==c) && (i_format < format.length)) {

			token += format.charAt(i_format++);

			}

		if (value[token] != null) { result=result + value[token]; }

		else { result=result + token; }

		}

	return result;

};

/*****************************************************************************/

Array.prototype.arrayIndex = function(searchVal,startIndex) //similar to array.indexOf() - created to fix IE deficiencies

{

	startIndex = (startIndex != null ? startIndex : 0); //default startIndex to 0, if not set

	for(var i=startIndex;i<this.length;i++)

	{

		if(searchVal == this[i]) {

			return i;

		}

	}

	return -1;

};





// ############################################################ Kalender Schnittstellen ######################################################################



function createCalendar(inID,multi)

{

	if(multi == undefined) multi = false;

	var tin = document.getElementById(inID);

	

	if(window[("nc_" + inID)] == null)

	{

		window[("nc_" + inID)] = new Nubcal(("nc_" + inID),'popup',tin,multi);

		myNubCalendars.push(window[("nc_" + inID)]);

		window.setTimeout(("nc_" + inID + ".show()"),calendarTimeToAppear);

	}

	else

	{

		window[("nc_" + inID)].show();		

	}

}



/*****************************************************************************/



function createDependentCalendar(slaveID,masterID)

{

	var slave = document.getElementById(slaveID);

	var master = document.getElementById(masterID);

	

	if(window[("nc_" + slaveID)] == null)

	{

		window[("nc_" + slaveID)] = new Nubcal(("nc_" + slaveID),'popup',slave,false,master);

		myNubCalendars.push(window[("nc_" + slaveID)]);

		window.setTimeout(("nc_" + slaveID + ".show()"),calendarTimeToAppear);

	}

	else

	{

		window[("nc_" + slaveID)].show();	

	}

}



/*****************************************************************************/



function closeAllOtherCalendars(inCal)

{

	for(var i=0; i < myNubCalendars.length; i++)

	{

		if(myNubCalendars[i] != inCal) myNubCalendars[i].hide();

	}

}



// ############################################################ Ajax ######################################################################



/**************************** Tabellen Sortieren ******************************/



function sortTable(tableID,colID,datatype,direction)

{

	if(! mySortIsWorking)

	{

		mySortIsWorking = true;

		var clones = new Array();

		var myTable = document.getElementById(tableID);

		var myBody = myTable.getElementsByTagName('tbody')[0];

		var rows = myBody.getElementsByTagName('tr');

		var tableHead = rows[0];

		for(var i =1; i < rows.length; i++)

		{

			clones[i-1] = { 

				compare: extractTableCellValue(rows[i],colID,datatype),

				col: rows[i]		

			};

		}

		switch(datatype)

		{

			case "text":

			case "link":

				var sortfunc = sortFunction_text;

				break;

			case "number":

			case "germanfloat":

			case "germandate":

			case "germandatetime":

				var sortfunc = sortFunction_number;

				break;		

		}

		clones.sort(sortfunc);

		if((direction == "desc") || (direction == "descending")) clones.reverse();

		myBody.appendChild(tableHead);



		for(i =0; i < clones.length; i++)

		{

			myBody.appendChild(clones[i].col);	

		}

		mySortIsWorking = false;

	}

}

function extractTableCellValue(row,col,datatype)

{

	var cells = row.getElementsByTagName('td');

	if(datatype == "link")

	{

		if(cells[col].firstChild.firstChild != null) return cells[col].firstChild.firstChild.nodeValue;

		else return " ";

	}

	if(cells[col].firstChild != null) 

	{

		var ret = cells[col].firstChild.nodeValue;

		switch(datatype)

		{			

			case "text":

				return ret;

				break;		

			case "number":

				ret = parseFloat(ret);

				if(isNaN(ret)) ret = 0;

				return ret;

				break;

			case "germanfloat":

				var ta = ret.split(",");

				var tf = ta[0] + "." + ta[1];

				var ret = parseFloat(tf);

				if(isNaN(ret)) ret = 0;

				return ret;

				break;

			case "germandate":

				var tf = ret.substr(6,4) + ret.substr(3,2) + ret.substr(0,2);

				var ret = parseFloat(tf);

				if(isNaN(ret)) ret = 0;

				return ret;

				break;

			case "germandatetime":

				var tf = ret.substr(6,4) + ret.substr(3,2) + ret.substr(0,2) + ret.substr(11,2) + ret.substr(14,2);

				var ret = parseFloat(tf);

				if(isNaN(ret)) ret = 0;

				return ret;

				break;

		}

	}

	else

	{

		switch(datatype)

		{			

			case "text":

				return " ";

				break;		

			case "number":

			case "germanfloat":

			case "germandate":

			case "germandatetime":

				return 0;

				break;

		}

	}

}

function sortFunction_text(a,b)

{

	if(a.compare > b.compare) return 1;

	if(a.compare < b.compare) return -1;

	else return 0;

}

function sortFunction_number(a,b)

{

	return(a.compare - b.compare);

}



/**************************** Ajax & Formulare ******************************/



function visualizeLoading()

{

	if(myLoadVisualizerCounter == 0) var newcont = "Lade Informationen&nbsp;&nbsp;&nbsp;&nbsp;";

	else if(myLoadVisualizerCounter == 1) var newcont = "Lade Informationen&nbsp;.&nbsp;&nbsp;";

	else if(myLoadVisualizerCounter == 2) var newcont = "Lade Informationen&nbsp;..&nbsp;";

	else if(myLoadVisualizerCounter == 3) var newcont = "Lade Informationen&nbsp;...";

	document.getElementById("loadVisualizer").innerHTML = newcont;

	myLoadVisualizerCounter++;

	if(myLoadVisualizerCounter == 4) myLoadVisualizerCounter=0;

}

function replaceContent(inUrl)

{

	replaceTargetContent("contentArea",inUrl,1)

}

function replaceTargetContent(inTarget,inUrl,inFlicker)

{

	if(myContentIsLoading) return;

	myContentIsLoading = true;

	if(inFlicker != undefined)

	{

		myLoadVisualizerCounter = 0;

		myLoadVisualizerTarget = inTarget;

		document.getElementById(inTarget).innerHTML = myLoadVisualizerHTML;

		var loadVisualizerActive = window.setInterval("visualizeLoading()",333);

	}

	if(inUrl.indexOf("?") == -1) inUrl += "?";

	else inUrl += "&";

	var jetzt = new Date();

	inUrl += ("cacheBuster=" + jetzt.getTime());



	var httpRequest = false; 	

	if (window.XMLHttpRequest) 

	{ 

		// Mozilla, Safari,... 

		httpRequest = new XMLHttpRequest();         

		if (httpRequest.overrideMimeType) httpRequest.overrideMimeType('text/xml [15]'); 

	} 

	else if (window.ActiveXObject) 

	{ 

		// IE         

		try 

		{             

			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");         

		} 

		catch (e) 

		{             

			try 

			{                 

				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");

			} 

			catch (e){}         

		}     

	}      

	if (!httpRequest) 

	{         

		alert('Ihr Browser unterstützt dieses Feature leider nicht.');        

		return false;     

	}  

	httpRequest.open('GET',inUrl,true);		

	httpRequest.onreadystatechange = function() 

	{         

		if (httpRequest.readyState == 4) 

		{			

			if (httpRequest.status == 200)

			{

				document.getElementById(inTarget).innerHTML = httpRequest.responseText;				

				if(inFlicker != undefined)

				{

					window.clearInterval(loadVisualizerActive);

					myLoadVisualizerCounter = 0;

				}

			}

			else alert('Es ist ein Problem beim laden der Seite aufgetreten.(Code: ' + httpRequest.status + ')');

			myContentIsLoading = false;

		}

	}   		

	httpRequest.send(null); 

	return false;

}	

function sendAjaxForm(inFormname,inAddPostvars)	

{

	sendTargetAjaxForm("contentArea",inFormname,inAddPostvars,1);	

}	

function sendTargetAjaxForm(inTarget,inFormname,inAddPostvars,inFlicker)

{ 

	if(myContentIsLoading) return;

	var postVars = getFormValues(document.forms[inFormname]);

	if(postVars == null) return;

	myContentIsLoading = true;



	var url = myDocumentRoot + document.forms[inFormname].action;	

	myActualContent = url;

	if(postVars != '') postVars += "&";

	var jetzt = new Date();

	postVars += ("cacheBuster=" + jetzt.getTime());

	if(inAddPostvars != '') postVars += ("&" + inAddPostvars);

	//alert("postVars: " + postVars);

	if(inFlicker != undefined)

	{

		myLoadVisualizerCounter = 0;

		myLoadVisualizerTarget = inTarget;

		document.getElementById(inTarget).innerHTML = myLoadVisualizerHTML;

		var loadVisualizerActive = window.setInterval("visualizeLoading()",333);

	}

	var httpRequest = false; 

	if (window.XMLHttpRequest) 

	{ 

		// Mozilla, Safari,... 

		httpRequest = new XMLHttpRequest();         

		if (httpRequest.overrideMimeType) httpRequest.overrideMimeType('text/xml [15]'); 

	} 

	else if (window.ActiveXObject) 

	{ 

		// IE         

		try 

		{             

			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");         

		} 

		catch (e) 

		{             

			try 

			{                 

				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");

			} 

			catch (e) {}         

		}     

	}      

	if (!httpRequest) 

	{         

		alert('Ihr Browser unterstützt dieses Feature leider nicht.');        

		return false;     

	}  

	httpRequest.open('POST', url, true);	

	httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	httpRequest.onreadystatechange = function() 

	{         

		if (httpRequest.readyState == 4) 

		{			

			if (httpRequest.status == 200)

			{

				document.getElementById(inTarget).innerHTML = httpRequest.responseText;				

				if(inFlicker != undefined)

				{

					window.clearInterval(loadVisualizerActive);

					myLoadVisualizerCounter = 0;

				}

			}

			else alert('Es ist ein Problem beim laden der Seite aufgetreten.(Code: ' + httpRequest.status + ')');

			myContentIsLoading = false;			

		}

	}   		

	httpRequest.send(postVars); 

}	

function getFormValues(fobj) 

{ 

	var str = "";

	var valueArr = null;

	var val = "";

	var cmd = "";

	for(var i=0; i < fobj.elements.length; i++) 

	{ 

		if((fobj.elements[i + 1] == null) || (fobj.elements[i].name != fobj.elements[i + 1].name))

		{

			switch(fobj.elements[i].type) 

			{ 

				case "text":

				case "textarea":

				case "password":

					if((fobj.elements[i].title != undefined) && (fobj.elements[i].title != "") && (fobj.elements[i].title.substr(0,12) == "Pflichtfeld:") && ((fobj.elements[i].value == "") || (fobj.elements[i].value == "[Datum]")))

					{						

						alert("Das Pflichtfeld \"" + fobj.elements[i].title.substr(12) + "\" wurde nicht ausgefüllt !");

						return null;

					}

					else str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";

					break;

				case "hidden":

					str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";

					break;

				case "select-one":

					if((fobj.elements[i].title != undefined) && (fobj.elements[i].title != "") && (fobj.elements[i].title.substr(0,12) == "Pflichtfeld:") && (fobj.elements[i].options[fobj.elements[i].selectedIndex].value == ""))

					{

						alert("Das Pflichtfeld \"" + fobj.elements[i].title.substr(12) + "\" wurde nicht ausgefüllt !");

						return null;

					}

					else str += fobj.elements[i].name + "=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&";

					break;

				case "checkbox":

				case "radio":

					if(fobj.elements[i].checked == true) str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";

					break;

			} 

		}

		else	// checkbox-gruppe od. radio-gruppe

		{

			var tempval = "";

			var ename = fobj.elements[i].name;

			while((fobj.elements[i] != null) && (fobj.elements[i].name == ename))

			{

				if(fobj.elements[i].checked == true) tempval += (fobj.elements[i].value + multipleValueSeperator);

				i++;

			}

			if(ename.substr((ename.length - 2)) == "[]") ename = ename.substr(0,(ename.length - 2))

			if(tempval != "") tempval = (ename + "=" + escape(tempval = tempval.substr(0,(tempval.length - 1))) + "&");

			str += tempval;

			i--;			

		}

	} 

	str = str.substr(0,(str.length - 1));

	return str; 

}



/**************************** diverse Helferlein ******************************/



function replaceConfirmedTargetContent(inTarget,inUrl,inConfirmation)

{

	var agree = confirm(inConfirmation); 

	if(agree)

	{

		if(inTarget == "contentArea") replaceTargetContent("contentArea",inUrl,'',1);

		else replaceTargetContent(inTarget,inUrl,'');

	}	

	else return false;	

}



function openExternalWindow(inURL)

{

	var ew = window.open(inURL,"_blank");

	ew.focus();

}



// ############################################################ Alter Kalender ######################################################################



function popUpBild(URL,X,Y)

{

	day = new Date();

	id = day.getTime();

	eval("page" + id + " = window.open(URL, '" + id + "', 'top=10,left=10,toolbar=0,menubar=0,scrollbars=0,location=0,statusbar=0,resizable=0,width=" + X + ",height=" + Y + "');");

}



function popUpWindow(URL,X,Y)

{

	day = new Date();

	id = day.getTime();

	eval("page" + id + " = window.open(URL, '" + id + "', 'top=10,left=10,toolbar=0,menubar=0,scrollbars=1,location=0,statusbar=0,resizable=0,width=" + X + ",height=" + Y + "');");

}


