// (c)2001-2004 i-DAT
// Stand: 14.03.2002
var NS4 = (document.layers); var IE4 = (document.all); var today = new Date(); var curr_day = today.getDate(); var curr_month = today.getMonth(); var curr_year = today.getYear(); var numb_years = 3; var years  = new Array(numb_years); for (i = 0; i < years.length; i++) years[i] = curr_year + i; var default_left = 200; var default_top = 80; var default_width = 218; var default_height = 224; var default_bg_color = 'ffffff'; var default_csspath = 'hc_inc/icalstyl.css'; var cal_addY = 30; var arr_weekdays = [ 'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa' ]; var arr_monthnames = [ 'Jan ', 'Feb ', 'Mär ', 'Apr ', 'Mai ', 'Jun ', 'Jul ', 'Aug ', 'Sep ', 'Okt ', 'Nov ', 'Dez ' ]; function iDatPicker(is_popup, hwin, handler, left, top, width, height, bg_color, in_month, in_year) {
this.is_popup = is_popup; this.parent = null; this.window = null; if (this.is_popup) {this.parent = hwin;}else{this.window = hwin;} this.handler = handler; this.left = (left == "undefined") ? default_left : left; this.top = (top == "undefined") ? default_top : top;
this.width = width || default_width; this.winwidth = this.width + 8; this.height = height || default_height; this.winheight = this.height + 8; this.cell_width = 26; this.cell_height = 20; this.bg_color = (bg_color == "undefined") ? default_bg_color : bg_color; this.sel_month = in_month; this.sel_year = in_year; if (this.sel_month == null) this.sel_month = curr_month; if (this.sel_year == null) this.sel_year = curr_year; this.style_path = default_csspath; this.style_link = '<link rel="STYLESHEET" type="text/css" href="' + this.style_path + '">'; this.days = new Array(42); this.cal = null; this.table_days = null; if (NS4){return;}else{iDatPicker.prototype.create_cal = iDatPicker_create_cal_IE4;iDatPicker.prototype.show_days = iDatPicker_show_days_IE4;}iDatPicker.prototype.popup_cal = iDatPicker_popup_cal;iDatPicker.prototype.new_month = iDatPicker_new_month;iDatPicker.prototype.prev_month = iDatPicker_prev_month;iDatPicker.prototype.next_month = iDatPicker_next_month;iDatPicker.prototype.clicked_day = iDatPicker_clicked_day;iDatPicker.prototype.set_indate = iDatPicker_set_indate;if (iDatPicker.prototype.id == null) iDatPicker.prototype.id = 0;iDatPicker.prototype.id++;this.id = iDatPicker.prototype.id;this.cal_id = 'cal' + this.id;this.table_days_id = 'table_days' + this.id;this.select_form_id = 'select_form' + this.id;}function iDatPicker_create_cal_IE4(){
if (this.is_popup){ var x = this.parent.screenLeft + (this.left || default_left); var y = this.parent.screenTop + (this.top || default_top); this.window = this.parent.open("", this.cal_id, 'left=' + x + ',top=' + y + ',width=' + this.winwidth + ',height=' + this.height + ',scrollbars=no,resizeable=no');this.window.document.open();this.window.document.writeln('<title>Datumsauswahl</title>');this.window.document.writeln(this.style_link);this.window.document.close();}this.window.document.body.insertAdjacentHTML("beforeEnd", "<div id='" + this.cal_id + "' style='position:absolute'></div>");this.cal = this.window.document.all[this.cal_id];if (this.is_popup){this.cal.style.pixelLeft = 0;this.cal.style.pixelTop = 0;}else{this.cal.style.pixelLeft = this.left || default_left;this.cal.style.pixelTop = this.top || default_top;}this.cal.style.zIndex = 1;this.cal.style.width = this.winwidth;this.cal.style.height = this.height;this.cal.style.backgroundColor = this.bg_color;this.cal.style.visibility = 'visible';this.cal.ipicker = this;
var str ="<table bgcolor=black width='" + this.winwidth + "' height='" + this.winheight + "' border='0' cellpadding='0' cellspacing='1'>\n" + "<tr><td>\n" + "<table bgcolor='" + this.cal.style.backgroundColor + "' height='" + this.winheight + "' border='0' cellpadding='0' cellspacing='0'>\n" + "<tr valign='top' align='center'><td bgcolor='" + this.cal.style.backgroundColor + "'>\n" + "<table width='" + this.winwidth + "' border='0px' cellpadding='0' cellspacing='2'>\n" + "<tr valign='top' align='center'>\n" + "<td align='center'>\n" + "<form name='" + this.select_form_id + "'>\n" + "<input type='button' value='&lt;&lt;' onClick='document.all." + this.cal_id + ".ipicker.prev_month()' class='cal_btn_steps'>\n" + "&nbsp;<select name='month_sel' onChange='document.all." + this.cal_id + ".ipicker.new_month()' class='cal_text_sels'>\n";for (i = 0; i < arr_monthnames.length; i++)
str += "<option value='" + i + "'>" + arr_monthnames[i] + "\n";str += "</select>\n" + "<select name='year_sel' onChange='document.all." + this.cal_id + ".ipicker.new_month()' class='cal_text_sels'>\n";for (i = 0; i < years.length; i++)
str += "<option value='" + years[i] + "'>" + years[i] + "\n";str += "</select>&nbsp;\n" + "<input type='button' value='&gt;&gt;' onClick='document.all." + this.cal_id + ".ipicker.next_month()' class='cal_btn_steps'>\n" + "</form>\n" + "</td>\n" +
"</tr>\n"+"</table>\n"+"<div id='" + this.table_days_id + "' style='position:absolute'></div>\n";this.cal.innerHTML = str;this.table_days = this.window.document.all[this.table_days_id];this.table_days.style.pixelLeft = 5;this.table_days.style.pixelTop = cal_addY;this.table_days.style.zIndex = 3;this.table_days.style.visibility = 'inherit';this.table_days.ipicker = this;}function iDatPicker_show_days_IE4(){var month_select = this.window.document.forms[this.select_form_id]['month_sel'];var year_select = this.window.document.forms[this.select_form_id]['year_sel'];month_select.selectedIndex = this.sel_month;year_select.selectedIndex = this.sel_year - years[0];var days_in_month = (new Date(this.sel_year, this.sel_month+1, 0)).getDate();var day_of_week_first = (new Date(this.sel_year, this.sel_month, 1)).getDay();for (i = 0; i < this.days.length; i++) this.days[i] = 0;for (i = 0; i < days_in_month; i++)
this.days[i + day_of_week_first] = i + 1;var str = "<center>\n"+"<table width='" + this.width + "' border='0px' cellpadding='0' cellspacing='2' class='cal_table_c'>\n"+"<form>\n"+"  <tr class='cal_text_wdays'>\n";for (j = 0; j < arr_weekdays.length; j++){
str += "<td align='center' valign='middle' width='" + this.cell_width + "'>" + arr_weekdays[j] + "</td>\n";}str += "</tr>\n";for (i = 0; i < 6; i++){
str += "<tr align='center' valign='middle'>\n";	for(j = 0; j < 7; j++){var val = this.days[i * 7 + j];if (val > 0 && val < 10) val = " " + val + " ";if (this.days[i * 7 + j]) str += "    <td width='" + this.cell_width + " height='" + this.cell_height + "'><center><input type='button' value='" + val + "' onClick='document.all." + this.table_days_id +".ipicker.clicked_day(" + this.days[i * 7 + j] + ")' class='cal_btn_days'></center></td>\n";
else str += "<td width='" + this.cell_width + " height='" + this.cell_height + ">&nbsp;</td>\n";} str += "</tr>\n";}
str +="</form>\n"+"</table>\n"+"</center>\n"+"</td></tr></table>\n"+"</td></tr></table>\n";this.table_days.innerHTML = str;} function iDatPicker_popup_cal(iposX, iposY, ioffsX, ioffsY, sel_Date){this.left = iposX + ioffsX;this.top = iposY + ioffsY;
if (this.is_popup){	if (this.cal && this.window && !this.window.closed) this.window.close();else{this.create_cal();this.set_indate(sel_Date);this.show_days();
}}else{if (!this.cal){this.create_cal();this.set_indate(sel_Date);this.show_days();} else {if (NS4){return;} else {if (this.cal.style.visibility == 'visible') this.cal.style.visibility = 'hidden'; else {this.set_indate(sel_Date);this.show_days();this.cal.style.visibility = 'visible';}}}}}function iDatPicker_set_indate(sel_Date){
if (sel_Date > '' && sel_Date != null){ var tmpdate = sel_Date; tmpdate = tmpdate.replace('.', ';'); tmpdate = tmpdate.replace('.', ';'); tmpdate = tmpdate.replace(',', ';'); tmpdate = tmpdate.replace(',', ';');
var tmpt = tmpdate.split(';'); if(tmpt[2].length < 2) {tmpt[2] = '0' + tmpt[2];} if(tmpt[2].length < 3) {tmpt[2] = '0' + tmpt[2];} if(tmpt[2].length < 4) {tmpt[2] = '2' + tmpt[2];} this.sel_month = parseInt(tmpt[1],10) - 1; this.sel_year = parseInt(tmpt[2],10); this.month_sel = parseInt(tmpt[1],10) - 1; this.year_sel = parseInt(tmpt[2],10);}else{}}function iDatPicker_new_month(){
var month_select = this.cal.document.forms[this.select_form_id]['month_sel'];this.sel_month = new Number(month_select.options[month_select.selectedIndex].value);var year_select = this.cal.document.forms[this.select_form_id]['year_sel'];this.sel_year = new Number(year_select.options[year_select.selectedIndex].value);this.show_days();}function iDatPicker_prev_month(){if(this.sel_month < 1 && this.sel_year == curr_year){}else{this.sel_month--;
if (this.sel_month < 0){this.sel_month = 11;this.sel_year--;}this.show_days();}}function iDatPicker_next_month(){if(this.sel_month > 10 && this.sel_year >= (curr_year + numb_years - 1)){}else{this.sel_month++;
if (this.sel_month > 11){this.sel_month = 0;this.sel_year++;}this.show_days();}}function iDatPicker_clicked_day(iday){if (this.is_popup)this.window.close();else if (NS4)
return; else this.cal.style.visibility = 'hidden';var sel_date = new Date(this.sel_year, this.sel_month, iday);	if (this.handler) this.handler(this, sel_date);}function get_days_in_month(imon, iyear){var month = new Number(imon);var year = new Number(iyear);
var mdays = [ [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],	[31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ];	var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0; return mdays[isleap][month];}
