var pageTitles = new Array('Research topics', 'Laws', 'Research budget', 'Diplomacy'); var rTypes = new Array('Fundamental', 'Military', 'Civilian'); function makeResearchTooltips() { rett = new Array(); if (ttDelay == 0) { var i; for (i=0;i<82;i++) rett[i] = ""; return; } rett[0] = tt_Dynamic("Click here to hide / show this research topic"); rett[1] = tt_Dynamic("Click here to implement this technology"); rett[10] = tt_Dynamic("Click here to hide / show this law"); rett[11] = tt_Dynamic("Click here to revoke this law"); rett[12] = tt_Dynamic("Click here to enact this law"); rett[20] = tt_Dynamic("Click here to decrease the percentage of research points attributed to this category by 10 points"); rett[21] = tt_Dynamic("Click here to decrease the percentage of research points attributed to this category by 1 point"); rett[22] = tt_Dynamic("Click here to increase the percentage of research points attributed to this category by 1 point"); rett[23] = tt_Dynamic("Click here to increase the percentage of research points attributed to this category by 10 points"); rett[30] = tt_Dynamic("Click here to validate the new budget attributions"); rett[31] = tt_Dynamic("Click here to reset the budget attributions"); rett[40] = tt_Dynamic("Check this radio button to offer scientific assistance"); rett[41] = tt_Dynamic("Type here the name of the player to send the offer to"); rett[42] = tt_Dynamic("Type here the amount of cash you want to receive in exchange for the offer"); rett[43] = tt_Dynamic("Click here to send the offer"); rett[44] = tt_Dynamic("Check this radio button to offer the selected technology"); rett[45] = tt_Dynamic("Choose here the technology you want to offer"); rett[50] = tt_Dynamic("Select here the page of pending technology exchange offers you want to display"); rett[51] = tt_Dynamic("Click here to accept this technology exchange"); rett[52] = tt_Dynamic("Click here to decline this technology exchange"); rett[60] = tt_Dynamic("Selected here the page of the history of technology exchanges to display"); rett[70] = tt_Dynamic("Click here to implement new technologies, view foreseen breakthroughs and already implemented technologies"); rett[71] = tt_Dynamic("Click here to enact and revoke laws"); rett[72] = tt_Dynamic("Click here to balance your research budget between fundamental, military and civilian research"); rett[73] = tt_Dynamic("Click here to give or sell technologies and scientific knowledge with other empires, and examine offers made to you"); rett[80] = tt_Dynamic("Click here to unlock the category"); rett[81] = tt_Dynamic("Click here to prevent this category from being changed along with the other two"); } function getLoadingText() { return "Loading page data ..."; } function getTopicsPage() { var str = '

New technologies

'; var tl = '!' + rtExpanded.join('!!') + '!'; var i, d, id; if (rtCompleted.length == 0) str += '

No new technology has been discovered.

'; else { str += ''; str += ''; for (i=0;i'; str += '[ ' + (d ? '-' : '+') + ' ] '; if (d) { str += ''; } else str += ''; str += ''; str += ''; if (d) str += ''; str += ''; } str += '
 TechnologyTypeCost 
' + rtTitles[id] + '
'; str += rtDescriptions[id] + '
More information ...
' + rtTitles[id] + '' + rTypes[rtTypes[id]] + '€' + formatNumber(rtCosts[id]) + 'Implement technology
  

'; } str += '

Foreseen breakthroughs

'; if (rtForeseen.length == 0) str += '

No breakthrough is currently in sight.

'; else { str += ''; str += ''; for (i=0;i'; str += '[ ' + (d ? '-' : '+') + ' ] '; if (d) { str += ''; } else str += ''; str += ''; str += ''; if (d) str += ''; str += ''; } str += '
 TechnologyTypeEstimated costCompletion
' + rtTitles[id] + '
'; str += rtDescriptions[id] + '
More information ...
' + rtTitles[id] + '' + rTypes[rtTypes[id]] + '€' + formatNumber(rtCosts[id]) + '' + rtForeseenP[id] + '%
  

'; } str += '

Implemented technologies

' + drawImplementedList(tl, 0) + drawImplementedList(tl, 1) + drawImplementedList(tl, 2) + '
'; return str; } function drawImplementedList(tl, type) { var str = '

' + rTypes[type] + ' research

'; if (rtImplemented.length == 0) return str + '

No such technology has been implemented at the moment.

'; var n = 0; for (i=0;i'; str += '[ ' + (d ? '-' : '+') + ' ] '; if (d) { str += '' + rtTitles[id] + '
'; str += rtDescriptions[id] + '
More information ... '; } else str += '' + rtTitles[id] + ''; } if (n>0) str += ''; else str += '

No such technology has been implemented at the moment.

'; return str; } function confirmTech(id) { var str; str = 'Implementing ' + rtTitles[id] + '\nThis will cost ' + formatNumber(rtCosts[id]) + ' euros.\n'; str += 'Are you sure you want to do this?'; return confirm(str); } function implError(code) { var str = 'Error: '; switch (code) { case 0: str += 'you do not have enough cash to implement this technology'; break; case 1: str += 'trying to cheat by hacking the server _is_ evil'; break; case 200: str += 'you can\'t implement technologies while in vacation mode'; break; default: str += 'an unknown error has occured'; break; } alert(str + '.'); } function getLawsPage() { var str = '

Enacted laws

'; var tl = '!' + rtExpanded.join('!!') + '!'; var i, d, id; if (lEnacted.length == 0) str += '

No laws have been enacted yet.

'; else { str += ''; str += ''; for (i=0;i'; str += '[ ' + (d ? '-' : '+') + ' ] '; if (d) str += ''; else str += ''; if (lTimeRevoke[id] == 0) { str += ''; } else { str += ''; } if (d) str += ''; str += ''; } str += '
 LawCost 
' + rtTitles[id] + '
' + rtDescriptions[id] + '
More information ...
' + rtTitles[id] + '€' + formatNumber(rtCosts[id]) + 'Revoke' + lTimeRevoke[id] + ' day' + (lTimeRevoke[id] > 1 ? 's' : ''); str += ' left before the law can be revoked.
  

'; } str += '

Available laws

'; if (lAvailable.length == 0) str += '

No laws are available.

'; else { str += ''; str += ''; for (i=0;i'; str += '[ ' + (d ? '-' : '+') + ' ] '; if (d) str += ''; else str += ''; if (lTimeEnact[id] == 0) { str += ''; } else { str += ''; } if (d) str += ''; str += ''; } str += '
 LawCost 
' + rtTitles[id] + '
' + rtDescriptions[id] + '
More information ...
' + rtTitles[id] + '€' + formatNumber(rtCosts[id]) + 'Enact' + lTimeEnact[id] + ' day' + (lTimeEnact[id] > 1 ? 's' : ''); str += ' left before the law can be enacted.
  

'; } return str; } function confirmEnact(id) { var str; str = 'Enacting ' + rtTitles[id] + ' will cost ' + formatNumber(rtCosts[id]) + ' euros.\n'; str += 'You will not be able to revoke the law before 5 days have passed.\n'; str += 'Are you sure you want to do this?'; return confirm(str); } function confirmRevoke(id) { var str; str = 'Revoking ' + rtTitles[id] + ' will cost ' + formatNumber(rtCosts[id]) + ' euros.\n'; str += 'You will not be able to enact the law again before 5 days have passed.\n'; str += 'Are you sure you want to do this?'; return confirm(str); } function slawError(code) { var str = 'Error: '; switch (code) { case 0: str += 'you do not have enough cash to switch this law\'s status'; break; case 1: str += 'trying to cheat by hacking the server _is_ evil'; break; case 200: str += 'you can\'t enact or revoke laws while in vacation mode'; break; default: str += 'an unknown error has occured'; break; } alert(str + '.'); } function budgetError(code) { var str = 'Error: '; switch (code) { case 0: str += 'trying to cheat by hacking the server _is_ evil'; break; case 200: str += 'you can\'t modify your research budget while in vacation mode'; break; default: str += 'an unknown error has occured'; break; } alert(str + '.'); } function drawAttributionsDisplay() { var i, str = '

Research budget

'; str += '

Research points: per day

'; str += '
'; for (i=0;i '; str += ''; if (i==0) str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; if (i==0) str += ''; str += ''; if (i==0) str += ''; str += ''; } str += ''; str += ''; str += ''; str += '
' + rTypes[i] + ' research: <<< %>>>    point(s)
 
   
'; document.getElementById('respage').innerHTML = str; } function drawBudgetControls() { document.getElementById('rbcl').innerHTML = ''; document.getElementById('rbcr').innerHTML = ''; } function drawDiplomacyRestrained(d) { var str = '

Give / receive scientific assistance

'; str += '

Your account is too young to use this feature. You must wait for ' + d + ' more day' + (d > 1 ? 's' : '') + '.

'; document.getElementById('respage').innerHTML = str; } function drawRDSentAlready() { var str = '

Send scientific assistance

'; str += '

We already sent an assistance offer in the last 22 hours (' + formatDate(rdSentOffer.time) + ').
'; str += 'We offered to give ' + rdSentOffer.player + ' '; if (rdSentOffer.tech == "") str += 'research assistance'; else str += 'the "' + rtTitles[rdSentOffer.tech] + '" technology'; if (rdSentOffer.price > 0) str += ' in exchange for €' + formatNumber(rdSentOffer.price) + ''; str += '; the offer '; if (rdSentOffer.status == "P") str += 'is still pending.'; else if (rdSentOffer.status == "A") str += 'has been accepted.'; else str += 'has been declined.'; str += '

'; document.getElementById('rdgive').innerHTML = str; } function drawRDSendForm() { var i, str = '

Send scientific assistance

'; str += ''; str += ' 0) { str += ' onClick="rdfType=0;document.getElementById(\'rdstype0\').checked=true" >'; str += ' in exchange for €'; } str += '
 Offer  0) { str += '
 '; } str += ' technology 
'; document.getElementById('rdgive').innerHTML = str; document.getElementById('rdsto').value = rdfTarget; document.getElementById('rdsprice').value = rdfPrice; } function drawRDPending() { var str = '

Received assistance offers

'; if (rdRecOffers.length == 0) str += '

No assistance offers have been received.

'; else { var n, m, i; n = rdRecOffers.length; m = n % 5; n = (n-m)/5 + (m>0?1:0); if (rdRecPage >= n) rdRecPage = n-1; str += '
 Page '; if (n == 1) str += "1 / 1"; else { str += ' / ' + n; } str += '
 
'; var r = new Array( 'Unfortunately, we do not have enough cash to accept this offer.', 'Since we have already accepted another offer in the past 22 hours, we cannot accept this offer.', 'However, we have already discovered or are about to discover this technology.', 'However, we do not have the scientific knowledge required to accept this offer.' ); for (i=5*rdRecPage;i has offered to give us '; if (rdRecOffers[i].tech == "") str += 'scientific assistance'; else str += 'the "' + rtTitles[rdRecOffers[i].tech] + '" technology'; if (rdRecOffers[i].price > 0) str += ' in exchange for €' + formatNumber(rdRecOffers[i].price) + ''; str += '. The offer was received at ' + formatDate(rdRecOffers[i].time) + '.
'; if (rdRecOffers[i].status2 == 0) { str += ''; str += ' '; } else { str += r[rdRecOffers[i].status2 - 1] + ' You may either decline the offer or let it expire.
'; str += ''; } str += '
'; } str += '
'; } document.getElementById('rdrec').innerHTML = str; } function drawRDHistory() { var str = '

History

'; if (rdHistory.length == 0) str += '

The history is empty.

'; else { var n, m, i; n = rdHistory.length; m = n % 5; n = (n-m)/5 + (m>0?1:0); if (rdHistPage >= n) rdHistPage = n-1; str += '
 Page '; if (n == 1) str += "1 / 1"; else { str += ' / ' + n; } str += '
 
'; for (i = 5 * rdHistPage; i < rdHistory.length && i < 5 * (rdHistPage + 1); i ++) { str += ''; } str += '
'; if (rdHistory[i].type == "R") str +='Player ' + rdHistory[i].player + ' offered to give us '; else str +='We offered to give player ' + rdHistory[i].player + ' '; if (rdHistory[i].tech == "") str += 'scientific assistance'; else str += 'the "' + rtTitles[rdHistory[i].tech] + '" technology'; if (rdHistory[i].price > 0) str += ' in exchange for €' + formatNumber(rdHistory[i].price) + ''; str += '. The offer was ' + (rdHistory[i].type == "R" ? 'received' : 'sent') + ' at ' + formatDate(rdHistory[i].time); str += ' and '; if (rdHistory[i].status == "E") str += "expired one day later."; else if (rdHistory[i].status == "A") str += "was accepted."; else str += "was declined."; str += '
'; } document.getElementById('rdhist').innerHTML = str; } function confirmSendOffer(tp, tc, pl, pr) { var str = "You are about to offer "; if (tp == 0) str += "scientific assistance"; else str += 'data on the "' + rtTitles[tc] + '" technology'; str += '\nto ' + pl; if (pr > 0) str += ' in exchange for ' + formatNumber(pr.toString()) + ' euros.'; str += '\nYou will not be able to make another offer for 24 hours.'; return confirm(str); } function rdOfferError(ec) { var str = "Error :\n"; switch (ec) { case 1: str += "You have not selected a technology to offer."; break case 2: str += "You have not specified a player to send the offer to."; break; case 3: str += "The price you specified is invalid."; break; case 4: str += "This player does not exist."; break; case 5: str += "You do not seem to have this technology."; break; case 6: str += "You can't send a diplomatic offer to yourself."; break; case 7: str += "This player is on vacation."; break; case 8: str += "Invalid data received."; break; case 9: str += "It seems you have already sent an offer in the past 24h."; break; case 10: str += "This player is under Peacekeeper protection."; break; case 200: str += "You can't send diplomatic offers while in vacation mode."; break; case 201: str += "You can't send diplomatic offers while under Peacekeeper protection."; break; default: str += "An unknown error has happened ("+ec+")."; break; } alert(str); } function rdAcceptError(ec) { var str = "Error :\n"; switch (ec) { case 1: str += "You do not have enough cash to accept this offer."; break case 2: str += "You have already accepted this offer."; break; case 3: str += "You have already declined this offer."; break; case 4: str += "Unknown offer identifier."; break; case 5: str += "You don't have the dependencies for this technology."; break; case 200: str += "You can't accept or reject diplomatic offers while in vacation mode."; break; case 201: str += "You can't accept diplomatic offers while under Peacekeeper protection."; break; default: str += "An unknown error has happened ("+ec+")."; break; } alert(str); } function confirmAcceptOffer(i) { var str = "Are you sure you want to accept " + rdRecOffers[i].player + "'s offer to\ngive us "; if (rdRecOffers[i].type == "R") str += "scientific assistance"; else str += "the \"" + rtTitles[rdRecOffers[i].tech] + "\" technology"; if (rdRecOffers[i].price > 0) str += " in exchange for\n" + formatNumber(rdRecOffers[i].price) + " euros"; str += "?"; return confirm(str); } function confirmRejectOffer(i) { var str = "Are you sure you want to decline " + rdRecOffers[i].player + "'s offer to\ngive us "; if (rdRecOffers[i].type == "R") str += "scientific assistance"; else str += "the \"" + rtTitles[rdRecOffers[i].tech] + "\" technology"; if (rdRecOffers[i].price > 0) str += " in exchange for\n" + formatNumber(rdRecOffers[i].price) + " euros"; str += "?"; return confirm(str); }