// =================================================================== // Author: Matt Kruse // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== // HISTORY // ------------------------------------------------------------------ // Feb 7, 2005: Fixed a CSS styles to use px unit // March 29, 2004: Added check in select() method for the form field // being disabled. If it is, just return and don't do anything. // March 24, 2004: Fixed bug - when month name and abbreviations were // changed, date format still used original values. // January 26, 2004: Added support for drop-down month and year // navigation (Thanks to Chris Reid for the idea) // September 22, 2003: Fixed a minor problem in YEAR calendar with // CSS prefix. // August 19, 2003: Renamed the function to get styles, and made it // work correctly without an object reference // August 18, 2003: Changed showYearNavigation and // showYearNavigationInput to optionally take an argument of // true or false // July 31, 2003: Added text input option for year navigation. // Added a per-calendar CSS prefix option to optionally use // different styles for different calendars. // July 29, 2003: Fixed bug causing the Today link to be clickable // even though today falls in a disabled date range. // Changed formatting to use pure CSS, allowing greater control // over look-and-feel options. // June 11, 2003: Fixed bug causing the Today link to be unselectable // under certain cases when some days of week are disabled // March 14, 2003: Added ability to disable individual dates or date // ranges, display as light gray and strike-through // March 14, 2003: Removed dependency on graypixel.gif and instead /// use table border coloring // March 12, 2003: Modified showCalendar() function to allow optional // start-date parameter // March 11, 2003: Modified select() function to allow optional // start-date parameter /* DESCRIPTION: This object implements a popup calendar to allow the user to select a date, month, quarter, or year. COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small positioning errors - usually with Window positioning - occur on the Macintosh platform. The calendar can be modified to work for any location in the world by changing which weekday is displayed as the first column, changing the month names, and changing the column headers for each day. USAGE: // Create a new CalendarPopup object of type WINDOW var cal = new CalendarPopup(); // Create a new CalendarPopup object of type DIV using the DIV named 'mydiv' var cal = new CalendarPopup('mydiv'); // Easy method to link the popup calendar with an input box. cal.select(inputObject, anchorname, dateFormat); // Same method, but passing a default date other than the field's current value cal.select(inputObject, anchorname, dateFormat, '01/02/2000'); // This is an example call to the popup calendar from a link to populate an // input box. Note that to use this, date.js must also be included!! Select // Set the type of date select to be used. By default it is 'date'. cal.setDisplayType(type); // When a date, month, quarter, or year is clicked, a function is called and // passed the details. You must write this function, and tell the calendar // popup what the function name is. // Function to be called for 'date' select receives y, m, d cal.setReturnFunction(functionname); // Function to be called for 'month' select receives y, m cal.setReturnMonthFunction(functionname); // Function to be called for 'quarter' select receives y, q cal.setReturnQuarterFunction(functionname); // Function to be called for 'year' select receives y cal.setReturnYearFunction(functionname); // Show the calendar relative to a given anchor cal.showCalendar(anchorname); // Hide the calendar. The calendar is set to autoHide automatically cal.hideCalendar(); // Set the month names to be used. Default are English month names cal.setMonthNames("January","February","March",...); // Set the month abbreviations to be used. Default are English month abbreviations cal.setMonthAbbreviations("Jan","Feb","Mar",...); // Show navigation for changing by the year, not just one month at a time cal.showYearNavigation(); // Show month and year dropdowns, for quicker selection of month of dates cal.showNavigationDropdowns(); // Set the text to be used above each day column. The days start with // sunday regardless of the value of WeekStartDay cal.setDayHeaders("S","M","T",...); // Set the day for the first column in the calendar grid. By default this // is Sunday (0) but it may be changed to fit the conventions of other // countries. cal.setWeekStartDay(1); // week is Monday - Sunday // Set the weekdays which should be disabled in the 'date' select popup. You can // then allow someone to only select week end dates, or Tuedays, for example cal.setDisabledWeekDays(0,1); // To disable selecting the 1st or 2nd days of the week // Selectively disable individual days or date ranges. Disabled days will not // be clickable, and show as strike-through text on current browsers. // Date format is any format recognized by parseDate() in date.js // Pass a single date to disable: cal.addDisabledDates("2003-01-01"); // Pass null as the first parameter to mean "anything up to and including" the // passed date: cal.addDisabledDates(null, "01/02/03"); // Pass null as the second parameter to mean "including the passed date and // anything after it: cal.addDisabledDates("Jan 01, 2003", null); // Pass two dates to disable all dates inbetween and including the two cal.addDisabledDates("January 01, 2003", "Dec 31, 2003"); // When the 'year' select is displayed, set the number of years back from the // current year to start listing years. Default is 2. // This is also used for year drop-down, to decide how many years +/- to display cal.setYearSelectStartOffset(2); // Text for the word "Today" appearing on the calendar cal.setTodayText("Today"); // The calendar uses CSS classes for formatting. If you want your calendar to // have unique styles, you can set the prefix that will be added to all the // classes in the output. // For example, normal output may have this: // Today // But if you set the prefix like this: cal.setCssPrefix("Test"); // The output will then look like: // Today // And you can define that style somewhere in your page. // When using Year navigation, you can make the year be an input box, so // the user can manually change it and jump to any year cal.showYearNavigationInput(); // Set the calendar offset to be different than the default. By default it // will appear just below and to the right of the anchorname. So if you have // a text box where the date will go and and anchor immediately after the // text box, the calendar will display immediately under the text box. cal.offsetX = 20; cal.offsetY = 20; NOTES: 1) Requires the functions in AnchorPosition.js and PopupWindow.js 2) Your anchor tag MUST contain both NAME and ID attributes which are the same. For example: 3) There must be at least a space between for IE5.5 to see the anchor tag correctly. Do not do with no space. 4) When a CalendarPopup object is created, a handler for 'onmouseup' is attached to any event handler you may have already defined. Do NOT define an event handler for 'onmouseup' after you define a CalendarPopup object or the autoHide() will not work correctly. 5) The calendar popup display uses style sheets to make it look nice. */ // CONSTRUCTOR for the CalendarPopup Object function CalendarPopup() { var c; if (arguments.length>0) { c = new PopupWindow(arguments[0]); } else { c = new PopupWindow(); c.setSize(150,175); } c.offsetX = -152; c.offsetY = 25; c.autoHide(); // Calendar-specific properties c.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); c.dayHeaders = new Array("S","M","T","W","T","F","S"); c.returnFunction = "CP_tmpReturnFunction"; c.returnMonthFunction = "CP_tmpReturnMonthFunction"; c.returnQuarterFunction = "CP_tmpReturnQuarterFunction"; c.returnYearFunction = "CP_tmpReturnYearFunction"; c.weekStartDay = 0; c.isShowYearNavigation = false; c.displayType = "date"; c.disabledWeekDays = new Object(); c.disabledDatesExpression = ""; c.yearSelectStartOffset = 2; c.currentDate = null; c.todayText="Today"; c.cssPrefix=""; c.isShowNavigationDropdowns=false; c.isShowYearNavigationInput=false; window.CP_calendarObject = null; window.CP_targetInput = null; window.CP_dateFormat = "MM/dd/yyyy"; // Method mappings 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.setYearSelectStartOffset = CP_setYearSelectStartOffset; c.setTodayText = CP_setTodayText; c.showYearNavigation = CP_showYearNavigation; c.showCalendar = CP_showCalendar; c.hideCalendar = CP_hideCalendar; c.getStyles = getCalendarStyles; c.refreshCalendar = CP_refreshCalendar; c.getCalendar = CP_getCalendar; c.select = CP_select; c.setCssPrefix = CP_setCssPrefix; c.showNavigationDropdowns = CP_showNavigationDropdowns; c.showYearNavigationInput = CP_showYearNavigationInput; c.copyMonthNamesToWindow(); // Return the object return c; } function CP_copyMonthNamesToWindow() { // Copy these values over to the date.js if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) { window.MONTH_NAMES = new Array(); for (var i=0; i\n"; result += '
\n'; } else { result += '
\n'; result += '
\n'; result += '
\n'; } // Code for DATE display (default) // ------------------------------- if (this.displayType=="date" || this.displayType=="week-end") { if (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; offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 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; if (this.type!="WINDOW") { result += ""; } result += '\n'; var refresh = windowref+'CP_refreshCalendar'; var refreshLink = 'javascript:' + refresh; if (this.isShowNavigationDropdowns) { result += ''; result += ''; result += ''; } else { if (this.isShowYearNavigation) { result += ''; result += ''; result += ''; result += ''; result += ''; if (this.isShowYearNavigationInput) { result += ''; } else { result += ''; } result += ''; } else { result += '\n'; result += '\n'; result += '\n'; } } result += '
 <'+this.monthNames[month-1]+'> <'+year+'><<'+this.monthNames[month-1]+' '+year+'>>
\n'; result += '\n'; result += '\n'; for (var j=0; j<7; j++) { result += '\n'; } result += '\n'; for (var row=1; row<=6; row++) { result += '\n'; 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 == this.currentDate.getMonth()+1) && (display_date==this.currentDate.getDate()) && (display_year==this.currentDate.getFullYear())) { dateClass = "cpCurrentDate"; } else if (display_month == month) { dateClass = "cpCurrentMonthDate"; } else { dateClass = "cpOtherMonthDate"; } if (disabled || this.disabledWeekDays[col-1]) { result += ' \n'; } 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 += ' \n'; } display_date++; if (display_date > daysinmonth[display_month]) { display_date=1; display_month++; } if (display_month > 12) { display_month=1; display_year++; } } result += ''; } var current_weekday = now.getDay() - this.weekStartDay; if (current_weekday < 0) { current_weekday += 7; } result += '\n'; result += '
'+this.dayHeaders[(this.weekStartDay+j)%7]+'
'+display_date+''+display_date+'
\n'; if (this.disabledDatesExpression!="") { var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate()); eval("disabled=("+this.disabledDatesExpression+")"); } if (disabled || this.disabledWeekDays[current_weekday+1]) { result += ' '+this.todayText+'\n'; } else { result += ' '+this.todayText+'\n'; } result += '
\n'; result += '
\n'; } // Code common for MONTH, QUARTER, YEAR // ------------------------------------ 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 += ""; result += '\n'; result += ' \n'; result += ' \n'; result += ' \n'; result += '
<<'+year+'>>
\n'; } } // Code for MONTH display // ---------------------- if (this.displayType=="month") { // If POPUP, write entire HTML document result += '\n'; for (var i=0; i<4; i++) { result += ''; for (var j=0; j<3; j++) { var monthindex = ((i*3)+j); result += ''; } result += ''; } result += '
'+this.monthAbbreviations[monthindex]+'
\n'; } // Code for QUARTER display // ------------------------ if (this.displayType=="quarter") { result += '
\n'; for (var i=0; i<2; i++) { result += ''; for (var j=0; j<2; j++) { var quarter = ((i*2)+j+1); result += ''; } result += ''; } result += '

Q'+quarter+'

\n'; } // Code for YEAR display // --------------------- if (this.displayType=="year") { var yearColumnSize = 4; result += ""; result += '\n'; result += ' \n'; result += ' \n'; result += '
<<>>
\n'; result += '\n'; for (var i=0; i'+currentyear+''; } result += ''; } result += '
\n'; } // Common if (this.type == "WINDOW") { result += "\n"; } return result; } // =================================================================== // Author: Matt Kruse // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== /* AnchorPosition.js Author: Matt Kruse Last modified: 10/11/02 DESCRIPTION: These functions find the position of an tag in a document, so other elements can be positioned relative to it. COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small positioning errors - usually with Window positioning - occur on the Macintosh platform. FUNCTIONS: getAnchorPosition(anchorname) Returns an Object() having .x and .y properties of the pixel coordinates of the upper-left corner of the anchor. Position is relative to the PAGE. getAnchorWindowPosition(anchorname) Returns an Object() having .x and .y properties of the pixel coordinates of the upper-left corner of the anchor, relative to the WHOLE SCREEN. NOTES: 1) For popping up separate browser windows, use getAnchorWindowPosition. Otherwise, use getAnchorPosition 2) Your anchor tag MUST contain both NAME and ID attributes which are the same. For example: 3) There must be at least a space between for IE5.5 to see the anchor tag correctly. Do not do with no space. */ // getAnchorPosition(anchorname) // This function returns an object having .x and .y properties which are the coordinates // of the named anchor, relative to the page. function getAnchorPosition(anchorname) { // This function will return an Object with x and y properties var useWindow=false; var coordinates=new Object(); var x=0,y=0; // Browser capability sniffing var use_gebi=false, use_css=false, use_layers=false; if (document.getElementById) { use_gebi=true; } else if (document.all) { use_css=true; } else if (document.layers) { use_layers=true; } // Logic to find position if (use_gebi && document.all) { x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); } else if (use_gebi) { var o=document.getElementById(anchorname); x=AnchorPosition_getPageOffsetLeft(o); y=AnchorPosition_getPageOffsetTop(o); } else if (use_css) { x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); } else if (use_layers) { var found=0; for (var i=0; i // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== // HISTORY // ------------------------------------------------------------------ // May 17, 2003: Fixed bug in parseDate() for dates <1970 // March 11, 2003: Added parseDate() function // March 11, 2003: Added "NNN" formatting option. Doesn't match up // perfectly with SimpleDateFormat formats, but // backwards-compatability was required. // ------------------------------------------------------------------ // These functions use the same 'format' strings as the // java.text.SimpleDateFormat class, with minor exceptions. // The format string consists of the following abbreviations: // // Field | Full Form | Short Form // -------------+--------------------+----------------------- // Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) // Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits) // | NNN (abbr.) | // Day of Month | dd (2 digits) | d (1 or 2 digits) // Day of Week | EE (name) | E (abbr) // Hour (1-12) | hh (2 digits) | h (1 or 2 digits) // Hour (0-23) | HH (2 digits) | H (1 or 2 digits) // Hour (0-11) | KK (2 digits) | K (1 or 2 digits) // Hour (1-24) | kk (2 digits) | k (1 or 2 digits) // Minute | mm (2 digits) | m (1 or 2 digits) // Second | ss (2 digits) | s (1 or 2 digits) // AM/PM | a | // // NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm! // Examples: // "MMM d, y" matches: January 01, 2000 // Dec 1, 1900 // Nov 20, 00 // "M/d/yy" matches: 01/20/00 // 9/2/00 // "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM" // ------------------------------------------------------------------ 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'); function LZ(x) {return(x<0||x>9?"":"0")+x} // ------------------------------------------------------------------ // isDate ( date_string, format_string ) // Returns true if date string matches format of format string and // is a valid date. Else returns false. // It is recommended that you trim whitespace around the value before // passing it to this function, as whitespace is NOT ignored! // ------------------------------------------------------------------ function isDate(val,format) { var date=getDateFromFormat(val,format); if (date==0) { return false; } return true; } // ------------------------------------------------------------------- // compareDates(date1,date1format,date2,date2format) // Compare two date strings to see which is greater. // Returns: // 1 if date1 is greater than date2 // 0 if date2 is greater than date1 of if they are the same // -1 if either of the dates is in an invalid format // ------------------------------------------------------------------- function compareDates(date1,dateformat1,date2,dateformat2) { var d1=getDateFromFormat(date1,dateformat1); var d2=getDateFromFormat(date2,dateformat2); if (d1==0 || d2==0) { return -1; } else if (d1 > d2) { return 1; } return 0; } // ------------------------------------------------------------------ // formatDate (date_object, format) // Returns a date in the output format specified. // The format string uses the same abbreviations as in getDateFromFormat() // ------------------------------------------------------------------ function formatDate(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; // Convert real date parts into formatted versions 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; } // ------------------------------------------------------------------ // Utility functions for parsing in getDateFromFormat() // ------------------------------------------------------------------ function _isInteger(val) { var digits="1234567890"; for (var i=0; i < val.length; i++) { if (digits.indexOf(val.charAt(i))==-1) { return false; } } return true; } function _getInt(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 (_isInteger(token)) { return token; } } return null; } // ------------------------------------------------------------------ // getDateFromFormat( date_string , format_string ) // // This function takes a date string and a format string. It matches // If the date string matches the format string, it returns the // getTime() of the date. If it does not match, it returns 0. // ------------------------------------------------------------------ function getDateFromFormat(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.getYear(); 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) { // Get next token from format string c=format.charAt(i_format); token=""; while ((format.charAt(i_format)==c) && (i_format < format.length)) { token += format.charAt(i_format++); } // Extract contents of value based on format token 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=_getInt(val,i_val,x,y); if (year==null) { return 0; } i_val += year.length; if (year.length==2) { if (year > 70) { year=1900+(year-0); } else { year=2000+(year-0); } } } else if (token=="MMM"||token=="NNN"){ month=0; for (var i=0; i11)) { 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; i12)){return 0;} i_val+=month.length;} else if (token=="dd"||token=="d") { date=_getInt(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=_getInt(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=_getInt(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=_getInt(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=_getInt(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=_getInt(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=_getInt(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 there are any trailing characters left in the value, it doesn't match if (i_val != val.length) { return 0; } // Is date valid for month? if (month==2) { // Check for leap year if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year if (date > 29){ return 0; } } else { if (date > 28) { return 0; } } } if ((month==4)||(month==6)||(month==9)||(month==11)) { if (date > 30) { return 0; } } // Correct hours value 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(); } // ------------------------------------------------------------------ // parseDate( date_string [, prefer_euro_format] ) // // This function takes a date string and tries to match it to a // number of possible date formats to get the value. It will try to // match against the following international formats, in this order: // y-M-d MMM d, y MMM d,y y-MMM-d d-MMM-y MMM d // M/d/y M-d-y M.d.y MMM-d M/d M-d // d/M/y d-M-y d.M.y d-MMM d/M d-M // A second argument may be passed to instruct the method to search // for formats like d/M/y (european format) before M/d/y (American). // Returns a Date object or null if no patterns match. // ------------------------------------------------------------------ function parseDate(val) { var preferEuro=(arguments.length==2)?arguments[1]:false; generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d'); monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d'); dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M'); var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst'); var d=null; for (var i=0; i // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== /* PopupWindow.js Author: Matt Kruse Last modified: 02/16/04 DESCRIPTION: This object allows you to easily and quickly popup a window in a certain place. The window can either be a DIV or a separate browser window. COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small positioning errors - usually with Window positioning - occur on the Macintosh platform. Due to bugs in Netscape 4.x, populating the popup window with ' ); // This style sheet can be extracted from the script and edited into regular // CSS (by removing all occurrences of + and '). That can be used as the // basis for themes. Classes are described in comments within the style // sheet. document.writeln( ''); function calAttributes(cal) {switch (cal.id) {case 'EnterYourIDHere': // If you want to vary the attributes for a specific instance // of the calendar, replace 'EnterYourIDHere' (above) with the // ID that you have defined for that calendar then amend and // uncomment the block-commented section below (which is just // a copy of the default section below with all the // documentation comments removed). /* cal.zIndex = 1; cal.baseYear = dateNow.getFullYear()-10; cal.dropDownYears = 20; cal.weekStart = 1; cal.weekNumberBaseDay = 4; cal.weekNumberDisplay = false; try {jacsSetLanguage(cal);} catch (exception) {cal.today = 'Dzisiaj:'; cal.clear = 'Wyczyœæ'; cal.drag = 'click here to drag'; cal.monthNames = ['Sty','Lut','Mar','Kwi','Maj','Cze', 'Lip','Sie','Wrz','PaŸ','Lis','Gru']; cal.weekInits = ['Ni','Po','Wt','Œr','Cz','Pi','So']; cal.invalidDateMsg = 'The entered date is invalid.\n'; cal.outOfRangeMsg = 'The entered date is out of range.'; cal.doesNotExistMsg = 'The entered date does not exist.'; cal.invalidAlert = ['Invalid date (',') ignored.']; cal.dateSettingError = ['Error ',' is not a Date object.']; cal.rangeSettingError = ['Error ',' should consist of two elements.']; } cal.showInvalidDateMsg = true; cal.showOutOfRangeMsg = true; cal.showDoesNotExistMsg = true; cal.showInvalidAlert = true; cal.showDateSettingError = true; cal.showRangeSettingError = true; cal.delimiters = ['/','-','.',':',',',' ']; cal.dateDisplayFormat = 'yyyy-mm-dd'; cal.dateFormat = 'YYYY MMM DD'; cal.strict = false; cal.dates = new Array(); cal.higlightDates = new Array(); cal.dayCells = [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true]; cal.outOfRangeDisable = true; cal.outOfMonthDisable = false; cal.outOfMonthHide = false; cal.formatTodayCell = true; cal.todayCellBorderColour = 'red'; cal.allowDrag = false; cal.onBlurMoveNext = false; cal.clickToHide = false; cal.xBase = 'L'; // L Left, M Middle, R Right or integer pixel offset from left cal.yBase = 'B'; // T Top, M Middle, B Bottom or integer pixel offset from top cal.xPosition = 'L'; // L Left, M Middle, R Right or integer pixel offset from left cal.yPosition = 'T'; // T Top, M Middle, B Bottom or integer pixel offset from top cal.autoPosition = true; */ break; default: // cal.zIndex controls how the pop-up calendar interacts with // the rest of the page. It is usually adequate to leave it // as 1 (One) but I have made it available here to help anyone // who needs to alter the level in order to ensure that the // calendar displays correctly in relation to all other elements // on the page. cal.zIndex = 10000; // Set the bounds for the calendar here... // If you want the year to roll forward you can use something // like this... // var baseYear = dateNow.getFullYear()-5; // alternatively, hard code a date like this... // var baseYear = 1990; cal.baseYear = dateNow.getFullYear()-10; // How many years do want to be valid and to show in the // drop-down list? cal.dropDownYears = 20; // weekStart determines the start of the week in the display // Set it to: 0 (Zero) for Sunday, 1 (One) for Monday etc.. // Note: Always start the weekInits array with your // string for Sunday whatever weekStart (below) // is set to. cal.weekStart = 1; // Week numbering rules are generally based on a day in the week // that determines the first week of the year. ISO 8601 uses // Thursday (day four when Sunday is day zero). You can alter // the base day here. // See http://www.cl.cam.ac.uk/~mgk25/iso-time.html // for more information cal.weekNumberBaseDay = 4; // The week start day for the display is taken as the week start // for week numbering. This ensures that only one week number // applies to one line of the calendar table. // [ISO 8601 begins the week with Day 1 = Monday.] // If you want to see week numbering on the calendar, set // this to true. If not, false. cal.weekNumberDisplay = false; // If the calendar is given a date that it can't parse a month // from, it will use a default month. If the following attribute // is FALSE then the default month is month 6 (June), if set to // TRUE then the default will be the current month. cal.defaultToCurrentMonth = false; // All language-dependent settings can be made here... // If you wish to work in a single language (other than English) // then just replace the English below with your own text. // Using multiple languages: // In order to keep this script to a resonable size I have not // included multiple languages here. However, you can set the language // fields in a function that you should name jacsSetLanguage. The script // will then use your languages. I have included all the translations // that have been sent to me in such a function on my demonstration // site at http://www.tarrget.info/calendar/jacsLanguages.js. try {jacsSetLanguage(cal);} catch (exception) {// English cal.language = 'pl'; cal.today = 'Dzisiaj:'; cal.clear = 'Wyczyść'; cal.drag = 'click here to drag'; cal.monthNames = ['Sty','Lut','Mar','Kwi','Maj','Cze', 'Lip','Sie','Wrz','Paz','Lis','Gru']; cal.weekInits = ['Ni','Po','Wt','Śr','Cz','Pi','So']; cal.invalidDateMsg = 'The entered date is invalid.\n'; cal.outOfRangeMsg = 'The entered date is out of range.'; cal.doesNotExistMsg = 'The entered date does not exist.'; cal.invalidAlert = ['Invalid date (',') ignored.']; cal.dateSettingError = ['Error ',' is not a Date object.']; cal.rangeSettingError = ['Error ',' should consist of two elements.']; } // Each of the calendar's alert message types can be disabled // independently here. cal.showInvalidDateMsg = true; cal.showOutOfRangeMsg = true; cal.showDoesNotExistMsg = true; cal.showInvalidAlert = true; cal.showDateSettingError = true; cal.showRangeSettingError = true; // Set the whole calendar as active (dates selectable) // or inactive (display only) cal.active = true; // Set the allowed input date delimiters here... // E.g. To set the rising slash, hyphen, full-stop (aka stop or // point), colon, comma and space as delimiters use // var cal.delimiters = ['/','-','.',':',',',' ']; cal.delimiters = ['/','-','.',':',',',' ']; // Set the format for the displayed 'Today' date and for the // output date here. // // The format is described using delimiters of your choice (as // set in cal.delimiters above) and case insensitive letters // D, M and Y. // // NOTE: If no delimiters are input then the date output format is used // to parse the value. This allows less flexiblility in the input // value than using delimiters but an accurately entered date // remains parsable. // Displayed "Today" date format cal.dateDisplayFormat = 'yyyy-mm-dd'; // e.g. 'MMM-DD-YYYY' for the US // Output date format cal.dateFormat = 'yyyy-mm-dd'; // e.g. 'MMM-DD-YYYY' for the US // Note: The delimiters used should be in cal.delimiters. // Personally I like the fact that entering 31-Sep-2005 (a date // that doesn't exist) displays 1-Oct-2005, however you may want // that to be an error. If so, set cal.strict = true. That // will cause an error message to display and the selected month // is displayed without a selected day. Thanks to Brad Allan for // his feedback prompting this feature. cal.strict = false; // If you are using ReadOnly or diaabled fields to return the date // value into, it can be useful to show a button on the calendar // that allows the value to be cleared. If you want to do that, // set cal.clearButton = true; cal.clearButton = true; // Choose whether the dates and days you specify in cal.dates // and as parameters to the JACS.show call are enabled (with all // other dates disabled) or disabled (with all other dates enabled). cal.valuesEnabled = false; // If you wish to set any displayed day, e.g. Every Monday, // you can do it using the following array. The array elements // match the displayed cells. // // With the valuesEnabled attribute FALSE you could put something // like the following in your calling page to disable all weekend // days; // // for (var i=0;i<<>.dayCells.length;i++) // {if (i%7%6==0) <>.dayCells[i] = false;} // // The above approach will allow you to select days of the week // for the whole of your page easily. If you need to set different // selected days for a number of date input fields on your page // there is an easier way: You can pass optional arguments to // JACS.show. The syntax is described at the top of this script in // the section: // "How to use the Calendar once it is defined for your page:" // // It is possible to use these two approaches in combination. cal.dayCells = [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true]; // You can specify any date (e.g. 24-Jan-2006 or Today) by creating // an element of the array cal.dates as a date object with the // value you want to handle. Date ranges can be handled by placing // an array of two values (Start and End) into an element of this array. // // Use cal.valuesEnabled to determine whether any specified dates // are treated as the only enabled ones or the only disabled ones. cal.dates = new Array(); // e.g. To specify 10-Dec-2005: // cal.dates[0] = new Date(2005,11,10); // // Or a range from 2004-Dec-25 to 2005-Jan-01: // // cal.dates[1] = // [new Date(2004,11,25),new Date(2005,0,1)]; // // The following will specify all calendar dates up to // yesterday: // // cal.dates[2] = // [new Date(cal.baseYear,0,1), // new Date(dateNow.getFullYear(), // dateNow.getMonth(), // dateNow.getDate()-1)]; // // Remember that Javascript months are zero-based. // Allow specified dates to be highlighted when they are enabled. // You can set individual dates or date ranges in the same way as // above. cal.highlightDates = new Array(); // Dates that are out of the specified range can be displayed at // the start of the very first month and end of the very last. // Set outOfRangeDisable = true to disable these dates // (or false to allow their selection). cal.outOfRangeDisable = true; // Dates that are out of the displayed month are shown at the start // (unless the month starts on the first day of the week) and end of // each month. Set outOfMonthDisable = true to disable these dates // (or false to allow their selection). Set outOfMonthHide = true // to hide these dates (or false to make them visible). cal.outOfMonthDisable = false; cal.outOfMonthHide = false; // If you want a special format for the cell that contains the current day // set this to true. This sets a thin border around the cell in the colour // set by cal.todayCellBorderColour. cal.formatTodayCell = true; cal.todayCellBorderColour = '#f00'; // red // You can allow the calendar to be dragged around the screen by // using the setting allowDrag = true. // I can't say I recommend it because of the danger of the user // forgetting which date field the calendar will update when // there are multiple date fields on a page. cal.allowDrag = false; // It is not easy to code HTML events to make the focus move // automatically on to the next element in the tab order so // here is a parameter you can set that will tell the script // to do it for you. NOTE: The script may have to build a list // of all the page's elements in tabIndex order to achieve this // so there can be an overhead to using this feature. cal.onBlurMoveNext = false; // You can allow a click on the calendar to close dynamic // calendars by setting clickToHide = true. If set to false // the script will hide a dynamic calendar when a date is // selected or the main page is clicked. cal.clickToHide = false; // Dynamic calendar positioning is relative to the return value // element. The script is supplied with the parameters below // setting the calendar's top left corner to appear at the // return element's bottom left corner. cal.xBase = 'L'; cal.yBase = 'B'; cal.xPosition = 'L'; cal.yPosition = 'T'; // For the horizontal (X) parameters, xBase and xPosition, // the accepted values are; L - Left // M - Middle // R - Right // or nn - integer pixel offset from left +/- // // For the vertical (Y) parameters, yBase and yPosition, // the accepted values are; T - Top // M - Middle // B - Bottom // or nn - integer pixel offset from top +/- // The calendar will position itself aligned according to the // choices above. If automatic positioning is turned // on with cal.autoPosition = true then if the chosen position // would cause the calendar to display off the visible screen, // it is shifted to a position that is visible. cal.autoPosition = true; } // Do not set the value of this calendar attribute. It is used // to tell you whether a date has been selected or not when // using the JACS.next feature to trigger a function after the // calendar is used. // dateReturned is False unless the user has clicked on an // active date cell or the value for "Today", in which case // it is True. cal.dateReturned = false; // The most recent date output to the target element is stored // as an attribute of the calendar. Initialised to Midnight // on 1st January 1970 (UTC), a selected date can never // equal this because returned dates are always 12 Midday. cal.outputDate = new Date(0); // Finally: The following attributes are used in calendar // functions. You need do nothing with them here. cal.seedDate = new Date(); cal.fullInputDate = false; cal.activeToday = true; cal.monthSum = 0; cal.days = new Array(); cal.arrOnNext = new Array(); cal.triggerEle; cal.targetEle; }; //****************************************************************************** //------------------------------------------------------------------------------ // End of customisation section //------------------------------------------------------------------------------ //****************************************************************************** // ******************************************************* // Custom methods for Date, String and Function prototypes // ******************************************************* // Format a date into the required pattern Date.prototype.jacsFormat = function(format,monthNames) {var charCount = 0, codeChar = '', result = ''; for (var i=0;i<=format.length;i++) {if (i0) {result += codeChar;} } if (i-1) {cal.monthSum =12*(selYears.options.selectedIndex)+bias;} if (selMonths.options.selectedIndex>-1) {cal.monthSum+=selMonths.options.selectedIndex;} showDate.setFullYear(cal.baseYear+Math.floor(cal.monthSum/12),(cal.monthSum%12),1); // If the Week numbers are displayed, shift the week day names to the right. getEl(calId+'Week_').style.display = (cal.weekNumberDisplay)?'':'none'; // Opera has a bug with setting the selected index. // It requires the following work-around to force SELECTs to display correctly. if (window.opera) {selMonths.style.display = 'inherit'; selYears.style.display = 'inherit'; } tmp = (12*parseInt((showDate.getFullYear()-cal.baseYear),10)) + parseInt(showDate.getMonth(),10); if (tmp > -1 && tmp < (12*cal.dropDownYears)) {selYears.options.selectedIndex = Math.floor(cal.monthSum/12); selMonths.options.selectedIndex = (cal.monthSum%12); curMonth = showDate.getMonth(); showDate.setDate((((showDate.getDay()-cal.weekStart)<0)?-6:1)+cal.weekStart-showDate.getDay()); var compareDateValue = new Date(showDate.getFullYear(),showDate.getMonth(),showDate.getDate()).valueOf(); startDate = new Date(showDate); var now = getEl(calId+'Now'); function nowOutput() {setOutput(dateNow,calId);}; if (cal.dates.length==0) {if (cal.active && cal.activeToday) {now.onclick = nowOutput; now.className = 'jacsNow'; if (getEl('jacsIE')) {now.onmouseover = changeClass; now.onmouseout = changeClass; } if (document.removeEventListener) {now.removeEventListener('click',stopPropagation,false);} else {now.detachEvent( 'onclick',stopPropagation);} } else {now.onclick = null; now.className = 'jacsNowDisabled'; if (getEl('jacsIE')) {now.onmouseover = null; now.onmouseout = null; } if (document.addEventListener) {now.addEventListener('click',stopPropagation,false);} else {now.attachEvent( 'onclick',stopPropagation);} } } else {for (var k=0;k= cal.dates[k][0].valueOf() && dateNow.valueOf() <= cal.dates[k][1].valueOf() ) ) ) ) {now.onclick = (cal.active && cal.valuesEnabled)?nowOutput:null; now.className = (cal.active && cal.valuesEnabled)?'jacsNow':'jacsNowDisabled'; if (getEl('jacsIE')) {now.onmouseover = (cal.active && cal.valuesEnabled)?changeClass:null; now.onmouseout = (cal.active && cal.valuesEnabled)?changeClass:null; } if (cal.active && cal.valuesEnabled) {if (document.removeEventListener) {now.removeEventListener('click',stopPropagation,false);} else {now.detachEvent( 'onclick',stopPropagation);} } else {if (document.addEventListener) {now.addEventListener('click',stopPropagation,false);} else {now.attachEvent( 'onclick',stopPropagation);} } break; } else {now.onclick = (cal.active && cal.valuesEnabled)?null:nowOutput; now.className = (cal.active && cal.valuesEnabled)?'jacsNowDisabled':'jacsNow'; if (getEl('jacsIE')) {now.onmouseover = (cal.active && cal.valuesEnabled)?null:changeClass; now.onmouseout = (cal.active && cal.valuesEnabled)?null:changeClass; } if (cal.active && cal.valuesEnabled) {if (document.addEventListener) {now.addEventListener('click',stopPropagation,false);} else {now.attachEvent( 'onclick',stopPropagation);} } else {if (document.removeEventListener) {now.removeEventListener('click',stopPropagation,false);} else {now.detachEvent( 'onclick',stopPropagation);} } } } } function setOutput(outputDate,calId) {var cal = getEl(calId); if (typeof cal.targetEle.value == 'undefined') {cal.triggerEle.textNode.replaceData(0,cal.triggerEle.len,outputDate.jacsFormat(cal.dateFormat,cal.monthNames));} else {cal.ele.value = outputDate.jacsFormat(cal.dateFormat,cal.monthNames);} cal.dateReturned = true; cal.outputDate = outputDate; if (cal.dynamic) {hide(calId);} else {if (typeof cal.onNext!='undefined' && cal.onNext!=null) {cal.onNext();} JACS.show(cal.ele,cal.id,cal.days); } if (cal.onBlurMoveNext) {// if the target element has a tabIndex look for tabIndex+1 // if that exists then set the focus to it var tagsToFind = 'INPUT;A;SELECT;TEXTAREA;BUTTON;AREA;OBJECT', found = false; if (cal.ele.tabIndex>0) {var tags = tagsToFind.split(';'); tagsOuterLoop: for (var i=0;tags.length;i++) {elementsByTag = document.getElementsByTagName(tags[i]); for (var j=0;j-1) {if (tempEle.tabIndex>0) {tabOrder[tempEle.tabIndex] = tempEle} else {unordered[unordered.length] = tempEle} } elementArrays(tempEle); } } }; elementArrays(document.body); while (tabOrder.length>0 && tabOrder[0]==null) {tabOrder.shift();} return tabOrder.concat(unordered); }; var tabSequenced = orderElements(); // find the current element in tabIndex ordered array // and set focus to the next element (or the first if // the current is the last) for (var i=0;i cal.weekNumberBaseDay)?7:0)); // The first Base Day in the year var firstBaseDay = new Date(inDateWeekBase.getFullYear(),0,1); firstBaseDay.setDate(firstBaseDay.getDate() - firstBaseDay.getDay() + cal.weekNumberBaseDay); if (firstBaseDayfirstBaseDay) {startWeekOne.setDate(startWeekOne.getDate()-7);} // Subtract the date of the current week from the date of the first week of the year to // get the number of weeks in milliseconds. Divide by the number of milliseconds in a // week then round to no decimals in order to remove the effect of daylight saving. Add // one to make the first week, week 1. Place a string zero on the front so that week // numbers are zero filled. var weekNo = '0'+(Math.round((inDateWeekBase - firstBaseDay)/604800000,0)+1); // Return the last two characters in the week number string return weekNo.substring(weekNo.length-2,weekNo.length); }; // walk the DOM to display the dates. var cells = getEl(calId+'Cells').childNodes; for (var i=0;i (new Date(showDate.getFullYear(),curMonth+1,0,showDate.getHours())) ) )?'hidden':'inherit'; // Disable if the outOfRangeDisable option has been set and the current date // is out of range or the cal.valuesEnabled option is true. var disabled = cal.valuesEnabled; if ((cal.outOfRangeDisable && (showDate < (new Date(cal.baseYear,0,1,12)) || showDate > (new Date(cal.baseYear+cal.dropDownYears,0,0,12)) ) ) || (cal.outOfMonthDisable && (showDate < (new Date(showDate.getFullYear(),curMonth,1,showDate.getHours())) || showDate > (new Date(showDate.getFullYear(),curMonth+1,0,showDate.getHours())) ) ) ) {disabled = true;} else {if ((cal.days.join().search(((j-1+(7*(i*cells.length/6))+cal.weekStart)%7))>-1) || !cal.dayCells[j-1+(7*((i*cells.length)/6))] ) {disabled = !cal.valuesEnabled;} // Set (Disable or Enable) if the day is passed as a parameter of JACS.show else {for (var k=0;k= cal.dates[k][0].valueOf() && compareDateValue <= cal.dates[k][1].valueOf() ) ) ) {disabled = !cal.valuesEnabled; break; } } } } if (disabled) {rows.childNodes[j].onclick = null; if (getEl('jacsIE')) {rows.childNodes[j].onmouseover = null; rows.childNodes[j].onmouseout = null; } cell.className= (showDate.getMonth()!=curMonth) ?'jacsCellsExMonthDisabled' :(cal.fullInputDate && compareDateValue== cal.seedDate.valueOf()) ?'jacsInputDateDisabled' :(showDate.getDay()%6==0) ?'jacsCellsWeekendDisabled' :'jacsCellsDisabled'; cell.style.borderColor = (cal.formatTodayCell && showDate.toDateString()==dateNow.toDateString()) ?cal.todayCellBorderColour :(cell.currentStyle) ?cell.currentStyle['backgroundColor'] :(document.defaultView.getComputedStyle) ?document.defaultView.getComputedStyle(cell,null).backgroundColor :''; } else {function cellOutput(evt) {var ele = eventTrigger(evt), outputDate = new Date(startDate); if (ele.nodeType==3) ele=ele.parentNode; outputDate.setDate(startDate.getDate() + parseInt(ele.id.substr(calId.length+5),10)); setOutput(outputDate,calId); }; if (cal.active) {rows.childNodes[j].onclick=cellOutput;} if (getEl('jacsIE')) {rows.childNodes[j].onmouseover = changeClass; rows.childNodes[j].onmouseout = changeClass; } var highlighted = false; for (var k=0;k= cal.highlightDates[k][0].valueOf() && compareDateValue <= cal.highlightDates[k][1].valueOf() ) ) ) {highlighted = true; break; } } cell.className= (showDate.getMonth()!=curMonth) ?'jacsCellsExMonth' :(cal.fullInputDate && compareDateValue== cal.seedDate.valueOf()) ?'jacsInputDate' :(showDate.getDay()%6==0) ?(highlighted)?'jacsCellsHighlightedWeekend':'jacsCellsWeekend' :(highlighted)?'jacsCellsHighlighted':'jacsCells'; cell.style.borderColor = (cal.formatTodayCell && showDate.toDateString()==dateNow.toDateString()) ?cal.todayCellBorderColour :(cell.currentStyle) ?cell.currentStyle['backgroundColor'] :(document.defaultView.getComputedStyle) ?document.defaultView.getComputedStyle(cell,null).backgroundColor :''; } showDate.setDate(showDate.getDate()+1); compareDateValue = new Date(showDate.getFullYear(), showDate.getMonth(), showDate.getDate()).valueOf(); } } } } } // Opera has a bug with setting the selected index. // It requires the following work-around to force SELECTs to display correctly. // Also Opera's poor dynamic rendering prior to 9.5 requires // the visibility to be reset to prevent garbage in the calendar // when the displayed month is changed. if (window.opera) {selMonths.style.display = 'inline'; selYears.style.display = 'inline'; cal.style.visibility = 'hidden'; cal.style.visibility = 'inherit'; } }; function hide(instanceID) {if (typeof instanceID=='object') {for (var i=0;i 0) {cal.onNext = cal.arrOnNext.shift(); cal.onNext(); // Explicit null set to prevent closure causing memory leak cal.onNext = null; } } }; function stopPropagation(evt) {if (evt.stopPropagation) {if (evt.target!=evt.currentTarget) {evt.stopPropagation(); evt.preventDefault();}} else {evt.cancelBubble = true;} }; // ********************************* // End of Private Function Library // ********************************* // Start of Public Function Library // ********************************* return {show: function(ele) {// Check the type of any additional parameters. // The optional string parameter is a calendar ID, // Take any remaining parameters as day numbers to be handled // (enabled/disabled) according to the setting of the // calendar's valuesEnabled attribute. // 0 = Sunday through to 6 = Saturday. if (typeof arguments[1]=='object') {var dynamic = true; if (typeof arguments[2]=='string') {var calId = arguments[2], min = 3;} else {var calId = 'jacs', min = 2;} // Stop the click event that opens the calendar // from bubbling up to the document-level event // handler that hides it! var source = arguments[1]; if (!source) {source = window.event;} if (source.tagName) // Second parameter isn't an event it's an element {var sourceEle = source; if (getEl('jacsIE')) {window.event.cancelBubble = true;} else {sourceEle.parentNode.addEventListener('click',stopPropagation,false);} } else // Second parameter is an event {var event = source; // Stop the click event that opens the calendar from bubbling up to // the document-level event handler that hides it! var sourceEle = (event.target)?event.target:event.srcElement; if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;} } } else {var sourceEle = ele, dynamic = false; if (typeof arguments[1]=='string') {var calId = arguments[1], min = 2;} else {var calId = 'jacs', min = 1;} } // Add event handlers to the return element and its parent. // This helps the script to support tab sequences and focus events. if (document.addEventListener) {ele.addEventListener('keydown',hideOnTab,false); ele.parentNode.addEventListener('click',stopPropagation,false);} else {ele.attachEvent('onkeydown',hideOnTab); if (ele.parentNode!=document.body) {ele.parentNode.attachEvent('onclick',stopPropagation);} } function hideOnTab(evt) {if (!evt) {var evt = window.event;} if ((evt.keyCode||evt.which)==9) {hide(calId);} }; // Create the calendar structure. One is enough unless you want more // than one calendar visible on the page at one time. If you DO need // more, you can create as many as you like but each must have a unique // ID. // The first parameter of JACS.make is the ID of the calendar. The // second is a boolean that determines whether the calendar is to be // static on the page (assigned to a single input field and always // visible) or dynamic (shown and hidden on events and can be assigned // to any number of input fields). if (!getEl(calId)) {JACS.make(calId,dynamic);} cal = getEl(calId); // If the calendar has been triggered using an onfocus event, // and the script actively returns the focus to the target // element (i.e. when cal.onBlurMoveNext = false). We need // to kill the event. if (event) {if (event.type == 'focus' && cal.dateReturned && !cal.onBlurMoveNext && cal.prevEventType == 'focus') {stopPropagation(event); cal.prevEventType = ''; cal.dateReturned = false; return false;} cal.prevEventType = event.type; } if (cal.style.visibility != 'hidden' && cal.style.visibility != 'inherit' && typeof doNext == 'function') {doNext(cal);} cal.triggerEle = sourceEle; cal.dateReturned = false; cal.activeToday = true; // Set enabled/disabled days if (arguments.length==min) {cal.days.length=0;} else {selectedDays = (typeof arguments[min]=='object')?arguments[min]:arguments; for (var i=(min|0);i 0) {cal.triggerEle.textNode = childNodes[i]; cal.triggerEle.len = childNodes[i].nodeValue.length; break; } } } } } // Set the year range var yearOptions = getEl(calId+'Years').options; if (yearOptions.length==0 || yearOptions[0].value!=cal.baseYear) {yearOptions.length = 0; for (var i=0;ical.seedDate ) {cal.seedDate = new Date(cal.baseYear+Math.floor(cal.dropDownYears / 2), 5, 1);} } else {function inputFormat() {var seed = new Array(), input = dateValue.split(new RegExp('[\\'+cal.delimiters.join('\\')+']+','g')); // "Escape" all the user defined date delimiters above - // several delimiters will need it and it does no harm for // the others. // Strip any empty array elements (caused by delimiters) // from the beginning or end of the array. They will // still appear in the output string if in the output // format. if (input[0]!=null) {if (input[0].length==0) {input.splice(0,1);} if (input[input.length-1].length==0) {input.splice(input.length-1,1);} } cal.fullInputDate = false; cal.dateFormat = cal.dateFormat.toUpperCase(); // List all the allowed letters in the date format var template = ['D','M','Y']; // Prepare the sequence of date input elements var result = new Array(); for (var i=0;i-1) {result[cal.dateFormat.search(template[i])] = template[i];} } cal.dateSequence = result.join(''); // Separate the elements of the date input switch (input.length) {case 1: {// Year only entry or undelimited date format if (cal.dateFormat.indexOf('Y')>-1 && input[0].length>cal.dateFormat.lastIndexOf('Y')) {seed[0] = parseInt(input[0].substring(cal.dateFormat.indexOf('Y'), cal.dateFormat.lastIndexOf('Y')+1),10); } else {seed[0] = parseInt(input[0],10);} if (cal.dateFormat.indexOf('M')>-1 && input[0].length>cal.dateFormat.lastIndexOf('M')) {seed[1] = input[0].substring(cal.dateFormat.indexOf('M'), cal.dateFormat.lastIndexOf('M')+1); } else {seed[1] = cal.defaultToCurrentMonth?(dateNow.getMonth()+1).toString():'6';} if (cal.dateFormat.indexOf('D')>-1 && input[0].length>cal.dateFormat.lastIndexOf('D')) {seed[2] = parseInt(input[0].substring(cal.dateFormat.indexOf('D'), cal.dateFormat.lastIndexOf('D')+1),10); } else {seed[2] = 1;} if (input[0].length==cal.dateFormat.length) {cal.fullInputDate = true;} break; } case 2: {// Year and Month entry seed[0] = parseInt(input[cal.dateSequence.replace(/D/i,'').search(/Y/i)],10); // Year seed[1] = input[cal.dateSequence.replace(/D/i,'').search(/M/i)]; // Month seed[2] = 1; // Day break; } case 3: {// Day Month and Year entry seed[0] = parseInt(input[cal.dateSequence.search(/Y/i)],10); // Year seed[1] = input[cal.dateSequence.search(/M/i)]; // Month seed[2] = parseInt(input[cal.dateSequence.search(/D/i)],10); // Day cal.fullInputDate = true; break; } default: {// A stuff-up has led to more than three elements in the date. seed[0] = 0; // Year seed[1] = 0; // Month seed[2] = 0; // Day } } // These regular expressions validate the input date format // to the following rules; // Day 1-31 (optional zero on single digits) // Month 1-12 (optional zero on single digits) // or case insensitive name // Year One, Two or four digits // Months names are as set in the language-dependent // definitions and delimiters are set just below there var expValDay = new RegExp('^(0?[1-9]|[1-2][0-9]|3[0-1])$'), expValMonth = new RegExp('^(0?[1-9]|1[0-2]|'+cal.monthNames.join('|')+')$','i'), expValYear = new RegExp('^([0-9]{1,2}|[0-9]{4})$'); // Apply validation and report failures if (expValYear.exec(seed[0]) ==null || expValMonth.exec(seed[1])==null || expValDay.exec(seed[2]) ==null ) {if (cal.showInvalidDateMsg) {alert(cal.invalidDateMsg + cal.invalidAlert[0] + dateValue + cal.invalidAlert[1]);} seed[0] = cal.baseYear + Math.floor(cal.dropDownYears/2); // Year seed[1] = cal.defaultToCurrentMonth?(dateNow.getMonth()+1).toString():'6'; // Month seed[2] = 1; // Day cal.fullInputDate = false; } // Return the Year in seed[0] // Month in seed[1] // Day in seed[2] return seed; }; // Parse the string into an array using the allowed delimiters seedDate = inputFormat(); // So now we have the Year, Month and Day in an array. // If the year is one or two digits then the routine assumes a // year belongs in the 21st Century unless it is less than 50 // in which case it assumes the 20th Century is intended. if (seedDate[0]<100) {seedDate[0] += (seedDate[0]>50)?1900:2000;} // Check whether the month is in digits or an abbreviation if (seedDate[1].search(/\d+/)<0) {for (i=0;ical.seedDate) {if (cal.strict && cal.showOutOfRangeMsg) {alert(cal.outOfRangeMsg);} cal.seedDate = new Date(cal.baseYear,0,1); cal.fullInputDate=false; } else {if ((new Date(cal.baseYear+cal.dropDownYears,0,0))cal.dates[i][1])) {cal.dates[i].reverse();} } else {if (cal.showRangeSettingError) {alert(cal.dateSettingError[0] + cal.dates[i] + cal.dateSettingError[1]);} } } } // Set language-dependent values getEl(calId+'DragText').innerHTML = cal.drag; var monthOptions = getEl(calId+'Months').options, months = ''; if (monthOptions.length>0) {for (var i=0;imonthOptions.length-1) {monthOptions[i] = new Option(cal.monthNames[i],cal.monthNames[i]);} else {monthOptions[i].innerHTML = cal.monthNames[i];} } } for (var i=0;i dateNow && (new Date(cal.baseYear, 0, 0)) < dateNow) || (cal.clearButton && (ele.readOnly || ele.disabled)) ) {getEl(calId+'Now').innerHTML = cal.today+' '+dateNow.jacsFormat(cal.dateDisplayFormat,cal.monthNames); getEl(calId+'ClearButton').value = cal.clear; getEl(calId+'Foot').style.display = ''; if ((new Date(cal.baseYear + cal.dropDownYears, 0, 0)) > dateNow && (new Date(cal.baseYear, 0, 0)) < dateNow) {getEl(calId+'Now').style.display = ''; if (cal.clearButton && (ele.readOnly || ele.disabled)) {getEl(calId+'Clear').style.display = ''; getEl(calId+'Clear').style.textAlign = 'left'; getEl(calId+'Now' ).style.textAlign = 'right'; } else {getEl(calId+'Clear').style.display = 'none'; getEl(calId+'Now' ).style.textAlign = 'center'; } } else {getEl(calId+'Clear').style.textAlign = 'center'; getEl(calId+'Clear').style.display = ''; getEl(calId+'Now' ).style.display = 'none'; } } else {getEl(calId+'Foot').style.display = 'none';} // Calculate the number of months that the entered (or // defaulted) month is after the start of the allowed // date range. cal.monthSum = 12*(cal.seedDate.getFullYear() - cal.baseYear) + cal.seedDate.getMonth(); // Set the drop down boxes. getEl(calId+'Years').options.selectedIndex = Math.floor(cal.monthSum/12); getEl(calId+'Months').options.selectedIndex = (cal.monthSum%12); getEl(calId).ele = ele; // Display the month showMonth(0,calId); // Remember the Element cal.targetEle = ele; // Position the calendar box. if (dynamic) {// Check whether or not dragging is allowed and display drag handle if necessary getEl(calId+'Drag').style.display = (cal.allowDrag)?'':'none'; var offsetTop = parseInt(ele.offsetTop ,10), offsetLeft = parseInt(ele.offsetLeft,10); // The object sniffing for Opera allows for the fact that Opera // is the only major browser that correctly reports the position // of an element in a scrollable DIV. This is because IE and // Firefox omit the DIV from the offsetParent tree. if (!window.opera) {while (ele.tagName!='BODY' && ele.tagName!='HTML') {offsetTop -= parseInt(ele.scrollTop, 10); offsetLeft -= parseInt(ele.scrollLeft,10); ele = ele.parentNode; } ele = cal.targetEle; } while (ele.tagName!='BODY' && ele.tagName!='HTML') {ele = ele.offsetParent; offsetTop += parseInt(ele.offsetTop, 10); offsetLeft += parseInt(ele.offsetLeft,10); } ele = cal.targetEle; var eleOffsetTop = offsetTop, eleOffsetLeft = offsetLeft; if (cal.xBase.length>0) {if (isNaN(cal.xBase)) {cal.xBase = cal.xBase.toUpperCase(); offsetLeft += (cal.xBase=='R') ?parseInt(ele.offsetWidth,10) :(cal.xBase=='M')?Math.round(parseInt(ele.offsetWidth,10)/2):0; } else {offsetLeft += parseInt(cal.xBase,10);} } if (cal.yBase.length>0) {if (isNaN(cal.yBase)) {cal.yBase = cal.yBase.toUpperCase(); offsetTop += (cal.yBase=='B') ?parseInt(ele.offsetHeight,10) :(cal.yBase=='M')?Math.round(parseInt(ele.offsetHeight,10)/2):0; } else {offsetTop += parseInt(cal.yBase,10);} } else {offsetTop += parseInt(ele.offsetHeight,10);} if (cal.xPosition.length>0) {if (isNaN(cal.xPosition)) {cal.xPosition = cal.xPosition.toUpperCase(); offsetLeft -= (cal.xPosition=='R') ?parseInt(cal.offsetWidth,10) :(cal.xPosition=='M')?Math.round(parseInt(cal.offsetWidth,10)/2):0; } else {offsetLeft += parseInt(cal.xPosition,10);} } if (cal.yPosition.length>0) {if (isNaN(cal.yPosition)) {cal.yPosition = cal.yPosition.toUpperCase(); offsetTop -= (cal.yPosition=='B') ?parseInt(cal.offsetHeight,10) :(cal.yPosition=='M')?Math.round((parseInt(cal.offsetHeight,10))/2):0; } else {offsetTop += parseInt(cal.yPosition,10);} } if (cal.autoPosition) {var width = parseInt(cal.offsetWidth, 10), height = parseInt(cal.offsetHeight,10), windowLeft = (document.body && document.body.scrollLeft) ?document.body.scrollLeft //DOM compliant :(document.documentElement && document.documentElement.scrollLeft) ?document.documentElement.scrollLeft //IE6+ standards compliant :0, //Failed windowWidth = (typeof(innerWidth) == 'number') ?innerWidth //DOM compliant :(document.documentElement && document.documentElement.clientWidth) ?document.documentElement.clientWidth //IE6+ standards compliant :(document.body && document.body.clientWidth) ?document.body.clientWidth //IE non-compliant :0, //Failed windowTop = (document.body && document.body.scrollTop) ?document.body.scrollTop //DOM compliant :(document.documentElement && document.documentElement.scrollTop) ?document.documentElement.scrollTop //IE6+ standards compliant :0, //Failed windowHeight = (typeof(innerHeight) == 'number') ?innerHeight //DOM compliant :(document.documentElement && document.documentElement.clientHeight) ?document.documentElement.clientHeight //IE6+ standards compliant :(document.body && document.body.clientHeight) ?document.body.clientHeight //IE non-compliant :0; //Failed if (eleOffsetLeft + parseInt(ele.offsetWidth,10) - width >= windowLeft && offsetLeft + width > windowLeft + windowWidth ) {offsetLeft = eleOffsetLeft + parseInt(ele.offsetWidth,10) - width;} else if (eleOffsetLeft >= windowLeft && offsetLeft < windowLeft ) {offsetLeft = eleOffsetLeft;} if (eleOffsetTop - height >= windowTop && offsetTop + height > windowTop + windowHeight ) {offsetTop = eleOffsetTop - height;} else if (offsetTop + height <= windowTop + windowHeight && offsetTop < windowTop) {offsetTop = eleOffsetTop + parseInt(ele.offsetHeight,10);} } cal.style.top = offsetTop+'px'; cal.style.left = offsetLeft+'px'; getEl(calId+'Iframe').style.top = offsetTop +'px'; getEl(calId+'Iframe').style.left = offsetLeft+'px'; getEl(calId+'Iframe').style.width = (cal.offsetWidth -(getEl('jacsIE')?2:4))+'px'; getEl(calId+'Iframe').style.height = (cal.offsetHeight-(getEl('jacsIE')?2:4))+'px'; getEl(calId+'Iframe').style.visibility = 'inherit'; } // Show it on the page cal.style.visibility = 'inherit'; }, make: function (calId) {cals.push(calId); var dynamic = (typeof arguments[1]=='boolean')?arguments[1]:true; TABLEjacs = document.createElement('table'); TABLEjacs.id = calId; TABLEjacs.dynamic = dynamic; TABLEjacs.className = (dynamic)?'jacs':'jacsStatic'; calAttributes(TABLEjacs); if (dynamic) {TABLEjacs.style.zIndex = TABLEjacs.zIndex+1;} function cancel(evt) {if (TABLEjacs.clickToHide) {hide(calId);} stopPropagation(evt); }; TBODYjacs = document.createElement('tbody'); TRjacs1 = document.createElement('tr'); TRjacs1.className = 'jacs'; TDjacs1 = document.createElement('td'); TDjacs1.className = 'jacs'; TABLEjacsHead = document.createElement('table'); TABLEjacsHead.id = calId+'Head'; TABLEjacsHead.cellSpacing = '0'; TABLEjacsHead.cellPadding = '0'; TABLEjacsHead.className = 'jacsHead'; TABLEjacsHead.width = '100%'; TBODYjacsHead = document.createElement('tbody'); TRjacsDrag = document.createElement('tr'); TRjacsDrag.id = calId+'Drag'; TRjacsDrag.style.display = 'none'; TDjacsDrag = document.createElement('td'); TDjacsDrag.className = 'jacsDrag'; TDjacsDrag.colSpan = '4'; function beginDrag(evt) {var elToDrag = getEl(calId); var deltaX = evt.clientX, deltaY = evt.clientY, offsetEle = elToDrag; while (offsetEle.tagName!='BODY' && offsetEle.tagName!='HTML') {deltaX -= parseInt(offsetEle.offsetLeft,10); deltaY -= parseInt(offsetEle.offsetTop ,10); offsetEle = offsetEle.offsetParent; } if (document.addEventListener) {elToDrag.addEventListener('mousemove',moveHandler,true); elToDrag.addEventListener('mouseup', upHandler,true); } else {elToDrag.attachEvent('onmousemove', moveHandler); elToDrag.attachEvent('onmouseup', upHandler); elToDrag.setCapture(); } stopPropagation(evt); function moveHandler(evt) {if (!evt) {evt = window.event;} elToDrag.style.left = (evt.clientX-deltaX)+'px'; elToDrag.style.top = (evt.clientY-deltaY)+'px'; getEl(calId+'Iframe').style.left = (evt.clientX-deltaX)+'px'; getEl(calId+'Iframe').style.top = (evt.clientY-deltaY)+'px'; stopPropagation(evt); }; function upHandler(evt) {if (!evt) {evt = window.event;} if (document.removeEventListener) {elToDrag.removeEventListener('mousemove',moveHandler,true); elToDrag.removeEventListener( 'mouseup', upHandler,true); } else {elToDrag.detachEvent('onmouseup', upHandler); elToDrag.detachEvent('onmousemove',moveHandler); elToDrag.releaseCapture(); } stopPropagation(evt); }; }; DIVjacsDragText = document.createElement('span'); DIVjacsDragText.id = calId+'DragText'; TRjacsHead = document.createElement('tr'); TRjacsHead.className = 'jacsHead'; TDjacsHead1 = document.createElement('td'); TDjacsHead1.className = 'jacsHead'; INPUTjacsHead1 = document.createElement('input'); INPUTjacsHead1.className = 'jacsHead'; INPUTjacsHead1.id = calId+'HeadLeft'; INPUTjacsHead1.type = 'button'; INPUTjacsHead1.tabIndex = '-1'; INPUTjacsHead1.value = '<'; INPUTjacsHead1.onclick = function() {showMonth(-1,calId);} TDjacsHead2 = document.createElement('td'); TDjacsHead2.className = 'jacsHead'; SELECTjacsHead2 = document.createElement('select'); SELECTjacsHead2.className = 'jacsHead'; SELECTjacsHead2.id = calId+'Months'; SELECTjacsHead2.tabIndex = '-1'; SELECTjacsHead2.onchange = function() {showMonth(0,calId);} TDjacsHead3 = document.createElement('td'); TDjacsHead3.className = 'jacsHead'; SELECTjacsHead3 = document.createElement('select'); SELECTjacsHead3.className = 'jacsHead'; SELECTjacsHead3.id = calId+'Years'; SELECTjacsHead3.tabIndex = '-1'; SELECTjacsHead3.onchange = function() {showMonth(0,calId);} TDjacsHead4 = document.createElement('td'); TDjacsHead4.className = 'jacsHead'; INPUTjacsHead4 = document.createElement('input'); INPUTjacsHead4.className = 'jacsHead'; INPUTjacsHead4.id = calId+'HeadRight'; INPUTjacsHead4.type = 'button'; INPUTjacsHead4.tabIndex = '-1'; INPUTjacsHead4.value = '>'; INPUTjacsHead4.onclick = function() {showMonth(1,calId);} TRjacs2 = document.createElement('tr'); TRjacs2.className = 'jacs'; TDjacs2 = document.createElement('td'); TDjacs2.className = 'jacs'; TABLEjacsCells = document.createElement('table'); TABLEjacsCells.className = 'jacsCells'; TABLEjacsCells.align = 'center'; TABLEjacsCells.width = '100%'; THEADjacsCells = document.createElement('thead'); TRjacsCells = document.createElement('tr'); TDjacsCells = document.createElement('td'); TDjacsCells.className = 'jacsWeekNumberHead'; TDjacsCells.id = calId+'Week_'; TABLEjacs.appendChild(TBODYjacs); TBODYjacs.appendChild(TRjacs1); TRjacs1.appendChild(TDjacs1); TDjacs1.appendChild(TABLEjacsHead); TABLEjacsHead.appendChild(TBODYjacsHead); TBODYjacsHead.appendChild(TRjacsDrag); TRjacsDrag.appendChild(TDjacsDrag); TDjacsDrag.appendChild(DIVjacsDragText); TBODYjacsHead.appendChild(TRjacsHead); TRjacsHead.appendChild(TDjacsHead1); TDjacsHead1.appendChild(INPUTjacsHead1); TRjacsHead.appendChild(TDjacsHead2); TDjacsHead2.appendChild(SELECTjacsHead2); TRjacsHead.appendChild(TDjacsHead3); TDjacsHead3.appendChild(SELECTjacsHead3); TRjacsHead.appendChild(TDjacsHead4); TDjacsHead4.appendChild(INPUTjacsHead4); TBODYjacs.appendChild(TRjacs2); TRjacs2.appendChild(TDjacs2); TDjacs2.appendChild(TABLEjacsCells); TABLEjacsCells.appendChild(THEADjacsCells); THEADjacsCells.appendChild(TRjacsCells); TRjacsCells.appendChild(TDjacsCells); for (var i=0;i<7;i++) {TDjacsCells = document.createElement('td'); TDjacsCells.className = 'jacsWeek'; TDjacsCells.id = calId+'WeekInit'+i; TRjacsCells.appendChild(TDjacsCells); } TBODYjacsCells = document.createElement('tbody'); TBODYjacsCells.id = calId+'Cells'; TABLEjacsCells.appendChild(TBODYjacsCells); for (var i=0;i<6;i++) {TRjacsCells = document.createElement('tr'); TBODYjacsCells.appendChild(TRjacsCells); TDjacsCells = document.createElement('td'); TDjacsCells.className = 'jacsWeekNo'; TDjacsCells.id = calId+'Week_'+i; TRjacsCells.appendChild(TDjacsCells); for (var j=0;j<7;j++) {TDjacsCells = document.createElement('td'); TDjacsCells.className = 'jacsCells'; TDjacsCells.id = calId+'Cell_'+(j+(i*7)); TRjacsCells.appendChild(TDjacsCells); } } TFOOTjacsFoot = document.createElement('tfoot'); TABLEjacsCells.appendChild(TFOOTjacsFoot); TRjacsFoot = document.createElement('tr'); TRjacsFoot.id = calId+'Foot'; TFOOTjacsFoot.appendChild(TRjacsFoot); TDjacsFoot = document.createElement('td'); TDjacsFoot.colSpan = '8'; TDjacsFoot.style.padding = '0px'; TRjacsFoot.appendChild(TDjacsFoot); TABLEjacsFootDetail = document.createElement('table'); TABLEjacsFootDetail.style.width = '100%'; TABLEjacsFootDetail.cellSpacing = '0'; TABLEjacsFootDetail.cellPadding = '0'; TDjacsFoot.appendChild(TABLEjacsFootDetail); TBODYjacsFootDetail = document.createElement('tbody'); TABLEjacsFootDetail.appendChild(TBODYjacsFootDetail); TRjacsFootDetail = document.createElement('tr'); TBODYjacsFootDetail.appendChild(TRjacsFootDetail); TDjacsFootDetail = document.createElement('td'); TDjacsFootDetail.className = 'jacsClear'; TDjacsFootDetail.id = calId+'Clear'; TDjacsFootDetail.style.padding = '0px'; TRjacsFootDetail.appendChild(TDjacsFootDetail); INPUTjacsClearButton = document.createElement('input'); INPUTjacsClearButton.type = 'button'; INPUTjacsClearButton.id = calId+'ClearButton'; INPUTjacsClearButton.className = 'Clear'; INPUTjacsClearButton.style.textAlign = 'center'; INPUTjacsClearButton.onclick = function() {cal.targetEle.value='';hide(calId);}; TDjacsFootDetail.appendChild(INPUTjacsClearButton); TDjacsNow = document.createElement('td'); TDjacsNow.className = 'jacsNow'; TDjacsNow.id = calId+'Now'; TDjacsNow.style.padding = '0px'; TRjacsFootDetail.appendChild(TDjacsNow); if (TABLEjacs.clickToHide) {if (document.addEventListener) { TABLEjacs.addEventListener('click', cancel, false); TABLEjacs.addEventListener('change', cancel, false); TDjacsDrag.addEventListener('mousedown',beginDrag, false); INPUTjacsHead1.addEventListener('click', stopPropagation,false); SELECTjacsHead2.addEventListener('click', stopPropagation,false); SELECTjacsHead2.addEventListener('change', stopPropagation,false); SELECTjacsHead3.addEventListener('click', stopPropagation,false); SELECTjacsHead3.addEventListener('change', stopPropagation,false); INPUTjacsHead4.addEventListener('click', stopPropagation,false); TBODYjacsCells.addEventListener('click', stopPropagation,false); } else { TABLEjacs.attachEvent('onclick', cancel); TABLEjacs.attachEvent('onchange', cancel); TDjacsDrag.attachEvent('onmousedown',beginDrag); INPUTjacsHead1.attachEvent('onclick', stopPropagation); SELECTjacsHead2.attachEvent('onclick', stopPropagation); SELECTjacsHead2.attachEvent('onchange', stopPropagation); SELECTjacsHead3.attachEvent('onclick', stopPropagation); SELECTjacsHead3.attachEvent('onchange', stopPropagation); INPUTjacsHead4.attachEvent('onclick', stopPropagation); TBODYjacsCells.attachEvent('onclick', stopPropagation); } } else {if (document.addEventListener) { TABLEjacs.addEventListener('click', stopPropagation,false); TABLEjacs.addEventListener('change', stopPropagation,false); TDjacsDrag.addEventListener('mousedown',beginDrag, false); } else { TABLEjacs.attachEvent('onclick', stopPropagation); TABLEjacs.attachEvent('onchange', stopPropagation); TDjacsDrag.attachEvent('onmousedown',beginDrag); } } if (dynamic) {iFrame = document.createElement('iframe'); iFrame.className = 'jacs'; iFrame.id = calId+'Iframe'; if (getEl('jacsIElt7')) {iFrame.src = '/jacsblank.html';} iFrame.name = 'jacsIframe'; iFrame.frameborder = '0'; iFrame.style.zIndex = TABLEjacs.zIndex; document.body.insertBefore(iFrame, document.body.firstChild); document.body.insertBefore(TABLEjacs, iFrame); } else {if (!getEl('jacsSpan'+calId)) {document.writeln("");} getEl('jacsSpan'+calId).appendChild(TABLEjacs); } }, cals: function () {return cals;}, next: function () {if (typeof arguments[0]=='string') {calID = arguments[0]; inFunc = arguments[1]; argPosition = 2; } else {calID = 'jacs'; inFunc = arguments[0]; argPosition = 1; } if (getEl(calID)) {// Take the arguments to be passed through to the defined function. var args = new Array(); for (var i=argPosition;i> does not exist.\n' + 'Please check that the calendar object id is correct\n' + 'and that JACS.show is called before JACS.next.'); } } }; }; // ****************************** // End of Public Function Library // ****************************************************** // End of Javascript Advanced Calendar Script (JACS) Code // ****************************************************** var lastbtnsel = null; var currbtnsel = null; var myWidth = 0; var myHeight = 0; var myW; var currobj; function GetWH() { if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } } function Start() { GetWH(); } function Top() { window.scroll(0,0); } function Bottom() { window.scroll(0,1800); } function PrintPage(address) { window.open(address, "", "width=700, height=600, scrollbars, resizable"); window.print(); } function PrintInvoiceIn() { if ($("#guid").length>0) { var guid = $("#guid").val(); if (guid!="") { window.open("http://system.pieczywo-buczek.pl/invoiceinpreview.php?guid="+guid, "", "width=800, height=600, scrollbars, resizable"); } else { alert("ProszÄ™ najpierw zapisać fakturÄ™!"); } } else { alert("ProszÄ™ najpierw wybrać fakturÄ™!"); } } function PrintZPage(address) { window.open(address, "", "width=700, height=600, scrollbars, resizable"); } function PrintJCard(wid,year,month,uid) { window.open("http://system.pieczywo-buczek.pl/jcardpreview.php?w="+wid+"&y="+year+"&m="+month+"&u="+uid, "", "width=700, height=600, scrollbars, resizable"); } function ShowGallery(g) { window.open("http://system.pieczywo-buczek.pl/gallery.php?g="+g, "", "width=700, height=600, scrollbars, resizable"); } function ShowUpload(c) { window.open("http://system.pieczywo-buczek.pl/uploader.php?c="+c, "", "width=500, height=150, scrollbars=0, resizable=0"); } function CheckFile(){ str=document.getElementById('fileToUpload').value.toUpperCase(); suffix_1=".JPG"; suffix_2=".PNG"; if ((str.indexOf(suffix_1, str.length - suffix_1.length) == -1) && (str.indexOf(suffix_2, str.length - suffix_2.length) == -1)) { alert('Dozwolone tylko pliki jpg!'); document.getElementById('fileToUpload').value=''; } } function CheckSubmitFile() { str=document.getElementById('fileToUpload').value; if (str=="") { alert('Nie wybrano pliku!'); return false; } else { return true; } } function SelectPicture(picture) { var selectedpicture = picture; var pictureObj = window.opener.document.getElementById("picture"); pictureObj.value = selectedpicture; var imgObj = window.opener.document.getElementById("pictureImg"); imgObj.src = "pos_images/"+selectedpicture; self.close(); } function PrintContent() { var chtml = $("#secModule").html(); var pwindow = window.open('', 'my div', 'height=400,width=600'); pwindow.document.write('Druk'); pwindow.document.write(''); pwindow.document.write(''); pwindow.document.write(chtml); pwindow.document.write(''); pwindow.print(); pwindow.close(); return true; } function PrintSection(secname) { var chtml = $("#"+secname).html(); var pwindow = window.open('', 'my div', 'height=400,width=600'); pwindow.document.write('Druk'); pwindow.document.write(''); pwindow.document.write(''); pwindow.document.write(chtml); pwindow.document.write(''); pwindow.print(); pwindow.close(); return true; } function moin(button) { var btnimage = button.src; nbtnimage = btnimage.replace("_light.jpg",".jpg"); button.src = nbtnimage; } function moout(button) { if (button!=currbtnsel) { var btnimage = button.src; nbtnimage = btnimage.replace(".jpg","_light.jpg"); button.src = nbtnimage; } } function btnout(button) { var btnimage = button.src; nbtnimage = btnimage.replace(".jpg","_light.jpg"); button.src = nbtnimage; } function setbtnsel(buttonname) { var button = document.getElementById(buttonname); currbtnsel = button; document.getElementById('secTitle').innerHTML = button.alt; moin(button); } function topsetbtnsel(buttonname,oldbuttonname,paramname,paramvalue) { var button = top.window.document.getElementById(buttonname); var oldbutton = top.window.document.getElementById(oldbuttonname); var modname = button.id; top.window.currbtnsel=oldbutton; if (top.window.currbtnsel!=null) { top.window.lastbtnsel = top.window.currbtnsel; btnout(top.window.lastbtnsel); } top.window.currbtnsel = button; moin(button); top.window.document.getElementById('secTitle').innerHTML = button.alt; if (paramname!="") { params = "&"+paramname+"="+paramvalue; } else { params = ""; } window.location.href="./?m="+modname+params; } function Load(obj) { document.getElementById('secTitle').innerHTML = obj.text; document.getElementById('secStatus').innerHTML = "Trwa Å‚adowanie. ProszÄ™ czekać..."; window.editor.location.href="./?m="+obj.id; currobj = obj; } function go(button) { var modname = button.id; if (currbtnsel!=null) { lastbtnsel = currbtnsel; btnout(lastbtnsel); } currbtnsel = button; moin(button); document.getElementById('secTitle').innerHTML = button.alt; window.editor.location.href="./?m="+modname; } function reload(href) { window.location.href=href; } function reloadP(href) { parent.window.location.href=href; } function preview() { window.open('../','',''); } function IsValidObject(objToTest) { if (objToTest == null || objToTest == undefined) { return false; } return true; } function SendMessage() { var oEditor = FCKeditorAPI.GetInstance('message'); xHTML = oEditor.GetXHTML(true); xajax_SendMessage(xajax.getFormValues('EditMailFrm'),xHTML); } function SubmitForm(formname) { var form = document.getElementById(formname); if (IsValidObject(form)) { form.submit(); } } function addOption(selectId, txt, val) { var objOption = new Option(txt, val); document.getElementById(selectId).options.add(objOption); } function selOption(selectId,val) { document.getElementById(selectId).selectedIndex = val; } function clearOptions(selectId) { var lb = document.getElementById(selectId); for (var i=lb.options.length-1; i>=0; i--){ lb.options[i] = null; } lb.selectedIndex = -1; } function addDays(startDate,numberOfDays) { var returnDate = new Date( startDate.getFullYear(), startDate.getMonth(), startDate.getDate()+numberOfDays, startDate.getHours(), startDate.getMinutes(), startDate.getSeconds()); return returnDate; } function SetTP(days) { var sell_date = $("#sell_date").val(); startdate = new Date(sell_date); var new_date = addDays(startdate,days); var payment_date = new_date.toISOString().substring(0, 10); $("#payment_date").val(payment_date); } function GotoWebpage(pid) { topsetbtnsel('webpages','mainmenu','pid',pid); } function visibilityToggle(elementid,display) { var el= document.getElementById(elementid); if (display) { el.style.display='inline'; } else { el.style.display='none'; } } function SetErrField(name,err) { var el = document.getElementById(name); if (err) { el.style.backgroundColor = "red"; } else { el.style.backgroundColor = "white"; } } function DeleteBBProduction(pid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteBBProduction("+pid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ™ produkcjÄ™ ?','q'); } function DeleteCost(cid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteCost("+cid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten koszt ?','q'); } function DeletePrices(pid,aid,plid) { xajax_SetSection("event","secYes","onclick","xajax_DeletePrices("+pid+","+aid+","+plid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… cenÄ™ we wszystkich sklepach ?','q'); } function DeleteShopCost(cid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteShopCost("+cid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten koszt ?','q'); } function DeleteCostsShopsTypes(tid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteCostsShopsTypes("+tid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten typ kosztu ?','q'); } function DeleteProvider(pid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteProvider("+pid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego dostawcÄ™ ?','q'); } function DeleteCostsProvider(cpid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteCostsProvider("+cpid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego dostawcÄ™ ?','q'); } function DeleteUser(uid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteUser("+uid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego użytkownika ?','q'); } function DeleteShop(pid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteShop("+pid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten sklep ?','q'); } function DeleteWorker(uid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteWorker("+uid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego pracownika ?','q'); } function DeleteOutProvider(uid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteOutProvider("+uid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego dostawcÄ™ ?','q'); } function DeleteOutProduct(pid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteOutProduct("+pid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten towar ?','q'); } function DeleteCourseUser(cident) { xajax_SetSection("event","secYes","onclick","xajax_DeleteCourseUser('"+cident+"')"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego użytkownika ze szkolenia ?','q'); } function DeletePoll(pid) { xajax_SetSection("event","secYes","onclick","xajax_DeletePoll("+pid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… sondÄ™ ?','q'); } function DeleteBonus(bident) { xajax_SetSection("event","secYes","onclick","xajax_DeleteBonus('"+bident+"')"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… premiÄ™ ?','q'); } function DeleteCourse(cid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteCourse("+cid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć to szkolenie ?','q'); } function DeleteAdvanceIn(pid,gid,aid,datefrom,dateto,tn) { xajax_SetSection("event","secYes","onclick","xajax_DeleteAdvanceIn("+pid+","+gid+","+aid+",'"+datefrom+"','"+dateto+"',"+tn+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten zwrot ?','q'); } function DeleteAdvanceOut(aid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteAdvanceOut("+aid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ™ zaliczkÄ™ ?','q'); } function CUA(uid) { var cua = prompt("Nowe hasÅ‚o", ""); if (cua!=null) { if (cua.length<5) { showWindow('HasÅ‚o jest za krótkie (min. 5 znaki)!','i'); } else { xajax_CUA(uid,cua); } } } function PNA(pid,name) { var pna = prompt("Nowa nazwa", name); if (pna!=null) { if (pna.length<5) { showWindow('Nazwa jest za krótka (min. 5 znaki)!','i'); } else { xajax_PNA(pid,pna); } } } function CUP(uid) { var cup = prompt("Nowe hasÅ‚o", ""); if (cup!=null) { if (cup.length<5) { showWindow('HasÅ‚o jest za krótkie (min. 5 znaki)!','i'); } else { xajax_CUP(uid,cup); } } } function CPP(ident) { var cpp = prompt("Nowa cena", ""); if (cpp!=null) { xajax_CPP(ident,cpp); } } function CTP(ident) { var ctp = prompt("Nowy termin pÅ‚tnoÅ›ci", ""); if (ctp!=null) { xajax_CTP(ident,ctp); } } function CPN(ident) { var cpn = prompt("Nowa nazwa towaru", ""); if (cpn!=null) { xajax_CPN(ident,cpn); } } function SetToTill(tid,pid) { var cvalue = document.getElementById("hv_"+tid).value; var v = prompt("ZmieÅ„ wartość", cvalue); if (v) { xajax_xSetToTill(tid,pid,v); } } function DeleteList(lid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteList("+lid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… listÄ™ ?','q'); } function DeleteDList(lid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteDList("+lid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… listÄ™ ?','q'); } function DeleteOutList(lid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteOutList("+lid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… listÄ™ ?','q'); } function DeleteOrder(oid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteOrder("+oid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć to zamówienie ?','q'); } function DeleteTill(tid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteTill("+tid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… wypÅ‚atÄ™ ?','q'); } function DeleteContribution(cid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteContribution("+cid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… wpÅ‚atÄ™ ?','q'); } function DeleteContributionOut(cid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteContributionOut("+cid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… wypÅ‚atÄ™ ?','q'); } function DeleteContributor(cid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteContributor("+cid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego wpÅ‚acajÄ…cego ?','q'); } function DeleteGrantee(gid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteGrantee("+gid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tego pobierajÄ…cego ?','q'); } function DeleteReturn(rid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteReturn("+rid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten zwrot ?','q'); } function DeleteMail(mid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteMail("+mid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… wiadomość ?','q'); } function DeleteTake(tid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteTake("+tid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten utarg ?','q'); } function DeleteLeaflet(tid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteLeaflet("+tid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… sprzedaż ?','q'); } function DeleteRem(rid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteRem("+rid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten remanent ?','q'); } function DeletePlan(pid) { xajax_SetSection("event","secYes","onclick","xajax_DeletePlan("+pid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… pozycjÄ™ ?','q'); } function DeleteInv(vid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteInv("+vid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… fakturÄ™ ?','q'); } function DeleteInvi(iid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteInvi("+iid+",xajax.getFormValues('inviFrm'))"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… pozycjÄ™ ?','q'); } function DeleteJCard(uid,date) { xajax_SetSection("event","secYes","onclick","xajax_DeleteJCard('"+uid+"','"+date+"')"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć godziny pracy ?','q', 2200); } function DeleteInvoice(iid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteInvoice("+iid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… fakturÄ™ ?','q'); } function DeleteInvoiceIn(iid) { xajax_SetSection("event","secYes","onclick","xajax_DeleteInvoiceIn("+iid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć tÄ… fakturÄ™ ?','q'); } function DeletePWTO(iid) { xajax_SetSection("event","secYes","onclick","xajax_DeletePWTO("+iid+")"); showWindow('Czy jesteÅ› pewien, że chcesz usunąć ten dokument ?','q'); } function PrepareSMargin() { fobj = document.getElementById("marginFrm"); sum = 0; for(i=0; i