var SMALLMAP_PORT_IMAGE_SIZE = 3;
var LARGEMAP_PORT_IMAGE_SIZE = 5;
var POPUP_HEIGHT = 110;
var EDITABLE = false;
var lastSmallMapSelectedPort = -1;
var lastBigMapSelectedPort = -1;
var allports = new Array();
var allresources = new Array();
var nationcolors = new Array();
nationcolors['French'] = "blue";
nationcolors['English'] = "red";
nationcolors['Pirate'] = "black";
nationcolors['Spanish'] = "yellow";
nationcolors['Dutch'] = "orange";
var nationflags = new Array();
nationflags['French'] = "images/franceFlag.gif";
nationflags['English'] = "images/englandFlag.gif";
nationflags['Pirate'] = "images/pirateFlag.gif";
nationflags['Spanish'] = "images/spainFlag.gif";
nationflags['Dutch'] = "images/dutchFlag.jpg";
function startUpMap() {
populatePorts();
populateResources();
addPortList();
addResourceList();
}
function showMap() {
document.getElementById('largemap').style.display = ''
document.getElementById('dropPortList1').style.display = 'none'
}
function hideMap() {
document.getElementById('largemap').style.display = 'none'
document.getElementById('dropPortList1').style.display = ''
}
function showPortPopup(pID, map){
var popupX, popupY
if (map == 'smallmap') {
popupX = allports[pID].x;
popupY = allports[pID].y;
if (popupX < 210) {
popupX = allports[pID].x + 10;
}
else {
popupX = allports[pID].x - 210;
}
if (popupY > (311 - POPUP_HEIGHT)) {
popupY = 311 - POPUP_HEIGHT;
}
}
else {
popupX = (allports[pID].x / 100) * 140;
popupY = (allports[pID].y / 100) * 140;
if (popupX < 210) {
popupX = ((allports[pID].x / 100) * 140) + 10;
}
else {
popupX = ((allports[pID].x / 100) * 140) - 210;
}
if (popupY > (435 - POPUP_HEIGHT)) {
popupY = 435 - POPUP_HEIGHT;
}
}
document.getElementById('popup'+map).innerHTML = allports[pID].returnAsString();
document.getElementById('popup'+map).style.left = popupX + "px";
document.getElementById('popup'+map).style.top = popupY + "px";
document.getElementById('popup'+map).style.display = '';
}
function hidePortPopup(map){
document.getElementById('popup'+map).style.display = 'none'
}
function addPortList() {
var portlist = 'Select Port
';
//var noSelect = '--Deselect Port--
';
for (x=0; x--Deselect Port--
';
document.getElementById('dropresourcesSmall').options.length = 0;
//document.getElementById('dropresourcesLarge').options.length = 0;
for (x=0; x