var secs; var timerID = null; var timerRunning = false; var delay = 1000; InitializeTimer(); function highlight(Tr, css) { Tr.OldClass = Tr.className; Tr.className = css; Tr.onmouseout = function() { this.className = this.OldClass; } } function loadHelp(Type) { if (Type < 3) window.open('honda_user/index.htm', 'myWindow', 'width=800,height=530,scrollbars=yes,resizable=1'); else window.open('hsaf_admin/index.htm', 'myWindow', 'width=800,height=530,scrollbars=yes,resizable=1'); } function InitializeTimer() { // Set the length of the timer, in seconds secs = 1200; StopTheClock(); StartTheTimer(); } function StopTheClock() { if (timerRunning) clearTimeout(timerID); timerRunning = false; } function ReRelease(id) { location.href = "index.php?retail+pending+" + id; } function StartTheTimer() { if (secs == 0) { StopTheClock(); // Here's where you put something useful that's // supposed to happen after the allotted time. // For example, you could display a message: // alert("You have just wasted 10 seconds of your life."); location.href = 'index.php?LogSession+logout'; } else { self.status = secs; secs = secs - 1; timerRunning = true; timerID = self.setTimeout("StartTheTimer()", delay); } } function SubmitTransfer(ProdID, DlrID) { if (confirm('Are you sure?')) { var loc = "index.php?placeorder+inter+" + ProdID + "+" + DlrID; location.href = loc; } } function viewOrderByID(OrderID) { var loc = 'index.php?orderinfo+showinfo+' + OrderID; location.href = loc; } function viewOrderLineByID(OrderLineID) { var loc = 'index.php?wesbank+history+' + OrderLineID; location.href = loc; } function QueryStock() { document.forms['frmQueryDealerStock'].submit(); // window.location = "index.php?querydealerstock+dealerstock"; } function viewProductByID(ProdID) { var loc; if ((ProdID > 0) && (ProdID != "")) { loc = 'index.php?productdisplay+view+' + ProdID; location.href = loc; } else { document.forms['frmQueryDealerStock'].submit(); return; } } function viewCaseNo(CaseNo) { var loc; if (CaseNo != "") { loc = 'index.php?productdisplay+viewcase+' + CaseNo; location.href = loc; } else { document.forms['frmQueryDealerStock'].submit(); return; } } function SubmitPayTransfer(From, To, ProdID) { var loc = 'index.php?dealertransfer+pay+' + From + '+' + To + '+' + ProdID; location.href = loc; } function ViewDealer(DealerID) { location.href = 'index.php?createdealer+create+' + DealerID; } function toggle_selection(source) { var checkboxes = document.querySelectorAll('input[type="checkbox"]'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i] != source) if (checkboxes[i].checked == true) checkboxes[i].checked = false; else checkboxes[i].checked = true; } }/** Show a calendar pop up and allow user to manipulate a date. * * @param form_name Name of the form this pop up is attached. * @param date_name Name of the input field to manipulate. * @param event Event to be used as a location of the pop up or (0,0) if left empty. */ function CalendarPopup(form_name,date_name,event){ var x=y=0; if (event != '') { x = event.screenX; y = event.screenY; } myWindow = window.open( 'cal.php?target=opener.parent.document.'+form_name+'.'+date_name+'.value', 'CalendarWindow','resizable,width=240,height=240,screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y); } var datePickerDivID = "datepicker"; var iFrameDivID = "datepickeriframe"; var dayArrayShort = new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'); var dayArrayMed = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var dayArrayLong = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var monthArrayShort = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var monthArrayMed = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'); var monthArrayLong = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var defaultDateSeparator = "/"; var defaultDateFormat = "ymd"; var dateSeparator = defaultDateSeparator; var dateFormat = defaultDateFormat; function displayDatePicker(dateFieldName, displayBelowThisObject, dtFormat, dtSep) { var targetDateField = document.getElementsByName (dateFieldName).item(0); if (!displayBelowThisObject) displayBelowThisObject = targetDateField; if (dtSep) dateSeparator = dtSep; else dateSeparator = defaultDateSeparator; if (dtFormat) dateFormat = dtFormat; else dateFormat = defaultDateFormat; var x = displayBelowThisObject.offsetLeft; var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ; var parent = displayBelowThisObject; while (parent.offsetParent) { parent = parent.offsetParent; x += parent.offsetLeft; y += parent.offsetTop ; } drawDatePicker(targetDateField, x, y); } function drawDatePicker(targetDateField, x, y) { var dt = getFieldDate(targetDateField.value ); if (!document.getElementById(datePickerDivID)) { var newNode = document.createElement("div"); newNode.setAttribute("id", datePickerDivID); newNode.setAttribute("class", "dpDiv"); newNode.setAttribute("style", "visibility: hidden;"); document.body.appendChild(newNode); } var pickerDiv = document.getElementById(datePickerDivID); pickerDiv.style.position = "absolute"; pickerDiv.style.left = x + "px"; pickerDiv.style.top = y + "px"; pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible"); pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block"); pickerDiv.style.zIndex = 10000; refreshDatePicker(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate()); } function refreshDatePicker(dateFieldName, year, month, day) { var thisDay = new Date(); if ((month >= 0) && (year > 0)) { thisDay = new Date(year, month, 1); } else { day = thisDay.getDate(); thisDay.setDate(1); } var crlf = "\r\n"; var TABLE = "