function CalendarPopup(){var c=new PopupWindow(arguments[0]);c.monthNames=new Array("Januar","Februar","M&auml;rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");c.monthAbbreviations=new Array("Jan","Feb","M&auml;r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez");c.dayHeaders=new Array("S","M","D","M","D","F","S");c.returnFunction="CP_tmpReturnFunction";c.returnMonthFunction="CP_tmpReturnMonthFunction";c.returnQuarterFunction="CP_tmpReturnQuarterFunction";c.returnYearFunction="CP_tmpReturnYearFunction";c.iconFilePath="";if(myWebRoot&&myWebRoot!=null&&typeof(myWebRoot)!="undefined"&&myWebRoot.length>0){c.iconFilePath=myWebRoot+"standard/admin/img/"}c.iconSingleGoLeftFile="icon-single-go-left.gif";c.iconSingleGoLeftName="&lt;";c.iconSingleGoRightFile="icon-single-go-right.gif";c.iconSingleGoRightName="&gt;";c.iconGoLeftFile="icon-go-left.gif";c.iconGoLeftName="&lt;&lt;";c.iconGoRightFile="icon-go-right.gif";c.iconGoRightName="&gt;&gt;";c.weekStartDay=1;c.displayType="date";c.disabledWeekDays=new Object();c.disabledDatesExpression="";c.disabledDates=new Array();c.yearSelectStartOffset=100;c.currentDate=null;c.todayText="Heute";c.copyrightYear="";c.name="Calendar";c.isShowYearNavigation=false;c.isShowNavigationDropdowns=true;c.isShowYearNavigationInput=false;window.CP_calendarObject=null;window.CP_targetInput=null;window.CP_dateFormat="MM/dd/yyyy";c.copyMonthNamesToWindow=CP_copyMonthNamesToWindow;c.setReturnFunction=CP_setReturnFunction;c.setReturnMonthFunction=CP_setReturnMonthFunction;c.setReturnQuarterFunction=CP_setReturnQuarterFunction;c.setReturnYearFunction=CP_setReturnYearFunction;c.setMonthNames=CP_setMonthNames;c.setMonthAbbreviations=CP_setMonthAbbreviations;c.setDayHeaders=CP_setDayHeaders;c.setWeekStartDay=CP_setWeekStartDay;c.setDisplayType=CP_setDisplayType;c.setDisabledWeekDays=CP_setDisabledWeekDays;c.addDisabledDates=CP_addDisabledDates;c.cancelDisabledDates=CP_cancelDisabledDates;c.setYearSelectStartOffset=CP_setYearSelectStartOffset;c.setTodayText=CP_setTodayText;c.setIconFilePath=CP_setIconFilePath;c.setIconSingleGoLeftFile=CP_setIconSingleGoLeftFile;c.setIconSingleGoLeftName=CP_setIconSingleGoLeftName;c.setIconSingleGoRightFile=CP_setIconSingleGoRightFile;c.setIconSingleGoRightName=CP_setIconSingleGoRightName;c.setIconGoLeftFile=CP_setIconGoLeftFile;c.setIconGoLeftName=CP_setIconGoLeftName;c.setIconGoRightFile=CP_setIconGoRightFile;c.setIconGoRightName=CP_setIconGoRightName;c.setCopyrightYear=CP_setCopyrightYear;c.setName=CP_setName;c.showYearNavigation=CP_showYearNavigation;c.showCalendar=CP_showCalendar;c.hideCalendar=CP_hideCalendar;c.refreshCalendar=CP_refreshCalendar;c.getCalendar=CP_getCalendar;c.select=CP_select;c.hideNavigationDropdowns=CP_hideNavigationDropdowns;c.showYearNavigationInput=CP_showYearNavigationInput;c.copyMonthNamesToWindow();return c}function CP_selectToday(index){var now=new Date();CP_refreshCalendar(index,(now.getMonth()+1),now.getFullYear(),now.getDate())}function CP_copyMonthNamesToWindow(){if(typeof(window.MONTH_NAMES)!="undefined"&&window.MONTH_NAMES!=null){window.MONTH_NAMES=new Array();for(var i=0;i<this.monthNames.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthNames[i]}for(var i=0;i<this.monthAbbreviations.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthAbbreviations[i]}}}function CP_tmpReturnFunction(y,m,d){if(window.CP_targetInput!=null){var dt=new Date(y,m-1,d,0,0,0);if(window.CP_calendarObject!=null){window.CP_calendarObject.copyMonthNamesToWindow()}window.CP_targetInput.value=myFormatDate(dt,window.CP_dateFormat);if(window.CP_targetInput.onblur){window.CP_targetInput.onblur()}}else{alert("Use setReturnFunction() to define which function will get the clicked results!")}}function CP_tmpReturnMonthFunction(y,m){alert("Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year="+y+" , month="+m)}function CP_tmpReturnQuarterFunction(y,q){alert("Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year="+y+" , quarter="+q)}function CP_tmpReturnYearFunction(y){alert("Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year="+y)}function CP_setReturnFunction(name){this.returnFunction=name}function CP_setReturnMonthFunction(name){this.returnMonthFunction=name}function CP_setReturnQuarterFunction(name){this.returnQuarterFunction=name}function CP_setReturnYearFunction(name){this.returnYearFunction=name}function CP_setMonthNames(){for(var i=0;i<arguments.length;i++){this.monthNames[i]=arguments[i]}this.copyMonthNamesToWindow()}function CP_setMonthAbbreviations(){for(var i=0;i<arguments.length;i++){this.monthAbbreviations[i]=arguments[i]}this.copyMonthNamesToWindow()}function CP_setDayHeaders(){for(var i=0;i<arguments.length;i++){this.dayHeaders[i]=arguments[i]}}function CP_setCopyrightYear(year){this.copyrightYear=year}function CP_setName(name){this.name=name}function CP_setIconFilePath(path){this.iconFilePath=path}function CP_setIconSingleGoLeftFile(file){this.iconSingleGoLeftFile=file}function CP_setIconSingleGoLeftName(name){this.iconSingleGoLeftName=name}function CP_setIconSingleGoRightFile(file){this.iconSingleGoRightFile=file}function CP_setIconSingleGoRightName(name){this.iconSingleGoRightName=name}function CP_setIconGoLeftFile(file){this.iconGoLeftFile=file}function CP_setIconGoLeftName(name){this.iconGoLeftName=name}function CP_setIconGoRightFile(file){this.iconGoRightFile=file}function CP_setIconGoRightName(name){this.iconGoRightName=name}function CP_setWeekStartDay(day){this.weekStartDay=day}function CP_showYearNavigation(){if(arguments.length>0){this.isShowYearNavigation=arguments[0]}else{this.isShowYearNavigation=true}}function CP_setDisplayType(type){if(type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false}this.displayType=type;return true}function CP_setYearSelectStartOffset(num){this.yearSelectStartOffset=num}function CP_setDisabledWeekDays(){this.disabledWeekDays=new Object();for(var i=0;i<arguments.length;i++){this.disabledWeekDays[arguments[i]]=true}}function CP_addDisabledDates(start,end,title){if(arguments.length==1||end==null){end=start}if(start!=null||end!=null){var disabledDate={};disabledDate.start=start;disabledDate.end=end;disabledDate.title=title;this.disabledDates[this.disabledDates.length]=disabledDate;if(this.disabledDatesExpression!=""){this.disabledDatesExpression+="||"}if(start!=null){start=myParseDate(start,true);start=""+start.getFullYear()+LZ(start.getMonth()+1)+LZ(start.getDate())}if(end!=null){end=myParseDate(end,true);end=""+end.getFullYear()+LZ(end.getMonth()+1)+LZ(end.getDate())}if(start==null){this.disabledDatesExpression+="(ds<="+end+")"}else{if(end==null){this.disabledDatesExpression+="(ds>="+start+")"}else{this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")"}}}}function CP_cancelDisabledDates(){this.disabledDatesExpression=""}function CP_setTodayText(text){this.todayText=text}function CP_hideNavigationDropdowns(){if(arguments.length>0){this.isShowNavigationDropdowns=!arguments[0]}else{this.isShowNavigationDropdowns=false}}function CP_showYearNavigationInput(){if(arguments.length>0){this.isShowYearNavigationInput=arguments[0]}else{this.isShowYearNavigationInput=true}}function CP_hideCalendar(){if(arguments.length>0){window.popupWindowObjects[arguments[0]].hidePopup()}else{this.hidePopup()}}function CP_refreshCalendar(index){var calObject=window.popupWindowObjects[index];if(arguments.length>1){calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))}else{calObject.populate(calObject.getCalendar())}calObject.refresh()}function CP_showCalendar(anchorname){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date()}else{this.currentDate=new Date(parseDate(arguments[1]))}}this.populate(this.getCalendar());this.showPopup(anchorname)}function CP_select(inputobj,linkname,format){if(arguments.length>3){var selectedDate=arguments[3]}else{var selectedDate=true}if(!window.myGetDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return}if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return}if(inputobj.type!="text"&&inputobj.type!="hidden"&&inputobj.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return}if(inputobj.disabled){return}window.CP_targetInput=inputobj;window.CP_calendarObject=this;this.currentDate=null;var time=0;if(selectedDate!=null){time=myGetDateFromFormat(selectedDate,format)}else{if(inputobj.value!=""){time=myGetDateFromFormat(inputobj.value,format)}}if(selectedDate!=null||inputobj.value!=""){if(time==0){this.currentDate=null}else{this.currentDate=new Date(time)}}window.CP_dateFormat=format;this.showCalendar(linkname)}function CP_getCalendar(){var now=new Date();var result="";result+='<table class="cpBorder" cellspacing="0" cellpadding="1"><tr><td>';if(this.displayType=="date"||this.displayType=="week-end"){if(arguments.length>2||this.currentDate==null){this.currentDate=now}if(arguments.length>0){var month=arguments[0]}else{var month=this.currentDate.getMonth()+1}if(arguments.length>1&&arguments[1]>0&&(arguments[1]-0)==arguments[1]){var year=arguments[1]}else{var year=this.currentDate.getFullYear()}var daysinmonth=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if((((year%4)==0)&&((year%100)!=0))||((year%400)==0)){daysinmonth[2]=29}var current_month=new Date(year,month-1,1);var display_year=year;var display_month=month;var display_date=1;var weekday=current_month.getDay();var offset=0;if(weekday>=this.weekStartDay){offset=weekday-this.weekStartDay}else{offset=7-this.weekStartDay+weekday}if(offset>0){display_month--;if(display_month<1){display_month=12;display_year--}display_date=daysinmonth[display_month]-offset+1}var next_month=month+1;var next_month_year=year;if(next_month>12){next_month=1;next_month_year++}var last_month=month-1;var last_month_year=year;if(last_month<1){last_month=12;last_month_year--}var date_class;result+='<table cellspacing="0" cellpadding="0"><tr>';var refresh="CP_refreshCalendar";var refreshLink="javascript:"+refresh;if(this.isShowNavigationDropdowns){result+='<td class="myMonthNavigation" colspan="3">';result+='<select class="myMonthNavigation" name="cpMonth" id="cpMonth" onChange="'+refresh+"("+this.index+",this.options[this.selectedIndex].value-0,"+(year-0)+');">';for(var monthCounter=1;monthCounter<=12;monthCounter++){var selected="";if(monthCounter==month){selected="selected"}result+='<option value="'+monthCounter+'" '+selected+">"+this.monthNames[monthCounter-1]+"</option>"}result+="</select></td>";result+='<td class="myMonthNavigation">&nbsp;</td>';result+='<td class="myYearNavigation" colspan="3">';result+='<select class="myYearNavigation" name="cpYear" id="cpYear" onChange="'+refresh+"("+this.index+","+month+',this.options[this.selectedIndex].value-0);">';for(var yearCounter=(year-this.yearSelectStartOffset);yearCounter<=(year+this.yearSelectStartOffset);yearCounter++){var selected="";if(yearCounter==year){selected="selected"}result+='<option value="'+yearCounter+'" '+selected+">"+yearCounter+"</option>"}result+="</select></td>"}else{if(this.isShowYearNavigation){result+='<td class="myMonthNavigation"><a class="myMonthNavigation" href="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+');"><img src="'+this.iconFilePath+this.iconSingleGoLeftFile+'" alt="'+this.iconSingleGoLeftName+'" title="'+this.iconSingleGoLeftName+'" /></a></td>';result+='<td class="myMonthNavigation">&nbsp;'+this.monthNames[month-1]+"&nbsp;</td>";result+='<td class="myMonthNavigation"><a class="myMonthNavigation" href="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+');"><img src="'+this.iconFilePath+this.iconSingleGoRightFile+'" alt="'+this.iconSingleGoRightName+'" title="'+this.iconSingleGoRightName+'" /></a></td>';result+='<td class="myMonthNavigation">&nbsp;</td>';result+='<td class="myYearNavigation"><a class="myYearNavigation" href="'+refreshLink+"("+this.index+","+month+","+(year-1)+');"><img src="'+this.iconFilePath+this.iconSingleGoLeftFile+'" alt="'+this.iconSingleGoLeftName+'" title="'+this.iconSingleGoLeftName+'" /></a></td>';if(this.isShowYearNavigationInput){result+='<td class="myYearNavigation">&nbsp;<input name="cpYear" id="cpYear" class="myYearNavigation" size="4" maxlength="4" value="'+year+'" onBlur="'+refresh+"("+this.index+","+month+',this.value-0);">&nbsp;</td>'}else{result+='<td class="myYearNavigation">&nbsp;'+year+"&nbsp;</td>"}result+='<td class="myYearNavigation"><a class="myYearNavigation" href="'+refreshLink+"("+this.index+","+month+","+(year+1)+');"><img src="'+this.iconFilePath+this.iconSingleGoRightFile+'" alt="'+this.iconSingleGoRightName+'" title="'+this.iconSingleGoRightName+'" /></a></td>'}else{result+='<td class="myMonthNavigation"><a class="myMonthNavigation" href="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+');"><img src="'+this.iconFilePath+this.iconGoLeftFile+'" alt="'+this.iconGoLeftName+'" title="'+this.iconGoLeftName+'" /></a></td>';result+='<td class="myMonthNavigation">&nbsp;'+this.monthNames[month-1]+" "+year+"&nbsp;</td>";result+='<td class="myMonthNavigation"><a class="myMonthNavigation" href="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+');"><img src="'+this.iconFilePath+this.iconGoRightFile+'" alt="'+this.iconGoRightName+'" title="'+this.iconGoRightName+'" /></a></td>'}}result+='</tr></table><table cellspacing="0" cellpadding="1"><tr>';for(var j=0;j<7;j++){result+='<td class="myDayColumnHeader">'+this.dayHeaders[((this.weekStartDay+j)%7)]+"</td>"}result+="</tr>";for(var row=1;row<=6;row++){result+="<tr>";for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")")}var dateClass="";if((display_month==(now.getMonth()+1))&&(display_date==now.getDate())&&(display_year==now.getFullYear())){dateClass="myCurrentDate "}if((display_month==(this.currentDate.getMonth()+1))&&(display_date==this.currentDate.getDate())&&(display_year==this.currentDate.getFullYear())){dateClass+="mySelectedDate"}else{if(display_month==month){dateClass+="myCurrentMonthDate"}else{dateClass+="myOtherMonthDate"}}if(disabled||this.disabledWeekDays[((col-1)+this.weekStartDay)]){var title=null;if(disabled){var tmpShownDate=new Date(display_year,display_month-1,display_date,0,0,0,0);for(var disabledDateIndex=0;disabledDateIndex<this.disabledDates.length;disabledDateIndex++){var tmpStartDate=this.disabledDates[disabledDateIndex].start;var tmpEndDate=this.disabledDates[disabledDateIndex].end;if((tmpStartDate==null||(myParseDate(tmpStartDate,true).getTime()-86400000)<=tmpShownDate.getTime())&&(tmpEndDate==null||myParseDate(tmpEndDate,true).getTime()>=tmpShownDate.getTime())){title=this.disabledDates[disabledDateIndex].title}}}result+='<td class="'+dateClass+'Disabled" ';if(title!=null&&title!=""){result+='title="'+title+'"'}result+=">"+display_date+"</td>"}else{var selected_date=display_date;var selected_month=display_month;var selected_year=display_year;if(this.displayType=="week-end"){var d=new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate((d.getDate()+(7-col)));selected_year=d.getYear();if(selected_year<1000){selected_year+=1900}selected_month=d.getMonth()+1;selected_date=d.getDate()}result+='<td class="'+dateClass+'"><a href="#" onclick="'+this.returnFunction+"("+selected_year+","+selected_month+","+selected_date+");CP_hideCalendar('"+this.index+'\'); return false;" class="'+dateClass+'">'+display_date+"</a></td>"}display_date++;if(display_date>daysinmonth[display_month]){display_date=1;display_month++}if(display_month>12){display_month=1;display_year++}}result+="</tr>"}var current_weekday=now.getDay()-this.weekStartDay;if(current_weekday<0){current_weekday+=7}result+="<tr>";result+='<td class="myTodayText"><a href="#" onclick="'+refreshLink+"("+this.index+","+month+","+(year-1)+'); return false;"><img src="'+this.iconFilePath+this.iconGoLeftFile+'" alt="'+this.iconGoLeftName+'" title="'+this.iconGoLeftName+'" /></a></td>';result+='<td class="myTodayText"><a href="#" onclick="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+'); return false;"><img src="'+this.iconFilePath+this.iconSingleGoLeftFile+'" alt="'+this.iconSingleGoLeftName+'" title="'+this.iconSingleGoLeftName+'" /></a></td>';result+='<td colspan="3" class="myTodayText">';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")")}result+='<a class="myTodayText" href="#" onclick="CP_selectToday( '+this.index+' ); return false;">'+this.todayText+"</a>";result+="</td>";result+='<td class="myTodayText"><a href="#" onclick="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+'); return false;"><img src="'+this.iconFilePath+this.iconSingleGoRightFile+'" alt="'+this.iconSingleGoRightName+'" title="'+this.iconSingleGoRightName+'" /></a></td>';result+='<td class="myTodayText"><a href="#" onclick="'+refreshLink+"("+this.index+","+month+","+(year+1)+'); return false;"><img src="'+this.iconFilePath+this.iconGoRightFile+'" alt="'+this.iconGoRightName+'" title="'+this.iconGoRightName+'" /></a></td>';result+="</tr></table></td></tr></table>"}if(this.displayType=="month"||this.displayType=="quarter"||this.displayType=="year"){if(arguments.length>0){var year=arguments[0]}else{if(this.displayType=="year"){var year=now.getFullYear()-this.yearSelectStartOffset}else{var year=now.getFullYear()}}if(this.displayType!="year"&&this.isShowYearNavigation){result+='<tablecellspacing="0" cellpadding="0"><tr>';result+='<td class="myYearNavigation"><a class="myYearNavigation" href="#" onclick="CP_refreshCalendar('+this.index+","+(year-1)+');"><img src="'+this.iconFilePath+this.iconGoLeftFile+'" alt="'+this.iconGoLeftName+'" title="'+this.iconGoLeftName+'" /></a></td>';result+='<td class="myYearNavigation">'+year+"</td>";result+='<td class="myYearNavigation"><a class="myYearNavigation" href="#" onclick="CP_refreshCalendar('+this.index+","+(year+1)+');"><img src="'+this.iconFilePath+this.iconGoRightFile+'" alt="'+this.iconGoRightName+'" title="'+this.iconGoRightName+'" /></a></td>';result+="</tr></table>"}}if(this.displayType=="month"){result+='<table cellspacing="1" cellpadding="0">';for(var i=0;i<4;i++){result+="<tr>";for(var j=0;j<3;j++){var monthindex=((i*3)+j);result+='<td><a class="myText" href="#" onclick="'+this.returnMonthFunction+"("+year+","+(monthindex+1)+");CP_hideCalendar('"+this.index+'\');" class="'+date_class+'">'+this.monthAbbreviations[monthindex]+"</a></td>"}result+="</tr>"}result+="</table></td></tr></table>"}if(this.displayType=="quarter"){result+='<br /><table cellspacing="0" cellpadding="0">';for(var i=0;i<2;i++){result+="<tr>";for(var j=0;j<2;j++){var quarter=((i*2)+j+1);result+='<td><br /><a class="myText" href="#" onclick="'+this.returnQuarterFunction+"("+year+","+quarter+");CP_hideCalendar('"+this.index+'\');" class="'+date_class+'">Q'+quarter+"</a><br />&nbsp;<br /></td>"}result+="</tr>"}result+="</table></td></tr></table>"}if(this.displayType=="year"){var yearColumnSize=4;result+='<table cellspacing="0" cellpadding="0"><tr>';result+='<td class="myYearNavigation"><a class="myYearNavigation" href="#" onclick="CP_refreshCalendar('+this.index+","+(year-(yearColumnSize*2))+');"><img src="'+this.iconFilePath+this.iconGoLeftFile+'" alt="'+this.iconGoLeftName+'" title="'+this.iconGoLeftName+'" /></a></td>';result+='<td class="myYearNavigation"><a class="myYearNavigation" href="#" onclick="CP_refreshCalendar('+this.index+","+(year+(yearColumnSize*2))+');"><img src="'+this.iconFilePath+this.iconGoRightFile+'" alt="'+this.iconGoRightName+'" title="'+this.iconGoRightName+'" /></a></td>';result+="</tr></table>";result+='<table cellspacing="1" cellpadding="0">';for(var i=0;i<yearColumnSize;i++){result+="<tr>";for(var j=0;j<2;j++){var currentyear=(year+(j*yearColumnSize)+i);result+='<td><a class="myText" href="#" onclick="'+this.returnYearFunction+"("+currentyear+");CP_hideCalendar('"+this.index+'\');" class="'+date_class+'">'+currentyear+"</a></td>"}result+="</tr>"}result+="</table></td></tr></table>"}return result};
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");var SHORT_DAY_NAMES=new Array("Su.","Mo.","Tu.","We.","Th.","Fr.","Sa.");function LZ(x){var returnValue="";if(x>=0&&x<=9){returnValue+="0"}returnValue+=x;return returnValue}function myIsDate(val,format){var date=myGetDateFromFormat(val,format);if(date==0){return false}return true}function myCompareDates(date1,dateformat1,date2,dateformat2){var returnValue=0;var d1=myGetDateFromFormat(date1,dateformat1);var d2=myGetDateFromFormat(date2,dateformat2);if(d1==0||d2==0){returnValue=-1}else{if(d1>d2){returnValue=1}}return returnValue}function myFormatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length<4){y=""+(y-0+1900)}value.y=""+y;value.yyyy=y;value.yy=y.substring(2,4);value.M=M;value.MM=LZ(M);value.MMM=MONTH_NAMES[M-1];value.NNN=MONTH_NAMES[M+11];value.d=d;value.dd=LZ(d);value.E=DAY_NAMES[E+7];value.EE=DAY_NAMES[E];value.H=H;value.HH=LZ(H);if(H==0){value.h=12}else{if(H>12){value.h=H-12}else{value.h=H}}value.hh=LZ(value.h);if(H>11){value.K=H-12}else{value.K=H}value.k=H+1;value.KK=LZ(value.K);value.kk=LZ(value.k);if(H>11){value.a="PM"}else{value.a="AM"}value.m=m;value.mm=LZ(m);value.s=s;value.ss=LZ(s);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}function myIsInteger(val){var digits="1234567890";for(var i=0;i<val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false}}return true}function myGetInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length<minlength){return null}if(myIsInteger(token)){return token}}return null}function myGetDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getFullYear();var month=now.getMonth()+1;var date=1;var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";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(token=="yyyy"||token=="yy"||token=="y"){if(token=="yyyy"){x=4;y=4}if(token=="yy"){x=2;y=2}if(token=="y"){x=2;y=4}year=myGetInt(val,i_val,x,y);if(year==null){return 0}i_val+=year.length;if(year.length==2){if(year>(now.getFullYear()-1990)){year=1900+(year-0)}else{year=2000+(year-0)}}}else{if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<MONTH_NAMES.length;i++){var month_name=MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12){month-=12}i_val+=month_name.length;break}}}if((month<1)||(month>12)){return 0}}else{if(token=="EE"||token=="E"){for(var i=0;i<DAY_NAMES.length;i++){var day_name=DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val+=day_name.length;break}}}else{if(token=="MM"||token=="M"){month=myGetInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return 0}i_val+=month.length}else{if(token=="dd"||token=="d"){date=myGetInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0}i_val+=date.length}else{if(token=="hh"||token=="h"){hh=myGetInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0}i_val+=hh.length}else{if(token=="HH"||token=="H"){hh=myGetInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0}i_val+=hh.length}else{if(token=="KK"||token=="K"){hh=myGetInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0}i_val+=hh.length}else{if(token=="kk"||token=="k"){hh=myGetInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0}i_val+=hh.length;hh--}else{if(token=="mm"||token=="m"){mm=myGetInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0}i_val+=mm.length}else{if(token=="ss"||token=="s"){ss=myGetInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0}i_val+=ss.length}else{if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM"}else{if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM"}else{return 0}}i_val+=2}else{if(val.substring(i_val,i_val+token.length)!=token){return 0}else{i_val+=token.length}}}}}}}}}}}}}}if(i_val!=val.length){return 0}if(month==2){if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29){return 0}}else{if(date>28){return 0}}}else{if((month==4)||(month==6)||(month==9)||(month==11)){if(date>30){return 0}}else{if(date>31){return 0}}}if(hh<12&&ampm=="PM"){hh=hh-0+12}else{if(hh>11&&ampm=="AM"){hh-=12}}var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime()}function myParseDate(val){var preferEuro=false;if(arguments.length==2){preferEuro=arguments[1]}val=val.replace(/,/g,".");generalFormats=new Array("y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d");generalFormatsWithHours=new Array("y-M-d H","MMM d, y H","MMM d,y H","y-MMM-d H","d-MMM-y H","MMM d H");generalFormatsWithHoursAndMinutes=new Array("y-M-d H:m","MMM d, y H:m","MMM d,y H:m","y-MMM-d H:m","d-MMM-y H:m","MMM d H:m","y-M-d H.m","MMM d, y H.m","MMM d,y H.m","y-MMM-d H.m","d-MMM-y H.m","MMM d H.m");generalFormatsWithHoursAndMinutesAnsSeconds=new Array("y-M-d H:m:s","MMM d, y H:m:s","MMM d,y H:m:s","y-MMM-d H:m:s","d-MMM-y H:m:s","MMM d H:m:s","y-M-d H.m.s","MMM d, y H.m.s","MMM d,y H.m.s","y-MMM-d H.m.s","d-MMM-y H.m.s","MMM d H.m.s","y-M-d H:m.s","MMM d, y H:m.s","MMM d,y H:m.s","y-MMM-d H:m.s","d-MMM-y H:m.s","MMM d H:m.s","y-M-d H.m:s","MMM d, y H.m:s","MMM d,y H.m:s","y-MMM-d H.m:s","d-MMM-y H.m:s","MMM d H.m:s");generalFormatsWithHoursAndMinutesAnsSecondsAndMillis=new Array("y-M-d H:m:s:S","MMM d, y H:m:s:S","MMM d,y H:m:s:S","y-MMM-d H:m:s:S","d-MMM-y H:m:s:S","MMM d H:m:s:S","y-M-d H:m:s.S","MMM d, y H:m:s.S","MMM d,y H:m:s.S","y-MMM-d H:m:s.S","d-MMM-y H:m:s.S","MMM d H:m:s.S","y-M-d H.m.s.S","MMM d, y H.m.s.S","MMM d,y H.m.s.S","y-MMM-d H.m.s.S","d-MMM-y H.m.s.S","MMM d H.m.s.S");monthFirst=new Array("M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d");monthFirstWithHours=new Array("M/d/y H","M-d-y H","M.d.y H","MMM-d H","M/d H","M-d H");monthFirstWithHoursAndMinutes=new Array("M/d/y H:m","M-d-y H:m","M.d.y H:m","MMM-d H:m","M/d H:m","M-d H:m","M/d/y H.m","M-d-y H.m","M.d.y H.m","MMM-d H.m","M/d H.m","M-d H.m");monthFirstWithHoursAndMinutesAndSeconds=new Array("M/d/y H:m:s","M-d-y H:m:s","M.d.y H:m:s","MMM-d H:m:s","M/d H:m:s","M-d H:m:s","M/d/y H.m.s","M-d-y H.m.s","M.d.y H.m.s","MMM-d H.m.s","M/d H.m.s","M-d H.m.s","M/d/y H:m.s","M-d-y H:m.s","M.d.y H:m.s","MMM-d H:m.s","M/d H:m.s","M-d H:m.s","M/d/y H.m:s","M-d-y H.m:s","M.d.y H.m:s","MMM-d H.m:s","M/d H.m:s","M-d H.m:s");monthFirstWithHoursAndMinutesAndSecondsAndMillis=new Array("M/d/y H:m:s:S","M-d-y H:m:s:S","M.d.y H:m:s:S","MMM-d H:m:s:S","M/d H:m:s:S","M-d H:m:s:S","M/d/y H:m:s.S","M-d-y H:m:s.S","M.d.y H:m:s.S","MMM-d H:m:s.S","M/d H:m:s.S","M-d H:m:s.S","M/d/y H.m.s.S","M-d-y H.m.s.S","M.d.y H.m.s.S","MMM-d H.m.s.S","M/d H.m.s.S","M-d H.m.s.S");dateFirst=new Array("d/M/y","d-M-y","d.M.y","d.M.yyyy","d-MMM","d/M","d-M");dateFirstWithHours=new Array("d/M/y H","d-M-y H","d.M.y H","d.M.yyyy H","d-MMM H","d/M H","d-M H");dateFirstWithHoursAndMinutes=new Array("d/M/y H:m","d-M-y H:m","d.M.y H:m","d.M.yyyy H:m","d-MMM H:m","d/M H:m","d-M H:m","d/M/y H.m","d-M-y H.m","d.M.y H.m","d.M.yyyy H.m","d-MMM H.m","d/M H.m","d-M H.m");dateFirstWithHoursAndMinutesAndSeconds=new Array("d/M/y H:m:s","d-M-y H:m:s","d.M.y H:m:s","d.M.yyyy H:m:s","d-MMM H:m:s","d/M H:m:s","d-M H:m:s","d/M/y H.m.s","d-M-y H.m.s","d.M.y H.m.s","d.M.yyyy H.m.s","d-MMM H.m.s","d/M H.m.s","d-M H.m.s","d/M/y H:m.s","d-M-y H:m.s","d.M.y H:m.s","d.M.yyyy H:m.s","d-MMM H:m.s","d/M H:m.s","d-M H:m.s","d/M/y H.m:s","d-M-y H.m:s","d.M.y H.m:s","d.M.yyyy H.m:s","d-MMM H.m:s","d/M H.m:s","d-M H.m:s");dateFirstWithHoursAndMinutesAndSecondsAndMillis=new Array("d/M/y H:m:s:S","d-M-y H:m:s:S","d.M.y H:m:s:S","d.M.yyyy H:m:s:S","d-MMM H:m:s:S","d/M H:m:s:S","d-M H:m:s:S","d/M/y H:m:s.S","d-M-y H:m:s.S","d.M.y H:m:s.S","d.M.yyyy H:m:s.S","d-MMM H:m:s.S","d/M H:m:s.S","d-M H:m:s.S","d/M/y H.m.s.S","d-M-y H.m.s.S","d.M.y H.m.s.S","d.M.yyyy H.m.s.S","d-MMM H.m.s.S","d/M H.m.s.S","d-M H.m.s.S");var generalFormatsList=new Array("generalFormats","generalFormatsWithHours","generalFormatsWithHoursAndMinutes","generalFormatsWithHoursAndMinutesAnsSeconds","generalFormatsWithHoursAndMinutesAnsSecondsAndMillis");var monthFirstList=new Array("monthFirst","monthFirstWithHours","monthFirstWithHoursAndMinutes","monthFirstWithHoursAndMinutesAndSeconds","monthFirstWithHoursAndMinutesAndSecondsAndMillis");var dateFirstList=new Array("dateFirst","dateFirstWithHours","dateFirstWithHoursAndMinutes","dateFirstWithHoursAndMinutesAndSeconds","dateFirstWithHoursAndMinutesAndSecondsAndMillis");var d=null;for(var i=0;i<generalFormatsList.length;i++){var l=window[generalFormatsList[i]];for(var j=0;j<l.length;j++){d=myGetDateFromFormat(val,l[j]);if(d!=0){return new Date(d)}}}if(preferEuro){for(var i=0;i<dateFirstList.length;i++){var l=window[dateFirstList[i]];for(var j=0;j<l.length;j++){d=myGetDateFromFormat(val,l[j]);if(d!=0){return new Date(d)}}}for(var i=0;i<monthFirstList.length;i++){var l=window[monthFirstList[i]];for(var j=0;j<l.length;j++){d=myGetDateFromFormat(val,l[j]);if(d!=0){return new Date(d)}}}}else{for(var i=0;i<monthFirstList.length;i++){var l=window[monthFirstList[i]];for(var j=0;j<l.length;j++){d=myGetDateFromFormat(val,l[j]);if(d!=0){return new Date(d)}}}for(var i=0;i<dateFirstList.length;i++){var l=window[dateFirstList[i]];for(var j=0;j<l.length;j++){d=myGetDateFromFormat(val,l[j]);if(d!=0){return new Date(d)}}}}return null}function myGetFormattedDate(val,format,preferEuro,errMsg){var returnValue=val;if(val!=""){var date=myParseDate(val,preferEuro);if(date!=null){returnValue=myFormatDate(date,format)}else{if(errMsg&&typeof(errMsg)!="undefined"&&errMsg!=null&&errMsg!=""){alert(errMsg)}}}return returnValue}function myChangeDate(inputobj,format,changeindays){var myDate=(new Date()).getTime();if(inputobj.value!=""){myDate=myGetDateFromFormat(inputobj.value,format)}myDate=myDate+(changeindays*86400000);var tmpDate=new Date(myDate);inputobj.value=myFormatDate(tmpDate,format);inputobj.onblur()}function myUpdateWeekDay(weekdayobj,inputobj,format){if(weekdayobj!=null){var myDate=(new Date()).getTime();if(inputobj.value!=""){myDate=myGetDateFromFormat(inputobj.value,format)}var tmpDate=new Date(myDate);weekdayobj.firstChild.nodeValue=SHORT_DAY_NAMES[tmpDate.getDay()]}}function setDateMonthNames(){for(var i=0;i<arguments.length;i++){this.SHORT_DAY_NAMES[i]=arguments[i]}};
function PopupWindow_populate(contents){this.contents=contents;this.populated=false}function PopupWindow_refresh(){writeHTMLToLayer(this.divName,this.contents)}function PopupWindow_showPopup(anchorname){if(!this.populated&&(this.contents!="")){this.populated=true;this.refresh()}myReposLayerByLink(this.divName,myGetObj(anchorname),this.offsetX,this.offsetY,true,true);myShowLayer(this.divName)}function PopupWindow_hidePopup(){myHideLayer(this.divName)}function PopupWindow_isClicked(e){var returnValue=false;if(!e){e=window.event}var pointerX=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var pointerY=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var layer=myGetObj(this.divName);var layerPos=PopupWindow_cumulativeOffset(layer);var layerDimensions=PopupWindow_getDimensions(layer);var layerWidth=layerDimensions.width;var layerHeight=layerDimensions.height;if(pointerX>=layerPos.left&&pointerX<=layerPos.left+layerWidth&&pointerY>=layerPos.top&&pointerY<=layerPos.top+layerHeight){returnValue=true}return returnValue}function PopupWindow_getDimensions(element){var display=element.style.display;if(display!="none"&&display!=null){return{width:element.offsetWidth,height:element.offsetHeight}}var els=element.style;var origVisibility=els.visibility;var origPosition=els.position;var origDisplay=els.display;els.visibility="hidden";els.position="absolute";els.display="block";var origWidth=element.clientWidth;var origHeight=element.clientHeight;els.display=origDisplay;els.position=origPosition;els.visibility=origVisibility;return{width:origWidth,height:origHeight}}function PopupWindow_cumulativeOffset(element){var valueT=0;var valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent}while(element);return{left:valueL,top:valueT}}function PopupWindow_hideIfNotClicked(e){if(!this.isClicked(e)){this.hidePopup()}}function PopupWindow_hidePopupWindows(e){for(var i=0;i<popupWindowObjects.length;i++){if(popupWindowObjects[i]!=null){var p=popupWindowObjects[i];p.hideIfNotClicked(e)}}}function PopupWindow_attachListener(){window.popupWindowOldEventListener=document.onclick;if(window.popupWindowOldEventListener!=null){document.onclick=new Function("window.popupWindowOldEventListener();PopupWindow_hidePopupWindows();")}else{document.onclick=PopupWindow_hidePopupWindows}}function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0}if(!window.popupWindowObjects){window.popupWindowObjects=new Array()}if(!window.listenerAttached){window.listenerAttached=true;PopupWindow_attachListener()}this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.populated=false;this.visible=false;this.contents="";this.divName=arguments[0];this.offsetX=0;this.offsetY=0;this.populate=PopupWindow_populate;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.isClicked=PopupWindow_isClicked;this.hideIfNotClicked=PopupWindow_hideIfNotClicked};

