function deleteItem(id) { if (confirm('Are you sure to delete the item??')) { document.location.href = 'index.php?show=deleteItem&id='+id; } } function deleteFile(id, show) { if (confirm('Delete this file??')) { document.location.href = 'computer.php?show='+show+'&action=delete&id='+id; } } function deleteMail(id) { if (confirm('Delete this mail??')) { document.location.href = 'index.php?show=mail&action=delete&id='+id; } } function getPostItem(id, price) { if (confirm('Get this item?? It will cost you '+price+',-')) { document.location.href = 'index.php?show=mail&action=getitem&id='+id; } } function warnPrice(type, level, price) { if (type != "newfortress") { confirmStr = 'Upgrade to '; if (type == "lab size") confirmStr += 'size '; else confirmStr += 'level '; } else confirmStr = 'Buy new fortress'; if (level > 0) confirmStr += level; confirmStr += '?? It will cost you '+price; if (confirm(confirmStr)) { var show = "familyfortress"; if ((type == "lab level") || (type == "lab size")) show = "upgradelab"; if (type == "newfortress") document.location.href = 'index.php?show=newfortress'; else document.location.href = 'index.php?show='+show+'&action=upgrade'+type; } } function useDrug(id) { if (confirm('Are you sure you want to use the drug??')) { document.location.href = 'index.php?show=usedrug&id='+id; } } function useHealing(id) { if (confirm('Are you sure you want to use the healing pack??')) { document.location.href = 'index.php?show=usehealing&id='+id; } } function toggleItem(id) { var itemDesc = document.getElementById('item'+id); var itemLink = document.getElementById('itemLink'+id); if ((itemDesc.style.display == 'none') || (itemDesc.style.display == "")) itemDesc.style.display = 'block'; else itemDesc.style.display = 'none'; if ((itemDesc.style.display == 'none') || (itemDesc.style.display == "")) itemLink.innerHTML = ''; else itemLink.innerHTML = ''; } function recalc(id, aprice) { var itemAmount = document.getElementById('amount'+id); var itemTotal = document.getElementById('total'+id); var itemAPrice = document.getElementById('aprice'+id); if ((typeof(itemAPrice) == 'object') && (itemAPrice != null)) { if (itemAPrice.value != aprice) aprice = itemAPrice.value; } var total = (aprice * itemAmount.value); itemTotal.innerHTML = formatCurrency(total)+',-'; } function auctionCalcTotal(select) { var itemTotal = document.getElementById('totalfee'); var days = select.options[select.selectedIndex].value; itemTotal.innerHTML = formatCurrency(25*days)+',-'; } function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if (isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+'.'+num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + num); } function quitFamily() { if (confirm('Are you sure you want quit??')) { document.location.href = 'index.php?show=quitfamily'; } }