2017-02-17 23:19:25 +01:00
|
|
|
/* Pop up Purchase Server Box */
|
2017-02-03 23:05:59 +01:00
|
|
|
function purchaseServerBoxInit() {
|
|
|
|
var cancelButton = document.getElementById("purchase-server-box-cancel");
|
|
|
|
|
|
|
|
//Close Dialog box
|
|
|
|
cancelButton.addEventListener("click", function() {
|
|
|
|
purchaseServerBoxClose();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", purchaseServerBoxInit, false);
|
|
|
|
|
|
|
|
purchaseServerBoxClose = function() {
|
|
|
|
var purchaseServerBox = document.getElementById("purchase-server-box-container");
|
|
|
|
purchaseServerBox.style.display = "none";
|
|
|
|
}
|
|
|
|
|
|
|
|
purchaseServerBoxOpen = function() {
|
|
|
|
var purchaseServerBox = document.getElementById("purchase-server-box-container");
|
|
|
|
purchaseServerBox.style.display = "block";
|
|
|
|
}
|
|
|
|
|
|
|
|
purchaseServerBoxSetText = function(txt) {
|
|
|
|
var purchaseServerBox = document.getElementById("purchase-server-box-text");
|
|
|
|
purchaseServerBox.innerHTML = txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
//ram argument is in GB
|
|
|
|
purchaseServerBoxCreate = function(ram, cost) {
|
|
|
|
purchaseServerBoxSetText("Would you like to purchase a new server with " + ram + "GB of RAM for $" + cost + "?" );
|
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
//Clear old event listeners from Confirm button
|
2017-05-05 23:27:35 +02:00
|
|
|
var newConfirmButton = clearEventListeners("purchase-server-box-confirm");
|
2017-02-17 23:19:25 +01:00
|
|
|
newConfirmButton.addEventListener("click", function() {
|
2017-02-06 02:29:17 +01:00
|
|
|
purchaseServerBoxClose();
|
2017-02-03 23:05:59 +01:00
|
|
|
purchaseServer(ram, cost);
|
2017-02-06 02:29:17 +01:00
|
|
|
return false;
|
2017-02-03 23:05:59 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
purchaseServerBoxOpen();
|
|
|
|
}
|