//= 1 && strday <= 9 ){ strday = arrDay[strday.toString()]; } var arrMonth = []; arrMonth["Jan"] = "01"; arrMonth["Feb"] = "02"; arrMonth["Mar"] = "03"; arrMonth["Apr"] = "04"; arrMonth["May"] = "05"; arrMonth["Jun"] = "06"; arrMonth["Jul"] = "07"; arrMonth["Aug"] = "08"; arrMonth["Sep"] = "09"; arrMonth["Oct"] = "10"; arrMonth["Nov"] = "11"; arrMonth["Dec"] = "12"; strmonth = arrMonth[strmonth.toString()]; var value = strday+"/"+strmonth+"/"+stryear; if($("#" + date.id).next("input:hidden").length == 1) { $("#" + date.id).next("input:hidden").val(value); } var myDateParts = value.split("/"); if ($(this).attr("id") == "flights_calendar_depart_inp_org") { $('#departureDateCT').val(myDateParts[1] + myDateParts[0] + myDateParts[2]); } if ($(this).attr("id") == "flights_calendar_return_inp_org") { $('#returnDateCT').val(myDateParts[1] + myDateParts[0] + myDateParts[2]); } if ($(this).attr("datepicker") == "first") { $("input[datepicker=last]" ).datepicker( "option", "minDate", new Date(myDateParts[2], myDateParts[1]-1, myDateParts[0]) ); } } var validNavigation = false; function wireUpEvents() { /* * For a list of events that triggers onbeforeunload on IE * check http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx */ window.onbeforeunload = function() { if (!validNavigation) { endSession(); } } // Attach the event keypress to exclude the F5 refresh $(document).bind('keypress', function(e) { if (e.keyCode == 116){ validNavigation = true; } }); // Attach the event click for all links in the page $("a").bind("click", function() { validNavigation = true; }); // Attach the event submit for all forms in the page $("form").bind("submit", function() { validNavigation = true; }); // Attach the event click for all inputs in the page $("input[type=submit]").bind("click", function() { validNavigation = true; }); } function endSession() { localStorage.removeItem('buttonPressed'); localStorage.removeItem('searchTime'); } $(document).ready(function() { wireUpEvents(); }); //]]>