Advertisement
Guest User

pch

a guest
Mar 30th, 2014
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 87.48 KB | None | 0 0
  1. //Javasript name: My Date Time Picker
  2. //Date created: 16-Nov-2003 23:19
  3. //Creator: TengYong Ng
  4. //Website: http://www.rainforestnet.com
  5. //Copyright (c) 2003 TengYong Ng
  6. //FileName: DateTimePicker_css.js
  7. //Version: 2.2.2
  8. // Note: Permission given to use and modify this script in ANY kind of applications if
  9. // header lines are left unchanged.
  10. //Permission is granted to redistribute and modify this javascript under the terms of the GNU General Public License 3.0.
  11. //New Css style version added by Yvan Lavoie (Québec, Canada) 29-Jan-2009
  12. //Formatted for JSLint compatibility by Labsmedia.com (30-Dec-2010)
  13.  
  14.  
  15. //Global variables
  16.  
  17. var winCal;
  18. var dtToday;
  19. var Cal;
  20. var MonthName;
  21. var WeekDayName1;
  22. var WeekDayName2;
  23. var exDateTime;//Existing Date and Time
  24. var selDate;//selected date. version 1.7
  25. var calSpanID = "calBorder"; // span ID
  26. var domStyle = null; // span DOM object with style
  27. var cnLeft = "0";//left coordinate of calendar span
  28. var cnTop = "0";//top coordinate of calendar span
  29. var xpos = 0; // mouse x position
  30. var ypos = 0; // mouse y position
  31. var calHeight = 0; // calendar height
  32. var CalWidth = 208;// calendar width
  33. var CellWidth = 30;// width of day cell.
  34. var TimeMode = 24;// TimeMode value. 12 or 24
  35. var StartYear = 2012; //First Year in drop down year selection
  36. var EndYear = 1; // The last year of pickable date. if current year is 2011, the last year that still picker will be 2016 (2011+5)
  37. var CalPosOffsetX = -1; //X position offset relative to calendar icon, can be negative value
  38. var CalPosOffsetY = 0; //Y position offset relative to calendar icon, can be negative value
  39.  
  40. //Configurable parameters start
  41. var SpanBorderColor = "#000000";//span border color
  42. var SpanBgColor = "#FFFFFF"; //span background color
  43. var MonthYearColor = "#cc0033"; //Font Color of Month and Year in Calendar header.
  44. var WeekHeadColor = "#A3C159"; //var WeekHeadColor="#18861B";//Background Color in Week header.
  45. var SundayColor = "#BCBCBC"; //var SundayColor="#C0F64F";//Background color of Sunday.
  46. var SaturdayColor = "#BCBCBC"; //Background color of Saturday.
  47. var WeekDayColor = "#E2E2E2"; //Background color of weekdays.
  48. var FontColor = "blue"; //color of font in Calendar day cell.
  49. var TodayColor = "#8DD53C"; //var TodayColor="#FFFF33";//Background color of today.
  50. var SelDateColor = "#FFFF00"; //var SelDateColor = "#8DD53C";//Backgrond color of selected date in textbox.
  51. var YrSelColor = "#cc0033"; //color of font of Year selector.
  52. var MthSelColor = "#cc0033"; //color of font of Month selector if "MonthSelector" is "arrow".
  53. var HoverColor = "#E0FF38"; //color when mouse move over.
  54. var DisableColor = "#4f4f4f"; //color of disabled cell.
  55. var CalBgColor = "#ffffff"; //Background color of Calendar window.
  56.  
  57. var WeekChar = 2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
  58. var DateSeparator = "/";//Date Separator, you can change it to "-" if you want.
  59. var ShowLongMonth = true;//Show long month name in Calendar header. example: "January".
  60. var ShowMonthYear = true;//Show Month and Year in Calendar header.
  61. var ThemeBg = "";//Background image of Calendar window.
  62. var PrecedeZero = true;//Preceding zero [true|false]
  63. var MondayFirstDay = true;//true:Use Monday as first day; false:Sunday as first day. [true|false] //added in version 1.7
  64. var UseImageFiles = true;//Use image files with "arrows" and "close" button
  65. var imageFilesPath = "images/";
  66. //Configurable parameters end
  67.  
  68. //use the Month and Weekday in your preferred language.
  69. var MonthName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  70. var WeekDayName1 = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
  71. var WeekDayName2 = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
  72.  
  73.  
  74. //end Configurable parameters
  75.  
  76. //end Global variable
  77.  
  78.  
  79. // Calendar prototype
  80. function Calendar(pDate, pCtrl) {
  81. //Properties
  82. this.Date = pDate.getDate();//selected date
  83. this.Month = pDate.getMonth();//selected month number
  84. this.Year = pDate.getFullYear();//selected year in 4 digits
  85. this.Hours = pDate.getHours();
  86.  
  87. if (pDate.getMinutes() < 10)
  88. {
  89. this.Minutes = "0" + pDate.getMinutes();
  90. }
  91. else
  92. {
  93. this.Minutes = pDate.getMinutes();
  94. }
  95.  
  96. if (pDate.getSeconds() < 10)
  97. {
  98. this.Seconds = "0" + pDate.getSeconds();
  99. }
  100. else
  101. {
  102. this.Seconds = pDate.getSeconds();
  103. }
  104. this.MyWindow = winCal;
  105. this.Ctrl = pCtrl;
  106. this.Format = "ddMMyyyy";
  107. this.Separator = DateSeparator;
  108. this.ShowTime = false;
  109. this.Scroller = "DROPDOWN";
  110. if (pDate.getHours() < 12)
  111. {
  112. this.AMorPM = "AM";
  113. }
  114. else
  115. {
  116. this.AMorPM = "PM";
  117. }
  118. this.ShowSeconds = false;
  119. this.EnableDateMode = ""
  120. }
  121.  
  122. Calendar.prototype.GetMonthIndex = function (shortMonthName)
  123. {
  124. for (var i = 0; i < 12; i += 1)
  125. {
  126. if (MonthName[i].substring(0, 3).toUpperCase() === shortMonthName.toUpperCase())
  127. {
  128. return i;
  129. }
  130. }
  131. };
  132.  
  133. Calendar.prototype.IncYear = function () {
  134. if (Cal.Year <= dtToday.getFullYear()+EndYear)
  135. Cal.Year += 1;
  136. };
  137.  
  138. Calendar.prototype.DecYear = function () {
  139. if (Cal.Year > StartYear)
  140. Cal.Year -= 1;
  141. };
  142.  
  143. Calendar.prototype.IncMonth = function() {
  144. if (Cal.Year <= dtToday.getFullYear() + EndYear) {
  145. Cal.Month += 1;
  146. if (Cal.Month >= 12) {
  147. Cal.Month = 0;
  148. Cal.IncYear();
  149. }
  150. }
  151. };
  152.  
  153. Calendar.prototype.DecMonth = function() {
  154. if (Cal.Year >= StartYear) {
  155. Cal.Month -= 1;
  156. if (Cal.Month < 0) {
  157. Cal.Month = 11;
  158. Cal.DecYear();
  159. }
  160. }
  161. };
  162.  
  163. Calendar.prototype.SwitchMth = function (intMth)
  164. {
  165. Cal.Month = parseInt(intMth, 10);
  166. };
  167.  
  168. Calendar.prototype.SwitchYear = function (intYear)
  169. {
  170. Cal.Year = parseInt(intYear, 10);
  171. };
  172.  
  173. Calendar.prototype.SetHour = function (intHour)
  174. {
  175. var MaxHour,
  176. MinHour,
  177. HourExp = new RegExp("^\\d\\d"),
  178. SingleDigit = new RegExp("\\d");
  179.  
  180. if (TimeMode === 24)
  181. {
  182. MaxHour = 23;
  183. MinHour = 0;
  184. }
  185. else if (TimeMode === 12)
  186. {
  187. MaxHour = 12;
  188. MinHour = 1;
  189. }
  190. else
  191. {
  192. alert("TimeMode can only be 12 or 24");
  193. }
  194.  
  195. if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) > MaxHour))
  196. {
  197. intHour = MinHour;
  198. }
  199.  
  200. else if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) < MinHour))
  201. {
  202. intHour = MaxHour;
  203. }
  204.  
  205. if (SingleDigit.test(intHour))
  206. {
  207. intHour = "0" + intHour;
  208. }
  209.  
  210. if (HourExp.test(intHour) && (parseInt(intHour, 10) <= MaxHour) && (parseInt(intHour, 10) >= MinHour))
  211. {
  212. if ((TimeMode === 12) && (Cal.AMorPM === "PM"))
  213. {
  214. if (parseInt(intHour, 10) === 12)
  215. {
  216. Cal.Hours = 12;
  217. }
  218. else
  219. {
  220. Cal.Hours = parseInt(intHour, 10) + 12;
  221. }
  222. }
  223.  
  224. else if ((TimeMode === 12) && (Cal.AMorPM === "AM"))
  225. {
  226. if (intHour === 12)
  227. {
  228. intHour -= 12;
  229. }
  230.  
  231. Cal.Hours = parseInt(intHour, 10);
  232. }
  233.  
  234. else if (TimeMode === 24)
  235. {
  236. Cal.Hours = parseInt(intHour, 10);
  237. }
  238. }
  239.  
  240. };
  241.  
  242. Calendar.prototype.SetMinute = function (intMin)
  243. {
  244. var MaxMin = 59,
  245. MinMin = 0,
  246.  
  247. SingleDigit = new RegExp("\\d"),
  248. SingleDigit2 = new RegExp("^\\d{1}$"),
  249. MinExp = new RegExp("^\\d{2}$"),
  250.  
  251. strMin = 0;
  252.  
  253. if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) > MaxMin))
  254. {
  255. intMin = MinMin;
  256. }
  257.  
  258. else if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) < MinMin))
  259. {
  260. intMin = MaxMin;
  261. }
  262.  
  263. strMin = intMin + "";
  264. if (SingleDigit2.test(intMin))
  265. {
  266. strMin = "0" + strMin;
  267. }
  268.  
  269. if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) <= 59) && (parseInt(intMin, 10) >= 0))
  270. {
  271. Cal.Minutes = strMin;
  272. }
  273. };
  274.  
  275. Calendar.prototype.SetSecond = function (intSec)
  276. {
  277. var MaxSec = 59,
  278. MinSec = 0,
  279.  
  280. SingleDigit = new RegExp("\\d"),
  281. SingleDigit2 = new RegExp("^\\d{1}$"),
  282. SecExp = new RegExp("^\\d{2}$"),
  283.  
  284. strSec = 0;
  285.  
  286. if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) > MaxSec))
  287. {
  288. intSec = MinSec;
  289. }
  290.  
  291. else if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) < MinSec))
  292. {
  293. intSec = MaxSec;
  294. }
  295.  
  296. strSec = intSec + "";
  297. if (SingleDigit2.test(intSec))
  298. {
  299. strSec = "0" + strSec;
  300. }
  301.  
  302. if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) <= 59) && (parseInt(intSec, 10) >= 0))
  303. {
  304. Cal.Seconds = strSec;
  305. }
  306.  
  307. };
  308.  
  309. Calendar.prototype.SetAmPm = function (pvalue)
  310. {
  311. this.AMorPM = pvalue;
  312. if (pvalue === "PM")
  313. {
  314. this.Hours = parseInt(this.Hours, 10) + 12;
  315. if (this.Hours === 24)
  316. {
  317. this.Hours = 12;
  318. }
  319. }
  320.  
  321. else if (pvalue === "AM")
  322. {
  323. this.Hours -= 12;
  324. }
  325. };
  326.  
  327. Calendar.prototype.getShowHour = function ()
  328. {
  329. var finalHour;
  330.  
  331. if (TimeMode === 12)
  332. {
  333. if (parseInt(this.Hours, 10) === 0)
  334. {
  335. this.AMorPM = "AM";
  336. finalHour = parseInt(this.Hours, 10) + 12;
  337. }
  338.  
  339. else if (parseInt(this.Hours, 10) === 12)
  340. {
  341. this.AMorPM = "PM";
  342. finalHour = 12;
  343. }
  344.  
  345. else if (this.Hours > 12)
  346. {
  347. this.AMorPM = "PM";
  348. if ((this.Hours - 12) < 10)
  349. {
  350. finalHour = "0" + ((parseInt(this.Hours, 10)) - 12);
  351. }
  352. else
  353. {
  354. finalHour = parseInt(this.Hours, 10) - 12;
  355. }
  356. }
  357. else
  358. {
  359. this.AMorPM = "AM";
  360. if (this.Hours < 10)
  361. {
  362. finalHour = "0" + parseInt(this.Hours, 10);
  363. }
  364. else
  365. {
  366. finalHour = this.Hours;
  367. }
  368. }
  369. }
  370.  
  371. else if (TimeMode === 24)
  372. {
  373. if (this.Hours < 10)
  374. {
  375. finalHour = "0" + parseInt(this.Hours, 10);
  376. }
  377. else
  378. {
  379. finalHour = this.Hours;
  380. }
  381. }
  382.  
  383. return finalHour;
  384. };
  385.  
  386. Calendar.prototype.getShowAMorPM = function ()
  387. {
  388. return this.AMorPM;
  389. };
  390.  
  391. Calendar.prototype.GetMonthName = function (IsLong)
  392. {
  393. var Month = MonthName[this.Month];
  394. if (IsLong)
  395. {
  396. return Month;
  397. }
  398. else
  399. {
  400. return Month.substr(0, 3);
  401. }
  402. };
  403.  
  404. Calendar.prototype.GetMonDays = function() { //Get number of days in a month
  405.  
  406. var DaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  407. if (Cal.IsLeapYear()) {
  408. DaysInMonth[1] = 29;
  409. }
  410.  
  411. return DaysInMonth[this.Month];
  412. };
  413.  
  414. Calendar.prototype.IsLeapYear = function ()
  415. {
  416. if ((this.Year % 4) === 0)
  417. {
  418. if ((this.Year % 100 === 0) && (this.Year % 400) !== 0)
  419. {
  420. return false;
  421. }
  422. else
  423. {
  424. return true;
  425. }
  426. }
  427. else
  428. {
  429. return false;
  430. }
  431. };
  432.  
  433. Calendar.prototype.FormatDate = function (pDate)
  434. {
  435. var MonthDigit = this.Month + 1;
  436. if (PrecedeZero === true)
  437. {
  438. if ((pDate < 10) && String(pDate).length===1) //length checking added in version 2.2
  439. {
  440. pDate = "0" + pDate;
  441. }
  442. if (MonthDigit < 10)
  443. {
  444. MonthDigit = "0" + MonthDigit;
  445. }
  446. }
  447.  
  448. switch (this.Format.toUpperCase())
  449. {
  450. case "DDMMYYYY":
  451. return (pDate + DateSeparator + MonthDigit + DateSeparator + this.Year);
  452. case "DDMMMYYYY":
  453. return (pDate + DateSeparator + this.GetMonthName(false) + DateSeparator + this.Year);
  454. case "MMDDYYYY":
  455. return (MonthDigit + DateSeparator + pDate + DateSeparator + this.Year);
  456. case "MMMDDYYYY":
  457. return (this.GetMonthName(false) + DateSeparator + pDate + DateSeparator + this.Year);
  458. case "YYYYMMDD":
  459. return (this.Year + DateSeparator + MonthDigit + DateSeparator + pDate);
  460. case "YYMMDD":
  461. return (String(this.Year).substring(2, 4) + DateSeparator + MonthDigit + DateSeparator + pDate);
  462. case "YYMMMDD":
  463. return (String(this.Year).substring(2, 4) + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
  464. case "YYYYMMMDD":
  465. return (this.Year + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
  466. default:
  467. return (pDate + DateSeparator + (this.Month + 1) + DateSeparator + this.Year);
  468. }
  469. };
  470.  
  471. // end Calendar prototype
  472.  
  473. function GenCell(pValue, pHighLight, pColor, pClickable)
  474. { //Generate table cell with value
  475. var PValue,
  476. PCellStr,
  477. PClickable,
  478. vTimeStr;
  479.  
  480. if (!pValue)
  481. {
  482. PValue = "";
  483. }
  484. else
  485. {
  486. PValue = pValue;
  487. }
  488.  
  489. if (pColor === undefined)
  490. pColor = CalBgColor;
  491.  
  492. if (pClickable !== undefined){
  493. PClickable = pClickable;
  494. }
  495. else{
  496. PClickable = true;
  497. }
  498.  
  499. if (Cal.ShowTime)
  500. {
  501. vTimeStr = ' ' + Cal.Hours + ':' + Cal.Minutes;
  502. if (Cal.ShowSeconds)
  503. {
  504. vTimeStr += ':' + Cal.Seconds;
  505. }
  506. if (TimeMode === 12)
  507. {
  508. vTimeStr += ' ' + Cal.AMorPM;
  509. }
  510. }
  511.  
  512. else
  513. {
  514. vTimeStr = "";
  515. }
  516.  
  517. if (PValue !== "")
  518. {
  519. if (PClickable === true) {
  520. if (Cal.ShowTime === true)
  521. { PCellStr = "<td id='c" + PValue + "' class='calTD' style='text-align:center;cursor:pointer;background-color:"+pColor+"' onmousedown='selectDate(this," + PValue + ");'>" + PValue + "</td>"; }
  522. else { PCellStr = "<td class='calTD' style='text-align:center;cursor:pointer;background-color:" + pColor + "' onmouseover='changeBorder(this, 0);' onmouseout=\"changeBorder(this, 1, '" + pColor + "');\" onClick=\"javascript:callback('" + Cal.Ctrl + "','" + Cal.FormatDate(PValue) + "');\">" + PValue + "</td>"; }
  523. }
  524. else
  525. { PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'>"+PValue+"</td>"; }
  526. }
  527. else
  528. { PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'>&nbsp;</td>"; }
  529.  
  530. return PCellStr;
  531. }
  532.  
  533. function RenderCssCal(bNewCal)
  534. {
  535. if (typeof bNewCal === "undefined" || bNewCal !== true)
  536. {
  537. bNewCal = false;
  538. }
  539. var vCalHeader,
  540. vCalData,
  541. vCalTime = "",
  542. vCalClosing = "",
  543. winCalData = "",
  544. CalDate,
  545.  
  546. i,
  547. j,
  548.  
  549. SelectStr,
  550. vDayCount = 0,
  551. vFirstDay,
  552.  
  553. WeekDayName = [],//Added version 1.7
  554. strCell,
  555.  
  556. showHour,
  557. ShowArrows = false,
  558. HourCellWidth = "35px", //cell width with seconds.
  559.  
  560. SelectAm,
  561. SelectPm,
  562.  
  563. funcCalback,
  564.  
  565. headID,
  566. e,
  567. cssStr,
  568. style,
  569. cssText,
  570. span;
  571.  
  572. calHeight = 0; // reset the window height on refresh
  573.  
  574. // Set the default cursor for the calendar
  575.  
  576. winCalData = "<span style='cursor:auto;'>";
  577. vCalHeader = "<table style='background-color:"+CalBgColor+";width:200px;padding:0;margin:5px auto 5px auto'><tbody>";
  578.  
  579. //Table for Month & Year Selector
  580.  
  581. vCalHeader += "<tr><td colspan='7'><table border='0' width='200px' cellpadding='0' cellspacing='0'><tr>";
  582. //******************Month and Year selector in dropdown list************************
  583.  
  584. if (Cal.Scroller === "DROPDOWN")
  585. {
  586. vCalHeader += "<td align='center'><select name='MonthSelector' onChange='javascript:Cal.SwitchMth(this.selectedIndex);RenderCssCal();'>";
  587. for (i = 0; i < 12; i += 1)
  588. {
  589. if (i === Cal.Month)
  590. {
  591. SelectStr = "Selected";
  592. }
  593. else
  594. {
  595. SelectStr = "";
  596. }
  597. vCalHeader += "<option " + SelectStr + " value=" + i + ">" + MonthName[i] + "</option>";
  598. }
  599.  
  600. vCalHeader += "</select></td>";
  601. //Year selector
  602.  
  603. vCalHeader += "<td align='center'><select name='YearSelector' size='1' onChange='javascript:Cal.SwitchYear(this.value);RenderCssCal();'>";
  604. for (i = StartYear; i <= (dtToday.getFullYear() + EndYear); i += 1)
  605. {
  606. if (i === Cal.Year)
  607. {
  608. SelectStr = 'selected="selected"';
  609. }
  610. else
  611. {
  612. SelectStr = '';
  613. }
  614. vCalHeader += "<option " + SelectStr + " value=" + i + ">" + i + "</option>\n";
  615. }
  616. vCalHeader += "</select></td>\n";
  617. calHeight += 30;
  618. }
  619.  
  620. //******************End Month and Year selector in dropdown list*********************
  621.  
  622. //******************Month and Year selector in arrow*********************************
  623.  
  624. else if (Cal.Scroller === "ARROW")
  625. {
  626. if (UseImageFiles)
  627. {
  628. vCalHeader += "<td><img onmousedown='javascript:Cal.DecYear();RenderCssCal();' src='"+imageFilesPath+"cal_fastreverse.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n";//Year scroller (decrease 1 year)
  629. vCalHeader += "<td><img onmousedown='javascript:Cal.DecMonth();RenderCssCal();' src='" + imageFilesPath + "cal_reverse.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Month scroller (decrease 1 month)
  630. vCalHeader += "<td width='70%' class='calR' style='color:"+YrSelColor+"'>"+ Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>"; //Month and Year
  631. vCalHeader += "<td><img onmousedown='javascript:Cal.IncMonth();RenderCssCal();' src='" + imageFilesPath + "cal_forward.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Month scroller (increase 1 month)
  632. vCalHeader += "<td><img onmousedown='javascript:Cal.IncYear();RenderCssCal();' src='" + imageFilesPath + "cal_fastforward.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Year scroller (increase 1 year)
  633. calHeight += 22;
  634. }
  635. else
  636. {
  637. vCalHeader += "<td><span id='dec_year' title='reverse year' onmousedown='javascript:Cal.DecYear();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white; color:" + YrSelColor + "'>-</span></td>";//Year scroller (decrease 1 year)
  638. vCalHeader += "<td><span id='dec_month' title='reverse month' onmousedown='javascript:Cal.DecMonth();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'>&lt;</span></td>\n";//Month scroller (decrease 1 month)
  639. vCalHeader += "<td width='70%' class='calR' style='color:" + YrSelColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>\n"; //Month and Year
  640. vCalHeader += "<td><span id='inc_month' title='forward month' onmousedown='javascript:Cal.IncMonth();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'>&gt;</span></td>\n";//Month scroller (increase 1 month)
  641. vCalHeader += "<td><span id='inc_year' title='forward year' onmousedown='javascript:Cal.IncYear();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white; color:" + YrSelColor + "'>+</span></td>\n";//Year scroller (increase 1 year)
  642. calHeight += 22;
  643. }
  644. }
  645.  
  646. vCalHeader += "</tr></table></td></tr>";
  647.  
  648. //******************End Month and Year selector in arrow******************************
  649.  
  650. //Calendar header shows Month and Year
  651. if (ShowMonthYear && Cal.Scroller === "DROPDOWN")
  652. {
  653. vCalHeader += "<tr><td colspan='7' class='calR' style='color:" + MonthYearColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td></tr>";
  654. calHeight += 19;
  655. }
  656.  
  657. //Week day header
  658.  
  659. vCalHeader += "<tr><td colspan=\"7\"><table style='border-spacing:1px;border-collapse:separate;'><tr>";
  660. if (MondayFirstDay === true)
  661. {
  662. WeekDayName = WeekDayName2;
  663. }
  664. else
  665. {
  666. WeekDayName = WeekDayName1;
  667. }
  668. for (i = 0; i < 7; i += 1)
  669. {
  670. vCalHeader += "<td style='background-color:"+WeekHeadColor+";width:"+CellWidth+"px;color:#FFFFFF' class='calTD'>" + WeekDayName[i].substr(0, WeekChar) + "</td>";
  671. }
  672.  
  673. calHeight += 19;
  674. vCalHeader += "</tr>";
  675. //Calendar detail
  676. CalDate = new Date(Cal.Year, Cal.Month);
  677. CalDate.setDate(1);
  678.  
  679. vFirstDay = CalDate.getDay();
  680.  
  681. //Added version 1.7
  682. if (MondayFirstDay === true)
  683. {
  684. vFirstDay -= 1;
  685. if (vFirstDay === -1)
  686. {
  687. vFirstDay = 6;
  688. }
  689. }
  690.  
  691. //Added version 1.7
  692. vCalData = "<tr>";
  693. calHeight += 19;
  694. for (i = 0; i < vFirstDay; i += 1)
  695. {
  696. vCalData = vCalData + GenCell();
  697. vDayCount = vDayCount + 1;
  698. }
  699.  
  700. //Added version 1.7
  701. for (j = 1; j <= Cal.GetMonDays(); j += 1)
  702. {
  703. if ((vDayCount % 7 === 0) && (j > 1))
  704. {
  705. vCalData = vCalData + "<tr>";
  706. }
  707.  
  708. vDayCount = vDayCount + 1;
  709. //added version 2.1.2
  710. if (Cal.EnableDateMode === "future" && ((j < dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Month < dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Year < dtToday.getFullYear())))
  711. {
  712. strCell = GenCell(j, false, DisableColor, false); //Before today's date is not clickable
  713. }
  714. else if (Cal.EnableDateMode === "past" && ((j >= dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Month > dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Year > dtToday.getFullYear()))) {
  715. strCell = GenCell(j, false, DisableColor, false); //After today's date is not clickable
  716. }
  717. //if End Year + Current Year = Cal.Year. Disable.
  718. else if (Cal.Year > (dtToday.getFullYear()+EndYear))
  719. {
  720. strCell = GenCell(j, false, DisableColor, false);
  721. }
  722. else if ((j === dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()))
  723. {
  724. strCell = GenCell(j, true, TodayColor);//Highlight today's date
  725. }
  726. else
  727. {
  728. if ((j === selDate.getDate()) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())){
  729. //modified version 1.7
  730. strCell = GenCell(j, true, SelDateColor);
  731. }
  732. else
  733. {
  734. if (MondayFirstDay === true)
  735. {
  736. if (vDayCount % 7 === 0)
  737. {
  738. strCell = GenCell(j, false, SundayColor);
  739. }
  740. else if ((vDayCount + 1) % 7 === 0)
  741. {
  742. strCell = GenCell(j, false, SaturdayColor);
  743. }
  744. else
  745. {
  746. strCell = GenCell(j, null, WeekDayColor);
  747. }
  748. }
  749. else
  750. {
  751. if (vDayCount % 7 === 0)
  752. {
  753. strCell = GenCell(j, false, SaturdayColor);
  754. }
  755. else if ((vDayCount + 6) % 7 === 0)
  756. {
  757. strCell = GenCell(j, false, SundayColor);
  758. }
  759. else
  760. {
  761. strCell = GenCell(j, null, WeekDayColor);
  762. }
  763. }
  764. }
  765. }
  766.  
  767. vCalData = vCalData + strCell;
  768.  
  769. if ((vDayCount % 7 === 0) && (j < Cal.GetMonDays()))
  770. {
  771. vCalData = vCalData + "</tr>";
  772. calHeight += 19;
  773. }
  774. }
  775.  
  776. // finish the table proper
  777.  
  778. if (vDayCount % 7 !== 0)
  779. {
  780. while (vDayCount % 7 !== 0)
  781. {
  782. vCalData = vCalData + GenCell();
  783. vDayCount = vDayCount + 1;
  784. }
  785. }
  786.  
  787. vCalData = vCalData + "</table></td></tr>";
  788.  
  789.  
  790. //Time picker
  791. if (Cal.ShowTime === true)
  792. {
  793. showHour = Cal.getShowHour();
  794.  
  795. if (Cal.ShowSeconds === false && TimeMode === 24)
  796. {
  797. ShowArrows = true;
  798. HourCellWidth = "10px";
  799. }
  800.  
  801. vCalTime = "<tr><td colspan='7' style=\"text-align:center;\"><table border='0' width='199px' cellpadding='0' cellspacing='0'><tbody><tr><td height='5px' width='" + HourCellWidth + "'>&nbsp;</td>";
  802.  
  803. if (ShowArrows && UseImageFiles) //this is where the up and down arrow control the hour.
  804. {
  805. vCalTime += "<td style='vertical-align:middle;'><table cellspacing='0' cellpadding='0' style='line-height:0pt;width:100%;'><tr><td style='text-align:center;'><img onclick='nextStep(\"Hour\", \"plus\");' onmousedown='startSpin(\"Hour\", \"plus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_plus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr><tr><td style='text-align:center;'><img onclick='nextStep(\"Hour\", \"minus\");' onmousedown='startSpin(\"Hour\", \"minus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_minus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr></table></td>\n";
  806. }
  807.  
  808. vCalTime += "<td width='22px'><input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH:22px\" value=" + showHour + " onkeyup=\"javascript:Cal.SetHour(this.value)\">";
  809. vCalTime += "</td><td style='font-weight:bold;text-align:center;'>:</td><td width='22px'>";
  810. vCalTime += "<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 22px\" value=" + Cal.Minutes + " onkeyup=\"javascript:Cal.SetMinute(this.value)\">";
  811.  
  812. if (Cal.ShowSeconds)
  813. {
  814. vCalTime += "</td><td style='font-weight:bold;'>:</td><td width='22px'>";
  815. vCalTime += "<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 22px\" value=" + Cal.Seconds + " onkeyup=\"javascript:Cal.SetSecond(parseInt(this.value,10))\">";
  816. }
  817.  
  818. if (TimeMode === 12)
  819. {
  820. SelectAm = (Cal.AMorPM === "AM") ? "Selected" : "";
  821. SelectPm = (Cal.AMorPM === "PM") ? "Selected" : "";
  822.  
  823. vCalTime += "</td><td>";
  824. vCalTime += "<select name=\"ampm\" onChange=\"javascript:Cal.SetAmPm(this.options[this.selectedIndex].value);\">\n";
  825. vCalTime += "<option " + SelectAm + " value=\"AM\">AM</option>";
  826. vCalTime += "<option " + SelectPm + " value=\"PM\">PM<option>";
  827. vCalTime += "</select>";
  828. }
  829.  
  830. if (ShowArrows && UseImageFiles) //this is where the up and down arrow to change the "Minute".
  831. {
  832. vCalTime += "</td>\n<td style='vertical-align:middle;'><table cellspacing='0' cellpadding='0' style='line-height:0pt;width:100%'><tr><td style='text-align:center;'><img onclick='nextStep(\"Minute\", \"plus\");' onmousedown='startSpin(\"Minute\", \"plus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_plus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr><tr><td style='text-align:center;'><img onmousedown='startSpin(\"Minute\", \"minus\");' onmouseup='stopSpin();' onclick='nextStep(\"Minute\",\"minus\");' src='" + imageFilesPath + "cal_minus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr></table>";
  833. }
  834.  
  835. vCalTime += "</td>\n<td align='right' valign='bottom' width='" + HourCellWidth + "px'></td></tr>";
  836. vCalTime += "<tr><td colspan='8' style=\"text-align:center;\"><input style='width:60px;font-size:12px;' onClick='javascript:closewin(\"" + Cal.Ctrl + "\");' type=\"button\" value=\"OK\">&nbsp;<input style='width:60px;font-size:12px;' onClick='javascript: winCal.style.visibility = \"hidden\"' type=\"button\" value=\"Cancel\"></td></tr>";
  837. }
  838. else //if not to show time.
  839. {
  840. vCalTime += "\n<tr>\n<td colspan='7' style=\"text-align:right;\">";
  841. //close button
  842. if (UseImageFiles) {
  843. vCalClosing += "<img onmousedown='javascript:closewin(\"" + Cal.Ctrl + "\"); stopSpin();' src='"+imageFilesPath+"cal_close.gif' width='16px' height='14px' onmouseover='changeBorder(this,0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>";
  844. }
  845. else {
  846. vCalClosing += "<span id='close_cal' title='close'onmousedown='javascript:closewin(\"" + Cal.Ctrl + "\");stopSpin();' onmouseover='changeBorder(this, 0)'onmouseout='changeBorder(this, 1)' style='border:1px solid white; font-family: Arial;font-size: 10pt;'>x</span></td>";
  847. }
  848. vCalClosing += "</tr>";
  849. }
  850. vCalClosing += "</tbody></table></td></tr>";
  851. calHeight += 31;
  852. vCalClosing += "</tbody></table>\n</span>";
  853.  
  854. //end time picker
  855. funcCalback = "function callback(id, datum) {";
  856. funcCalback += " var CalId = document.getElementById(id);if (datum=== 'undefined') { var d = new Date(); datum = d.getDate() + '/' +(d.getMonth()+1) + '/' + d.getFullYear(); } window.calDatum=datum;CalId.value=datum;";
  857. funcCalback += " if(Cal.ShowTime){";
  858. funcCalback += " CalId.value+=' '+Cal.getShowHour()+':'+Cal.Minutes;";
  859. funcCalback += " if (Cal.ShowSeconds) CalId.value+=':'+Cal.Seconds;";
  860. funcCalback += " if (TimeMode === 12) CalId.value+=''+Cal.getShowAMorPM();";
  861. funcCalback += "}if(CalId.onchange!=undefined) CalId.onchange();CalId.focus();winCal.style.visibility='hidden';}";
  862. funcCalback += "satcheck()"
  863.  
  864. // determines if there is enough space to open the cal above the position where it is called
  865. if (ypos > calHeight)
  866. {
  867. ypos = ypos - calHeight;
  868. }
  869.  
  870. if (!winCal)
  871. {
  872. headID = document.getElementsByTagName("head")[0];
  873.  
  874. // add javascript function to the span cal
  875. e = document.createElement("script");
  876. e.type = "text/javascript";
  877. e.language = "javascript";
  878. e.text = funcCalback;
  879. headID.appendChild(e);
  880. // add stylesheet to the span cal
  881.  
  882. cssStr = ".calTD {font-family: verdana; font-size: 12px; text-align: center; border:0; }\n";
  883. cssStr += ".calR {font-family: verdana; font-size: 12px; text-align: center; font-weight: bold;}";
  884.  
  885. style = document.createElement("style");
  886. style.type = "text/css";
  887. style.rel = "stylesheet";
  888. if (style.styleSheet)
  889. { // IE
  890. style.styleSheet.cssText = cssStr;
  891. }
  892.  
  893. else
  894. { // w3c
  895. cssText = document.createTextNode(cssStr);
  896. style.appendChild(cssText);
  897. }
  898.  
  899. headID.appendChild(style);
  900. // create the outer frame that allows the cal. to be moved
  901. span = document.createElement("span");
  902. span.id = calSpanID;
  903. span.style.position = "absolute";
  904. span.style.left = (xpos + CalPosOffsetX) + 'px';
  905. span.style.top = (ypos - CalPosOffsetY) + 'px';
  906. span.style.width = CalWidth + 'px';
  907. span.style.border = "solid 1pt " + SpanBorderColor;
  908. span.style.padding = "0";
  909. span.style.cursor = "move";
  910. span.style.backgroundColor = SpanBgColor;
  911. span.style.zIndex = 100;
  912. document.body.appendChild(span);
  913. winCal = document.getElementById(calSpanID);
  914. }
  915.  
  916. else
  917. {
  918. winCal.style.visibility = "visible";
  919. winCal.style.Height = calHeight;
  920.  
  921. // set the position for a new calendar only
  922. if (bNewCal === true)
  923. {
  924. winCal.style.left = (xpos + CalPosOffsetX) + 'px';
  925. winCal.style.top = (ypos - CalPosOffsetY) + 'px';
  926. }
  927. }
  928.  
  929. winCal.innerHTML = winCalData + vCalHeader + vCalData + vCalTime + vCalClosing;
  930. return true;
  931. }
  932.  
  933.  
  934. function NewCssCal(pCtrl, pFormat, pScroller, pShowTime, pTimeMode, pShowSeconds, pEnableDateMode)
  935. {
  936. // get current date and time
  937.  
  938. dtToday = new Date();
  939. Cal = new Calendar(dtToday);
  940.  
  941. if (pShowTime !== undefined)
  942. {
  943. if (pShowTime) {
  944. Cal.ShowTime = true;
  945. }
  946. else {
  947. Cal.ShowTime = false;
  948. }
  949.  
  950. if (pTimeMode)
  951. {
  952. pTimeMode = parseInt(pTimeMode, 10);
  953. }
  954. if (pTimeMode === 12 || pTimeMode === 24)
  955. {
  956. TimeMode = pTimeMode;
  957. }
  958. else
  959. {
  960. TimeMode = 24;
  961. }
  962.  
  963. if (pShowSeconds !== undefined)
  964. {
  965. if (pShowSeconds)
  966. {
  967. Cal.ShowSeconds = true;
  968. }
  969. else
  970. {
  971. Cal.ShowSeconds = false;
  972. }
  973. }
  974. else
  975. {
  976. Cal.ShowSeconds = false;
  977. }
  978.  
  979. }
  980.  
  981. if (pCtrl !== undefined)
  982. {
  983. Cal.Ctrl = pCtrl;
  984. }
  985.  
  986. if (pFormat!== undefined && pFormat !=="")
  987. {
  988. Cal.Format = pFormat.toUpperCase();
  989. }
  990. else
  991. {
  992. Cal.Format = "MMDDYYYY";
  993. }
  994.  
  995. if (pScroller!== undefined && pScroller!=="")
  996. {
  997. if (pScroller.toUpperCase() === "ARROW")
  998. {
  999. Cal.Scroller = "ARROW";
  1000. }
  1001. else
  1002. {
  1003. Cal.Scroller = "DROPDOWN";
  1004. }
  1005. }
  1006.  
  1007. if (pEnableDateMode !== undefined && (pEnableDateMode === "future" || pEnableDateMode === "past")) {
  1008. Cal.EnableDateMode= pEnableDateMode;
  1009. }
  1010.  
  1011. exDateTime = document.getElementById(pCtrl).value; //Existing Date Time value in textbox.
  1012.  
  1013. if (exDateTime)
  1014. { //Parse existing Date String
  1015. var Sp1 = exDateTime.indexOf(DateSeparator, 0),//Index of Date Separator 1
  1016. Sp2 = exDateTime.indexOf(DateSeparator, parseInt(Sp1, 10) + 1),//Index of Date Separator 2
  1017. tSp1,//Index of Time Separator 1
  1018. tSp2,//Index of Time Separator 2
  1019. strMonth,
  1020. strDate,
  1021. strYear,
  1022. intMonth,
  1023. YearPattern,
  1024. strHour,
  1025. strMinute,
  1026. strSecond,
  1027. winHeight,
  1028. offset = parseInt(Cal.Format.toUpperCase().lastIndexOf("M"), 10) - parseInt(Cal.Format.toUpperCase().indexOf("M"), 10) - 1,
  1029. strAMPM = "";
  1030. //parse month
  1031.  
  1032. if (Cal.Format.toUpperCase() === "DDMMYYYY" || Cal.Format.toUpperCase() === "DDMMMYYYY")
  1033. {
  1034. if (DateSeparator === "")
  1035. {
  1036. strMonth = exDateTime.substring(2, 4 + offset);
  1037. strDate = exDateTime.substring(0, 2);
  1038. strYear = exDateTime.substring(4 + offset, 8 + offset);
  1039. }
  1040. else
  1041. {
  1042. if (exDateTime.indexOf("D*") !== -1)
  1043. { //DTG
  1044. strMonth = exDateTime.substring(8, 11);
  1045. strDate = exDateTime.substring(0, 2);
  1046. strYear = "20" + exDateTime.substring(11, 13); //Hack, nur für Jahreszahlen ab 2000
  1047.  
  1048. }
  1049. else
  1050. {
  1051. strMonth = exDateTime.substring(Sp1 + 1, Sp2);
  1052. strDate = exDateTime.substring(0, Sp1);
  1053. strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
  1054. }
  1055. }
  1056. }
  1057.  
  1058. else if (Cal.Format.toUpperCase() === "MMDDYYYY" || Cal.Format.toUpperCase() === "MMMDDYYYY"){
  1059. if (DateSeparator === ""){
  1060. strMonth = exDateTime.substring(0, 2 + offset);
  1061. strDate = exDateTime.substring(2 + offset, 4 + offset);
  1062. strYear = exDateTime.substring(4 + offset, 8 + offset);
  1063. }
  1064. else{
  1065. strMonth = exDateTime.substring(0, Sp1);
  1066. strDate = exDateTime.substring(Sp1 + 1, Sp2);
  1067. strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
  1068. }
  1069. }
  1070.  
  1071. else if (Cal.Format.toUpperCase() === "YYYYMMDD" || Cal.Format.toUpperCase() === "YYYYMMMDD")
  1072. {
  1073. if (DateSeparator === ""){
  1074. strMonth = exDateTime.substring(4, 6 + offset);
  1075. strDate = exDateTime.substring(6 + offset, 8 + offset);
  1076. strYear = exDateTime.substring(0, 4);
  1077. }
  1078. else{
  1079. strMonth = exDateTime.substring(Sp1 + 1, Sp2);
  1080. strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
  1081. strYear = exDateTime.substring(0, Sp1);
  1082. }
  1083. }
  1084.  
  1085. else if (Cal.Format.toUpperCase() === "YYMMDD" || Cal.Format.toUpperCase() === "YYMMMDD")
  1086. {
  1087. if (DateSeparator === "")
  1088. {
  1089. strMonth = exDateTime.substring(2, 4 + offset);
  1090. strDate = exDateTime.substring(4 + offset, 6 + offset);
  1091. strYear = exDateTime.substring(0, 2);
  1092. }
  1093. else
  1094. {
  1095. strMonth = exDateTime.substring(Sp1 + 1, Sp2);
  1096. strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
  1097. strYear = exDateTime.substring(0, Sp1);
  1098. }
  1099. }
  1100.  
  1101. if (isNaN(strMonth)){
  1102. intMonth = Cal.GetMonthIndex(strMonth);
  1103. }
  1104. else{
  1105. intMonth = parseInt(strMonth, 10) - 1;
  1106. }
  1107. if ((parseInt(intMonth, 10) >= 0) && (parseInt(intMonth, 10) < 12)) {
  1108. Cal.Month = intMonth;
  1109. }
  1110. //end parse month
  1111.  
  1112. //parse year
  1113. YearPattern = /^\d{4}$/;
  1114. if (YearPattern.test(strYear)) {
  1115. if ((parseInt(strYear, 10)>=StartYear) && (parseInt(strYear, 10)<= (dtToday.getFullYear()+EndYear)))
  1116. Cal.Year = parseInt(strYear, 10);
  1117. }
  1118. //end parse year
  1119.  
  1120. //parse Date
  1121. if ((parseInt(strDate, 10) <= Cal.GetMonDays()) && (parseInt(strDate, 10) >= 1)) {
  1122. Cal.Date = strDate;
  1123. }
  1124. //end parse Date
  1125.  
  1126. //parse time
  1127.  
  1128. if (Cal.ShowTime === true)
  1129. {
  1130.  
  1131. //parse AM or PM
  1132.  
  1133. if (TimeMode === 12)
  1134. {
  1135. strAMPM = exDateTime.substring(exDateTime.length - 2, exDateTime.length);
  1136. Cal.AMorPM = strAMPM;
  1137. }
  1138.  
  1139. tSp1 = exDateTime.indexOf(":", 0);
  1140. tSp2 = exDateTime.indexOf(":", (parseInt(tSp1, 10) + 1));
  1141. if (tSp1 > 0)
  1142. {
  1143.  
  1144. strHour = exDateTime.substring(tSp1, tSp1 - 2);
  1145. Cal.SetHour(strHour);
  1146.  
  1147. strMinute = exDateTime.substring(tSp1 + 1, tSp1 + 3);
  1148. Cal.SetMinute(strMinute);
  1149.  
  1150. strSecond = exDateTime.substring(tSp2 + 1, tSp2 + 3);
  1151. Cal.SetSecond(strSecond);
  1152.  
  1153. }
  1154. else if (exDateTime.indexOf("D*") !== -1)
  1155. { //DTG
  1156. strHour = exDateTime.substring(2, 4);
  1157. Cal.SetHour(strHour);
  1158. strMinute = exDateTime.substring(4, 6);
  1159. Cal.SetMinute(strMinute);
  1160.  
  1161. }
  1162. }
  1163.  
  1164. }
  1165. selDate = new Date(Cal.Year, Cal.Month, Cal.Date);//version 1.7
  1166. RenderCssCal(true);
  1167. }
  1168.  
  1169. function closewin(id) {
  1170.  
  1171. if (Cal.ShowTime === true) {
  1172. var MaxYear = dtToday.getFullYear() + EndYear;
  1173. var beforeToday =
  1174. (Cal.Date < dtToday.getDate()) &&
  1175. (Cal.Month === dtToday.getMonth()) &&
  1176. (Cal.Year === dtToday.getFullYear())
  1177. ||
  1178. (Cal.Month < dtToday.getMonth()) &&
  1179. (Cal.Year === dtToday.getFullYear())
  1180. ||
  1181. (Cal.Year < dtToday.getFullYear());
  1182.  
  1183. if ((Cal.Year <= MaxYear) && (Cal.Year >= StartYear) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())) {
  1184. if (Cal.EnableDateMode === "future") {
  1185. if (beforeToday === false) {
  1186. callback(id, Cal.FormatDate(Cal.Date));
  1187.  
  1188. }
  1189. }
  1190. else
  1191. callback(id, Cal.FormatDate(Cal.Date));
  1192.  
  1193. }
  1194. }
  1195.  
  1196. var CalId = document.getElementById(id);
  1197. CalId.focus();
  1198. satcheck();
  1199. winCal.style.visibility = 'hidden';
  1200. }
  1201.  
  1202. function changeBorder(element, col, oldBgColor)
  1203. {
  1204. if (col === 0)
  1205. {
  1206. element.style.background = HoverColor;
  1207. element.style.borderColor = "black";
  1208. element.style.cursor = "pointer";
  1209. }
  1210.  
  1211. else
  1212. {
  1213. if (oldBgColor)
  1214. {
  1215. element.style.background = oldBgColor;
  1216. }
  1217. else
  1218. {
  1219. element.style.background = "white";
  1220. }
  1221. element.style.borderColor = "white";
  1222. element.style.cursor = "auto";
  1223. }
  1224. }
  1225.  
  1226. function selectDate(element, date) {
  1227. Cal.Date = date;
  1228. selDate = new Date(Cal.Year, Cal.Month, Cal.Date);
  1229. element.style.background = SelDateColor;
  1230. RenderCssCal();
  1231. }
  1232.  
  1233. function pickIt(evt)
  1234. {
  1235. var objectID,
  1236. dom,
  1237. de,
  1238. b;
  1239. // accesses the element that generates the event and retrieves its ID
  1240. if (document.addEventListener)
  1241. { // w3c
  1242. objectID = evt.target.id;
  1243. if (objectID.indexOf(calSpanID) !== -1)
  1244. {
  1245. dom = document.getElementById(objectID);
  1246. cnLeft = evt.pageX;
  1247. cnTop = evt.pageY;
  1248.  
  1249. if (dom.offsetLeft)
  1250. {
  1251. cnLeft = (cnLeft - dom.offsetLeft);
  1252. cnTop = (cnTop - dom.offsetTop);
  1253. }
  1254. }
  1255.  
  1256. // get mouse position on click
  1257. xpos = (evt.pageX);
  1258. ypos = (evt.pageY);
  1259. }
  1260.  
  1261. else
  1262. { // IE
  1263. objectID = event.srcElement.id;
  1264. cnLeft = event.offsetX;
  1265. cnTop = (event.offsetY);
  1266.  
  1267. // get mouse position on click
  1268. de = document.documentElement;
  1269. b = document.body;
  1270.  
  1271. xpos = event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
  1272. ypos = event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
  1273. }
  1274.  
  1275. // verify if this is a valid element to pick
  1276. if (objectID.indexOf(calSpanID) !== -1)
  1277. {
  1278. domStyle = document.getElementById(objectID).style;
  1279. }
  1280.  
  1281. if (domStyle)
  1282. {
  1283. domStyle.zIndex = 100;
  1284. return false;
  1285. }
  1286.  
  1287. else
  1288. {
  1289. domStyle = null;
  1290. return;
  1291. }
  1292. }
  1293.  
  1294.  
  1295.  
  1296. function dragIt(evt)
  1297. {
  1298. if (domStyle)
  1299. {
  1300. if (document.addEventListener)
  1301. { //for IE
  1302. domStyle.left = (event.clientX - cnLeft + document.body.scrollLeft) + 'px';
  1303. domStyle.top = (event.clientY - cnTop + document.body.scrollTop) + 'px';
  1304. }
  1305. else
  1306. { //Firefox
  1307. domStyle.left = (evt.clientX - cnLeft + document.body.scrollLeft) + 'px';
  1308. domStyle.top = (evt.clientY - cnTop + document.body.scrollTop) + 'px';
  1309. }
  1310. }
  1311. }
  1312.  
  1313. // performs a single increment or decrement
  1314. function nextStep(whatSpinner, direction)
  1315. {
  1316. if (whatSpinner === "Hour")
  1317. {
  1318. if (direction === "plus")
  1319. {
  1320. Cal.SetHour(Cal.Hours + 1);
  1321. RenderCssCal();
  1322. }
  1323. else if (direction === "minus")
  1324. {
  1325. Cal.SetHour(Cal.Hours - 1);
  1326. RenderCssCal();
  1327. }
  1328. }
  1329. else if (whatSpinner === "Minute")
  1330. {
  1331. if (direction === "plus")
  1332. {
  1333. Cal.SetMinute(parseInt(Cal.Minutes, 10) + 1);
  1334. RenderCssCal();
  1335. }
  1336. else if (direction === "minus")
  1337. {
  1338. Cal.SetMinute(parseInt(Cal.Minutes, 10) - 1);
  1339. RenderCssCal();
  1340. }
  1341. }
  1342.  
  1343. }
  1344.  
  1345. // starts the time spinner
  1346. function startSpin(whatSpinner, direction)
  1347. {
  1348. document.thisLoop = setInterval(function ()
  1349. {
  1350. nextStep(whatSpinner, direction);
  1351. }, 125); //125 ms
  1352. }
  1353.  
  1354. //stops the time spinner
  1355. function stopSpin()
  1356. {
  1357. clearInterval(document.thisLoop);
  1358. }
  1359.  
  1360. function dropIt()
  1361. {
  1362. stopSpin();
  1363.  
  1364. if (domStyle)
  1365. {
  1366. domStyle = null;
  1367.  
  1368. }
  1369.  
  1370. }
  1371.  
  1372. // Default events configuration
  1373.  
  1374. document.onmousedown = pickIt;
  1375. document.onmousemove = dragIt;
  1376. document.onmouseup = dropIt;
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429. // price calculation
  1430. function calculate() {
  1431. // use get month
  1432. var month = new Date().getMonth();
  1433.  
  1434. var d1 = document.date.firstDate.value;
  1435. var d2 = d1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
  1436. var d3 = new Date(d2);
  1437. month = d3.getMonth();
  1438.  
  1439. var days = parseInt('0' + document.date.days.value, 10),
  1440. groupstring, total = 0;
  1441. // 1 day, 2 days, 3 days, 4 days, 5 days, 6 days, 7 days, 28 DaySummer, 28 DayWinter, Excess Amount, excess mile, 12week
  1442. switch (document.date.car.value) {
  1443.  
  1444. case 'B': groupstring = '2650,5300,7950,10600,13250,13500,14500,48000,46000,25000,10,44000'; break;//CLIO 3/5 -->
  1445. case 'B2': groupstring = '2650,5300,7950,10600,13250,13500,14500,48000,46000,25000,10,44000'; break;//MAN PICANTO -->
  1446. case 'CD': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;// RIO MANUAL-->
  1447. case 'CD2': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;//CORSA -->
  1448. case 'CD3': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;// PICANTO AUTO-->
  1449. case 'CD4': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,44000'; break;// 500-->
  1450. case 'E': groupstring = '3000,6000,9000,12000,15000,15500,16500,53500,51000,25000,10,48000'; break;// VENGA MANUAL -->
  1451. case 'E2': groupstring = '3000,6000,9000,12000,15000,15500,16500,53500,51000,25000,10,48000'; break;// RIO AUTO-->
  1452. case 'F': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// FOCUS-->
  1453. case 'F2': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// MEGANE-->
  1454. case 'F3': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// CEED-->
  1455. case 'F4': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// I30-->
  1456. case 'F5': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// VENGA AUTO-->
  1457. case 'G': groupstring = '3500,7000,10500,14000,17500,19000,20000,62000,59000,25000,15,54000'; break;//CEED ESTATE -->
  1458. case 'G2': groupstring = '3500,7000,10500,14000,17500,19000,20000,62000,59000,40000,15,54000'; break;//SPORT PET -->
  1459. case 'H': groupstring = '3800,7600,11400,15200,19000,21500,22500,72000,62000,25000,15,44000'; break;// -MONDEO->
  1460. case 'I': groupstring = '3800,7600,11400,15200,19000,21500,22500,72000,62000,25000,15,58000'; break;//2WD SPORTAGE -->
  1461. case 'J': groupstring = '4500,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,60000'; break;//4WD SPORTAGE -->
  1462. case 'J2': groupstring = '4500,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,44000'; break;//OPTIMA -->
  1463. case 'J3': groupstring = '5000,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,44000'; break;//IX35 -->
  1464. case 'K': groupstring = '6500,11000,16500,22000,27500,30000,31000,95000,82500,40000,15,44000'; break;//GALAXY -->
  1465. case 'K2': groupstring = '6500,11000,16500,22000,27500,30000,31000,95000,82500,40000,15,44000'; break;//RCZ -->
  1466. case 'L': groupstring = '7000,12000,18000,24000,30000,35000,36000,120000,120000,40000,15,100000'; break;// SORENTO-->
  1467. case 'L2': groupstring = '7000,12000,18000,24000,30000,35000,36000,120000,120000,40000,15,100000'; break;// I800-->
  1468. case 'L3': groupstring = '4500,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,60000'; break;//carens -->
  1469. case 'M': groupstring = '2650,5300,7950,10600,13250,14600,15000,49900,48000,25000,10,44000'; break;// KANGOO-->
  1470. case 'N': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;// nv200-->
  1471. case 'O': groupstring = '4100,8200,12300,16400,20500,20800,21000,70000,70000,40000,15,62500'; break;// TRAFIC-->
  1472. }
  1473. groupstring = groupstring.split(',');
  1474. if (days > 0 && days < 8) {total = groupstring[days - 1]; } else
  1475. if (days < 28) {total = (groupstring[6] / 7) * days;} else
  1476. if (days === 28) {total = groupstring[8];}
  1477. if (days > 28 && days < 84) {total =(groupstring[8] / 28) * days;}
  1478. if (days === 84) {total = groupstring[11] * 3;}
  1479. if (days > 84) {total =(groupstring[11] / 28) * days;}
  1480. if (month > 1 && month < 9 && days == 28) {total = groupstring[7];} // if jan or feb or oct, nov, dec then summer
  1481. if (month > 1 && month < 9 && days > 28 && days < 84) {total =(groupstring[7] / 28) * days;}
  1482.  
  1483.  
  1484. var testa = parseInt(groupstring[8])
  1485. var testb = parseInt(groupstring[7])
  1486. var testc = parseInt(groupstring[11])
  1487.  
  1488.  
  1489.  
  1490. if (days < 28 && total > testa && month < 2 ) {total = groupstring[8]} // winter
  1491. if (days < 28 && total > testa && month > 8 ) {total = groupstring[8]} // winter
  1492. if (days < 28 && total > testb && month > 1 && month < 9 && days < 84 ) {total = groupstring[7]} // summer
  1493. if (days < 84 && days > 77 && total > testc) {total =groupstring[11] *3 && price4 = groupstring[11]/3} //12week fix
  1494.  
  1495.  
  1496.  
  1497.  
  1498. if (days > 50) {document.getElementById("waiv").value = "n"}
  1499.  
  1500.  
  1501. document.date.rentalamount.value = "£" + (Math.round(total) / 100).toFixed(2);
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508. }
  1509.  
  1510. // 4week price, gav sucks balls
  1511. function adva() {
  1512. var days = parseInt('0' + document.date.days.value, 10),
  1513. groupstring, total = 0;
  1514. var ee = document.date.trc.value
  1515. var er = (ee.slice(1))
  1516. var rre = er/days
  1517. var rree = rre * 28
  1518.  
  1519. document.date.price4.value = "£" + rree.toFixed(2)
  1520.  
  1521.  
  1522. }
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528. // DATE DIFFRENCE
  1529.  
  1530. function dateDiff() {
  1531.  
  1532. t1 = document.date.firstDate.value;
  1533. t2 = document.date.secondDate.value;
  1534.  
  1535. var one_day=1000*60*60*24;
  1536. var x=t1.split("/");
  1537. var y=t2.split("/");
  1538. //date format(Fullyear,month,date)
  1539. var date1=new Date(x[2],(x[1]-1),x[0]);
  1540. var date2=new Date(y[2],(y[1]-1),y[0])
  1541. var month1=x[1]-1;
  1542. var month2=y[1]-1;
  1543. var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
  1544.  
  1545. var time1 = parseInt(document.getElementById('time1').value, 10);
  1546. var time2 = parseInt(document.getElementById('time2').value, 10);
  1547. if(time2-time1 >= 5) {Diff = Diff +1};
  1548. if (Diff == 0) {Diff = 1};
  1549. if (Diff < 0) {Diff = 0};
  1550.  
  1551.  
  1552.  
  1553. document.date.days.value = (Diff +" days");
  1554.  
  1555. if ( Diff >= 50 )
  1556.  
  1557. { document.getElementById('aive').style.display='none'}
  1558.  
  1559. else
  1560.  
  1561. {document.getElementById('aive').style.display=''}
  1562.  
  1563. if ( Diff >= 50 )
  1564.  
  1565. { document.getElementById('aaive').style.display='none'}
  1566.  
  1567. else
  1568.  
  1569. {document.getElementById('aaive').style.display=''}
  1570.  
  1571. if ( Diff >= 50 )
  1572.  
  1573. { document.getElementById('aaaive').style.display='none'}
  1574.  
  1575. else
  1576.  
  1577. {document.getElementById('aaaive').style.display=''}
  1578.  
  1579. if ( Diff >= 50 )
  1580.  
  1581. { document.getElementById('aaaaive').style.display='none'}
  1582.  
  1583. else
  1584.  
  1585. {document.getElementById('aaaaive').style.display=''}
  1586.  
  1587.  
  1588.  
  1589.  
  1590. }
  1591.  
  1592. // End -->
  1593. // DEPOSIT
  1594. function deposit(){
  1595. if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="y" )
  1596.  
  1597. {
  1598. document.date.depo.value="£100.00"
  1599. }
  1600.  
  1601.  
  1602. else if( document.date.car.options[document.date.car.selectedIndex].value=="G2" ||
  1603. document.date.car.options[document.date.car.selectedIndex].value=="I" || document.date.car.options[document.date.car.selectedIndex].value== "L3" ||
  1604. document.date.car.options[document.date.car.selectedIndex].value== "J" || document.date.car.options[document.date.car.selectedIndex].value== "K" ||
  1605. document.date.car.options[document.date.car.selectedIndex].value== "K2" || document.date.car.options[document.date.car.selectedIndex].value== "L" ||
  1606. document.date.car.options[document.date.car.selectedIndex].value== "L2" || document.date.car.options[document.date.car.selectedIndex].value== "O" ||
  1607. document.date.car.options[document.date.car.selectedIndex].value== "J2" || document.date.car.options[document.date.car.selectedIndex].value== "J3")
  1608. {
  1609. document.date.depo.value="£400.00"
  1610. }
  1611.  
  1612.  
  1613. else
  1614. {
  1615. document.date.depo.value="£250.00"
  1616. }
  1617.  
  1618. }
  1619. //Waiver stuff seriously fuck you gav this shit sucked
  1620. function waivon(){
  1621.  
  1622.  
  1623.  
  1624.  
  1625. if ( Diff >= 35 )
  1626.  
  1627. { document.getElementById('fourweek').style.display=''}
  1628.  
  1629. else
  1630.  
  1631. { document.getElementById('fourweek').style.display='none'}
  1632.  
  1633. if ( Diff >= 35 )
  1634.  
  1635. { document.getElementById('afourweek').style.display=''}
  1636.  
  1637. else
  1638.  
  1639. { document.getElementById('afourweek').style.display='none'}
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647. if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="y" )
  1648.  
  1649. { towaiv() }
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655. if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="n" )
  1656. {
  1657. document.date.ewc.value="£0"
  1658.  
  1659. document.date.trc.value = document.date.rentalamount.value
  1660.  
  1661.  
  1662.  
  1663. }
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669. }
  1670.  
  1671. function towaiv(){
  1672. if( document.date.car.options[document.date.car.selectedIndex].value=="G2" ||
  1673. document.date.car.options[document.date.car.selectedIndex].value=="I" || document.date.car.options[document.date.car.selectedIndex].value== "L3" ||
  1674. document.date.car.options[document.date.car.selectedIndex].value== "J" || document.date.car.options[document.date.car.selectedIndex].value== "K" ||
  1675. document.date.car.options[document.date.car.selectedIndex].value== "K2" || document.date.car.options[document.date.car.selectedIndex].value== "L" ||
  1676. document.date.car.options[document.date.car.selectedIndex].value== "L2" || document.date.car.options[document.date.car.selectedIndex].value== "O" ||
  1677. document.date.car.options[document.date.car.selectedIndex].value== "J2" || document.date.car.options[document.date.car.selectedIndex].value== "J3")
  1678.  
  1679.  
  1680. {
  1681. document.date.waiv2.value="2"
  1682. }
  1683.  
  1684.  
  1685. else
  1686. {
  1687. document.date.waiv2.value="1"
  1688. }
  1689.  
  1690.  
  1691. var daff = document.date.days.value
  1692. var dapp =(daff.slice(0,2))
  1693.  
  1694.  
  1695. // 250 cars
  1696.  
  1697. //1 to 5 days
  1698. if ( dapp >=1 && dapp <=5 && document.date.waiv2.value==1 )
  1699.  
  1700. {
  1701. document.date.waivmo.value= dapp * 5
  1702. }
  1703.  
  1704. // 6 days
  1705.  
  1706. if ( dapp ==6 && document.date.waiv2.value==1)
  1707.  
  1708. {
  1709. document.date.waivmo.value="25"
  1710. }
  1711.  
  1712.  
  1713. // Weekly
  1714.  
  1715. if ( dapp >=7 && dapp <=27 && document.date.waiv2.value==1)
  1716.  
  1717. {
  1718. document.date.waivmo.value= dapp * 3
  1719. }
  1720.  
  1721. // Month
  1722.  
  1723. if (dapp >=28 && document.date.waiv2.value==1)
  1724.  
  1725. {
  1726. document.date.waivmo.value= dapp * 2
  1727. }
  1728.  
  1729. // fix if over month rate
  1730.  
  1731.  
  1732.  
  1733. if ( dapp >=18 && dapp <=27 && document.date.waiv2.value==1 && document.date.waivmo >= 56)
  1734.  
  1735. {
  1736. document.date.waivmo.value= 56
  1737. }
  1738.  
  1739.  
  1740.  
  1741.  
  1742. //400 cars
  1743.  
  1744. // 1 to 5 days
  1745. if ( dapp >=1 && dapp <=5 && document.date.waiv2.value==2 )
  1746.  
  1747. {
  1748. document.date.waivmo.value= dapp * 8
  1749. }
  1750. // 6 days
  1751. if ( dapp ==6 && document.date.waiv2.value==2)
  1752.  
  1753. {
  1754. document.date.waivmo.value="41"
  1755. }
  1756.  
  1757. // weekly
  1758. if ( dapp >=7 && dapp <=27 && document.date.waiv2.value==2)
  1759.  
  1760. {
  1761. document.date.waivmo.value= dapp * 6
  1762. }
  1763. // month
  1764. if (dapp >=28 && document.date.waiv2.value==2)
  1765.  
  1766. {
  1767. document.date.waivmo.value= dapp * 4
  1768. }
  1769. // fix if over month rate
  1770.  
  1771.  
  1772.  
  1773. if ( dapp >=7 && dapp <=27 && document.date.waiv2.value==2 && document.date.waivmo >= 112)
  1774.  
  1775. {
  1776. document.date.waivmo.value= dapp * 4
  1777. }
  1778.  
  1779.  
  1780.  
  1781. document.date.ewc.value = "£" + document.date.waivmo.value
  1782.  
  1783. if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="y" )
  1784.  
  1785. {
  1786. var pp = document.date.rentalamount.value
  1787. var np = (pp.slice(1))
  1788. var wv = document.date.waivmo.value
  1789. var npwv= parseFloat(np) + parseFloat(wv)
  1790. var npmp= npwv.toFixed(2)
  1791. var nnpp=npmp/4
  1792. document.date.trc.value = "£" + npwv.toFixed(2)
  1793.  
  1794. adva()
  1795.  
  1796. }
  1797.  
  1798. }
  1799. // DEPOSIT// End -->
  1800.  
  1801.  
  1802.  
  1803.  
  1804. //ONE DAY SAT HIRE
  1805.  
  1806. function onesat() {
  1807.  
  1808.  
  1809.  
  1810. var da1 = document.date.firstDate.value;
  1811. var da2 = da1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
  1812. var da3 = new Date(da2);
  1813. var oned= da3.getDay();
  1814.  
  1815.  
  1816. var qda1 = document.date.firstDate.value;
  1817. var qda2 = qda1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
  1818. var qda3 = new Date(qda2);
  1819. var twod= qda3.getDay();
  1820.  
  1821.  
  1822.  
  1823.  
  1824. if ( da1 == qda1 && oned == 6 && document.date.time2.options[document.date.time2.selectedIndex].value < 5)
  1825.  
  1826. {
  1827.  
  1828. window.alert("back by 5 ");
  1829.  
  1830. }
  1831.  
  1832. }
  1833.  
  1834. // END
  1835.  
  1836. // MILEAGE
  1837. function milecharge(){
  1838. if(document.date.car.options[document.date.car.selectedIndex].value=="A" || document.date.car.options[document.date.car.selectedIndex].value=="A2" || document.date.car.options[document.date.car.selectedIndex].value=="B" || document.date.car.options[document.date.car.selectedIndex].value=="B2" || document.date.car.options[document.date.car.selectedIndex].value=="CD" || document.date.car.options[document.date.car.selectedIndex].value=="CD2" || document.date.car.options[document.date.car.selectedIndex].value=="CD3" ||
  1839. document.date.car.options[document.date.car.selectedIndex].value=="CD4" ||
  1840. document.date.car.options[document.date.car.selectedIndex].value=="E" || document.date.car.options[document.date.car.selectedIndex].value=="E2")
  1841. {
  1842. document.date.mile.value="10p Per Mile"
  1843. }
  1844.  
  1845. else{
  1846. document.date.mile.value="15p Per Mile"
  1847. }
  1848. }
  1849. // End -->
  1850.  
  1851.  
  1852.  
  1853. // SETS DATE TO CURRENT DATE ONLOAD
  1854. function load() {
  1855.  
  1856. var d = new Date();
  1857.  
  1858. var curr_date = d.getDate();
  1859.  
  1860. var curr_month = d.getMonth()+1;
  1861.  
  1862. var curr_year = d.getFullYear();
  1863.  
  1864. var two_Day = d.getDate()+1;
  1865.  
  1866. document.date.firstDate.value =(curr_date + "/" + curr_month + "/" + curr_year);
  1867.  
  1868. document.date.secondDate.value = (two_Day + "/" + curr_month + "/" + curr_year)
  1869.  
  1870.  
  1871. }
  1872. // END ----->
  1873.  
  1874.  
  1875. // CHECKS IF SAT AND SHOWS OPEN TIME IF BEFORE/AFTER OPEN
  1876. function satcheck() {
  1877. xDate = document.date.firstDate.value.split("/").reverse().join("/");
  1878. x = new Date( xDate ).getDay()
  1879.  
  1880. if (x===6 && document.date.time1.options[document.date.time1.selectedIndex].value < 3 ) {alert("Collection must be between 9AM - 6PM");}
  1881.  
  1882. if (x===6 && document.date.time1.options[document.date.time1.selectedIndex].value > 21 ) {alert("Collection must be between 9AM - 6PM");}
  1883.  
  1884. }
  1885.  
  1886.  
  1887. function satcheck2() {
  1888. t1 = document.date.firstDate.value;
  1889. t2 = document.date.secondDate.value;
  1890.  
  1891. var one_day=1000*60*60*24;
  1892. var x=t1.split("/");
  1893. var y=t2.split("/");
  1894. //date format(Fullyear,month,date)
  1895. var date1=new Date(x[2],(x[1]-1),x[0]);
  1896. var date2=new Date(y[2],(y[1]-1),y[0])
  1897. var month1=x[1]-1;
  1898. var month2=y[1]-1;
  1899. var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
  1900.  
  1901. var time1 = parseInt(document.getElementById('time1').value, 10);
  1902. var time2 = parseInt(document.getElementById('time2').value, 10);
  1903. if(time2-time1 >= 5) {Diff = Diff +1};
  1904. if (Diff == 0) {Diff = 1};
  1905. if (Diff < 0) {Diff = 0};
  1906.  
  1907.  
  1908.  
  1909.  
  1910. x2Date = document.date.secondDate.value.split("/").reverse().join("/");
  1911. x2 = new Date( x2Date ).getDay()
  1912.  
  1913. if (Diff== 1 && x2===6 && document.date.time1.options[document.date.time2.selectedIndex].value < 3 ) {alert("For a one day rental returning on Saturday, the return time must be by 5PM. If returning after 5PM you will be charged for the weekend")}
  1914.  
  1915. if (Diff== 1 && x2===6 && document.date.time1.options[document.date.time2.selectedIndex].value < 3 ) {document.date.days.value = 2 + " days"}
  1916.  
  1917. if (Diff== 1 && x2===6 && document.date.time1.options[document.date.time2.selectedIndex].value > 19 ) {alert("For a one day rental returning on Saturday, the return time must be by 5PM. If returning after 5PM you will be charged for the weekend")}
  1918.  
  1919. if (Diff== 1 && x2===6 && document.date.time1.options[document.date.time2.selectedIndex].value > 19 ) {document.date.days.value = 2 + " days"}
  1920.  
  1921. calculate()
  1922. waivon()
  1923. }
  1924.  
  1925.  
  1926. // CHECKS IF SUN AND SHOWS OPEN TIME IF BEFORE/AFTER OPEN
  1927. function suncheck() {
  1928.  
  1929. x3Date = document.date.firstDate.value.split("/").reverse().join("/");
  1930. x3 = new Date( x3Date ).getDay()
  1931.  
  1932. if (x3===0 && document.date.time1.options[document.date.time1.selectedIndex].value <= 16 ) {alert("Sunday Opening times are 4PM - 8PM Collection Time has been moved to 6PM, Please amend if necessary");}
  1933.  
  1934. if (x3===0 && document.date.time1.options[document.date.time1.selectedIndex].value <= 16 ) {document.date.time1.selectedIndex = 20;}
  1935.  
  1936. if (x3===0 && document.date.time1.options[document.date.time1.selectedIndex].value >= 16 && x3===0 && document.date.time1.options[document.date.time1.selectedIndex].value <= 18) {alert("Sunday between 4PM - 5PM are extremely busy, please collect slightly later if possible");}
  1937.  
  1938. }
  1939.  
  1940. function suncheck2() {
  1941.  
  1942. t1 = document.date.firstDate.value;
  1943. t2 = document.date.secondDate.value;
  1944.  
  1945. var one_day=1000*60*60*24;
  1946. var x=t1.split("/");
  1947. var y=t2.split("/");
  1948. //date format(Fullyear,month,date)
  1949. var date1=new Date(x[2],(x[1]-1),x[0]);
  1950. var date2=new Date(y[2],(y[1]-1),y[0])
  1951. var month1=x[1]-1;
  1952. var month2=y[1]-1;
  1953. var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
  1954.  
  1955. var time1 = parseInt(document.getElementById('time1').value, 10);
  1956. var time2 = parseInt(document.getElementById('time2').value, 10);
  1957. if(time2-time1 >= 5) {Diff = Diff +1};
  1958. if (Diff == 0) {Diff = 1};
  1959. if (Diff < 0) {Diff = 0};
  1960.  
  1961. x4Date = document.date.secondDate.value.split("/").reverse().join("/");
  1962. x4 = new Date( x4Date ).getDay()
  1963.  
  1964. if (Diff== 1 && x4===0 && document.date.time2.options[document.date.time2.selectedIndex].value <= 16 ) {alert("Sunday Opening times are 4PM - 8PM, You may return the vehicle before this, but you will be charged to 4PM. ");}
  1965.  
  1966.  
  1967.  
  1968. if (Diff== 1 && x4===0 && document.date.time2.options[document.date.time2.selectedIndex].value <= 16 ) {document.date.time2.selectedIndex = 16;}
  1969. dateDiff()
  1970. calculate()
  1971. waivon()
  1972. }
  1973. //END
  1974.  
  1975. //puts date in hidden box for transfer to booking
  1976. function box2() {
  1977.  
  1978. document.date.date1.value = (document.date.firstDate.value)
  1979. document.date.date2.value = (document.date.secondDate.value)
  1980.  
  1981. }
  1982. //END
  1983.  
  1984. // milage calculations
  1985.  
  1986. function incmile() {
  1987.  
  1988. t1 = document.date.firstDate.value;
  1989. t2 = document.date.secondDate.value;
  1990.  
  1991. var one_day=1000*60*60*24;
  1992. var x=t1.split("/");
  1993. var y=t2.split("/");
  1994. //date format(Fullyear,month,date)
  1995. var date1=new Date(x[2],(x[1]-1),x[0]);
  1996. var date2=new Date(y[2],(y[1]-1),y[0])
  1997. var month1=x[1]-1;
  1998. var month2=y[1]-1;
  1999. Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
  2000.  
  2001. var time1 = parseInt(document.getElementById('time1').value, 10);
  2002. var time2 = parseInt(document.getElementById('time2').value, 10);
  2003. if(time2-time1 >= 5) {Diff = Diff +1};
  2004. if (Diff == 0) {Diff = 1};
  2005. if (Diff < 0) {Diff = 0};
  2006.  
  2007. var miles = 0;
  2008. var price = document.date.rentalamount.value;
  2009. if(Diff <= 27) {
  2010. miles = Diff * 100;
  2011. } else {
  2012. miles = Math.round((Diff / 7) * 500);
  2013. }
  2014.  
  2015. if(document.date.car.options[document.date.car.selectedIndex].value=="A" && price == "£420.00" || price == "£450.00") {
  2016. miles = 2000;
  2017. }
  2018.  
  2019. if(document.date.car.options[document.date.car.selectedIndex].value=="A2" && price == "£420.00" || price == "£450.00") {
  2020. miles = 2000;
  2021. }
  2022.  
  2023. if(document.date.car.options[document.date.car.selectedIndex].value=="B" && price == "£460.00" || price == "£480.00") {
  2024. miles = 2000;
  2025. }
  2026.  
  2027. if(document.date.car.options[document.date.car.selectedIndex].value=="B2" && price == "£460.00" || price == "£480.00") {
  2028. miles = 2000;
  2029. }
  2030.  
  2031. if(document.date.car.options[document.date.car.selectedIndex].value=="CD" && price == "£480.00" || price == "£499.00") {
  2032. miles = 2000;
  2033. }
  2034.  
  2035. if(document.date.car.options[document.date.car.selectedIndex].value=="CD2" && price == "£480.00" || price == "£499.00") {
  2036. miles = 2000;
  2037. }
  2038.  
  2039. if(document.date.car.options[document.date.car.selectedIndex].value=="CD3" && price == "£480.00" || price == "£499.00") {
  2040. miles = 2000;
  2041. }
  2042.  
  2043. if(document.date.car.options[document.date.car.selectedIndex].value=="CD4" && price == "£480.00" || price == "£499.00") {
  2044. miles = 2000;
  2045. }
  2046.  
  2047. if(document.date.car.options[document.date.car.selectedIndex].value=="E" && price == "£510.00" || price == "£535.00") {
  2048. miles = 2000;
  2049. }
  2050.  
  2051. if(document.date.car.options[document.date.car.selectedIndex].value=="E2" && price == "£510.00" || price == "£535.00") {
  2052. miles = 2000;
  2053. }
  2054.  
  2055. if(document.date.car.options[document.date.car.selectedIndex].value=="F" && price == "£540.00" || price == "£580.00") {
  2056. miles = 2000;
  2057. }
  2058.  
  2059. if(document.date.car.options[document.date.car.selectedIndex].value=="F2" && price == "£540.00" || price == "£580.00") {
  2060. miles = 2000;
  2061. }
  2062.  
  2063. if(document.date.car.options[document.date.car.selectedIndex].value=="F3" && price == "£540.00" || price == "£580.00") {
  2064. miles = 2000;
  2065. }
  2066.  
  2067. if(document.date.car.options[document.date.car.selectedIndex].value=="F4" && price == "£540.00" || price == "£580.00") {
  2068. miles = 2000;
  2069. }
  2070.  
  2071. if(document.date.car.options[document.date.car.selectedIndex].value=="G" && price == "£590.00" || price == "£620.00") {
  2072. miles = 2000;
  2073. }
  2074.  
  2075. if(document.date.car.options[document.date.car.selectedIndex].value=="G2" && price == "£590.00" || price == "£620.00") {
  2076. miles = 2000;
  2077. }
  2078.  
  2079. if(document.date.car.options[document.date.car.selectedIndex].value=="H" && price == "£620.00" || price == "£720.00") {
  2080. miles = 2000;
  2081. }
  2082.  
  2083. if(document.date.car.options[document.date.car.selectedIndex].value=="I" && price == "£650.00" || price == "£750.00") {
  2084. miles = 2000;
  2085. }
  2086.  
  2087. if(document.date.car.options[document.date.car.selectedIndex].value=="J" && price == "800.00" || price == "£800.00") {
  2088. miles = 2000;
  2089. }
  2090.  
  2091. if(document.date.car.options[document.date.car.selectedIndex].value=="J2" && price == "800.00" || price == "£800.00") {
  2092. miles = 2000;
  2093. }
  2094.  
  2095. if(document.date.car.options[document.date.car.selectedIndex].value=="J3" && price == "800.00" || price == "£800.00") {
  2096. miles = 2000;
  2097. }
  2098.  
  2099. if(document.date.car.options[document.date.car.selectedIndex].value=="K" && price == "£825.00" || price == "£9500.00") {
  2100. miles = 2000;
  2101. }
  2102.  
  2103. if(document.date.car.options[document.date.car.selectedIndex].value=="K2" && price == "£825.00" || price == "£950.00") {
  2104. miles = 2000;
  2105. }
  2106.  
  2107. if(document.date.car.options[document.date.car.selectedIndex].value=="L" && price == "£1200.00" || price == "£1200.00") {
  2108. miles = 2000;
  2109. }
  2110.  
  2111. if(document.date.car.options[document.date.car.selectedIndex].value=="L2" && price == "£1200.00" || price == "£1200.00") {
  2112. miles = 2000;
  2113. }
  2114.  
  2115. if(document.date.car.options[document.date.car.selectedIndex].value=="L3" && price == "800.00" || price == "£800.00") {
  2116. miles = 2000;
  2117. }
  2118.  
  2119. if(document.date.car.options[document.date.car.selectedIndex].value=="M" && price == "£480.00" || price == "£499.00") {
  2120. miles = 2000;
  2121. }
  2122.  
  2123. if(document.date.car.options[document.date.car.selectedIndex].value=="O" && price == "£725.00" || price == "£750.00") {
  2124. miles = 2000;
  2125. }
  2126.  
  2127.  
  2128.  
  2129. if(document.date.car.options[document.date.car.selectedIndex].value=="B2" && price == "£1320.00") {
  2130. miles = 6000;
  2131. }
  2132.  
  2133. if(document.date.car.options[document.date.car.selectedIndex].value=="CD" && price == "£1380.00") {
  2134. miles = 6000;
  2135. }
  2136.  
  2137. if(document.date.car.options[document.date.car.selectedIndex].value=="CD2" && price == "£1380.00") {
  2138. miles = 6000;
  2139. }
  2140.  
  2141. if(document.date.car.options[document.date.car.selectedIndex].value=="CD3" && price == "£1380.00") {
  2142. miles = 6000;
  2143. }
  2144.  
  2145. if(document.date.car.options[document.date.car.selectedIndex].value=="E" && price == "£1440.00") {
  2146. miles = 6000;
  2147. }
  2148.  
  2149. if(document.date.car.options[document.date.car.selectedIndex].value=="E2" && price == "£1440.00") {
  2150. miles = 6000;
  2151. }
  2152.  
  2153. if(document.date.car.options[document.date.car.selectedIndex].value=="F3" && price == "£1500.00") {
  2154. miles = 6000;
  2155. }
  2156.  
  2157. if(document.date.car.options[document.date.car.selectedIndex].value=="F5" && price == "£1500.00") {
  2158. miles = 6000;
  2159. }
  2160.  
  2161. if(document.date.car.options[document.date.car.selectedIndex].value=="G" && price == "£1620.00") {
  2162. miles = 6000;
  2163. }
  2164.  
  2165. if(document.date.car.options[document.date.car.selectedIndex].value=="G2" && price == "£1620.00") {
  2166. miles = 6000;
  2167. }
  2168.  
  2169. if(document.date.car.options[document.date.car.selectedIndex].value=="I" && price == "£1740.00") {
  2170. miles = 6000;
  2171. }
  2172.  
  2173. if(document.date.car.options[document.date.car.selectedIndex].value=="J" && price == "£1800.00") {
  2174. miles = 6000;
  2175. }
  2176.  
  2177. if(document.date.car.options[document.date.car.selectedIndex].value=="L" && price == "£3000.00") {
  2178. miles = 6000;
  2179. }
  2180.  
  2181. if(document.date.car.options[document.date.car.selectedIndex].value=="L2" && price == "3000.00") {
  2182. miles = 6000;
  2183. }
  2184.  
  2185. if(document.date.car.options[document.date.car.selectedIndex].value=="L3" && price == "£1800.00") {
  2186. miles = 6000;
  2187. }
  2188.  
  2189. if(document.date.car.options[document.date.car.selectedIndex].value=="N" && price == "£1380.00") {
  2190. miles = 6000;
  2191. }
  2192.  
  2193. if(document.date.car.options[document.date.car.selectedIndex].value=="O" && price == "£1875.00") {
  2194. miles = 6000;
  2195. }
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210. document.date.alow.value = miles + " Miles";
  2211.  
  2212.  
  2213.  
  2214. }
  2215. //END
  2216.  
  2217.  
  2218. //age checks
  2219. function agecheck() {
  2220.  
  2221. if(document.date.car.options[document.date.car.selectedIndex].value=="I" || document.date.car.options[document.date.car.selectedIndex].value=="L3" || document.date.car.options[document.date.car.selectedIndex].value=="G2" || document.date.car.options[document.date.car.selectedIndex].value=="J" || document.date.car.options[document.date.car.selectedIndex].value=="J2" || document.date.car.options[document.date.car.selectedIndex].value=="J3" )
  2222.  
  2223. {
  2224. alert("You Must Be Over 25 To hire This Vehicle ");
  2225. }
  2226.  
  2227. if(document.date.car.options[document.date.car.selectedIndex].value=="K" || document.date.car.options[document.date.car.selectedIndex].value=="K2" || document.date.car.options[document.date.car.selectedIndex].value=="L" || document.date.car.options[document.date.car.selectedIndex].value=="L2" || document.date.car.options[document.date.car.selectedIndex].value=="L2")
  2228.  
  2229. {
  2230. alert("You Must Be Over 28 To hire This Vehicle ");
  2231. }
  2232.  
  2233. }
  2234. //END
  2235.  
  2236. // More info button
  2237. function info() {
  2238.  
  2239. if(document.date.car.options[document.date.car.selectedIndex].value=="A")
  2240. {
  2241. window.open ("http://www.pennycarhire.co.uk/Panda.html");
  2242. }
  2243.  
  2244. if(document.date.car.options[document.date.car.selectedIndex].value=="A2")
  2245. {
  2246. window.open ("http://www.pennycarhire.co.uk/smart.html");
  2247. }
  2248.  
  2249. if(document.date.car.options[document.date.car.selectedIndex].value=="B")
  2250. {
  2251. window.open ("http://www.pennycarhire.co.uk/clio3dr.html");
  2252. }
  2253.  
  2254. if(document.date.car.options[document.date.car.selectedIndex].value=="B2")
  2255. {
  2256. window.open ("http://www.pennycarhire.co.uk/newpicanto.html");
  2257. }
  2258.  
  2259. if(document.date.car.options[document.date.car.selectedIndex].value=="CD")
  2260. {
  2261. window.open ("http://www.pennycarhire.co.uk/rio.html");
  2262. }
  2263.  
  2264. if(document.date.car.options[document.date.car.selectedIndex].value=="CD2")
  2265. {
  2266. window.open ("http://www.pennycarhire.co.uk/newcorsa.html");
  2267. }
  2268.  
  2269. if(document.date.car.options[document.date.car.selectedIndex].value=="CD3")
  2270. {
  2271. window.open ("http://www.pennycarhire.co.uk/newpicantoauto.html");
  2272. }
  2273.  
  2274. if(document.date.car.options[document.date.car.selectedIndex].value=="CD4")
  2275. {
  2276. window.open ("http://www.pennycarhire.co.uk/500.html");
  2277. }
  2278.  
  2279. if(document.date.car.options[document.date.car.selectedIndex].value=="E")
  2280. {
  2281. window.open ("http://www.pennycarhire.co.uk/venga.html");
  2282. }
  2283.  
  2284. if(document.date.car.options[document.date.car.selectedIndex].value=="E2")
  2285. {
  2286. window.open ("http://www.pennycarhire.co.uk/newrio.html");
  2287. }
  2288.  
  2289. if(document.date.car.options[document.date.car.selectedIndex].value=="F")
  2290. {
  2291. window.open ("http://www.pennycarhire.co.uk/focus.html");
  2292. }
  2293.  
  2294. if(document.date.car.options[document.date.car.selectedIndex].value=="F2")
  2295. {
  2296. window.open ("http://www.pennycarhire.co.uk/ceedhb.html");
  2297. }
  2298.  
  2299. if(document.date.car.options[document.date.car.selectedIndex].value=="F3")
  2300. {
  2301. window.open ("http://www.pennycarhire.co.uk/Megane1.html");
  2302. }
  2303.  
  2304. if(document.date.car.options[document.date.car.selectedIndex].value=="F4")
  2305. {
  2306. window.open ("http://www.pennycarhire.co.uk/i30.html");
  2307. }
  2308.  
  2309. if(document.date.car.options[document.date.car.selectedIndex].value=="F5")
  2310. {
  2311. window.open ("http://www.pennycarhire.co.uk/vengaauto.html");
  2312. }
  2313.  
  2314. if(document.date.car.options[document.date.car.selectedIndex].value=="G")
  2315. {
  2316. window.open ("http://www.pennycarhire.co.uk/ceed.html");
  2317. }
  2318.  
  2319. if(document.date.car.options[document.date.car.selectedIndex].value=="G2")
  2320. {
  2321. window.open ("http://www.pennycarhire.co.uk/sportagep.html");
  2322. }
  2323.  
  2324. if(document.date.car.options[document.date.car.selectedIndex].value=="H")
  2325. {
  2326. window.open ("http://www.pennycarhire.co.uk/newmondeo.html");
  2327. }
  2328.  
  2329. if(document.date.car.options[document.date.car.selectedIndex].value=="I")
  2330. {
  2331. window.open ("http://www.pennycarhire.co.uk/sportage.html");
  2332. }
  2333.  
  2334. if(document.date.car.options[document.date.car.selectedIndex].value=="J")
  2335. {
  2336. window.open ("http://www.pennycarhire.co.uk/sportageauto.html");
  2337. }
  2338.  
  2339. if(document.date.car.options[document.date.car.selectedIndex].value=="J2")
  2340. {
  2341. window.open ("http://www.pennycarhire.co.uk/optima.html");
  2342. }
  2343.  
  2344. if(document.date.car.options[document.date.car.selectedIndex].value=="J3")
  2345. {
  2346. window.open ("http://www.pennycarhire.co.uk/ix35.html");
  2347. }
  2348.  
  2349. if(document.date.car.options[document.date.car.selectedIndex].value=="K")
  2350. {
  2351. window.open ("http://www.pennycarhire.co.uk/newgalaxy.html");
  2352. }
  2353.  
  2354. if(document.date.car.options[document.date.car.selectedIndex].value=="K2")
  2355. {
  2356. window.open ("http://www.pennycarhire.co.uk/rcz.html");
  2357. }
  2358.  
  2359. if(document.date.car.options[document.date.car.selectedIndex].value=="L")
  2360. {
  2361. window.open ("http://www.pennycarhire.co.uk/sorento.html");
  2362. }
  2363.  
  2364. if(document.date.car.options[document.date.car.selectedIndex].value=="L2")
  2365. {
  2366. window.open ("http://www.pennycarhire.co.uk/i800.html");
  2367. }
  2368.  
  2369. if(document.date.car.options[document.date.car.selectedIndex].value=="L3")
  2370. {
  2371. window.open ("http://www.pennycarhire.co.uk/carens2.html");
  2372. }
  2373.  
  2374.  
  2375. if(document.date.car.options[document.date.car.selectedIndex].value=="M")
  2376. {
  2377. window.open ("http://www.pennycarhire.co.uk/kangoo.html");
  2378. }
  2379.  
  2380. if(document.date.car.options[document.date.car.selectedIndex].value=="N")
  2381. {
  2382. window.open ("http://www.pennycarhire.co.uk/nv200.html");
  2383. }
  2384.  
  2385.  
  2386. if(document.date.car.options[document.date.car.selectedIndex].value=="O")
  2387. {
  2388. window.open ("http://www.pennycarhire.co.uk/TraficLWB.html");
  2389. }
  2390.  
  2391. }
  2392.  
  2393. function tcar() {
  2394.  
  2395. passedData = urlGet();
  2396.  
  2397. document.date.lpag.value = passedData['car'];
  2398.  
  2399.  
  2400. if (document.date.lpag.value == "picman" ) {document.date.car.value = "B2"; }
  2401.  
  2402. else if (document.date.lpag.value == "rio" ) {document.date.car.value = "CD"; }
  2403.  
  2404. else if (document.date.lpag.value == "corsa" ) {document.date.car.value = "CD2"; }
  2405.  
  2406. else if (document.date.lpag.value == "picauto" ) {document.date.car.value = "CD3"; }
  2407.  
  2408. else if (document.date.lpag.value == "500" ) {document.date.car.value = "CD4"; }
  2409.  
  2410. else if (document.date.lpag.value == "venga" ) {document.date.car.value = "E"; }
  2411.  
  2412. else if (document.date.lpag.value == "rioaut" ) {document.date.car.value = "E2"; }
  2413.  
  2414. else if (document.date.lpag.value == "focus" ) {document.date.car.value = "F"; }
  2415.  
  2416. else if (document.date.lpag.value == "ceedhb" ) {document.date.car.value = "F2"; }
  2417.  
  2418. else if (document.date.lpag.value == "megane" ) {document.date.car.value = "F3"; }
  2419.  
  2420. else if (document.date.lpag.value == "i30" ) {document.date.car.value = "F4"; }
  2421.  
  2422. else if (document.date.lpag.value == "vengaauto" ) {document.date.car.value = "F5"; }
  2423.  
  2424. else if (document.date.lpag.value == "ceed" ) {document.date.car.value = "G"; }
  2425.  
  2426. else if (document.date.lpag.value == "sportp" ) {document.date.car.value = "G2"; }
  2427.  
  2428. else if (document.date.lpag.value == "mondeo" ) {document.date.car.value = "H"; }
  2429.  
  2430. else if (document.date.lpag.value == "sportman" ) {document.date.car.value = "I"; }
  2431.  
  2432. else if (document.date.lpag.value == "sportaut" ) {document.date.car.value = "J"; }
  2433.  
  2434. else if (document.date.lpag.value == "optima" ) {document.date.car.value = "J2"; }
  2435.  
  2436. else if (document.date.lpag.value == "ix35" ) {document.date.car.value = "J3"; }
  2437.  
  2438. else if (document.date.lpag.value == "galaxy" ) {document.date.car.value = "K"; }
  2439.  
  2440. else if (document.date.lpag.value == "rcz" ) {document.date.car.value = "K2"; }
  2441.  
  2442. else if (document.date.lpag.value == "sorento" ) {document.date.car.value = "L"; }
  2443.  
  2444. else if (document.date.lpag.value == "i800" ) {document.date.car.value = "L2"; }
  2445.  
  2446. else if (document.date.lpag.value == "carens2" ) {document.date.car.value = "L3"; }
  2447.  
  2448. else if (document.date.lpag.value == "kangoo" ) {document.date.car.value = "M"; }
  2449.  
  2450. else if (document.date.lpag.value == "NV200" ) {document.date.car.value = "N"; }
  2451.  
  2452. else if (document.date.lpag.value == "trafic" ) {document.date.car.value = "O"; }
  2453.  
  2454.  
  2455. else {document.date.car.value = "B2"; }
  2456. }
  2457.  
  2458. function urlGet(f) {
  2459. var str = location.search.slice(1).split("&"),
  2460. retVal = [],
  2461. f = f || false;
  2462. for (p = 0; p < str.length; p++) {
  2463. // get the values.
  2464. if (str[p].indexOf("=") > 0) {
  2465. var pv = str[p].split("=");
  2466. retVal[pv.shift()] = pv.pop();
  2467. }
  2468. }
  2469.  
  2470.  
  2471. return f ? retVal[f] : retVal;
  2472.  
  2473.  
  2474. }
  2475. //END
  2476.  
  2477. function loading() {
  2478. tcar();
  2479. load();
  2480. dateDiff()
  2481. ;calculate();
  2482. deposit();
  2483. milecharge();
  2484. incmile();
  2485. box2();
  2486. waivon();
  2487. ;names()
  2488.  
  2489.  
  2490.  
  2491.  
  2492. }
  2493.  
  2494.  
  2495. function tody()
  2496. {
  2497.  
  2498. //Gets Current day and month
  2499. var d1 = document.date.firstDate.value
  2500. var tt = new Date();
  2501. var dd1 =tt.getDate();
  2502. var mm1 =tt.getMonth()+1;
  2503. var tom = tt.getDate()+1;
  2504.  
  2505. //end
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515. // changes date input to date fromat and gets inputted day and month
  2516. t1 = document.date.firstDate.value;
  2517.  
  2518.  
  2519. var one_day=1000*60*60*24;
  2520. var x=t1.split("/");
  2521.  
  2522. //date format(Fullyear,month,date)
  2523. var date1=new Date(x[2],(x[1]-1),x[0]);
  2524.  
  2525. var dd2 =date1.getDate();
  2526. var mm2 =date1.getMonth()+1;
  2527. //
  2528.  
  2529. if ( dd2 == dd1 && mm1 == mm2 || dd2 == tom && mm1 == mm2) {
  2530. alert("Due To High Demend It Is Suggested You Call Us For Bookings Less Then Three Days In Advanced");
  2531. }
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539. }
  2540.  
  2541. var nesne ;
  2542. if(navigator.appName.search('Microsoft')>-1) { nesne = new ActiveXObject('MSXML2.XMLHTTP'); }
  2543. else { nesne = new XMLHttpRequest(); }
  2544.  
  2545. function yolla() {
  2546. nesne.open('get', 'display.txt', true);
  2547. nesne.onreadystatechange= cevap;
  2548. nesne.send(null);
  2549. }
  2550.  
  2551. function cevap() {
  2552. if(nesne.readyState==4) {
  2553. var el = document.getElementById('bilgi');
  2554. el.innerHTML = nesne.responseText;
  2555. }
  2556. }
  2557.  
  2558. //weekend summer fix ADD TO THIS WHEN WE HAVE NEW CAR!
  2559. function sumwkfix() {
  2560.  
  2561. t1 = document.date.firstDate.value;
  2562. t2 = document.date.secondDate.value;
  2563.  
  2564. var one_day=1000*60*60*24;
  2565. var x=t1.split("/");
  2566. var y=t2.split("/");
  2567. //date format(Fullyear,month,date)
  2568. var date1=new Date(x[2],(x[1]-1),x[0]);
  2569. var date2=new Date(y[2],(y[1]-1),y[0])
  2570. var month1=x[1]-1;
  2571. var month2=y[1]-1;
  2572. var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
  2573.  
  2574. var time1 = parseInt(document.getElementById('time1').value, 10);
  2575. var time2 = parseInt(document.getElementById('time2').value, 10);
  2576. if(time2-time1 >= 5) {Diff = Diff +1};
  2577. if (Diff == 0) {Diff = 1};
  2578. if (Diff < 0) {Diff = 0};
  2579.  
  2580.  
  2581. var d1 = document.date.secondDate.value;
  2582. var d2 = d1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
  2583. var d3 = new Date(d2);
  2584. month = d3.getMonth();
  2585.  
  2586. x3Date = document.date.secondDate.value.split("/").reverse().join("/");
  2587. x3 = new Date( x3Date ).getDay()
  2588.  
  2589. x4Date = document.date.firstDate.value.split("/").reverse().join("/");
  2590. x4 = new Date( x4Date ).getDay()
  2591.  
  2592.  
  2593.  
  2594. if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2595.  
  2596. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2597.  
  2598. if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2599.  
  2600. {document.date.days.value = 2 + " days"}
  2601.  
  2602. if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2603.  
  2604. {document.date.alow.value= 200 + " miles" }
  2605.  
  2606. if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2607.  
  2608. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2609.  
  2610. if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2611.  
  2612. {document.date.days.value = 2 + " days" }
  2613.  
  2614. if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2615.  
  2616. {document.date.alow.value= 200 + " miles" }
  2617.  
  2618. //
  2619. if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2620.  
  2621. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2622.  
  2623. if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2624.  
  2625. {document.date.days.value = 2 + " days"}
  2626.  
  2627. if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2628.  
  2629. {document.date.alow.value= 200 + " miles" }
  2630.  
  2631. if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2632.  
  2633. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2634.  
  2635. if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2636.  
  2637. {document.date.days.value = 2 + " days"}
  2638.  
  2639. if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2640.  
  2641. {document.date.alow.value= 200 + " miles" }
  2642.  
  2643.  
  2644. //
  2645.  
  2646. if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2647.  
  2648. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2649.  
  2650. if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2651.  
  2652. {document.date.days.value = 2 + " days"}
  2653.  
  2654. if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2655.  
  2656. {document.date.alow.value= 200 + " miles" }
  2657.  
  2658. if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2659.  
  2660. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2661.  
  2662. if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2663.  
  2664. {document.date.days.value = 2 + " days"}
  2665.  
  2666. if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2667.  
  2668. {document.date.alow.value= 200 + " miles" }
  2669.  
  2670. //
  2671.  
  2672. if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2673.  
  2674. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2675.  
  2676. if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2677.  
  2678. {document.date.days.value = 2 + " days"}
  2679.  
  2680. if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2681.  
  2682. {document.date.alow.value= 200 + " miles" }
  2683.  
  2684. if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2685.  
  2686. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2687.  
  2688. if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2689.  
  2690. {document.date.days.value = 2 + " days"}
  2691.  
  2692. if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2693.  
  2694. {document.date.alow.value= 200 + " miles" }
  2695.  
  2696. //
  2697.  
  2698. if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2699.  
  2700. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2701.  
  2702. if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2703.  
  2704. {document.date.days.value = 2 + " days"}
  2705.  
  2706. if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2707.  
  2708. {document.date.alow.value= 200 + " miles" }
  2709.  
  2710. if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2711.  
  2712. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2713.  
  2714. if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2715.  
  2716. {document.date.days.value = 2 + " days"}
  2717.  
  2718. if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2719.  
  2720. {document.date.alow.value= 200 + " miles" }
  2721.  
  2722. //
  2723.  
  2724. if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2725.  
  2726. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2727.  
  2728. if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2729.  
  2730. {document.date.days.value = 2 + " days"}
  2731.  
  2732. if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2733.  
  2734. {document.date.alow.value= 200 + " miles" }
  2735.  
  2736. if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2737.  
  2738. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2739.  
  2740. if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2741.  
  2742. {document.date.days.value = 2 + " days"}
  2743.  
  2744. if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2745.  
  2746. {document.date.alow.value= 200 + " miles" }
  2747.  
  2748. //
  2749.  
  2750. if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2751.  
  2752. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2753.  
  2754. if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2755.  
  2756. {document.date.days.value = 2 + " days"}
  2757.  
  2758. if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2759.  
  2760. {document.date.alow.value= 200 + " miles" }
  2761.  
  2762. if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2763.  
  2764. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2765.  
  2766. if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2767.  
  2768. {document.date.days.value = 2 + " days"}
  2769.  
  2770. if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2771.  
  2772. {document.date.alow.value= 200 + " miles" }
  2773.  
  2774. //
  2775.  
  2776. if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2777.  
  2778. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2779.  
  2780. if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2781.  
  2782. {document.date.days.value = 2 + " days"}
  2783.  
  2784. if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2785.  
  2786. {document.date.alow.value= 200 + " miles" }
  2787.  
  2788. if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2789.  
  2790. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2791.  
  2792. if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2793.  
  2794. {document.date.days.value = 2 + " days"}
  2795.  
  2796. if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2797.  
  2798. {document.date.alow.value= 200 + " miles" }
  2799.  
  2800. //
  2801.  
  2802. if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2803.  
  2804. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2805.  
  2806. if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2807.  
  2808. {document.date.days.value = 2 + " days"}
  2809.  
  2810. if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2811.  
  2812. {document.date.alow.value= 200 + " miles" }
  2813.  
  2814. if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2815.  
  2816. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2817.  
  2818. if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2819.  
  2820. {document.date.days.value = 2 + " days"}
  2821.  
  2822. if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2823.  
  2824. {document.date.alow.value= 200 + " miles" }
  2825. //
  2826.  
  2827. if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2828.  
  2829. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2830.  
  2831. if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2832.  
  2833. {document.date.days.value = 2 + " days"}
  2834.  
  2835. if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2836.  
  2837. {document.date.alow.value= 200 + " miles" }
  2838.  
  2839. if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2840.  
  2841. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2842.  
  2843. if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2844.  
  2845. {document.date.days.value = 2 + " days"}
  2846.  
  2847. if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2848.  
  2849. {document.date.alow.value= 200 + " miles" }
  2850.  
  2851. //
  2852.  
  2853. if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2854.  
  2855. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2856.  
  2857. if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2858.  
  2859. {document.date.days.value = 2 + " days"}
  2860.  
  2861. if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2862.  
  2863. {document.date.alow.value= 200 + " miles" }
  2864.  
  2865. if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2866.  
  2867. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2868.  
  2869. if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2870.  
  2871. {document.date.days.value = 2 + " days"}
  2872.  
  2873. if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2874.  
  2875. {document.date.alow.value= 200 + " miles" }
  2876.  
  2877. //
  2878. if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2879.  
  2880. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2881.  
  2882. if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2883.  
  2884. {document.date.days.value = 2 + " days"}
  2885.  
  2886. if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2887.  
  2888. {document.date.alow.value= 200 + " miles" }
  2889.  
  2890. if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2891.  
  2892. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2893.  
  2894. if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2895.  
  2896. {document.date.days.value = 2 + " days"}
  2897.  
  2898. if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2899.  
  2900. {document.date.alow.value= 200 + " miles" }
  2901.  
  2902. //
  2903.  
  2904. if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2905.  
  2906. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2907.  
  2908. if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2909.  
  2910. {document.date.days.value = 2 + " days"}
  2911.  
  2912. if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2913.  
  2914. {document.date.alow.value= 200 + " miles" }
  2915.  
  2916. if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2917.  
  2918. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2919.  
  2920. if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2921.  
  2922. {document.date.days.value = 2 + " days" }
  2923.  
  2924. if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2925.  
  2926. {document.date.alow.value= 200 + " miles" }
  2927.  
  2928. //
  2929.  
  2930. if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2931.  
  2932. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2933.  
  2934. if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
  2935.  
  2936. {document.date.days.value = 2 + " days"}
  2937.  
  2938. if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
  2939.  
  2940. {document.date.alow.value= 200 + " Miles" }
  2941.  
  2942. if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2943.  
  2944. {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
  2945.  
  2946. if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2947.  
  2948. {document.date.days.value = 2 + " days"}
  2949.  
  2950. if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
  2951.  
  2952. {document.date.alow.value= 200 + " miles" }
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958. waivon()
  2959. calculate()
  2960. waivon()
  2961. }
  2962.  
  2963.  
  2964. function names() {
  2965.  
  2966. x4Date = document.date.firstDate.value.split("/").reverse().join("/");
  2967. x4 = new Date( x4Date ).getDay()
  2968.  
  2969. if (x4 == 0) {document.date.day.value = "Sunday"}
  2970.  
  2971. if (x4 == 1) {document.date.day.value = "Monday"}
  2972.  
  2973. if (x4 == 2) {document.date.day.value = "Tuesday"}
  2974.  
  2975. if (x4 == 3) {document.date.day.value = "Wednesday"}
  2976.  
  2977. if (x4 == 4) {document.date.day.value = "Thursday"}
  2978.  
  2979. if (x4 == 5) {document.date.day.value = "Friday"}
  2980.  
  2981. if (x4 == 6) {document.date.day.value = "Saturday"}
  2982.  
  2983.  
  2984. x5Date = document.date.secondDate.value.split("/").reverse().join("/");
  2985. x5 = new Date( x5Date ).getDay()
  2986.  
  2987. if (x5 == 0) {document.date.day2.value = "Sunday"}
  2988.  
  2989. if (x5 == 1) {document.date.day2.value = "Monday"}
  2990.  
  2991. if (x5 == 2) {document.date.day2.value = "Tuesday"}
  2992.  
  2993. if (x5 == 3) {document.date.day2.value = "Wednesday"}
  2994.  
  2995. if (x5 == 4) {document.date.day2.value = "Thursday"}
  2996.  
  2997. if (x5 == 5) {document.date.day2.value = "Friday"}
  2998.  
  2999. if (x5 == 6) {document.date.day2.value = "Saturday"}
  3000.  
  3001. }
  3002.  
  3003. //END OF SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement