Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Javasript name: My Date Time Picker
- //Date created: 16-Nov-2003 23:19
- //Creator: TengYong Ng
- //Website: http://www.rainforestnet.com
- //Copyright (c) 2003 TengYong Ng
- //FileName: DateTimePicker_css.js
- //Version: 2.2.2
- // Note: Permission given to use and modify this script in ANY kind of applications if
- // header lines are left unchanged.
- //Permission is granted to redistribute and modify this javascript under the terms of the GNU General Public License 3.0.
- //New Css style version added by Yvan Lavoie (Québec, Canada) 29-Jan-2009
- //Formatted for JSLint compatibility by Labsmedia.com (30-Dec-2010)
- //Global variables
- var winCal;
- var dtToday;
- var Cal;
- var MonthName;
- var WeekDayName1;
- var WeekDayName2;
- var exDateTime;//Existing Date and Time
- var selDate;//selected date. version 1.7
- var calSpanID = "calBorder"; // span ID
- var domStyle = null; // span DOM object with style
- var cnLeft = "0";//left coordinate of calendar span
- var cnTop = "0";//top coordinate of calendar span
- var xpos = 0; // mouse x position
- var ypos = 0; // mouse y position
- var calHeight = 0; // calendar height
- var CalWidth = 208;// calendar width
- var CellWidth = 30;// width of day cell.
- var TimeMode = 24;// TimeMode value. 12 or 24
- var StartYear = 2012; //First Year in drop down year selection
- 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)
- var CalPosOffsetX = -1; //X position offset relative to calendar icon, can be negative value
- var CalPosOffsetY = 0; //Y position offset relative to calendar icon, can be negative value
- //Configurable parameters start
- var SpanBorderColor = "#000000";//span border color
- var SpanBgColor = "#FFFFFF"; //span background color
- var MonthYearColor = "#cc0033"; //Font Color of Month and Year in Calendar header.
- var WeekHeadColor = "#A3C159"; //var WeekHeadColor="#18861B";//Background Color in Week header.
- var SundayColor = "#BCBCBC"; //var SundayColor="#C0F64F";//Background color of Sunday.
- var SaturdayColor = "#BCBCBC"; //Background color of Saturday.
- var WeekDayColor = "#E2E2E2"; //Background color of weekdays.
- var FontColor = "blue"; //color of font in Calendar day cell.
- var TodayColor = "#8DD53C"; //var TodayColor="#FFFF33";//Background color of today.
- var SelDateColor = "#FFFF00"; //var SelDateColor = "#8DD53C";//Backgrond color of selected date in textbox.
- var YrSelColor = "#cc0033"; //color of font of Year selector.
- var MthSelColor = "#cc0033"; //color of font of Month selector if "MonthSelector" is "arrow".
- var HoverColor = "#E0FF38"; //color when mouse move over.
- var DisableColor = "#4f4f4f"; //color of disabled cell.
- var CalBgColor = "#ffffff"; //Background color of Calendar window.
- var WeekChar = 2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
- var DateSeparator = "/";//Date Separator, you can change it to "-" if you want.
- var ShowLongMonth = true;//Show long month name in Calendar header. example: "January".
- var ShowMonthYear = true;//Show Month and Year in Calendar header.
- var ThemeBg = "";//Background image of Calendar window.
- var PrecedeZero = true;//Preceding zero [true|false]
- var MondayFirstDay = true;//true:Use Monday as first day; false:Sunday as first day. [true|false] //added in version 1.7
- var UseImageFiles = true;//Use image files with "arrows" and "close" button
- var imageFilesPath = "images/";
- //Configurable parameters end
- //use the Month and Weekday in your preferred language.
- var MonthName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
- var WeekDayName1 = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
- var WeekDayName2 = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
- //end Configurable parameters
- //end Global variable
- // Calendar prototype
- function Calendar(pDate, pCtrl) {
- //Properties
- this.Date = pDate.getDate();//selected date
- this.Month = pDate.getMonth();//selected month number
- this.Year = pDate.getFullYear();//selected year in 4 digits
- this.Hours = pDate.getHours();
- if (pDate.getMinutes() < 10)
- {
- this.Minutes = "0" + pDate.getMinutes();
- }
- else
- {
- this.Minutes = pDate.getMinutes();
- }
- if (pDate.getSeconds() < 10)
- {
- this.Seconds = "0" + pDate.getSeconds();
- }
- else
- {
- this.Seconds = pDate.getSeconds();
- }
- this.MyWindow = winCal;
- this.Ctrl = pCtrl;
- this.Format = "ddMMyyyy";
- this.Separator = DateSeparator;
- this.ShowTime = false;
- this.Scroller = "DROPDOWN";
- if (pDate.getHours() < 12)
- {
- this.AMorPM = "AM";
- }
- else
- {
- this.AMorPM = "PM";
- }
- this.ShowSeconds = false;
- this.EnableDateMode = ""
- }
- Calendar.prototype.GetMonthIndex = function (shortMonthName)
- {
- for (var i = 0; i < 12; i += 1)
- {
- if (MonthName[i].substring(0, 3).toUpperCase() === shortMonthName.toUpperCase())
- {
- return i;
- }
- }
- };
- Calendar.prototype.IncYear = function () {
- if (Cal.Year <= dtToday.getFullYear()+EndYear)
- Cal.Year += 1;
- };
- Calendar.prototype.DecYear = function () {
- if (Cal.Year > StartYear)
- Cal.Year -= 1;
- };
- Calendar.prototype.IncMonth = function() {
- if (Cal.Year <= dtToday.getFullYear() + EndYear) {
- Cal.Month += 1;
- if (Cal.Month >= 12) {
- Cal.Month = 0;
- Cal.IncYear();
- }
- }
- };
- Calendar.prototype.DecMonth = function() {
- if (Cal.Year >= StartYear) {
- Cal.Month -= 1;
- if (Cal.Month < 0) {
- Cal.Month = 11;
- Cal.DecYear();
- }
- }
- };
- Calendar.prototype.SwitchMth = function (intMth)
- {
- Cal.Month = parseInt(intMth, 10);
- };
- Calendar.prototype.SwitchYear = function (intYear)
- {
- Cal.Year = parseInt(intYear, 10);
- };
- Calendar.prototype.SetHour = function (intHour)
- {
- var MaxHour,
- MinHour,
- HourExp = new RegExp("^\\d\\d"),
- SingleDigit = new RegExp("\\d");
- if (TimeMode === 24)
- {
- MaxHour = 23;
- MinHour = 0;
- }
- else if (TimeMode === 12)
- {
- MaxHour = 12;
- MinHour = 1;
- }
- else
- {
- alert("TimeMode can only be 12 or 24");
- }
- if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) > MaxHour))
- {
- intHour = MinHour;
- }
- else if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) < MinHour))
- {
- intHour = MaxHour;
- }
- if (SingleDigit.test(intHour))
- {
- intHour = "0" + intHour;
- }
- if (HourExp.test(intHour) && (parseInt(intHour, 10) <= MaxHour) && (parseInt(intHour, 10) >= MinHour))
- {
- if ((TimeMode === 12) && (Cal.AMorPM === "PM"))
- {
- if (parseInt(intHour, 10) === 12)
- {
- Cal.Hours = 12;
- }
- else
- {
- Cal.Hours = parseInt(intHour, 10) + 12;
- }
- }
- else if ((TimeMode === 12) && (Cal.AMorPM === "AM"))
- {
- if (intHour === 12)
- {
- intHour -= 12;
- }
- Cal.Hours = parseInt(intHour, 10);
- }
- else if (TimeMode === 24)
- {
- Cal.Hours = parseInt(intHour, 10);
- }
- }
- };
- Calendar.prototype.SetMinute = function (intMin)
- {
- var MaxMin = 59,
- MinMin = 0,
- SingleDigit = new RegExp("\\d"),
- SingleDigit2 = new RegExp("^\\d{1}$"),
- MinExp = new RegExp("^\\d{2}$"),
- strMin = 0;
- if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) > MaxMin))
- {
- intMin = MinMin;
- }
- else if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) < MinMin))
- {
- intMin = MaxMin;
- }
- strMin = intMin + "";
- if (SingleDigit2.test(intMin))
- {
- strMin = "0" + strMin;
- }
- if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) <= 59) && (parseInt(intMin, 10) >= 0))
- {
- Cal.Minutes = strMin;
- }
- };
- Calendar.prototype.SetSecond = function (intSec)
- {
- var MaxSec = 59,
- MinSec = 0,
- SingleDigit = new RegExp("\\d"),
- SingleDigit2 = new RegExp("^\\d{1}$"),
- SecExp = new RegExp("^\\d{2}$"),
- strSec = 0;
- if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) > MaxSec))
- {
- intSec = MinSec;
- }
- else if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) < MinSec))
- {
- intSec = MaxSec;
- }
- strSec = intSec + "";
- if (SingleDigit2.test(intSec))
- {
- strSec = "0" + strSec;
- }
- if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) <= 59) && (parseInt(intSec, 10) >= 0))
- {
- Cal.Seconds = strSec;
- }
- };
- Calendar.prototype.SetAmPm = function (pvalue)
- {
- this.AMorPM = pvalue;
- if (pvalue === "PM")
- {
- this.Hours = parseInt(this.Hours, 10) + 12;
- if (this.Hours === 24)
- {
- this.Hours = 12;
- }
- }
- else if (pvalue === "AM")
- {
- this.Hours -= 12;
- }
- };
- Calendar.prototype.getShowHour = function ()
- {
- var finalHour;
- if (TimeMode === 12)
- {
- if (parseInt(this.Hours, 10) === 0)
- {
- this.AMorPM = "AM";
- finalHour = parseInt(this.Hours, 10) + 12;
- }
- else if (parseInt(this.Hours, 10) === 12)
- {
- this.AMorPM = "PM";
- finalHour = 12;
- }
- else if (this.Hours > 12)
- {
- this.AMorPM = "PM";
- if ((this.Hours - 12) < 10)
- {
- finalHour = "0" + ((parseInt(this.Hours, 10)) - 12);
- }
- else
- {
- finalHour = parseInt(this.Hours, 10) - 12;
- }
- }
- else
- {
- this.AMorPM = "AM";
- if (this.Hours < 10)
- {
- finalHour = "0" + parseInt(this.Hours, 10);
- }
- else
- {
- finalHour = this.Hours;
- }
- }
- }
- else if (TimeMode === 24)
- {
- if (this.Hours < 10)
- {
- finalHour = "0" + parseInt(this.Hours, 10);
- }
- else
- {
- finalHour = this.Hours;
- }
- }
- return finalHour;
- };
- Calendar.prototype.getShowAMorPM = function ()
- {
- return this.AMorPM;
- };
- Calendar.prototype.GetMonthName = function (IsLong)
- {
- var Month = MonthName[this.Month];
- if (IsLong)
- {
- return Month;
- }
- else
- {
- return Month.substr(0, 3);
- }
- };
- Calendar.prototype.GetMonDays = function() { //Get number of days in a month
- var DaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- if (Cal.IsLeapYear()) {
- DaysInMonth[1] = 29;
- }
- return DaysInMonth[this.Month];
- };
- Calendar.prototype.IsLeapYear = function ()
- {
- if ((this.Year % 4) === 0)
- {
- if ((this.Year % 100 === 0) && (this.Year % 400) !== 0)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- else
- {
- return false;
- }
- };
- Calendar.prototype.FormatDate = function (pDate)
- {
- var MonthDigit = this.Month + 1;
- if (PrecedeZero === true)
- {
- if ((pDate < 10) && String(pDate).length===1) //length checking added in version 2.2
- {
- pDate = "0" + pDate;
- }
- if (MonthDigit < 10)
- {
- MonthDigit = "0" + MonthDigit;
- }
- }
- switch (this.Format.toUpperCase())
- {
- case "DDMMYYYY":
- return (pDate + DateSeparator + MonthDigit + DateSeparator + this.Year);
- case "DDMMMYYYY":
- return (pDate + DateSeparator + this.GetMonthName(false) + DateSeparator + this.Year);
- case "MMDDYYYY":
- return (MonthDigit + DateSeparator + pDate + DateSeparator + this.Year);
- case "MMMDDYYYY":
- return (this.GetMonthName(false) + DateSeparator + pDate + DateSeparator + this.Year);
- case "YYYYMMDD":
- return (this.Year + DateSeparator + MonthDigit + DateSeparator + pDate);
- case "YYMMDD":
- return (String(this.Year).substring(2, 4) + DateSeparator + MonthDigit + DateSeparator + pDate);
- case "YYMMMDD":
- return (String(this.Year).substring(2, 4) + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
- case "YYYYMMMDD":
- return (this.Year + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
- default:
- return (pDate + DateSeparator + (this.Month + 1) + DateSeparator + this.Year);
- }
- };
- // end Calendar prototype
- function GenCell(pValue, pHighLight, pColor, pClickable)
- { //Generate table cell with value
- var PValue,
- PCellStr,
- PClickable,
- vTimeStr;
- if (!pValue)
- {
- PValue = "";
- }
- else
- {
- PValue = pValue;
- }
- if (pColor === undefined)
- pColor = CalBgColor;
- if (pClickable !== undefined){
- PClickable = pClickable;
- }
- else{
- PClickable = true;
- }
- if (Cal.ShowTime)
- {
- vTimeStr = ' ' + Cal.Hours + ':' + Cal.Minutes;
- if (Cal.ShowSeconds)
- {
- vTimeStr += ':' + Cal.Seconds;
- }
- if (TimeMode === 12)
- {
- vTimeStr += ' ' + Cal.AMorPM;
- }
- }
- else
- {
- vTimeStr = "";
- }
- if (PValue !== "")
- {
- if (PClickable === true) {
- if (Cal.ShowTime === true)
- { PCellStr = "<td id='c" + PValue + "' class='calTD' style='text-align:center;cursor:pointer;background-color:"+pColor+"' onmousedown='selectDate(this," + PValue + ");'>" + PValue + "</td>"; }
- 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>"; }
- }
- else
- { PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'>"+PValue+"</td>"; }
- }
- else
- { PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'> </td>"; }
- return PCellStr;
- }
- function RenderCssCal(bNewCal)
- {
- if (typeof bNewCal === "undefined" || bNewCal !== true)
- {
- bNewCal = false;
- }
- var vCalHeader,
- vCalData,
- vCalTime = "",
- vCalClosing = "",
- winCalData = "",
- CalDate,
- i,
- j,
- SelectStr,
- vDayCount = 0,
- vFirstDay,
- WeekDayName = [],//Added version 1.7
- strCell,
- showHour,
- ShowArrows = false,
- HourCellWidth = "35px", //cell width with seconds.
- SelectAm,
- SelectPm,
- funcCalback,
- headID,
- e,
- cssStr,
- style,
- cssText,
- span;
- calHeight = 0; // reset the window height on refresh
- // Set the default cursor for the calendar
- winCalData = "<span style='cursor:auto;'>";
- vCalHeader = "<table style='background-color:"+CalBgColor+";width:200px;padding:0;margin:5px auto 5px auto'><tbody>";
- //Table for Month & Year Selector
- vCalHeader += "<tr><td colspan='7'><table border='0' width='200px' cellpadding='0' cellspacing='0'><tr>";
- //******************Month and Year selector in dropdown list************************
- if (Cal.Scroller === "DROPDOWN")
- {
- vCalHeader += "<td align='center'><select name='MonthSelector' onChange='javascript:Cal.SwitchMth(this.selectedIndex);RenderCssCal();'>";
- for (i = 0; i < 12; i += 1)
- {
- if (i === Cal.Month)
- {
- SelectStr = "Selected";
- }
- else
- {
- SelectStr = "";
- }
- vCalHeader += "<option " + SelectStr + " value=" + i + ">" + MonthName[i] + "</option>";
- }
- vCalHeader += "</select></td>";
- //Year selector
- vCalHeader += "<td align='center'><select name='YearSelector' size='1' onChange='javascript:Cal.SwitchYear(this.value);RenderCssCal();'>";
- for (i = StartYear; i <= (dtToday.getFullYear() + EndYear); i += 1)
- {
- if (i === Cal.Year)
- {
- SelectStr = 'selected="selected"';
- }
- else
- {
- SelectStr = '';
- }
- vCalHeader += "<option " + SelectStr + " value=" + i + ">" + i + "</option>\n";
- }
- vCalHeader += "</select></td>\n";
- calHeight += 30;
- }
- //******************End Month and Year selector in dropdown list*********************
- //******************Month and Year selector in arrow*********************************
- else if (Cal.Scroller === "ARROW")
- {
- if (UseImageFiles)
- {
- 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)
- 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)
- vCalHeader += "<td width='70%' class='calR' style='color:"+YrSelColor+"'>"+ Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>"; //Month and Year
- 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)
- 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)
- calHeight += 22;
- }
- else
- {
- 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)
- 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'><</span></td>\n";//Month scroller (decrease 1 month)
- vCalHeader += "<td width='70%' class='calR' style='color:" + YrSelColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>\n"; //Month and Year
- 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'>></span></td>\n";//Month scroller (increase 1 month)
- 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)
- calHeight += 22;
- }
- }
- vCalHeader += "</tr></table></td></tr>";
- //******************End Month and Year selector in arrow******************************
- //Calendar header shows Month and Year
- if (ShowMonthYear && Cal.Scroller === "DROPDOWN")
- {
- vCalHeader += "<tr><td colspan='7' class='calR' style='color:" + MonthYearColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td></tr>";
- calHeight += 19;
- }
- //Week day header
- vCalHeader += "<tr><td colspan=\"7\"><table style='border-spacing:1px;border-collapse:separate;'><tr>";
- if (MondayFirstDay === true)
- {
- WeekDayName = WeekDayName2;
- }
- else
- {
- WeekDayName = WeekDayName1;
- }
- for (i = 0; i < 7; i += 1)
- {
- vCalHeader += "<td style='background-color:"+WeekHeadColor+";width:"+CellWidth+"px;color:#FFFFFF' class='calTD'>" + WeekDayName[i].substr(0, WeekChar) + "</td>";
- }
- calHeight += 19;
- vCalHeader += "</tr>";
- //Calendar detail
- CalDate = new Date(Cal.Year, Cal.Month);
- CalDate.setDate(1);
- vFirstDay = CalDate.getDay();
- //Added version 1.7
- if (MondayFirstDay === true)
- {
- vFirstDay -= 1;
- if (vFirstDay === -1)
- {
- vFirstDay = 6;
- }
- }
- //Added version 1.7
- vCalData = "<tr>";
- calHeight += 19;
- for (i = 0; i < vFirstDay; i += 1)
- {
- vCalData = vCalData + GenCell();
- vDayCount = vDayCount + 1;
- }
- //Added version 1.7
- for (j = 1; j <= Cal.GetMonDays(); j += 1)
- {
- if ((vDayCount % 7 === 0) && (j > 1))
- {
- vCalData = vCalData + "<tr>";
- }
- vDayCount = vDayCount + 1;
- //added version 2.1.2
- 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())))
- {
- strCell = GenCell(j, false, DisableColor, false); //Before today's date is not clickable
- }
- 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()))) {
- strCell = GenCell(j, false, DisableColor, false); //After today's date is not clickable
- }
- //if End Year + Current Year = Cal.Year. Disable.
- else if (Cal.Year > (dtToday.getFullYear()+EndYear))
- {
- strCell = GenCell(j, false, DisableColor, false);
- }
- else if ((j === dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()))
- {
- strCell = GenCell(j, true, TodayColor);//Highlight today's date
- }
- else
- {
- if ((j === selDate.getDate()) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())){
- //modified version 1.7
- strCell = GenCell(j, true, SelDateColor);
- }
- else
- {
- if (MondayFirstDay === true)
- {
- if (vDayCount % 7 === 0)
- {
- strCell = GenCell(j, false, SundayColor);
- }
- else if ((vDayCount + 1) % 7 === 0)
- {
- strCell = GenCell(j, false, SaturdayColor);
- }
- else
- {
- strCell = GenCell(j, null, WeekDayColor);
- }
- }
- else
- {
- if (vDayCount % 7 === 0)
- {
- strCell = GenCell(j, false, SaturdayColor);
- }
- else if ((vDayCount + 6) % 7 === 0)
- {
- strCell = GenCell(j, false, SundayColor);
- }
- else
- {
- strCell = GenCell(j, null, WeekDayColor);
- }
- }
- }
- }
- vCalData = vCalData + strCell;
- if ((vDayCount % 7 === 0) && (j < Cal.GetMonDays()))
- {
- vCalData = vCalData + "</tr>";
- calHeight += 19;
- }
- }
- // finish the table proper
- if (vDayCount % 7 !== 0)
- {
- while (vDayCount % 7 !== 0)
- {
- vCalData = vCalData + GenCell();
- vDayCount = vDayCount + 1;
- }
- }
- vCalData = vCalData + "</table></td></tr>";
- //Time picker
- if (Cal.ShowTime === true)
- {
- showHour = Cal.getShowHour();
- if (Cal.ShowSeconds === false && TimeMode === 24)
- {
- ShowArrows = true;
- HourCellWidth = "10px";
- }
- 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 + "'> </td>";
- if (ShowArrows && UseImageFiles) //this is where the up and down arrow control the hour.
- {
- 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";
- }
- vCalTime += "<td width='22px'><input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH:22px\" value=" + showHour + " onkeyup=\"javascript:Cal.SetHour(this.value)\">";
- vCalTime += "</td><td style='font-weight:bold;text-align:center;'>:</td><td width='22px'>";
- vCalTime += "<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 22px\" value=" + Cal.Minutes + " onkeyup=\"javascript:Cal.SetMinute(this.value)\">";
- if (Cal.ShowSeconds)
- {
- vCalTime += "</td><td style='font-weight:bold;'>:</td><td width='22px'>";
- vCalTime += "<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 22px\" value=" + Cal.Seconds + " onkeyup=\"javascript:Cal.SetSecond(parseInt(this.value,10))\">";
- }
- if (TimeMode === 12)
- {
- SelectAm = (Cal.AMorPM === "AM") ? "Selected" : "";
- SelectPm = (Cal.AMorPM === "PM") ? "Selected" : "";
- vCalTime += "</td><td>";
- vCalTime += "<select name=\"ampm\" onChange=\"javascript:Cal.SetAmPm(this.options[this.selectedIndex].value);\">\n";
- vCalTime += "<option " + SelectAm + " value=\"AM\">AM</option>";
- vCalTime += "<option " + SelectPm + " value=\"PM\">PM<option>";
- vCalTime += "</select>";
- }
- if (ShowArrows && UseImageFiles) //this is where the up and down arrow to change the "Minute".
- {
- 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>";
- }
- vCalTime += "</td>\n<td align='right' valign='bottom' width='" + HourCellWidth + "px'></td></tr>";
- 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\"> <input style='width:60px;font-size:12px;' onClick='javascript: winCal.style.visibility = \"hidden\"' type=\"button\" value=\"Cancel\"></td></tr>";
- }
- else //if not to show time.
- {
- vCalTime += "\n<tr>\n<td colspan='7' style=\"text-align:right;\">";
- //close button
- if (UseImageFiles) {
- 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>";
- }
- else {
- 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>";
- }
- vCalClosing += "</tr>";
- }
- vCalClosing += "</tbody></table></td></tr>";
- calHeight += 31;
- vCalClosing += "</tbody></table>\n</span>";
- //end time picker
- funcCalback = "function callback(id, datum) {";
- 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;";
- funcCalback += " if(Cal.ShowTime){";
- funcCalback += " CalId.value+=' '+Cal.getShowHour()+':'+Cal.Minutes;";
- funcCalback += " if (Cal.ShowSeconds) CalId.value+=':'+Cal.Seconds;";
- funcCalback += " if (TimeMode === 12) CalId.value+=''+Cal.getShowAMorPM();";
- funcCalback += "}if(CalId.onchange!=undefined) CalId.onchange();CalId.focus();winCal.style.visibility='hidden';}";
- funcCalback += "satcheck()"
- // determines if there is enough space to open the cal above the position where it is called
- if (ypos > calHeight)
- {
- ypos = ypos - calHeight;
- }
- if (!winCal)
- {
- headID = document.getElementsByTagName("head")[0];
- // add javascript function to the span cal
- e = document.createElement("script");
- e.type = "text/javascript";
- e.language = "javascript";
- e.text = funcCalback;
- headID.appendChild(e);
- // add stylesheet to the span cal
- cssStr = ".calTD {font-family: verdana; font-size: 12px; text-align: center; border:0; }\n";
- cssStr += ".calR {font-family: verdana; font-size: 12px; text-align: center; font-weight: bold;}";
- style = document.createElement("style");
- style.type = "text/css";
- style.rel = "stylesheet";
- if (style.styleSheet)
- { // IE
- style.styleSheet.cssText = cssStr;
- }
- else
- { // w3c
- cssText = document.createTextNode(cssStr);
- style.appendChild(cssText);
- }
- headID.appendChild(style);
- // create the outer frame that allows the cal. to be moved
- span = document.createElement("span");
- span.id = calSpanID;
- span.style.position = "absolute";
- span.style.left = (xpos + CalPosOffsetX) + 'px';
- span.style.top = (ypos - CalPosOffsetY) + 'px';
- span.style.width = CalWidth + 'px';
- span.style.border = "solid 1pt " + SpanBorderColor;
- span.style.padding = "0";
- span.style.cursor = "move";
- span.style.backgroundColor = SpanBgColor;
- span.style.zIndex = 100;
- document.body.appendChild(span);
- winCal = document.getElementById(calSpanID);
- }
- else
- {
- winCal.style.visibility = "visible";
- winCal.style.Height = calHeight;
- // set the position for a new calendar only
- if (bNewCal === true)
- {
- winCal.style.left = (xpos + CalPosOffsetX) + 'px';
- winCal.style.top = (ypos - CalPosOffsetY) + 'px';
- }
- }
- winCal.innerHTML = winCalData + vCalHeader + vCalData + vCalTime + vCalClosing;
- return true;
- }
- function NewCssCal(pCtrl, pFormat, pScroller, pShowTime, pTimeMode, pShowSeconds, pEnableDateMode)
- {
- // get current date and time
- dtToday = new Date();
- Cal = new Calendar(dtToday);
- if (pShowTime !== undefined)
- {
- if (pShowTime) {
- Cal.ShowTime = true;
- }
- else {
- Cal.ShowTime = false;
- }
- if (pTimeMode)
- {
- pTimeMode = parseInt(pTimeMode, 10);
- }
- if (pTimeMode === 12 || pTimeMode === 24)
- {
- TimeMode = pTimeMode;
- }
- else
- {
- TimeMode = 24;
- }
- if (pShowSeconds !== undefined)
- {
- if (pShowSeconds)
- {
- Cal.ShowSeconds = true;
- }
- else
- {
- Cal.ShowSeconds = false;
- }
- }
- else
- {
- Cal.ShowSeconds = false;
- }
- }
- if (pCtrl !== undefined)
- {
- Cal.Ctrl = pCtrl;
- }
- if (pFormat!== undefined && pFormat !=="")
- {
- Cal.Format = pFormat.toUpperCase();
- }
- else
- {
- Cal.Format = "MMDDYYYY";
- }
- if (pScroller!== undefined && pScroller!=="")
- {
- if (pScroller.toUpperCase() === "ARROW")
- {
- Cal.Scroller = "ARROW";
- }
- else
- {
- Cal.Scroller = "DROPDOWN";
- }
- }
- if (pEnableDateMode !== undefined && (pEnableDateMode === "future" || pEnableDateMode === "past")) {
- Cal.EnableDateMode= pEnableDateMode;
- }
- exDateTime = document.getElementById(pCtrl).value; //Existing Date Time value in textbox.
- if (exDateTime)
- { //Parse existing Date String
- var Sp1 = exDateTime.indexOf(DateSeparator, 0),//Index of Date Separator 1
- Sp2 = exDateTime.indexOf(DateSeparator, parseInt(Sp1, 10) + 1),//Index of Date Separator 2
- tSp1,//Index of Time Separator 1
- tSp2,//Index of Time Separator 2
- strMonth,
- strDate,
- strYear,
- intMonth,
- YearPattern,
- strHour,
- strMinute,
- strSecond,
- winHeight,
- offset = parseInt(Cal.Format.toUpperCase().lastIndexOf("M"), 10) - parseInt(Cal.Format.toUpperCase().indexOf("M"), 10) - 1,
- strAMPM = "";
- //parse month
- if (Cal.Format.toUpperCase() === "DDMMYYYY" || Cal.Format.toUpperCase() === "DDMMMYYYY")
- {
- if (DateSeparator === "")
- {
- strMonth = exDateTime.substring(2, 4 + offset);
- strDate = exDateTime.substring(0, 2);
- strYear = exDateTime.substring(4 + offset, 8 + offset);
- }
- else
- {
- if (exDateTime.indexOf("D*") !== -1)
- { //DTG
- strMonth = exDateTime.substring(8, 11);
- strDate = exDateTime.substring(0, 2);
- strYear = "20" + exDateTime.substring(11, 13); //Hack, nur für Jahreszahlen ab 2000
- }
- else
- {
- strMonth = exDateTime.substring(Sp1 + 1, Sp2);
- strDate = exDateTime.substring(0, Sp1);
- strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
- }
- }
- }
- else if (Cal.Format.toUpperCase() === "MMDDYYYY" || Cal.Format.toUpperCase() === "MMMDDYYYY"){
- if (DateSeparator === ""){
- strMonth = exDateTime.substring(0, 2 + offset);
- strDate = exDateTime.substring(2 + offset, 4 + offset);
- strYear = exDateTime.substring(4 + offset, 8 + offset);
- }
- else{
- strMonth = exDateTime.substring(0, Sp1);
- strDate = exDateTime.substring(Sp1 + 1, Sp2);
- strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
- }
- }
- else if (Cal.Format.toUpperCase() === "YYYYMMDD" || Cal.Format.toUpperCase() === "YYYYMMMDD")
- {
- if (DateSeparator === ""){
- strMonth = exDateTime.substring(4, 6 + offset);
- strDate = exDateTime.substring(6 + offset, 8 + offset);
- strYear = exDateTime.substring(0, 4);
- }
- else{
- strMonth = exDateTime.substring(Sp1 + 1, Sp2);
- strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
- strYear = exDateTime.substring(0, Sp1);
- }
- }
- else if (Cal.Format.toUpperCase() === "YYMMDD" || Cal.Format.toUpperCase() === "YYMMMDD")
- {
- if (DateSeparator === "")
- {
- strMonth = exDateTime.substring(2, 4 + offset);
- strDate = exDateTime.substring(4 + offset, 6 + offset);
- strYear = exDateTime.substring(0, 2);
- }
- else
- {
- strMonth = exDateTime.substring(Sp1 + 1, Sp2);
- strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
- strYear = exDateTime.substring(0, Sp1);
- }
- }
- if (isNaN(strMonth)){
- intMonth = Cal.GetMonthIndex(strMonth);
- }
- else{
- intMonth = parseInt(strMonth, 10) - 1;
- }
- if ((parseInt(intMonth, 10) >= 0) && (parseInt(intMonth, 10) < 12)) {
- Cal.Month = intMonth;
- }
- //end parse month
- //parse year
- YearPattern = /^\d{4}$/;
- if (YearPattern.test(strYear)) {
- if ((parseInt(strYear, 10)>=StartYear) && (parseInt(strYear, 10)<= (dtToday.getFullYear()+EndYear)))
- Cal.Year = parseInt(strYear, 10);
- }
- //end parse year
- //parse Date
- if ((parseInt(strDate, 10) <= Cal.GetMonDays()) && (parseInt(strDate, 10) >= 1)) {
- Cal.Date = strDate;
- }
- //end parse Date
- //parse time
- if (Cal.ShowTime === true)
- {
- //parse AM or PM
- if (TimeMode === 12)
- {
- strAMPM = exDateTime.substring(exDateTime.length - 2, exDateTime.length);
- Cal.AMorPM = strAMPM;
- }
- tSp1 = exDateTime.indexOf(":", 0);
- tSp2 = exDateTime.indexOf(":", (parseInt(tSp1, 10) + 1));
- if (tSp1 > 0)
- {
- strHour = exDateTime.substring(tSp1, tSp1 - 2);
- Cal.SetHour(strHour);
- strMinute = exDateTime.substring(tSp1 + 1, tSp1 + 3);
- Cal.SetMinute(strMinute);
- strSecond = exDateTime.substring(tSp2 + 1, tSp2 + 3);
- Cal.SetSecond(strSecond);
- }
- else if (exDateTime.indexOf("D*") !== -1)
- { //DTG
- strHour = exDateTime.substring(2, 4);
- Cal.SetHour(strHour);
- strMinute = exDateTime.substring(4, 6);
- Cal.SetMinute(strMinute);
- }
- }
- }
- selDate = new Date(Cal.Year, Cal.Month, Cal.Date);//version 1.7
- RenderCssCal(true);
- }
- function closewin(id) {
- if (Cal.ShowTime === true) {
- var MaxYear = dtToday.getFullYear() + EndYear;
- var beforeToday =
- (Cal.Date < dtToday.getDate()) &&
- (Cal.Month === dtToday.getMonth()) &&
- (Cal.Year === dtToday.getFullYear())
- ||
- (Cal.Month < dtToday.getMonth()) &&
- (Cal.Year === dtToday.getFullYear())
- ||
- (Cal.Year < dtToday.getFullYear());
- if ((Cal.Year <= MaxYear) && (Cal.Year >= StartYear) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())) {
- if (Cal.EnableDateMode === "future") {
- if (beforeToday === false) {
- callback(id, Cal.FormatDate(Cal.Date));
- }
- }
- else
- callback(id, Cal.FormatDate(Cal.Date));
- }
- }
- var CalId = document.getElementById(id);
- CalId.focus();
- satcheck();
- winCal.style.visibility = 'hidden';
- }
- function changeBorder(element, col, oldBgColor)
- {
- if (col === 0)
- {
- element.style.background = HoverColor;
- element.style.borderColor = "black";
- element.style.cursor = "pointer";
- }
- else
- {
- if (oldBgColor)
- {
- element.style.background = oldBgColor;
- }
- else
- {
- element.style.background = "white";
- }
- element.style.borderColor = "white";
- element.style.cursor = "auto";
- }
- }
- function selectDate(element, date) {
- Cal.Date = date;
- selDate = new Date(Cal.Year, Cal.Month, Cal.Date);
- element.style.background = SelDateColor;
- RenderCssCal();
- }
- function pickIt(evt)
- {
- var objectID,
- dom,
- de,
- b;
- // accesses the element that generates the event and retrieves its ID
- if (document.addEventListener)
- { // w3c
- objectID = evt.target.id;
- if (objectID.indexOf(calSpanID) !== -1)
- {
- dom = document.getElementById(objectID);
- cnLeft = evt.pageX;
- cnTop = evt.pageY;
- if (dom.offsetLeft)
- {
- cnLeft = (cnLeft - dom.offsetLeft);
- cnTop = (cnTop - dom.offsetTop);
- }
- }
- // get mouse position on click
- xpos = (evt.pageX);
- ypos = (evt.pageY);
- }
- else
- { // IE
- objectID = event.srcElement.id;
- cnLeft = event.offsetX;
- cnTop = (event.offsetY);
- // get mouse position on click
- de = document.documentElement;
- b = document.body;
- xpos = event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
- ypos = event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
- }
- // verify if this is a valid element to pick
- if (objectID.indexOf(calSpanID) !== -1)
- {
- domStyle = document.getElementById(objectID).style;
- }
- if (domStyle)
- {
- domStyle.zIndex = 100;
- return false;
- }
- else
- {
- domStyle = null;
- return;
- }
- }
- function dragIt(evt)
- {
- if (domStyle)
- {
- if (document.addEventListener)
- { //for IE
- domStyle.left = (event.clientX - cnLeft + document.body.scrollLeft) + 'px';
- domStyle.top = (event.clientY - cnTop + document.body.scrollTop) + 'px';
- }
- else
- { //Firefox
- domStyle.left = (evt.clientX - cnLeft + document.body.scrollLeft) + 'px';
- domStyle.top = (evt.clientY - cnTop + document.body.scrollTop) + 'px';
- }
- }
- }
- // performs a single increment or decrement
- function nextStep(whatSpinner, direction)
- {
- if (whatSpinner === "Hour")
- {
- if (direction === "plus")
- {
- Cal.SetHour(Cal.Hours + 1);
- RenderCssCal();
- }
- else if (direction === "minus")
- {
- Cal.SetHour(Cal.Hours - 1);
- RenderCssCal();
- }
- }
- else if (whatSpinner === "Minute")
- {
- if (direction === "plus")
- {
- Cal.SetMinute(parseInt(Cal.Minutes, 10) + 1);
- RenderCssCal();
- }
- else if (direction === "minus")
- {
- Cal.SetMinute(parseInt(Cal.Minutes, 10) - 1);
- RenderCssCal();
- }
- }
- }
- // starts the time spinner
- function startSpin(whatSpinner, direction)
- {
- document.thisLoop = setInterval(function ()
- {
- nextStep(whatSpinner, direction);
- }, 125); //125 ms
- }
- //stops the time spinner
- function stopSpin()
- {
- clearInterval(document.thisLoop);
- }
- function dropIt()
- {
- stopSpin();
- if (domStyle)
- {
- domStyle = null;
- }
- }
- // Default events configuration
- document.onmousedown = pickIt;
- document.onmousemove = dragIt;
- document.onmouseup = dropIt;
- // price calculation
- function calculate() {
- // use get month
- var month = new Date().getMonth();
- var d1 = document.date.firstDate.value;
- var d2 = d1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
- var d3 = new Date(d2);
- month = d3.getMonth();
- var days = parseInt('0' + document.date.days.value, 10),
- groupstring, total = 0;
- // 1 day, 2 days, 3 days, 4 days, 5 days, 6 days, 7 days, 28 DaySummer, 28 DayWinter, Excess Amount, excess mile, 12week
- switch (document.date.car.value) {
- case 'B': groupstring = '2650,5300,7950,10600,13250,13500,14500,48000,46000,25000,10,44000'; break;//CLIO 3/5 -->
- case 'B2': groupstring = '2650,5300,7950,10600,13250,13500,14500,48000,46000,25000,10,44000'; break;//MAN PICANTO -->
- case 'CD': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;// RIO MANUAL-->
- case 'CD2': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;//CORSA -->
- case 'CD3': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;// PICANTO AUTO-->
- case 'CD4': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,44000'; break;// 500-->
- case 'E': groupstring = '3000,6000,9000,12000,15000,15500,16500,53500,51000,25000,10,48000'; break;// VENGA MANUAL -->
- case 'E2': groupstring = '3000,6000,9000,12000,15000,15500,16500,53500,51000,25000,10,48000'; break;// RIO AUTO-->
- case 'F': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// FOCUS-->
- case 'F2': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// MEGANE-->
- case 'F3': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// CEED-->
- case 'F4': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// I30-->
- case 'F5': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15,50000'; break;// VENGA AUTO-->
- case 'G': groupstring = '3500,7000,10500,14000,17500,19000,20000,62000,59000,25000,15,54000'; break;//CEED ESTATE -->
- case 'G2': groupstring = '3500,7000,10500,14000,17500,19000,20000,62000,59000,40000,15,54000'; break;//SPORT PET -->
- case 'H': groupstring = '3800,7600,11400,15200,19000,21500,22500,72000,62000,25000,15,44000'; break;// -MONDEO->
- case 'I': groupstring = '3800,7600,11400,15200,19000,21500,22500,72000,62000,25000,15,58000'; break;//2WD SPORTAGE -->
- case 'J': groupstring = '4500,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,60000'; break;//4WD SPORTAGE -->
- case 'J2': groupstring = '4500,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,44000'; break;//OPTIMA -->
- case 'J3': groupstring = '5000,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,44000'; break;//IX35 -->
- case 'K': groupstring = '6500,11000,16500,22000,27500,30000,31000,95000,82500,40000,15,44000'; break;//GALAXY -->
- case 'K2': groupstring = '6500,11000,16500,22000,27500,30000,31000,95000,82500,40000,15,44000'; break;//RCZ -->
- case 'L': groupstring = '7000,12000,18000,24000,30000,35000,36000,120000,120000,40000,15,100000'; break;// SORENTO-->
- case 'L2': groupstring = '7000,12000,18000,24000,30000,35000,36000,120000,120000,40000,15,100000'; break;// I800-->
- case 'L3': groupstring = '4500,9000,13500,18000,22500,24000,25000,75000,65000,40000,15,60000'; break;//carens -->
- case 'M': groupstring = '2650,5300,7950,10600,13250,14600,15000,49900,48000,25000,10,44000'; break;// KANGOO-->
- case 'N': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10,46000'; break;// nv200-->
- case 'O': groupstring = '4100,8200,12300,16400,20500,20800,21000,70000,70000,40000,15,62500'; break;// TRAFIC-->
- }
- groupstring = groupstring.split(',');
- if (days > 0 && days < 8) {total = groupstring[days - 1]; } else
- if (days < 28) {total = (groupstring[6] / 7) * days;} else
- if (days === 28) {total = groupstring[8];}
- if (days > 28 && days < 84) {total =(groupstring[8] / 28) * days;}
- if (days === 84) {total = groupstring[11] * 3;}
- if (days > 84) {total =(groupstring[11] / 28) * days;}
- if (month > 1 && month < 9 && days == 28) {total = groupstring[7];} // if jan or feb or oct, nov, dec then summer
- if (month > 1 && month < 9 && days > 28 && days < 84) {total =(groupstring[7] / 28) * days;}
- var testa = parseInt(groupstring[8])
- var testb = parseInt(groupstring[7])
- var testc = parseInt(groupstring[11])
- if (days < 28 && total > testa && month < 2 ) {total = groupstring[8]} // winter
- if (days < 28 && total > testa && month > 8 ) {total = groupstring[8]} // winter
- if (days < 28 && total > testb && month > 1 && month < 9 && days < 84 ) {total = groupstring[7]} // summer
- if (days < 84 && days > 77 && total > testc) {total =groupstring[11] *3 && price4 = groupstring[11]/3} //12week fix
- if (days > 50) {document.getElementById("waiv").value = "n"}
- document.date.rentalamount.value = "£" + (Math.round(total) / 100).toFixed(2);
- }
- // 4week price, gav sucks balls
- function adva() {
- var days = parseInt('0' + document.date.days.value, 10),
- groupstring, total = 0;
- var ee = document.date.trc.value
- var er = (ee.slice(1))
- var rre = er/days
- var rree = rre * 28
- document.date.price4.value = "£" + rree.toFixed(2)
- }
- // DATE DIFFRENCE
- function dateDiff() {
- t1 = document.date.firstDate.value;
- t2 = document.date.secondDate.value;
- var one_day=1000*60*60*24;
- var x=t1.split("/");
- var y=t2.split("/");
- //date format(Fullyear,month,date)
- var date1=new Date(x[2],(x[1]-1),x[0]);
- var date2=new Date(y[2],(y[1]-1),y[0])
- var month1=x[1]-1;
- var month2=y[1]-1;
- var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
- var time1 = parseInt(document.getElementById('time1').value, 10);
- var time2 = parseInt(document.getElementById('time2').value, 10);
- if(time2-time1 >= 5) {Diff = Diff +1};
- if (Diff == 0) {Diff = 1};
- if (Diff < 0) {Diff = 0};
- document.date.days.value = (Diff +" days");
- if ( Diff >= 50 )
- { document.getElementById('aive').style.display='none'}
- else
- {document.getElementById('aive').style.display=''}
- if ( Diff >= 50 )
- { document.getElementById('aaive').style.display='none'}
- else
- {document.getElementById('aaive').style.display=''}
- if ( Diff >= 50 )
- { document.getElementById('aaaive').style.display='none'}
- else
- {document.getElementById('aaaive').style.display=''}
- if ( Diff >= 50 )
- { document.getElementById('aaaaive').style.display='none'}
- else
- {document.getElementById('aaaaive').style.display=''}
- }
- // End -->
- // DEPOSIT
- function deposit(){
- if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="y" )
- {
- document.date.depo.value="£100.00"
- }
- else if( document.date.car.options[document.date.car.selectedIndex].value=="G2" ||
- 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== "J" || 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== "O" ||
- document.date.car.options[document.date.car.selectedIndex].value== "J2" || document.date.car.options[document.date.car.selectedIndex].value== "J3")
- {
- document.date.depo.value="£400.00"
- }
- else
- {
- document.date.depo.value="£250.00"
- }
- }
- //Waiver stuff seriously fuck you gav this shit sucked
- function waivon(){
- if ( Diff >= 35 )
- { document.getElementById('fourweek').style.display=''}
- else
- { document.getElementById('fourweek').style.display='none'}
- if ( Diff >= 35 )
- { document.getElementById('afourweek').style.display=''}
- else
- { document.getElementById('afourweek').style.display='none'}
- if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="y" )
- { towaiv() }
- if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="n" )
- {
- document.date.ewc.value="£0"
- document.date.trc.value = document.date.rentalamount.value
- }
- }
- function towaiv(){
- if( document.date.car.options[document.date.car.selectedIndex].value=="G2" ||
- 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== "J" || 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== "O" ||
- document.date.car.options[document.date.car.selectedIndex].value== "J2" || document.date.car.options[document.date.car.selectedIndex].value== "J3")
- {
- document.date.waiv2.value="2"
- }
- else
- {
- document.date.waiv2.value="1"
- }
- var daff = document.date.days.value
- var dapp =(daff.slice(0,2))
- // 250 cars
- //1 to 5 days
- if ( dapp >=1 && dapp <=5 && document.date.waiv2.value==1 )
- {
- document.date.waivmo.value= dapp * 5
- }
- // 6 days
- if ( dapp ==6 && document.date.waiv2.value==1)
- {
- document.date.waivmo.value="25"
- }
- // Weekly
- if ( dapp >=7 && dapp <=27 && document.date.waiv2.value==1)
- {
- document.date.waivmo.value= dapp * 3
- }
- // Month
- if (dapp >=28 && document.date.waiv2.value==1)
- {
- document.date.waivmo.value= dapp * 2
- }
- // fix if over month rate
- if ( dapp >=18 && dapp <=27 && document.date.waiv2.value==1 && document.date.waivmo >= 56)
- {
- document.date.waivmo.value= 56
- }
- //400 cars
- // 1 to 5 days
- if ( dapp >=1 && dapp <=5 && document.date.waiv2.value==2 )
- {
- document.date.waivmo.value= dapp * 8
- }
- // 6 days
- if ( dapp ==6 && document.date.waiv2.value==2)
- {
- document.date.waivmo.value="41"
- }
- // weekly
- if ( dapp >=7 && dapp <=27 && document.date.waiv2.value==2)
- {
- document.date.waivmo.value= dapp * 6
- }
- // month
- if (dapp >=28 && document.date.waiv2.value==2)
- {
- document.date.waivmo.value= dapp * 4
- }
- // fix if over month rate
- if ( dapp >=7 && dapp <=27 && document.date.waiv2.value==2 && document.date.waivmo >= 112)
- {
- document.date.waivmo.value= dapp * 4
- }
- document.date.ewc.value = "£" + document.date.waivmo.value
- if ( document.date.waiv.options[document.date.waiv.selectedIndex].value=="y" )
- {
- var pp = document.date.rentalamount.value
- var np = (pp.slice(1))
- var wv = document.date.waivmo.value
- var npwv= parseFloat(np) + parseFloat(wv)
- var npmp= npwv.toFixed(2)
- var nnpp=npmp/4
- document.date.trc.value = "£" + npwv.toFixed(2)
- adva()
- }
- }
- // DEPOSIT// End -->
- //ONE DAY SAT HIRE
- function onesat() {
- var da1 = document.date.firstDate.value;
- var da2 = da1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
- var da3 = new Date(da2);
- var oned= da3.getDay();
- var qda1 = document.date.firstDate.value;
- var qda2 = qda1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
- var qda3 = new Date(qda2);
- var twod= qda3.getDay();
- if ( da1 == qda1 && oned == 6 && document.date.time2.options[document.date.time2.selectedIndex].value < 5)
- {
- window.alert("back by 5 ");
- }
- }
- // END
- // MILEAGE
- function milecharge(){
- 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" ||
- document.date.car.options[document.date.car.selectedIndex].value=="CD4" ||
- document.date.car.options[document.date.car.selectedIndex].value=="E" || document.date.car.options[document.date.car.selectedIndex].value=="E2")
- {
- document.date.mile.value="10p Per Mile"
- }
- else{
- document.date.mile.value="15p Per Mile"
- }
- }
- // End -->
- // SETS DATE TO CURRENT DATE ONLOAD
- function load() {
- var d = new Date();
- var curr_date = d.getDate();
- var curr_month = d.getMonth()+1;
- var curr_year = d.getFullYear();
- var two_Day = d.getDate()+1;
- document.date.firstDate.value =(curr_date + "/" + curr_month + "/" + curr_year);
- document.date.secondDate.value = (two_Day + "/" + curr_month + "/" + curr_year)
- }
- // END ----->
- // CHECKS IF SAT AND SHOWS OPEN TIME IF BEFORE/AFTER OPEN
- function satcheck() {
- xDate = document.date.firstDate.value.split("/").reverse().join("/");
- x = new Date( xDate ).getDay()
- if (x===6 && document.date.time1.options[document.date.time1.selectedIndex].value < 3 ) {alert("Collection must be between 9AM - 6PM");}
- if (x===6 && document.date.time1.options[document.date.time1.selectedIndex].value > 21 ) {alert("Collection must be between 9AM - 6PM");}
- }
- function satcheck2() {
- t1 = document.date.firstDate.value;
- t2 = document.date.secondDate.value;
- var one_day=1000*60*60*24;
- var x=t1.split("/");
- var y=t2.split("/");
- //date format(Fullyear,month,date)
- var date1=new Date(x[2],(x[1]-1),x[0]);
- var date2=new Date(y[2],(y[1]-1),y[0])
- var month1=x[1]-1;
- var month2=y[1]-1;
- var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
- var time1 = parseInt(document.getElementById('time1').value, 10);
- var time2 = parseInt(document.getElementById('time2').value, 10);
- if(time2-time1 >= 5) {Diff = Diff +1};
- if (Diff == 0) {Diff = 1};
- if (Diff < 0) {Diff = 0};
- x2Date = document.date.secondDate.value.split("/").reverse().join("/");
- x2 = new Date( x2Date ).getDay()
- 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")}
- if (Diff== 1 && x2===6 && document.date.time1.options[document.date.time2.selectedIndex].value < 3 ) {document.date.days.value = 2 + " days"}
- 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")}
- if (Diff== 1 && x2===6 && document.date.time1.options[document.date.time2.selectedIndex].value > 19 ) {document.date.days.value = 2 + " days"}
- calculate()
- waivon()
- }
- // CHECKS IF SUN AND SHOWS OPEN TIME IF BEFORE/AFTER OPEN
- function suncheck() {
- x3Date = document.date.firstDate.value.split("/").reverse().join("/");
- x3 = new Date( x3Date ).getDay()
- 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");}
- if (x3===0 && document.date.time1.options[document.date.time1.selectedIndex].value <= 16 ) {document.date.time1.selectedIndex = 20;}
- 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");}
- }
- function suncheck2() {
- t1 = document.date.firstDate.value;
- t2 = document.date.secondDate.value;
- var one_day=1000*60*60*24;
- var x=t1.split("/");
- var y=t2.split("/");
- //date format(Fullyear,month,date)
- var date1=new Date(x[2],(x[1]-1),x[0]);
- var date2=new Date(y[2],(y[1]-1),y[0])
- var month1=x[1]-1;
- var month2=y[1]-1;
- var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
- var time1 = parseInt(document.getElementById('time1').value, 10);
- var time2 = parseInt(document.getElementById('time2').value, 10);
- if(time2-time1 >= 5) {Diff = Diff +1};
- if (Diff == 0) {Diff = 1};
- if (Diff < 0) {Diff = 0};
- x4Date = document.date.secondDate.value.split("/").reverse().join("/");
- x4 = new Date( x4Date ).getDay()
- 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. ");}
- if (Diff== 1 && x4===0 && document.date.time2.options[document.date.time2.selectedIndex].value <= 16 ) {document.date.time2.selectedIndex = 16;}
- dateDiff()
- calculate()
- waivon()
- }
- //END
- //puts date in hidden box for transfer to booking
- function box2() {
- document.date.date1.value = (document.date.firstDate.value)
- document.date.date2.value = (document.date.secondDate.value)
- }
- //END
- // milage calculations
- function incmile() {
- t1 = document.date.firstDate.value;
- t2 = document.date.secondDate.value;
- var one_day=1000*60*60*24;
- var x=t1.split("/");
- var y=t2.split("/");
- //date format(Fullyear,month,date)
- var date1=new Date(x[2],(x[1]-1),x[0]);
- var date2=new Date(y[2],(y[1]-1),y[0])
- var month1=x[1]-1;
- var month2=y[1]-1;
- Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
- var time1 = parseInt(document.getElementById('time1').value, 10);
- var time2 = parseInt(document.getElementById('time2').value, 10);
- if(time2-time1 >= 5) {Diff = Diff +1};
- if (Diff == 0) {Diff = 1};
- if (Diff < 0) {Diff = 0};
- var miles = 0;
- var price = document.date.rentalamount.value;
- if(Diff <= 27) {
- miles = Diff * 100;
- } else {
- miles = Math.round((Diff / 7) * 500);
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="A" && price == "£420.00" || price == "£450.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="A2" && price == "£420.00" || price == "£450.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="B" && price == "£460.00" || price == "£480.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="B2" && price == "£460.00" || price == "£480.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD" && price == "£480.00" || price == "£499.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD2" && price == "£480.00" || price == "£499.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD3" && price == "£480.00" || price == "£499.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD4" && price == "£480.00" || price == "£499.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="E" && price == "£510.00" || price == "£535.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="E2" && price == "£510.00" || price == "£535.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F" && price == "£540.00" || price == "£580.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F2" && price == "£540.00" || price == "£580.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F3" && price == "£540.00" || price == "£580.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F4" && price == "£540.00" || price == "£580.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="G" && price == "£590.00" || price == "£620.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="G2" && price == "£590.00" || price == "£620.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="H" && price == "£620.00" || price == "£720.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="I" && price == "£650.00" || price == "£750.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J" && price == "800.00" || price == "£800.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J2" && price == "800.00" || price == "£800.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J3" && price == "800.00" || price == "£800.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="K" && price == "£825.00" || price == "£9500.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="K2" && price == "£825.00" || price == "£950.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L" && price == "£1200.00" || price == "£1200.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L2" && price == "£1200.00" || price == "£1200.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L3" && price == "800.00" || price == "£800.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="M" && price == "£480.00" || price == "£499.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="O" && price == "£725.00" || price == "£750.00") {
- miles = 2000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="B2" && price == "£1320.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD" && price == "£1380.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD2" && price == "£1380.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD3" && price == "£1380.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="E" && price == "£1440.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="E2" && price == "£1440.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F3" && price == "£1500.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F5" && price == "£1500.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="G" && price == "£1620.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="G2" && price == "£1620.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="I" && price == "£1740.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J" && price == "£1800.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L" && price == "£3000.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L2" && price == "3000.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L3" && price == "£1800.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="N" && price == "£1380.00") {
- miles = 6000;
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="O" && price == "£1875.00") {
- miles = 6000;
- }
- document.date.alow.value = miles + " Miles";
- }
- //END
- //age checks
- function agecheck() {
- 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" )
- {
- alert("You Must Be Over 25 To hire This Vehicle ");
- }
- 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")
- {
- alert("You Must Be Over 28 To hire This Vehicle ");
- }
- }
- //END
- // More info button
- function info() {
- if(document.date.car.options[document.date.car.selectedIndex].value=="A")
- {
- window.open ("http://www.pennycarhire.co.uk/Panda.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="A2")
- {
- window.open ("http://www.pennycarhire.co.uk/smart.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="B")
- {
- window.open ("http://www.pennycarhire.co.uk/clio3dr.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="B2")
- {
- window.open ("http://www.pennycarhire.co.uk/newpicanto.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD")
- {
- window.open ("http://www.pennycarhire.co.uk/rio.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD2")
- {
- window.open ("http://www.pennycarhire.co.uk/newcorsa.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD3")
- {
- window.open ("http://www.pennycarhire.co.uk/newpicantoauto.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="CD4")
- {
- window.open ("http://www.pennycarhire.co.uk/500.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="E")
- {
- window.open ("http://www.pennycarhire.co.uk/venga.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="E2")
- {
- window.open ("http://www.pennycarhire.co.uk/newrio.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F")
- {
- window.open ("http://www.pennycarhire.co.uk/focus.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F2")
- {
- window.open ("http://www.pennycarhire.co.uk/ceedhb.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F3")
- {
- window.open ("http://www.pennycarhire.co.uk/Megane1.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F4")
- {
- window.open ("http://www.pennycarhire.co.uk/i30.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="F5")
- {
- window.open ("http://www.pennycarhire.co.uk/vengaauto.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="G")
- {
- window.open ("http://www.pennycarhire.co.uk/ceed.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="G2")
- {
- window.open ("http://www.pennycarhire.co.uk/sportagep.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="H")
- {
- window.open ("http://www.pennycarhire.co.uk/newmondeo.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="I")
- {
- window.open ("http://www.pennycarhire.co.uk/sportage.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J")
- {
- window.open ("http://www.pennycarhire.co.uk/sportageauto.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J2")
- {
- window.open ("http://www.pennycarhire.co.uk/optima.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="J3")
- {
- window.open ("http://www.pennycarhire.co.uk/ix35.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="K")
- {
- window.open ("http://www.pennycarhire.co.uk/newgalaxy.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="K2")
- {
- window.open ("http://www.pennycarhire.co.uk/rcz.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L")
- {
- window.open ("http://www.pennycarhire.co.uk/sorento.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L2")
- {
- window.open ("http://www.pennycarhire.co.uk/i800.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="L3")
- {
- window.open ("http://www.pennycarhire.co.uk/carens2.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="M")
- {
- window.open ("http://www.pennycarhire.co.uk/kangoo.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="N")
- {
- window.open ("http://www.pennycarhire.co.uk/nv200.html");
- }
- if(document.date.car.options[document.date.car.selectedIndex].value=="O")
- {
- window.open ("http://www.pennycarhire.co.uk/TraficLWB.html");
- }
- }
- function tcar() {
- passedData = urlGet();
- document.date.lpag.value = passedData['car'];
- if (document.date.lpag.value == "picman" ) {document.date.car.value = "B2"; }
- else if (document.date.lpag.value == "rio" ) {document.date.car.value = "CD"; }
- else if (document.date.lpag.value == "corsa" ) {document.date.car.value = "CD2"; }
- else if (document.date.lpag.value == "picauto" ) {document.date.car.value = "CD3"; }
- else if (document.date.lpag.value == "500" ) {document.date.car.value = "CD4"; }
- else if (document.date.lpag.value == "venga" ) {document.date.car.value = "E"; }
- else if (document.date.lpag.value == "rioaut" ) {document.date.car.value = "E2"; }
- else if (document.date.lpag.value == "focus" ) {document.date.car.value = "F"; }
- else if (document.date.lpag.value == "ceedhb" ) {document.date.car.value = "F2"; }
- else if (document.date.lpag.value == "megane" ) {document.date.car.value = "F3"; }
- else if (document.date.lpag.value == "i30" ) {document.date.car.value = "F4"; }
- else if (document.date.lpag.value == "vengaauto" ) {document.date.car.value = "F5"; }
- else if (document.date.lpag.value == "ceed" ) {document.date.car.value = "G"; }
- else if (document.date.lpag.value == "sportp" ) {document.date.car.value = "G2"; }
- else if (document.date.lpag.value == "mondeo" ) {document.date.car.value = "H"; }
- else if (document.date.lpag.value == "sportman" ) {document.date.car.value = "I"; }
- else if (document.date.lpag.value == "sportaut" ) {document.date.car.value = "J"; }
- else if (document.date.lpag.value == "optima" ) {document.date.car.value = "J2"; }
- else if (document.date.lpag.value == "ix35" ) {document.date.car.value = "J3"; }
- else if (document.date.lpag.value == "galaxy" ) {document.date.car.value = "K"; }
- else if (document.date.lpag.value == "rcz" ) {document.date.car.value = "K2"; }
- else if (document.date.lpag.value == "sorento" ) {document.date.car.value = "L"; }
- else if (document.date.lpag.value == "i800" ) {document.date.car.value = "L2"; }
- else if (document.date.lpag.value == "carens2" ) {document.date.car.value = "L3"; }
- else if (document.date.lpag.value == "kangoo" ) {document.date.car.value = "M"; }
- else if (document.date.lpag.value == "NV200" ) {document.date.car.value = "N"; }
- else if (document.date.lpag.value == "trafic" ) {document.date.car.value = "O"; }
- else {document.date.car.value = "B2"; }
- }
- function urlGet(f) {
- var str = location.search.slice(1).split("&"),
- retVal = [],
- f = f || false;
- for (p = 0; p < str.length; p++) {
- // get the values.
- if (str[p].indexOf("=") > 0) {
- var pv = str[p].split("=");
- retVal[pv.shift()] = pv.pop();
- }
- }
- return f ? retVal[f] : retVal;
- }
- //END
- function loading() {
- tcar();
- load();
- dateDiff()
- ;calculate();
- deposit();
- milecharge();
- incmile();
- box2();
- waivon();
- ;names()
- }
- function tody()
- {
- //Gets Current day and month
- var d1 = document.date.firstDate.value
- var tt = new Date();
- var dd1 =tt.getDate();
- var mm1 =tt.getMonth()+1;
- var tom = tt.getDate()+1;
- //end
- // changes date input to date fromat and gets inputted day and month
- t1 = document.date.firstDate.value;
- var one_day=1000*60*60*24;
- var x=t1.split("/");
- //date format(Fullyear,month,date)
- var date1=new Date(x[2],(x[1]-1),x[0]);
- var dd2 =date1.getDate();
- var mm2 =date1.getMonth()+1;
- //
- if ( dd2 == dd1 && mm1 == mm2 || dd2 == tom && mm1 == mm2) {
- alert("Due To High Demend It Is Suggested You Call Us For Bookings Less Then Three Days In Advanced");
- }
- }
- var nesne ;
- if(navigator.appName.search('Microsoft')>-1) { nesne = new ActiveXObject('MSXML2.XMLHTTP'); }
- else { nesne = new XMLHttpRequest(); }
- function yolla() {
- nesne.open('get', 'display.txt', true);
- nesne.onreadystatechange= cevap;
- nesne.send(null);
- }
- function cevap() {
- if(nesne.readyState==4) {
- var el = document.getElementById('bilgi');
- el.innerHTML = nesne.responseText;
- }
- }
- //weekend summer fix ADD TO THIS WHEN WE HAVE NEW CAR!
- function sumwkfix() {
- t1 = document.date.firstDate.value;
- t2 = document.date.secondDate.value;
- var one_day=1000*60*60*24;
- var x=t1.split("/");
- var y=t2.split("/");
- //date format(Fullyear,month,date)
- var date1=new Date(x[2],(x[1]-1),x[0]);
- var date2=new Date(y[2],(y[1]-1),y[0])
- var month1=x[1]-1;
- var month2=y[1]-1;
- var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
- var time1 = parseInt(document.getElementById('time1').value, 10);
- var time2 = parseInt(document.getElementById('time2').value, 10);
- if(time2-time1 >= 5) {Diff = Diff +1};
- if (Diff == 0) {Diff = 1};
- if (Diff < 0) {Diff = 0};
- var d1 = document.date.secondDate.value;
- var d2 = d1.replace(/^(\d{1,2}\/)(\d{1,2}\/)(\d{4})$/, "$2$1$3");
- var d3 = new Date(d2);
- month = d3.getMonth();
- x3Date = document.date.secondDate.value.split("/").reverse().join("/");
- x3 = new Date( x3Date ).getDay()
- x4Date = document.date.firstDate.value.split("/").reverse().join("/");
- x4 = new Date( x4Date ).getDay()
- if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days" }
- if (document.date.car.value=="B2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="CD" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="CD2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="CD3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="E2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="F3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="F5" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="G" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="G2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="I" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="J" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="L" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " miles" }
- if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days" }
- if (document.date.car.value=="L2" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- //
- if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0)
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==0 && x4!=0 )
- {document.date.alow.value= 200 + " Miles" }
- if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {alert("between March - September the minimum CAR rental period at the weekend is 2 days")}
- if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.days.value = 2 + " days"}
- if (document.date.car.value=="L3" && month > 1 && month < 9 && Diff== 1 && x3==6 )
- {document.date.alow.value= 200 + " miles" }
- waivon()
- calculate()
- waivon()
- }
- function names() {
- x4Date = document.date.firstDate.value.split("/").reverse().join("/");
- x4 = new Date( x4Date ).getDay()
- if (x4 == 0) {document.date.day.value = "Sunday"}
- if (x4 == 1) {document.date.day.value = "Monday"}
- if (x4 == 2) {document.date.day.value = "Tuesday"}
- if (x4 == 3) {document.date.day.value = "Wednesday"}
- if (x4 == 4) {document.date.day.value = "Thursday"}
- if (x4 == 5) {document.date.day.value = "Friday"}
- if (x4 == 6) {document.date.day.value = "Saturday"}
- x5Date = document.date.secondDate.value.split("/").reverse().join("/");
- x5 = new Date( x5Date ).getDay()
- if (x5 == 0) {document.date.day2.value = "Sunday"}
- if (x5 == 1) {document.date.day2.value = "Monday"}
- if (x5 == 2) {document.date.day2.value = "Tuesday"}
- if (x5 == 3) {document.date.day2.value = "Wednesday"}
- if (x5 == 4) {document.date.day2.value = "Thursday"}
- if (x5 == 5) {document.date.day2.value = "Friday"}
- if (x5 == 6) {document.date.day2.value = "Saturday"}
- }
- //END OF SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement