// ## carbuilder.js var openwin = 0; onunload = function() { if (openwin) if(!openwin.closed) openwin.close(); } // General code to make sure that a user has made a selection before a form is submitted function selectionCheck(name, message) { var checkList = new Array(); checkList = name; var passCount = 0; for (var i = 0; i < checkList.length; i++) { for (var ii = 0; ii < document.carBuilder.length; ii++) { if (document.carBuilder[ii].name==checkList[i]) { if (document.carBuilder[ii].checked==true) passCount++; } } } if (passCount!=checkList.length) { alert(message); return false; } return true; } // Code for manage.html to ensure that a valid configuration is chosen to compare an existing configuration against. function manageCheck(name,configId,message) { var element; element = document.getElementById(name); if (element.value==-1) alert(message); else { document.getElementById('path2-'+configId).value = document.getElementById('path1-'+element.value).value; return true; } } // Returns a array of all the equipments that are displayed to the user function availableEquipmentList(name) { var equipmentsList = new Array(); var element; element = document.getElementsByName(name); for (var ii = 0; ii < element.length; ii++) { equipmentsList[ii] = element[ii].getAttribute("value"); } return equipmentsList; } // Alerts the user with a confirm message to whether they want to move away from the page. function confirmStepBack(url,message) { if(confirm(message)) document.location=url; }